| 1 | window.__ModuleLoader__.load({ |
| 2 | id: "@nanmicoder/dsh-agent-teams", |
| 3 | factory: (require) => { |
| 4 | var module = { exports: {} }; |
| 5 | var exports = module.exports; |
| 6 | Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); |
| 7 | let react_jsx_runtime = require("react/jsx-runtime"); |
| 8 | let react = require("react"); |
| 9 | let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives"); |
| 10 | //#region lib/client/icons.js |
| 11 | /** Plugin-owned icons avoid depending on the host's generated design-export names. */ |
| 12 | const stroke = { |
| 13 | fill: "none", |
| 14 | stroke: "currentColor", |
| 15 | strokeWidth: 1.5, |
| 16 | strokeLinecap: "round", |
| 17 | strokeLinejoin: "round" |
| 18 | }; |
| 19 | function IconBranchOutline16() { |
| 20 | return (0, react_jsx_runtime.jsxs)("svg", { |
| 21 | width: "16", |
| 22 | height: "16", |
| 23 | viewBox: "0 0 16 16", |
| 24 | "aria-hidden": "true", |
| 25 | ...stroke, |
| 26 | children: [ |
| 27 | (0, react_jsx_runtime.jsx)("circle", { |
| 28 | cx: "4", |
| 29 | cy: "3", |
| 30 | r: "1.5" |
| 31 | }), |
| 32 | (0, react_jsx_runtime.jsx)("circle", { |
| 33 | cx: "12", |
| 34 | cy: "4", |
| 35 | r: "1.5" |
| 36 | }), |
| 37 | (0, react_jsx_runtime.jsx)("circle", { |
| 38 | cx: "4", |
| 39 | cy: "13", |
| 40 | r: "1.5" |
| 41 | }), |
| 42 | (0, react_jsx_runtime.jsx)("path", { d: "M4 4.5v7M4 9h3a5 5 0 0 0 5-3.5" }) |
| 43 | ] |
| 44 | }); |
| 45 | } |
| 46 | function IconChevronDownOutline14() { |
| 47 | return (0, react_jsx_runtime.jsx)("svg", { |
| 48 | width: "14", |
| 49 | height: "14", |
| 50 | viewBox: "0 0 14 14", |
| 51 | "aria-hidden": "true", |
| 52 | ...stroke, |
| 53 | children: (0, react_jsx_runtime.jsx)("path", { d: "m3 5 4 4 4-4" }) |
| 54 | }); |
| 55 | } |
| 56 | function IconPanelLeftOutline16() { |
| 57 | return (0, react_jsx_runtime.jsxs)("svg", { |
| 58 | width: "16", |
| 59 | height: "16", |
| 60 | viewBox: "0 0 16 16", |
| 61 | "aria-hidden": "true", |
| 62 | ...stroke, |
| 63 | children: [(0, react_jsx_runtime.jsx)("rect", { |
| 64 | x: "2", |
| 65 | y: "2.5", |
| 66 | width: "12", |
| 67 | height: "11", |
| 68 | rx: "2" |
| 69 | }), (0, react_jsx_runtime.jsx)("path", { d: "M6 2.5v11" })] |
| 70 | }); |
| 71 | } |
| 72 | function IconStopFill16() { |
| 73 | return (0, react_jsx_runtime.jsx)("svg", { |
| 74 | width: "16", |
| 75 | height: "16", |
| 76 | viewBox: "0 0 16 16", |
| 77 | "aria-hidden": "true", |
| 78 | children: (0, react_jsx_runtime.jsx)("rect", { |
| 79 | x: "4", |
| 80 | y: "4", |
| 81 | width: "8", |
| 82 | height: "8", |
| 83 | rx: "1", |
| 84 | fill: "currentColor" |
| 85 | }) |
| 86 | }); |
| 87 | } |
| 88 | function IconWarningOutline16() { |
| 89 | return (0, react_jsx_runtime.jsxs)("svg", { |
| 90 | width: "16", |
| 91 | height: "16", |
| 92 | viewBox: "0 0 16 16", |
| 93 | "aria-hidden": "true", |
| 94 | ...stroke, |
| 95 | children: [(0, react_jsx_runtime.jsx)("path", { d: "m7 2-5.5 10a1 1 0 0 0 1 1.5h11a1 1 0 0 0 1-1.5L9 2a1.1 1.1 0 0 0-2 0Z" }), (0, react_jsx_runtime.jsx)("path", { d: "M8 6v3m0 2v.1" })] |
| 96 | }); |
| 97 | } |
| 98 | //#endregion |
| 99 | //#region lib/client/session-navigation.js |
| 100 | /** Version-tolerant navigation into durable AgentTeams member transcripts. */ |
| 101 | /** Newer sessions retain view ownership instead of publishing list.current. */ |
| 102 | function currentSessionId(state) { |
| 103 | if ("current" in state) return state.current; |
| 104 | return Object.values(state.byId).find((row) => (row.retainedBy?.mainView ?? 0) > 0)?.id; |
| 105 | } |
| 106 | /** |
| 107 | * Open one member's persisted transcript. |
| 108 | * |
| 109 | * Harness rc.8 intentionally removed cold subagents from the ordinary session |
| 110 | * list. They must first be rediscovered in their parent's catalog, then opened |
| 111 | * with the exact parent/child/mode address. Older runtimes have only `open()`; |
| 112 | * the fallback preserves ordinary-session navigation. New layouts also select |
| 113 | * the Conversation panel and cancel catalog refreshes superseded by navigation. |
| 114 | */ |
| 115 | async function openAgentTeamMember(sessions, parentSessionId, childSessionId, layout, workspace) { |
| 116 | if (sessions.open === void 0 && workspace !== void 0) { |
| 117 | workspace.openSession({ |
| 118 | parentSessionId, |
| 119 | childSessionId, |
| 120 | mode: "continuable" |
| 121 | }); |
| 122 | return "subagent"; |
| 123 | } |
| 124 | const navigation = layout?.beginNavigation?.(); |
| 125 | if (sessions.openSubagent === void 0 || sessions.refreshSubagents === void 0) { |
| 126 | if (sessions.open === void 0) throw new Error("Harness does not expose session navigation"); |
| 127 | sessions.open(childSessionId); |
| 128 | layout?.selectPanel?.(null); |
| 129 | return "session"; |
| 130 | } |
| 131 | await sessions.refreshSubagents(parentSessionId); |
| 132 | if (navigation?.aborted) return "cancelled"; |
| 133 | const retained = sessions.subagentAddress?.(childSessionId); |
| 134 | sessions.openSubagent(retained?.parentSessionId === parentSessionId ? retained : { |
| 135 | parentSessionId, |
| 136 | childSessionId, |
| 137 | mode: "continuable" |
| 138 | }); |
| 139 | layout?.selectPanel?.(null); |
| 140 | return "subagent"; |
| 141 | } |
| 142 | /** Compact `provider/model` route, or just the model when the provider is absent. */ |
| 143 | function memberRouteLabel(member) { |
| 144 | if (member === void 0) return ""; |
| 145 | const provider = member.provider?.trim() ?? ""; |
| 146 | const model = member.model?.trim() ?? ""; |
| 147 | if (provider !== "" && model !== "") return `${provider}/${model}`; |
| 148 | return model; |
| 149 | } |
| 150 | /** |
| 151 | * Compact route shown on a running task. Prefer the task's own snapshot |
| 152 | * field; fall back to the assignee member when older hosts omit it. |
| 153 | */ |
| 154 | function taskModelLabel(task, members) { |
| 155 | const direct = task.model?.trim() ?? ""; |
| 156 | if (direct !== "") return direct; |
| 157 | return memberRouteLabel(members.find((candidate) => candidate.name === task.assignee)); |
| 158 | } |
| 159 | /** Short model id for tight DAG/chip surfaces (`openai/gpt-5.6-sol` → `gpt-5.6-sol`). */ |
| 160 | function compactModelLabel(route) { |
| 161 | const trimmed = route.trim(); |
| 162 | if (trimmed === "") return ""; |
| 163 | const slash = trimmed.lastIndexOf("/"); |
| 164 | return slash === -1 ? trimmed : trimmed.slice(slash + 1); |
| 165 | } |
| 166 | /** |
| 167 | * Latest terminal-task `updatedAt` owned by one member. |
| 168 | * @param memberName - member whose owned tasks are scanned. |
| 169 | * @param tasks - team tasks carrying durable `updatedAt` stamps. |
| 170 | * @returns the newest terminal stamp, or undefined when the member owns none. |
| 171 | */ |
| 172 | function memberFinishedAt(memberName, tasks) { |
| 173 | let latest; |
| 174 | for (const task of tasks) { |
| 175 | if (task.assignee !== memberName) continue; |
| 176 | if (task.status !== "completed" && task.status !== "failed" && task.status !== "cancelled") continue; |
| 177 | const stamp = task.updatedAt; |
| 178 | if (typeof stamp !== "number" || !Number.isFinite(stamp)) continue; |
| 179 | if (latest === void 0 || stamp > latest) latest = stamp; |
| 180 | } |
| 181 | return latest; |
| 182 | } |
| 183 | /** Whether a member still has live work (running activity or an open task). */ |
| 184 | function memberIsRunning(member, tasks) { |
| 185 | if (member.activity === "working" || member.status === "working") return true; |
| 186 | return tasks.some((task) => task.assignee === member.name && (task.status === "pending" || task.status === "claimed" || task.status === "in_progress")); |
| 187 | } |
| 188 | /** |
| 189 | * Order the delegation member list for issue #192. |
| 190 | * |
| 191 | * Running members keep their incoming relative order and come first; finished |
| 192 | * members follow sorted by finish time, newest first. Members without a |
| 193 | * derivable finish time keep their incoming relative order after the stamped |
| 194 | * ones, so an older host that omits stamps never reorders them randomly. |
| 195 | * @param members - delegation roster in snapshot order. |
| 196 | * @param tasks - team tasks carrying durable `updatedAt` stamps. |
| 197 | * @returns the members in display order. |
| 198 | */ |
| 199 | function orderDelegationMembers(members, tasks) { |
| 200 | const running = []; |
| 201 | const finishedStamped = []; |
| 202 | const finishedUnstamped = []; |
| 203 | members.forEach((member, index) => { |
| 204 | if (memberIsRunning(member, tasks)) { |
| 205 | running.push({ |
| 206 | member, |
| 207 | index |
| 208 | }); |
| 209 | return; |
| 210 | } |
| 211 | const finishedAt = memberFinishedAt(member.name, tasks); |
| 212 | if (finishedAt === void 0) finishedUnstamped.push({ |
| 213 | member, |
| 214 | index |
| 215 | }); |
| 216 | else finishedStamped.push({ |
| 217 | member, |
| 218 | index, |
| 219 | finishedAt |
| 220 | }); |
| 221 | }); |
| 222 | finishedStamped.sort((left, right) => right.finishedAt - left.finishedAt || left.index - right.index); |
| 223 | return [ |
| 224 | ...running, |
| 225 | ...finishedStamped, |
| 226 | ...finishedUnstamped |
| 227 | ].map((entry) => entry.member); |
| 228 | } |
| 229 | /** Whether the captain chat should keep showing the in-progress banner. */ |
| 230 | function teamIsActive(team) { |
| 231 | if (team.halted === true || team.phase === "staged") return false; |
| 232 | if (team.members.some((member) => member.activity === "working" || member.status === "working")) return true; |
| 233 | if (team.tasks.some((task) => task.status === "pending" || task.status === "claimed" || task.status === "in_progress")) return true; |
| 234 | return team.members.length > 0 && team.tasks.length === 0; |
| 235 | } |
| 236 | /** Use a fill-width grid when the task graph has no real dependency edges. */ |
| 237 | function usesParallelTaskGrid(tasks) { |
| 238 | if (tasks.length === 0) return false; |
| 239 | const taskIds = new Set(tasks.map((task) => task.id)); |
| 240 | return tasks.every((task) => task.dependencies.every((dependency) => !taskIds.has(dependency))); |
| 241 | } |
| 242 | /** |
| 243 | * Whether an expanded activity panel still belongs to the current session. |
| 244 | * |
| 245 | * The panel is mounted in the root-scoped shell overlay, so React does not |
| 246 | * remount it when the conversation route changes. Ownership keeps an expanded |
| 247 | * panel from leaking onto the new-session screen (or another conversation) |
| 248 | * while its local open state is being reset. |
| 249 | */ |
| 250 | function activityPanelExpandedForSession(open, owner, current) { |
| 251 | return open && owner !== void 0 && owner === current; |
| 252 | } |
| 253 | /** |
| 254 | * Auto-expand only for live teams that appear after the current session's |
| 255 | * initial restore pass. Replayed cards, archived teams, and live teams restored |
| 256 | * while reopening a conversation must remain behind the collapsed badge. |
| 257 | */ |
| 258 | function activityPanelShouldAutoExpand({ alreadyAutoOpened, pageSettled, restoreComplete, previousLiveTeamIds, currentLiveTeamIds }) { |
| 259 | return !alreadyAutoOpened && pageSettled && restoreComplete && currentLiveTeamIds.some((teamId) => !previousLiveTeamIds.has(teamId)); |
| 260 | } |
| 261 | /** |
| 262 | * Resolve the task whose dependency chain should be highlighted. |
| 263 | * |
| 264 | * A pinned task is an explicit user choice. Keyboard focus takes precedence |
| 265 | * over delayed pointer intent so an older hover timer cannot steal the active |
| 266 | * chain from someone navigating the task map with the keyboard. |
| 267 | */ |
| 268 | function dependencyFocusTaskId(pinnedTaskId, keyboardTaskId, hoverTaskId) { |
| 269 | return pinnedTaskId ?? keyboardTaskId ?? hoverTaskId; |
| 270 | } |
| 271 | /** Group tasks by their precomputed dependency depth. */ |
| 272 | function taskStages(tasks) { |
| 273 | const byDepth = /* @__PURE__ */ new Map(); |
| 274 | for (const task of tasks) { |
| 275 | const depth = Number.isFinite(task.depth) ? Math.max(0, Math.floor(task.depth)) : 0; |
| 276 | const stage = byDepth.get(depth) ?? []; |
| 277 | stage.push(task); |
| 278 | byDepth.set(depth, stage); |
| 279 | } |
| 280 | return [...byDepth.entries()].sort(([left], [right]) => left - right).map(([depth, stageTasks]) => ({ |
| 281 | depth, |
| 282 | tasks: stageTasks.slice().sort((left, right) => left.id.localeCompare(right.id, "en", { numeric: true })) |
| 283 | })); |
| 284 | } |
| 285 | /** |
| 286 | * Lay tasks out as the reference panel's compact left-to-right DAG. |
| 287 | * |
| 288 | * Columns are dependency-depth stages. Rows are stable task-id order within |
| 289 | * each stage. Edges use cubic curves so fan-in remains readable without |
| 290 | * turning every task into a large card. |
| 291 | */ |
| 292 | function compactDagLayout(tasks, dimensions) { |
| 293 | const nodeWidth = dimensions?.nodeWidth ?? 92; |
| 294 | const nodeHeight = dimensions?.nodeHeight ?? 30; |
| 295 | const columnGap = dimensions?.columnGap ?? 26; |
| 296 | const rowGap = dimensions?.rowGap ?? 8; |
| 297 | const stages = taskStages(tasks); |
| 298 | const positions = /* @__PURE__ */ new Map(); |
| 299 | const nodes = []; |
| 300 | for (const [column, stage] of stages.entries()) for (const [row, task] of stage.tasks.entries()) { |
| 301 | const x = column * (nodeWidth + columnGap); |
| 302 | const y = row * (nodeHeight + rowGap); |
| 303 | positions.set(task.id, { |
| 304 | x, |
| 305 | y |
| 306 | }); |
| 307 | nodes.push({ |
| 308 | task, |
| 309 | x, |
| 310 | y |
| 311 | }); |
| 312 | } |
| 313 | const edges = []; |
| 314 | for (const task of tasks) { |
| 315 | const target = positions.get(task.id); |
| 316 | if (target === void 0) continue; |
| 317 | for (const dependency of task.dependencies) { |
| 318 | const source = positions.get(dependency); |
| 319 | if (source === void 0) continue; |
| 320 | const x1 = source.x + nodeWidth; |
| 321 | const y1 = source.y + nodeHeight / 2; |
| 322 | const x2 = target.x; |
| 323 | const y2 = target.y + nodeHeight / 2; |
| 324 | edges.push({ |
| 325 | from: dependency, |
| 326 | to: task.id, |
| 327 | path: `M${x1} ${y1}C${x1 + 14} ${y1},${x2 - 14} ${y2},${x2} ${y2}` |
| 328 | }); |
| 329 | } |
| 330 | } |
| 331 | const rows = Math.max(1, ...stages.map((stage) => stage.tasks.length)); |
| 332 | return { |
| 333 | width: stages.length === 0 ? 0 : stages.length * nodeWidth + (stages.length - 1) * columnGap, |
| 334 | height: stages.length === 0 ? 0 : rows * nodeHeight + (rows - 1) * rowGap, |
| 335 | nodes, |
| 336 | edges |
| 337 | }; |
| 338 | } |
| 339 | /** |
| 340 | * Return the complete upstream/downstream chain around one task. |
| 341 | * |
| 342 | * Traversal uses both dependency directions and remains cycle-safe, so the UI |
| 343 | * can highlight every handoff related to the focused task even if malformed |
| 344 | * durable data contains a cycle. |
| 345 | */ |
| 346 | function relatedTaskIds(taskId, tasks) { |
| 347 | const byId = new Map(tasks.map((task) => [task.id, task])); |
| 348 | if (!byId.has(taskId)) return /* @__PURE__ */ new Set(); |
| 349 | const dependents = /* @__PURE__ */ new Map(); |
| 350 | for (const task of tasks) for (const dependency of task.dependencies) { |
| 351 | const targets = dependents.get(dependency) ?? []; |
| 352 | targets.push(task.id); |
| 353 | dependents.set(dependency, targets); |
| 354 | } |
| 355 | const related = /* @__PURE__ */ new Set(); |
| 356 | const upstreamSeen = /* @__PURE__ */ new Set(); |
| 357 | const downstreamSeen = /* @__PURE__ */ new Set(); |
| 358 | const visitUpstream = (id) => { |
| 359 | if (upstreamSeen.has(id)) return; |
| 360 | upstreamSeen.add(id); |
| 361 | related.add(id); |
| 362 | for (const dependency of byId.get(id)?.dependencies ?? []) visitUpstream(dependency); |
| 363 | }; |
| 364 | const visitDownstream = (id) => { |
| 365 | if (downstreamSeen.has(id)) return; |
| 366 | downstreamSeen.add(id); |
| 367 | related.add(id); |
| 368 | for (const dependent of dependents.get(id) ?? []) visitDownstream(dependent); |
| 369 | }; |
| 370 | visitUpstream(taskId); |
| 371 | visitDownstream(taskId); |
| 372 | return related; |
| 373 | } |
| 374 | //#endregion |
| 375 | //#region lib/client/activity-monitor.js |
| 376 | /** Shared, demand-driven state for the AgentTeams browser monitor. */ |
| 377 | const targets = /* @__PURE__ */ new Map(); |
| 378 | const targetListeners = /* @__PURE__ */ new Set(); |
| 379 | const snapshotListeners = /* @__PURE__ */ new Set(); |
| 380 | let targetSnapshot = []; |
| 381 | let activitySnapshots = { |
| 382 | teams: [], |
| 383 | archivedTeams: [] |
| 384 | }; |
| 385 | const MAX_RETAINED_SCOPES = 8; |
| 386 | const scopedSnapshots = { |
| 387 | teams: /* @__PURE__ */ new Map(), |
| 388 | archivedTeams: /* @__PURE__ */ new Map() |
| 389 | }; |
| 390 | function targetKey(sessionId, teamId) { |
| 391 | return `${sessionId}\u0000${teamId}`; |
| 392 | } |
| 393 | function publishTargets() { |
| 394 | targetSnapshot = [...targets.values()].filter((target) => target.active).map(({ key, sessionId, teamId }) => ({ |
| 395 | key, |
| 396 | sessionId, |
| 397 | teamId |
| 398 | })); |
| 399 | for (const listener of targetListeners) listener(); |
| 400 | } |
| 401 | /** Subscribe to the active monitor-target list (React external-store shape). */ |
| 402 | function subscribeActivityMonitorTargets(listener) { |
| 403 | targetListeners.add(listener); |
| 404 | return () => { |
| 405 | targetListeners.delete(listener); |
| 406 | }; |
| 407 | } |
| 408 | /** Read the stable active-target snapshot. */ |
| 409 | function getActivityMonitorTargetsSnapshot() { |
| 410 | return targetSnapshot; |
| 411 | } |
| 412 | /** |
| 413 | * Register one successful AgentTeams card as a monitoring demand. |
| 414 | * |
| 415 | * The returned cleanup is reference-counted so multiple cards and React |
| 416 | * StrictMode remounts cannot stop another card's monitor. |
| 417 | */ |
| 418 | function monitorAgentTeam(sessionId, teamId) { |
| 419 | const owner = sessionId.trim(); |
| 420 | const id = teamId.trim(); |
| 421 | if (owner === "" || id === "") return () => {}; |
| 422 | const key = targetKey(owner, id); |
| 423 | const existing = targets.get(key); |
| 424 | if (existing === void 0) { |
| 425 | targets.set(key, { |
| 426 | key, |
| 427 | sessionId: owner, |
| 428 | teamId: id, |
| 429 | refs: 1, |
| 430 | active: true |
| 431 | }); |
| 432 | publishTargets(); |
| 433 | } else { |
| 434 | existing.refs += 1; |
| 435 | if (!existing.active) { |
| 436 | existing.active = true; |
| 437 | publishTargets(); |
| 438 | } |
| 439 | } |
| 440 | let released = false; |
| 441 | return () => { |
| 442 | if (released) return; |
| 443 | released = true; |
| 444 | const current = targets.get(key); |
| 445 | if (current === void 0) return; |
| 446 | current.refs -= 1; |
| 447 | if (current.refs <= 0) { |
| 448 | targets.delete(key); |
| 449 | if (current.active) publishTargets(); |
| 450 | } |
| 451 | }; |
| 452 | } |
| 453 | /** Stop polling targets whose final archived snapshot has been captured. */ |
| 454 | function settleActivityMonitorTargets(keys) { |
| 455 | let changed = false; |
| 456 | for (const key of keys) { |
| 457 | const target = targets.get(key); |
| 458 | if (target?.active !== true) continue; |
| 459 | target.active = false; |
| 460 | changed = true; |
| 461 | } |
| 462 | if (changed) publishTargets(); |
| 463 | } |
| 464 | /** Subscribe to the shared live/archive snapshot. */ |
| 465 | function subscribeActivitySnapshots(listener) { |
| 466 | snapshotListeners.add(listener); |
| 467 | return () => { |
| 468 | snapshotListeners.delete(listener); |
| 469 | }; |
| 470 | } |
| 471 | /** Read the stable shared live/archive snapshot. */ |
| 472 | function getActivitySnapshotsSnapshot() { |
| 473 | return activitySnapshots; |
| 474 | } |
| 475 | /** Read the rows owned by one route and optional scope for ETag comparison. */ |
| 476 | function getPublishedActivityRows(field, scope) { |
| 477 | return scope === void 0 ? activitySnapshots[field] : scopedSnapshots[field].get(scope); |
| 478 | } |
| 479 | function replaceActivityRows(field, rows, scope) { |
| 480 | const current = activitySnapshots[field]; |
| 481 | if (rows === void 0) return current; |
| 482 | const recent = scopedSnapshots[field]; |
| 483 | if (scope === void 0) { |
| 484 | recent.clear(); |
| 485 | return rows; |
| 486 | } |
| 487 | const previous = recent.get(scope); |
| 488 | recent.delete(scope); |
| 489 | recent.set(scope, rows); |
| 490 | const oldest = recent.size > MAX_RETAINED_SCOPES ? recent.keys().next().value : void 0; |
| 491 | if (oldest !== void 0) recent.delete(oldest); |
| 492 | if (previous === rows) return current; |
| 493 | const otherRows = current.filter((team) => team.captainSessionId !== scope && team.captainSessionId !== oldest); |
| 494 | return otherRows.length === current.length && rows.length === 0 ? current : [...otherRows, ...rows]; |
| 495 | } |
| 496 | /** Publish full state-route responses or replace the rows for just one captain. */ |
| 497 | function updateActivitySnapshots(update, scope) { |
| 498 | const next = { |
| 499 | teams: replaceActivityRows("teams", update.teams, scope), |
| 500 | archivedTeams: replaceActivityRows("archivedTeams", update.archivedTeams, scope) |
| 501 | }; |
| 502 | if (next.teams === activitySnapshots.teams && next.archivedTeams === activitySnapshots.archivedTeams) return; |
| 503 | activitySnapshots = next; |
| 504 | for (const listener of snapshotListeners) listener(); |
| 505 | } |
| 506 | /** Poll cadence for the live host snapshot route. */ |
| 507 | const ACTIVITY_POLL_MS = 1e3; |
| 508 | /** |
| 509 | * Low-frequency probe cadence while a cardless discovery session still owns |
| 510 | * no team. The probe keeps the panel able to pick up a team created later in |
| 511 | * that session (e.g. a run_code-wrapped agent_teams_create) without turning |
| 512 | * every ordinary session into a one-second filesystem scan. |
| 513 | */ |
| 514 | const ACTIVITY_PROBE_MS = 5e3; |
| 515 | /** Host route serving live and archived team snapshots. */ |
| 516 | const ACTIVITY_STATE_URL = "/plugins/dsh-agent-teams/state"; |
| 517 | const ACTIVITY_HALT_URL = "/plugins/dsh-agent-teams/halt"; |
| 518 | async function readActivityTeams(response, scope) { |
| 519 | if (!response.ok) throw new Error("Activity unavailable"); |
| 520 | const body = await response.json(); |
| 521 | if (!Array.isArray(body?.teams) || body.teams.some((team) => typeof team?.teamId !== "string" || typeof team?.captainSessionId !== "string")) throw new Error("Invalid activity response"); |
| 522 | const teams = body.teams; |
| 523 | return scope === void 0 ? teams : teams.filter((team) => team.captainSessionId === scope); |
| 524 | } |
| 525 | /** |
| 526 | * Start the single polling loop for the current session's requested targets. |
| 527 | * |
| 528 | * With neither targets nor a discovery session this is deliberately inert. |
| 529 | * Explicit card targets poll at the live cadence from the start. A discovery |
| 530 | * session performs an immediate live+archive restore pass, then — while it |
| 531 | * still owns no team — probes on a low-frequency cadence, so a team created |
| 532 | * later in that session (e.g. a run_code-wrapped agent_teams_create) is |
| 533 | * discovered without a manual reload, without turning every ordinary session |
| 534 | * into a one-second filesystem scan. The moment a team for the discovery |
| 535 | * session appears, the controller upgrades to the live one-second cadence for |
| 536 | * the rest of its lifetime. The caller — the session view, which stops the |
| 537 | * controller when the session is no longer current — bounds the lifetime, and |
| 538 | * archive state is refreshed when a target or a previously discovered live |
| 539 | * team disappears. |
| 540 | */ |
| 541 | function startActivityPolling(monitorTargets, runtime = {}) { |
| 542 | const discoverySessionId = runtime.discoverySessionId?.trim(); |
| 543 | if (monitorTargets.length === 0 && (discoverySessionId === void 0 || discoverySessionId === "")) return { |
| 544 | firstTick: Promise.resolve(), |
| 545 | stop: () => {} |
| 546 | }; |
| 547 | const fetchState = runtime.fetchState ?? ((url, init) => fetch(url, init)); |
| 548 | const schedule = runtime.schedule ?? ((callback, intervalMs) => setInterval(callback, intervalMs)); |
| 549 | const cancel = runtime.cancel ?? ((timer) => { |
| 550 | clearInterval(timer); |
| 551 | }); |
| 552 | const publishSnapshots = runtime.publishSnapshots ?? updateActivitySnapshots; |
| 553 | const getPublishedRows = runtime.getPublishedRows ?? (runtime.publishSnapshots === void 0 ? getPublishedActivityRows : void 0); |
| 554 | const settleTargets = runtime.settleTargets ?? settleActivityMonitorTargets; |
| 555 | const owners = new Set(monitorTargets.map((target) => target.sessionId)); |
| 556 | if (discoverySessionId) owners.add(discoverySessionId); |
| 557 | const scope = owners.size === 1 ? owners.values().next().value : void 0; |
| 558 | const sessionQuery = scope ? new URLSearchParams({ session: scope }).toString() : ""; |
| 559 | const liveUrl = sessionQuery === "" ? ACTIVITY_STATE_URL : `${ACTIVITY_STATE_URL}?${sessionQuery}&summary=1`; |
| 560 | const archiveUrl = `${ACTIVITY_STATE_URL}?archived=1${sessionQuery === "" ? "" : `&${sessionQuery}`}`; |
| 561 | const conditionalHeaders = (tag) => tag === void 0 ? {} : { headers: { "if-none-match": tag } }; |
| 562 | const stillPublished = (field, snapshot) => getPublishedRows === void 0 || getPublishedRows(field, scope) === snapshot?.teams; |
| 563 | let cancelled = false; |
| 564 | let inFlight = false; |
| 565 | let hot = monitorTargets.length > 0; |
| 566 | let discoveredLiveKeys = /* @__PURE__ */ new Set(); |
| 567 | let archiveRefreshPending = Boolean(discoverySessionId); |
| 568 | let missingTargets = /* @__PURE__ */ new Set(); |
| 569 | let publishedLive; |
| 570 | let publishedArchive; |
| 571 | let controller; |
| 572 | let timer; |
| 573 | const intervalMs = () => hot ? ACTIVITY_POLL_MS : ACTIVITY_PROBE_MS; |
| 574 | const reschedule = () => { |
| 575 | cancel(timer); |
| 576 | timer = schedule(() => { |
| 577 | tick(); |
| 578 | }, intervalMs()); |
| 579 | }; |
| 580 | const tick = async () => { |
| 581 | if (inFlight || cancelled) return; |
| 582 | inFlight = true; |
| 583 | controller = new AbortController(); |
| 584 | try { |
| 585 | const liveTag = stillPublished("teams", publishedLive) ? publishedLive?.tag : void 0; |
| 586 | const liveResponse = await fetchState(liveUrl, { |
| 587 | cache: "no-store", |
| 588 | signal: controller.signal, |
| 589 | ...conditionalHeaders(liveTag) |
| 590 | }); |
| 591 | if (cancelled) return; |
| 592 | if (liveResponse.status !== 304 || liveTag === void 0) { |
| 593 | const liveTeams = await readActivityTeams(liveResponse, scope); |
| 594 | if (cancelled) return; |
| 595 | publishSnapshots({ teams: liveTeams }, scope); |
| 596 | if (cancelled) return; |
| 597 | publishedLive = { |
| 598 | teams: liveTeams, |
| 599 | tag: liveResponse.headers?.get("etag") ?? void 0 |
| 600 | }; |
| 601 | const previousDiscoveredKeys = discoveredLiveKeys; |
| 602 | discoveredLiveKeys = new Set(discoverySessionId ? liveTeams.filter((team) => team.captainSessionId === discoverySessionId).map((team) => team.teamId) : []); |
| 603 | archiveRefreshPending ||= [...previousDiscoveredKeys].some((teamId) => !discoveredLiveKeys.has(teamId)); |
| 604 | missingTargets = new Set(monitorTargets.filter((target) => !liveTeams.some((team) => team.captainSessionId === target.sessionId && team.teamId === target.teamId)).map((target) => target.key)); |
| 605 | if (!hot && discoveredLiveKeys.size > 0) { |
| 606 | hot = true; |
| 607 | reschedule(); |
| 608 | } |
| 609 | } else if (!stillPublished("teams", publishedLive)) return; |
| 610 | runtime.onStatus?.("ready"); |
| 611 | const archiveReplaced = publishedArchive !== void 0 && !stillPublished("archivedTeams", publishedArchive); |
| 612 | if (cancelled || missingTargets.size === 0 && !archiveRefreshPending && !archiveReplaced) return; |
| 613 | const archiveTag = archiveReplaced ? void 0 : publishedArchive?.tag; |
| 614 | const archivedResponse = await fetchState(archiveUrl, { |
| 615 | cache: "no-store", |
| 616 | signal: controller.signal, |
| 617 | ...conditionalHeaders(archiveTag) |
| 618 | }); |
| 619 | if (cancelled) return; |
| 620 | if (archivedResponse.status !== 304 || archiveTag === void 0) { |
| 621 | const archivedTeams = await readActivityTeams(archivedResponse, scope); |
| 622 | if (cancelled) return; |
| 623 | publishSnapshots({ archivedTeams }, scope); |
| 624 | if (cancelled) return; |
| 625 | publishedArchive = { |
| 626 | teams: archivedTeams, |
| 627 | tag: archivedResponse.headers?.get("etag") ?? void 0 |
| 628 | }; |
| 629 | } else if (!stillPublished("archivedTeams", publishedArchive)) return; |
| 630 | archiveRefreshPending = false; |
| 631 | const settled = missingTargets; |
| 632 | missingTargets = /* @__PURE__ */ new Set(); |
| 633 | settleTargets(settled); |
| 634 | } catch (error) { |
| 635 | if (error?.name === "AbortError") return; |
| 636 | if (!cancelled) runtime.onStatus?.("error"); |
| 637 | } finally { |
| 638 | inFlight = false; |
| 639 | } |
| 640 | }; |
| 641 | const firstTick = tick(); |
| 642 | if (timer === void 0) timer = schedule(() => { |
| 643 | tick(); |
| 644 | }, intervalMs()); |
| 645 | return { |
| 646 | firstTick, |
| 647 | stop: () => { |
| 648 | if (cancelled) return; |
| 649 | cancelled = true; |
| 650 | controller?.abort(); |
| 651 | cancel(timer); |
| 652 | } |
| 653 | }; |
| 654 | } |
| 655 | //#endregion |
| 656 | //#region lib/client/artwork.js |
| 657 | /** |
| 658 | * Shared whale artwork lookup for the activity panel and the conversation |
| 659 | * card: role keywords map to the packaged role images; the captain always |
| 660 | * uses the lead whale. |
| 661 | * @module dsh-agent-teams/client/artwork |
| 662 | */ |
| 663 | /** Artwork route prefix served by the plugin host half. */ |
| 664 | const ART_BASE = "/plugins/dsh-agent-teams/assets/"; |
| 665 | /** V2 whale role artwork per role keyword. */ |
| 666 | const ROLE_ART = [ |
| 667 | [/data|analys|metric|performance|数据|分析|指标|性能/, "member-data-v2.png"], |
| 668 | [/resear|investig|explor|study|研究|调查|探索|调研/, "member-researcher-v2.png"], |
| 669 | [/\bqa\b|test|verif|quality|测试|质量|验证/, "member-qa-v2.png"], |
| 670 | [/engineer|dev\b|server|backend|\bapi\b|runtime|watcher|contract|工程|后端|服务|接口|开发|代码|编程/, "member-engineer-v2.png"], |
| 671 | [/design|\bui\b|\bux\b|front|theme|accessib|设计|前端|主题|无障碍/, "member-designer-v2.png"], |
| 672 | [/secur|audit|risk|threat|review|安全|审计|审查|风险/, "member-security-v2.png"], |
| 673 | [/docs|writer|product|spec|撰写|文案|写作|文档|规范/, "member-docs-v2.png"], |
| 674 | [/release|\bbuild\b|deploy|\bops\b|\bci\b|ship|coordin|发布|构建|部署|运维|协调/, "member-operator-v2.png"] |
| 675 | ]; |
| 676 | /** Captain artwork (always the lead whale). */ |
| 677 | const LEAD_ART = `${ART_BASE}team-lead-v2.png`; |
| 678 | /** Status action artwork per member activity. */ |
| 679 | const ACTION_ART = { |
| 680 | working: `${ART_BASE}action-working-v2.png`, |
| 681 | idle: `${ART_BASE}action-sleeping-v2.png`, |
| 682 | unknown: `${ART_BASE}action-thinking-v2.png` |
| 683 | }; |
| 684 | /** |
| 685 | * Member artwork URL, or null when no role matches (initial-letter fallback). |
| 686 | * @param name - the member's display name. |
| 687 | * @param role - the member's role text. |
| 688 | * @returns the artwork URL, or null when unmatched. |
| 689 | */ |
| 690 | function memberArtUrl(name, role) { |
| 691 | const identity = `${name} ${role}`.toLowerCase(); |
| 692 | for (const [pattern, art] of ROLE_ART) if (pattern.test(identity)) return `${ART_BASE}${art}`; |
| 693 | return null; |
| 694 | } |
| 695 | //#endregion |
| 696 | //#region \0dsh-css:/home/runner/work/dsh-agent-teams/dsh-agent-teams/src/client/AgentTeamsCard.module.css.mjs |
| 697 | const css$2 = ".kPAopq_root{box-sizing:border-box;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-module-platform);border-radius:10px;flex-direction:column;gap:8px;width:100%;min-width:0;padding:10px 12px;display:flex}.kPAopq_head{align-items:center;gap:8px;min-width:0;display:flex}.kPAopq_leadAvatar{object-fit:contain;filter:drop-shadow(0 1px 1px #122d4833);background:0 0;border:0;border-radius:0;flex:none;width:30px;height:30px}.kPAopq_teamName{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;flex:0 auto;font-size:13px;font-weight:600;line-height:20px;overflow:hidden}.kPAopq_memberCount{color:var(--dsw-alias-label-tertiary);white-space:nowrap;flex:none;margin-left:auto;font-size:11px;line-height:16px}.kPAopq_panelButton{border:1px solid var(--dsw-alias-border-l3);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-secondary);font:inherit;cursor:pointer;border-radius:999px;flex:none;padding:2px 8px;font-size:10.5px;font-weight:600;line-height:16px;transition:border-color .12s,color .12s}.kPAopq_panelButton:hover{border-color:var(--dsw-alias-state-business-primary);color:var(--dsw-alias-state-business-primary)}.kPAopq_panelButton:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:1px}.kPAopq_members{flex-wrap:wrap;gap:6px;min-width:0;display:flex}.kPAopq_member{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);max-width:160px;color:var(--dsw-alias-label-secondary);font:inherit;cursor:pointer;border-radius:999px;align-items:center;gap:5px;padding:3px 8px 3px 3px;font-size:11px;font-weight:500;line-height:16px;transition:border-color .12s,background-color .12s;display:inline-flex}.kPAopq_member:hover{border-color:var(--dsw-alias-state-business-primary);background:var(--dsw-alias-button-ghost-active-fill)}.kPAopq_member:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:1px}.kPAopq_memberArt{object-fit:contain;filter:drop-shadow(0 1px 1px #122d482e);background:0 0;border:0;border-radius:0;width:24px;height:24px}.kPAopq_memberInitial{background:var(--dsw-alias-state-business-primary);width:20px;height:20px;color:var(--dsw-alias-label-primary-inverted);border-radius:50%;justify-content:center;align-items:center;font-size:10px;font-weight:600;line-height:20px;display:inline-flex}.kPAopq_memberName{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.kPAopq_chatEntry{border:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);font:inherit;white-space:nowrap;cursor:pointer;background:0 0;border-radius:7px;align-items:center;gap:5px;padding:3px 8px;font-size:12px;display:inline-flex}.kPAopq_chatEntry img{object-fit:contain;width:22px;height:22px}.kPAopq_chatEntry:hover{background:var(--dsw-alias-bg-module-platform)}.kPAopq_chatEntry:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}.kPAopq_turnCards{gap:8px;margin-block:10px;display:grid}@media (width<=600px){.kPAopq_head{flex-wrap:wrap}}"; |
| 698 | const tagId$2 = "@nanmicoder/dsh-agent-teams/AgentTeamsCard.module.css"; |
| 699 | if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$2) + "]") === null) { |
| 700 | const tag = document.createElement("style"); |
| 701 | tag.dataset.plugin = "@nanmicoder/dsh-agent-teams"; |
| 702 | tag.dataset.pluginCss = tagId$2; |
| 703 | tag.textContent = css$2; |
| 704 | document.head.appendChild(tag); |
| 705 | } |
| 706 | var AgentTeamsCard_module_css_default = { |
| 707 | "chatEntry": "kPAopq_chatEntry", |
| 708 | "head": "kPAopq_head", |
| 709 | "leadAvatar": "kPAopq_leadAvatar", |
| 710 | "member": "kPAopq_member", |
| 711 | "memberArt": "kPAopq_memberArt", |
| 712 | "memberCount": "kPAopq_memberCount", |
| 713 | "memberInitial": "kPAopq_memberInitial", |
| 714 | "memberName": "kPAopq_memberName", |
| 715 | "members": "kPAopq_members", |
| 716 | "panelButton": "kPAopq_panelButton", |
| 717 | "root": "kPAopq_root", |
| 718 | "teamName": "kPAopq_teamName", |
| 719 | "turnCards": "kPAopq_turnCards" |
| 720 | }; |
| 721 | //#endregion |
| 722 | //#region lib/client/AgentTeamsCard.js |
| 723 | /** |
| 724 | * AgentTeams conversation card: the lightweight in-conversation summary for |
| 725 | * one team — the captain's whale avatar and name, the member roster as |
| 726 | * clickable whale avatars (opening the member's subagent transcript), and |
| 727 | * an "activity panel" button that re-activates the top-right floater. |
| 728 | * |
| 729 | * The floater and this card share the `agent-teams:open-panel` window event |
| 730 | * so the card can summon the panel even after it was closed (or when an old |
| 731 | * session is re-opened for review). |
| 732 | * @module dsh-agent-teams/client/card |
| 733 | */ |
| 734 | /** Window event name the floater listens for to open itself. */ |
| 735 | const OPEN_PANEL_EVENT = "agent-teams:open-panel"; |
| 736 | /** Open the matching team view, carrying this team's summary |
| 737 | * so the panel can show it even when the team no longer exists on disk |
| 738 | * (historical session review). */ |
| 739 | function openActivityPanel(data) { |
| 740 | window.dispatchEvent(new CustomEvent(OPEN_PANEL_EVENT, { detail: { |
| 741 | teamId: data.teamId, |
| 742 | captainSessionId: data.captainSessionId, |
| 743 | teamName: data.teamName, |
| 744 | members: data.members |
| 745 | } })); |
| 746 | } |
| 747 | /** Render one durable team as a compact conversation card. */ |
| 748 | const noWorkspace = () => void 0; |
| 749 | const noSubscription = () => () => {}; |
| 750 | function AgentTeamsCard({ node, openMember, sessionId, t, workspaceBridge }) { |
| 751 | const native = (0, react.useSyncExternalStore)(workspaceBridge?.subscribe ?? noSubscription, workspaceBridge?.getSnapshot ?? noWorkspace); |
| 752 | const location = node.location; |
| 753 | if (native && (location.kind === "turn" || location.kind === "step") && location.turn.status === "closed") return null; |
| 754 | return (0, react_jsx_runtime.jsx)(AgentTeamsSummary, { |
| 755 | data: node.data, |
| 756 | openMember, |
| 757 | sessionId, |
| 758 | t |
| 759 | }); |
| 760 | } |
| 761 | function AgentTeamsSummary({ data, openMember, sessionId, t }) { |
| 762 | const owner = data.captainSessionId || sessionId; |
| 763 | const { teams, archivedTeams } = (0, react.useSyncExternalStore)(subscribeActivitySnapshots, getActivitySnapshotsSnapshot); |
| 764 | (0, react.useEffect)(() => { |
| 765 | return monitorAgentTeam(owner, data.teamId); |
| 766 | }, [data.teamId, owner]); |
| 767 | const snapshot = teams.find((team) => team.teamId === data.teamId && (owner === "" || team.captainSessionId === owner)) ?? archivedTeams.find((team) => team.teamId === data.teamId && (owner === "" || team.captainSessionId === owner)); |
| 768 | const resolved = (0, react.useMemo)(() => ({ |
| 769 | ...data, |
| 770 | captainSessionId: snapshot?.captainSessionId ?? owner, |
| 771 | teamName: snapshot?.name ?? data.teamName, |
| 772 | members: snapshot?.members.map((member) => ({ |
| 773 | id: member.id, |
| 774 | name: member.name, |
| 775 | role: member.role |
| 776 | })) ?? data.members |
| 777 | }), [ |
| 778 | data, |
| 779 | owner, |
| 780 | snapshot |
| 781 | ]); |
| 782 | return (0, react_jsx_runtime.jsxs)("section", { |
| 783 | className: AgentTeamsCard_module_css_default.root, |
| 784 | "data-agent-teams-card": true, |
| 785 | "data-team-id": resolved.teamId, |
| 786 | children: [(0, react_jsx_runtime.jsxs)("header", { |
| 787 | className: AgentTeamsCard_module_css_default.head, |
| 788 | children: [ |
| 789 | (0, react_jsx_runtime.jsx)("img", { |
| 790 | className: AgentTeamsCard_module_css_default.leadAvatar, |
| 791 | src: LEAD_ART, |
| 792 | alt: "", |
| 793 | "aria-hidden": true |
| 794 | }), |
| 795 | (0, react_jsx_runtime.jsx)("span", { |
| 796 | className: AgentTeamsCard_module_css_default.teamName, |
| 797 | title: resolved.teamName, |
| 798 | children: resolved.teamName |
| 799 | }), |
| 800 | (0, react_jsx_runtime.jsx)("span", { |
| 801 | className: AgentTeamsCard_module_css_default.memberCount, |
| 802 | children: t("card.memberCount", { count: resolved.members.length }) |
| 803 | }), |
| 804 | (0, react_jsx_runtime.jsx)("button", { |
| 805 | type: "button", |
| 806 | className: AgentTeamsCard_module_css_default.panelButton, |
| 807 | onClick: () => { |
| 808 | openActivityPanel(resolved); |
| 809 | }, |
| 810 | "aria-label": t("workspace.focus"), |
| 811 | title: t("workspace.focus"), |
| 812 | children: t("workspace.focus") |
| 813 | }) |
| 814 | ] |
| 815 | }), resolved.members.length > 0 && (0, react_jsx_runtime.jsx)("div", { |
| 816 | className: AgentTeamsCard_module_css_default.members, |
| 817 | children: resolved.members.map((member) => (0, react_jsx_runtime.jsxs)("button", { |
| 818 | type: "button", |
| 819 | className: AgentTeamsCard_module_css_default.member, |
| 820 | onClick: () => { |
| 821 | if (member.id !== "") openMember(owner, member.id); |
| 822 | }, |
| 823 | title: member.role === "" ? member.name : `${member.name} · ${member.role}`, |
| 824 | children: [memberArtUrl(member.name, member.role) !== null ? (0, react_jsx_runtime.jsx)("img", { |
| 825 | className: AgentTeamsCard_module_css_default.memberArt, |
| 826 | src: memberArtUrl(member.name, member.role) ?? "", |
| 827 | alt: "", |
| 828 | "aria-hidden": true |
| 829 | }) : (0, react_jsx_runtime.jsx)("span", { |
| 830 | className: AgentTeamsCard_module_css_default.memberInitial, |
| 831 | children: member.name.trim().slice(0, 1).toUpperCase() || "?" |
| 832 | }), (0, react_jsx_runtime.jsx)("span", { |
| 833 | className: AgentTeamsCard_module_css_default.memberName, |
| 834 | children: member.name |
| 835 | })] |
| 836 | }, member.id || member.name)) |
| 837 | })] |
| 838 | }); |
| 839 | } |
| 840 | //#endregion |
| 841 | //#region \0dsh-css:/home/runner/work/dsh-agent-teams/dsh-agent-teams/src/client/ActivityPanel.module.css.mjs |
| 842 | const css$1 = "html{--agent-teams-panel-shift:420px}html[data-agent-teams-panel-open] [data-phase=active]{box-sizing:border-box;padding-right:var(--agent-teams-panel-shift)}.aYQbCq_badge{box-sizing:border-box;border:1px solid var(--dsw-alias-border-l2);background:color-mix(in srgb, var(--dsw-alias-bg-module-platform) 92%, transparent);backdrop-filter:blur(16px);height:34px;box-shadow:0 8px 28px color-mix(in srgb, var(--dsw-alias-bg-mask-3) 29%, transparent);color:var(--dsw-alias-label-secondary);font:inherit;cursor:pointer;border-radius:999px;align-items:center;gap:7px;padding:0 12px;font-size:12px;font-weight:600;line-height:20px;transition:border-color .15s,transform .12s;display:inline-flex;position:absolute;top:64px;right:18px}.aYQbCq_badge:hover{border-color:var(--dsw-alias-border-l3);transform:translateY(-1px)}.aYQbCq_badge:active{transform:translateY(0)scale(.98)}.aYQbCq_badge:focus-visible,.aYQbCq_iconButton:focus-visible,.aYQbCq_memberRow:focus-visible,.aYQbCq_membersToggle:focus-visible,.aYQbCq_sectionToggleTitle:focus-visible,.aYQbCq_dagNode:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}.aYQbCq_badgeDot,.aYQbCq_panelDot{background:var(--dsw-alias-label-tertiary);border-radius:50%;width:7px;height:7px}.aYQbCq_badgeDot[data-busy=true],.aYQbCq_panelDot[data-busy=true]{background:var(--dsw-alias-state-business-primary);animation:1.25s ease-in-out infinite aYQbCq_agentTeamsPulse}.aYQbCq_badgeCount,.aYQbCq_memberCount,.aYQbCq_teamStats,.aYQbCq_stageLabel,.aYQbCq_taskId{font-variant-numeric:tabular-nums}.aYQbCq_panel{box-sizing:border-box;border:1px solid color-mix(in srgb, var(--dsw-alias-border-l3) 58%, transparent);background:color-mix(in srgb, var(--dsw-alias-bg-layer-1) 95%, transparent);backdrop-filter:blur(20px)saturate(1.08);box-shadow:0 12px 32px color-mix(in srgb, var(--dsw-alias-bg-mask-3) 25%, transparent), 0 32px 72px color-mix(in srgb, var(--dsw-alias-bg-mask-3) 33%, transparent);will-change:transform;border-radius:16px;flex-direction:column;animation:.16s ease-out aYQbCq_agentTeamsPanelIn;display:flex;position:absolute;top:0;left:0;overflow:hidden}.aYQbCq_panel[data-dragging],.aYQbCq_panel[data-resizing]{user-select:none;box-shadow:0 16px 38px color-mix(in srgb, var(--dsw-alias-bg-mask-3) 29%, transparent), 0 36px 78px color-mix(in srgb, var(--dsw-alias-bg-mask-3) 38%, transparent)}@keyframes aYQbCq_agentTeamsPanelIn{0%{opacity:0}to{opacity:1}}@keyframes aYQbCq_agentTeamsPulse{0%,to{opacity:.42}50%{opacity:1}}.aYQbCq_panelHead{border-bottom:1px solid var(--dsw-alias-border-l2);cursor:grab;touch-action:none;flex:none;justify-content:space-between;align-items:center;min-height:44px;padding:0 14px 0 16px;display:flex}.aYQbCq_panelHead:active,.aYQbCq_panel[data-dragging] .aYQbCq_panelHead{cursor:grabbing}.aYQbCq_panel[data-compact] .aYQbCq_panelHead{cursor:default;touch-action:auto}.aYQbCq_panelTitle{color:var(--dsw-alias-label-primary);align-items:center;gap:8px;font-size:14px;font-weight:600;line-height:20px;display:inline-flex}.aYQbCq_panelControls{flex:none;align-items:center;gap:2px;display:inline-flex}.aYQbCq_iconButton{width:28px;height:28px;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:0;border-radius:7px;justify-content:center;align-items:center;padding:0;transition:background-color .12s,color .12s,transform .12s;display:inline-flex}.aYQbCq_iconButton:hover{background:var(--dsw-alias-button-ghost-active-fill);color:var(--dsw-alias-label-primary)}.aYQbCq_iconButton:active{transform:scale(.94)}.aYQbCq_iconButton[data-control=dock][data-mode=docked] svg{transform:scaleX(-1)}.aYQbCq_resizeHandle{z-index:5;touch-action:none;pointer-events:auto;position:absolute}.aYQbCq_resizeHandle[data-resize-edge=left]{cursor:ew-resize;width:14px;top:44px;bottom:14px;left:0}.aYQbCq_resizeHandle[data-resize-edge=left]:after{background:color-mix(in srgb, var(--dsw-alias-label-tertiary) 42%, transparent);content:\"\";opacity:.45;border-radius:999px;width:3px;height:48px;transition:background-color .12s,opacity .12s;position:absolute;top:50%;left:4px;transform:translateY(-50%)}.aYQbCq_resizeHandle[data-resize-edge=bottom]{cursor:ns-resize;height:14px;bottom:0;left:20px;right:20px}.aYQbCq_resizeHandle[data-resize-edge=bottom]:after{background:color-mix(in srgb, var(--dsw-alias-label-tertiary) 42%, transparent);content:\"\";opacity:.45;border-radius:999px;width:48px;height:3px;transition:background-color .12s,opacity .12s;position:absolute;bottom:4px;left:50%;transform:translate(-50%)}.aYQbCq_resizeHandle[data-resize-edge=corner]{cursor:nwse-resize;width:28px;height:28px;bottom:0;right:0}.aYQbCq_resizeHandle[data-resize-edge=corner]:after{border-right:2px solid var(--dsw-alias-label-tertiary);border-bottom:2px solid var(--dsw-alias-label-tertiary);content:\"\";opacity:.58;width:10px;height:10px;transition:border-color .12s,opacity .12s;position:absolute;bottom:6px;right:6px}.aYQbCq_resizeHandle:hover:after,.aYQbCq_panel[data-resizing] .aYQbCq_resizeHandle:after{background-color:var(--dsw-alias-state-business-primary);border-color:var(--dsw-alias-state-business-primary);opacity:.95}.aYQbCq_teams{overscroll-behavior:contain;scrollbar-color:color-mix(in srgb, var(--dsw-alias-label-tertiary) 28%, transparent) transparent;scrollbar-width:thin;flex-direction:column;min-height:0;display:flex;overflow-y:auto}.aYQbCq_teams::-webkit-scrollbar{width:6px}.aYQbCq_teams::-webkit-scrollbar-track{background:0 0}.aYQbCq_teams::-webkit-scrollbar-thumb{background:color-mix(in srgb, var(--dsw-alias-label-tertiary) 28%, transparent);background-clip:padding-box;border:2px solid #0000;border-radius:999px}.aYQbCq_teams:hover::-webkit-scrollbar-thumb{background:color-mix(in srgb, var(--dsw-alias-label-tertiary) 44%, transparent);background-clip:padding-box}.aYQbCq_team{border-bottom:1px solid var(--dsw-alias-border-l2);flex-direction:column;gap:12px;padding:12px 14px 16px;display:flex;container:aYQbCq_agent-team/inline-size}.aYQbCq_team:last-child{border-bottom:0}.aYQbCq_teamHead{align-items:center;gap:10px;min-width:0;display:flex}.aYQbCq_teamName{min-width:0;color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;flex:1;font-size:13px;font-weight:600;line-height:18px;overflow:hidden}.aYQbCq_teamStats{color:var(--dsw-alias-label-tertiary);white-space:nowrap;flex:none;gap:8px;font-size:10.5px;line-height:16px;display:inline-flex}.aYQbCq_teamStopButton{border:1px solid var(--dsw-alias-border-l2);width:26px;height:26px;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border-radius:7px;flex:none;place-items:center;padding:0;transition:border-color .15s,background .15s,color .15s;display:grid}.aYQbCq_teamStopButton:hover{border-color:color-mix(in srgb, var(--dsw-alias-state-error-primary) 42%, var(--dsw-alias-border-l2));background:color-mix(in srgb, var(--dsw-alias-state-error-primary) 7%, transparent);color:var(--dsw-alias-state-error-primary)}.aYQbCq_teamStopButton:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}.aYQbCq_stopModalActions{justify-content:flex-end;gap:8px;display:flex}.aYQbCq_stopModalActions button{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-button-ghost-active-fill);min-height:34px;color:var(--dsw-alias-label-primary);cursor:pointer;font:inherit;border-radius:8px;justify-content:center;align-items:center;gap:6px;padding:6px 13px;font-size:12px;font-weight:600;display:inline-flex}.aYQbCq_stopModalActions button[data-danger]{border-color:var(--dsw-alias-state-error-primary);background:var(--dsw-alias-state-error-primary);color:var(--dsw-alias-label-primary-inverted)}.aYQbCq_stopModalActions button:disabled{cursor:wait;opacity:.58}.aYQbCq_stopModalError{background:color-mix(in srgb, var(--dsw-alias-state-error-primary) 8%, transparent);color:var(--dsw-alias-state-error-primary);border-radius:8px;align-items:flex-start;gap:7px;margin:0;padding:9px 10px;font-size:12px;line-height:18px;display:flex}.aYQbCq_stopModalError svg{flex:none;margin-top:1px}.aYQbCq_sectionHead{justify-content:space-between;align-items:center;gap:8px;min-width:0;display:flex}.aYQbCq_sectionTitle{color:var(--dsw-alias-label-secondary);align-items:center;gap:6px;font-size:11px;font-weight:600;line-height:16px;display:inline-flex}.aYQbCq_sectionHint{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;font-size:10px;line-height:14px;overflow:hidden}.aYQbCq_delegationSection{min-width:0}.aYQbCq_captainNode{box-sizing:border-box;border:1px solid color-mix(in srgb, var(--dsw-alias-state-business-primary) 32%, var(--dsw-alias-border-l2));background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 7%, var(--dsw-alias-bg-layer-1));border-radius:10px;grid-template-columns:48px minmax(0,1fr) auto;align-items:center;gap:9px;min-height:56px;padding:6px 10px;display:grid}.aYQbCq_captainAvatar,.aYQbCq_memberAvatar{flex:none;justify-content:center;align-items:center;display:inline-flex;position:relative}.aYQbCq_captainAvatar{width:46px;height:46px}.aYQbCq_leadAvatar,.aYQbCq_memberArt{object-fit:contain;filter:drop-shadow(0 1px 1px #122d4833);background:0 0;border:0;border-radius:0}.aYQbCq_leadAvatar{width:44px;height:44px}.aYQbCq_memberArt{width:40px;height:40px}.aYQbCq_captainInfo,.aYQbCq_memberInfo{flex-direction:column;min-width:0;display:flex}.aYQbCq_captainInfo{gap:2px}.aYQbCq_captainLine,.aYQbCq_memberLine{align-items:center;gap:6px;min-width:0;display:flex}.aYQbCq_captainName,.aYQbCq_memberName{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;font-size:12.5px;font-weight:600;line-height:18px;overflow:hidden}.aYQbCq_captainRole,.aYQbCq_memberRole{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;font-size:10px;line-height:14px;overflow:hidden}.aYQbCq_captainSummary,.aYQbCq_memberStatusLine{color:var(--dsw-alias-label-secondary);text-overflow:ellipsis;white-space:nowrap;font-size:10.5px;line-height:15px;overflow:hidden}.aYQbCq_taskDetailModel{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:9.5px;line-height:14px;overflow:hidden}.aYQbCq_memberModel{box-sizing:border-box;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-button-ghost-active-fill);min-width:0;max-width:132px;color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;border-radius:999px;flex:0 auto;align-items:center;padding:0 6px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:9px;font-weight:600;line-height:15px;display:inline-flex;overflow:hidden}.aYQbCq_captainState,.aYQbCq_memberState{color:var(--dsw-alias-label-tertiary);white-space:nowrap;flex:none;align-items:center;gap:5px;font-size:10px;font-weight:500;line-height:15px;display:inline-flex}.aYQbCq_captainState[data-busy=true],.aYQbCq_memberState[data-activity=working]{color:var(--dsw-alias-state-business-primary)}.aYQbCq_workGlyph rect{opacity:.5}.aYQbCq_workGlyph[data-active=true] rect{animation:1.1s ease-in-out infinite aYQbCq_agentTeamsDot}@keyframes aYQbCq_agentTeamsDot{0%,to{opacity:.25}50%{opacity:1}}.aYQbCq_progressOverview{flex-direction:column;gap:7px;display:flex}.aYQbCq_progressTitle{color:var(--dsw-alias-label-secondary);font-size:11px;font-weight:600;line-height:16px}.aYQbCq_progressSegments{gap:3px;display:flex}.aYQbCq_progressSegments>span,.aYQbCq_progressEmpty{background:var(--dsw-alias-border-l3);border-radius:2px;flex:1;height:5px}.aYQbCq_progressEmpty{width:100%;display:block}.aYQbCq_progressSegments>span[data-state=running]{background:var(--dsw-alias-state-business-primary)}.aYQbCq_progressSegments>span[data-state=blocked]{background:var(--dsw-alias-state-warn-primary)}.aYQbCq_progressSegments>span[data-state=completed]{background:var(--dsw-alias-state-success-primary)}.aYQbCq_progressSegments>span[data-state=failed]{background:var(--dsw-alias-state-error-primary)}.aYQbCq_progressSegments>span[data-state=cancelled]{opacity:.55}.aYQbCq_progressLegend{color:var(--dsw-alias-label-tertiary);flex-wrap:wrap;gap:10px;font-size:9.5px;line-height:14px;display:flex}.aYQbCq_progressLegend>span[data-state=running]{color:var(--dsw-alias-state-business-primary)}.aYQbCq_progressLegend>span[data-state=blocked]{color:var(--dsw-alias-state-warn-primary)}.aYQbCq_progressLegend>span[data-state=completed]{color:var(--dsw-alias-state-success-primary)}.aYQbCq_progressSummary{background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 7%, var(--dsw-alias-bg-layer-1));min-width:0;color:var(--dsw-alias-label-secondary);border-radius:8px;align-items:center;gap:6px;padding:5px 8px;font-size:10px;font-weight:600;line-height:15px;display:flex}.aYQbCq_progressSummary[data-state=warning]{background:color-mix(in srgb, var(--dsw-alias-state-warn-primary) 8%, var(--dsw-alias-bg-layer-1))}.aYQbCq_progressSummary[data-state=completed]{background:color-mix(in srgb, var(--dsw-alias-state-success-primary) 8%, var(--dsw-alias-bg-layer-1))}.aYQbCq_progressSummary[data-state=discarded]{background:var(--dsw-alias-button-ghost-active-fill)}.aYQbCq_progressSummary>span:last-child{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.aYQbCq_progressSummaryDot{background:var(--dsw-alias-state-business-primary);border-radius:50%;flex:none;width:5px;height:5px}.aYQbCq_progressSummary[data-state=warning] .aYQbCq_progressSummaryDot{background:var(--dsw-alias-state-warn-primary)}.aYQbCq_progressSummary[data-state=completed] .aYQbCq_progressSummaryDot{background:var(--dsw-alias-state-success-primary)}.aYQbCq_progressSummary[data-state=discarded] .aYQbCq_progressSummaryDot{background:var(--dsw-alias-label-tertiary)}.aYQbCq_membersToggle{background:var(--dsw-alias-bg-module-platform);width:100%;color:var(--dsw-alias-label-secondary);font:inherit;cursor:pointer;border:0;border-radius:8px;justify-content:space-between;align-items:center;gap:8px;padding:6px 8px;font-size:10.5px;font-weight:600;line-height:15px;display:flex}.aYQbCq_membersToggle:hover{background:var(--dsw-alias-button-ghost-active-fill)}.aYQbCq_membersToggle>span{align-items:center;gap:5px;display:inline-flex}.aYQbCq_membersToggle>span:last-child{color:var(--dsw-alias-state-business-primary)}.aYQbCq_chevron{flex:none;transition:transform .14s}.aYQbCq_chevron[data-open=true]{transform:rotate(90deg)}.aYQbCq_delegationTree{flex-direction:column;gap:2px;margin-left:18px;padding:9px 0 0 20px;display:flex;position:relative}.aYQbCq_delegationTree:before{background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 48%, var(--dsw-alias-border-l2));content:\"\";width:1px;position:absolute;top:0;bottom:22px;left:0}.aYQbCq_memberBlock{flex-direction:column;min-width:0;padding:3px 0 7px;display:flex;position:relative}.aYQbCq_memberBranch{background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 48%, var(--dsw-alias-border-l2));width:20px;height:1px;display:block;position:absolute;top:27px;right:100%}.aYQbCq_memberBranch:before{background:var(--dsw-alias-state-business-primary);content:\"\";border-radius:50%;width:5px;height:5px;position:absolute;top:-2px;right:-1px}.aYQbCq_memberRow{box-sizing:border-box;width:100%;min-width:0;min-height:48px;color:inherit;font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:8px;grid-template-columns:46px minmax(0,1fr) auto;align-items:center;gap:8px;padding:4px 6px;transition:background-color .12s,transform .12s;display:grid}.aYQbCq_memberRow:hover,.aYQbCq_memberRow[data-activity=working]{background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 6%, var(--dsw-alias-bg-layer-1))}.aYQbCq_memberRow:active{transform:scale(.995)}.aYQbCq_memberAvatar{width:42px;height:42px}.aYQbCq_memberAvatar[data-unread=true]:after{box-sizing:border-box;border:1px solid var(--dsw-alias-bg-layer-1);background:var(--dsw-alias-state-business-primary);content:\"\";border-radius:50%;width:6px;height:6px;animation:1.8s ease-in-out infinite aYQbCq_agentTeamsUnreadPulse;position:absolute;top:0;right:-1px}@keyframes aYQbCq_agentTeamsUnreadPulse{0%,to{opacity:.78;transform:scale(.92)}50%{opacity:1;transform:scale(1.16)}}.aYQbCq_memberInitial{background:var(--dsw-alias-state-business-primary);width:34px;height:34px;color:var(--dsw-alias-label-primary-inverted);border-radius:50%;justify-content:center;align-items:center;font-size:14px;font-weight:600;line-height:20px;display:inline-flex}.aYQbCq_stateArt{box-sizing:border-box;object-fit:contain;width:22px;height:22px;filter:drop-shadow(0 0 1px var(--dsw-alias-bg-layer-1)) drop-shadow(0 1px 1px #122d483d);background:0 0;border:0;border-radius:0;position:absolute;bottom:-3px;right:-5px}.aYQbCq_stateArt[data-activity=working]{animation:2.4s ease-in-out infinite aYQbCq_agentTeamsFloat}.aYQbCq_stateArt[data-activity=idle]{animation:4.2s ease-in-out infinite aYQbCq_agentTeamsBreathe}.aYQbCq_stateArt[data-activity=unknown]{animation:2.8s ease-in-out infinite aYQbCq_agentTeamsThink}@keyframes aYQbCq_agentTeamsFloat{0%,to{transform:translateY(0)rotate(-4deg)}50%{transform:translateY(-2px)rotate(4deg)}}@keyframes aYQbCq_agentTeamsBreathe{0%,to{opacity:.82;transform:scale(1)}50%{opacity:1;transform:scale(1.06)}}@keyframes aYQbCq_agentTeamsThink{0%,to{transform:rotate(-7deg)}50%{transform:rotate(7deg)}}.aYQbCq_memberState{margin-left:auto}.aYQbCq_memberCount{color:var(--dsw-alias-label-tertiary);font-size:10.5px;line-height:16px}.aYQbCq_assignmentLine{align-items:center;gap:7px;min-width:0;padding:0 6px 0 60px;display:flex}.aYQbCq_assignmentLabel{color:var(--dsw-alias-label-tertiary);flex:none;font-size:9.5px;line-height:14px}.aYQbCq_assignmentTasks{flex-wrap:wrap;flex:1;gap:4px;min-width:0;display:flex}.aYQbCq_assignmentChip{background:var(--dsw-alias-button-ghost-active-fill);max-width:100%;min-height:16px;color:var(--dsw-alias-label-secondary);text-overflow:ellipsis;white-space:nowrap;border-radius:4px;align-items:center;padding:0 5px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:9px;font-weight:600;line-height:14px;display:inline-flex;overflow:hidden}.aYQbCq_assignmentChip[data-state=running]{background:var(--dsw-alias-state-business-primary);color:var(--dsw-alias-label-primary-inverted)}.aYQbCq_assignmentChip[data-state=completed]{background:var(--dsw-alias-state-success-primary);color:var(--dsw-alias-label-primary-inverted)}.aYQbCq_assignmentChip[data-state=blocked]{background:var(--dsw-alias-state-warn-primary);color:var(--dsw-alias-label-primary-inverted)}.aYQbCq_assignmentChip[data-state=failed]{background:var(--dsw-alias-state-error-primary);color:var(--dsw-alias-label-primary-inverted)}.aYQbCq_assignmentChip[data-state=cancelled]{color:var(--dsw-alias-label-tertiary);text-decoration:line-through}.aYQbCq_unreadPill{color:var(--dsw-alias-state-business-primary);white-space:nowrap;flex:none;font-size:9.5px;font-weight:600;line-height:14px}.aYQbCq_taskEmpty{color:var(--dsw-alias-label-tertiary);font-size:9.5px;line-height:14px}.aYQbCq_dependencySection{border-top:1px solid var(--dsw-alias-border-l2);flex-direction:column;gap:7px;min-width:0;padding-top:10px;display:flex}.aYQbCq_sectionToggleTitle{color:var(--dsw-alias-label-secondary);font:inherit;cursor:pointer;background:0 0;border:0;align-items:center;gap:6px;padding:0;font-size:11px;font-weight:600;line-height:16px;display:inline-flex}.aYQbCq_dagViewport{scrollbar-width:thin;min-width:0;padding:2px 0 4px;overflow-x:auto}.aYQbCq_dagCanvas{min-width:100%;position:relative}.aYQbCq_dagCanvas[data-layout=parallel]{flex-wrap:wrap;gap:8px;display:flex}.aYQbCq_dagCanvas[data-layout=parallel] .aYQbCq_dagNode{flex:92px;min-width:92px;position:relative}.aYQbCq_dagEdges{pointer-events:none;position:absolute;inset:0;overflow:visible}.aYQbCq_dagEdges path{fill:none;stroke:var(--dsw-alias-border-l3);stroke-width:1px;transition:opacity .14s,stroke .14s,stroke-width .14s}.aYQbCq_dagEdges path[data-active=true]{stroke:var(--dsw-alias-state-business-primary);stroke-width:1.6px}.aYQbCq_dagEdges path[data-dimmed=true]{opacity:.24}.aYQbCq_dagNode{box-sizing:border-box;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);font:inherit;text-align:left;cursor:pointer;border-radius:6px;flex-direction:column;justify-content:center;gap:1px;padding:0 6px;transition:border-color .14s,background-color .14s,opacity .14s;display:flex;position:absolute}.aYQbCq_dagNode:hover,.aYQbCq_dagNode[data-focused=true]{border-color:var(--dsw-alias-state-business-primary);background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 6%, var(--dsw-alias-bg-layer-1))}.aYQbCq_dagNode[data-dimmed=true]{opacity:.3}.aYQbCq_dagNode[data-state=running][data-dimmed=true]{opacity:.58}.aYQbCq_dagNode[data-state=completed]{border-color:color-mix(in srgb, var(--dsw-alias-state-success-primary) 48%, var(--dsw-alias-border-l2))}.aYQbCq_dagNode[data-state=blocked]{border-color:color-mix(in srgb, var(--dsw-alias-state-warn-primary) 52%, var(--dsw-alias-border-l2))}.aYQbCq_dagNode[data-state=failed]{border-color:color-mix(in srgb, var(--dsw-alias-state-error-primary) 56%, var(--dsw-alias-border-l2))}.aYQbCq_dagNode[data-verdict-stale=true]{border-style:dashed;border-color:color-mix(in srgb, var(--dsw-alias-state-warn-primary) 62%, var(--dsw-alias-border-l2))}.aYQbCq_dagNode[data-verdict-stale=true] .aYQbCq_dagNodeHead{color:var(--dsw-alias-state-warn-primary)}.aYQbCq_dagNodeHead{color:var(--dsw-alias-label-primary);align-items:center;gap:4px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:9.5px;font-weight:700;display:flex}.aYQbCq_dagNodeDot{background:var(--dsw-alias-border-l3);border-radius:1.5px;flex:none;width:5px;height:5px}.aYQbCq_dagNode[data-state=running] .aYQbCq_dagNodeDot{background:var(--dsw-alias-state-business-primary)}.aYQbCq_dagNode[data-state=running] .aYQbCq_dagNodeHead{padding-right:12px}.aYQbCq_dagRunningState{width:9px;height:9px;color:var(--dsw-alias-state-business-primary);pointer-events:none;justify-content:center;align-items:center;display:inline-flex;position:absolute;top:4px;right:5px}.aYQbCq_dagRunningState .aYQbCq_workGlyph{width:9px;height:9px}.aYQbCq_dagNode[data-state=blocked] .aYQbCq_dagNodeDot{background:var(--dsw-alias-state-warn-primary)}.aYQbCq_dagNode[data-state=completed] .aYQbCq_dagNodeDot{background:var(--dsw-alias-state-success-primary)}.aYQbCq_dagNode[data-state=failed] .aYQbCq_dagNodeDot{background:var(--dsw-alias-state-error-primary)}.aYQbCq_dagNodeLabel{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;font-size:8.5px;line-height:11px;overflow:hidden}.aYQbCq_taskDetail{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-module-platform);border-radius:9px;flex-direction:column;gap:3px;min-width:0;padding:7px 9px;display:flex}.aYQbCq_taskDetailHead{align-items:center;gap:6px;min-width:0;display:flex}.aYQbCq_taskDetailId{color:var(--dsw-alias-state-business-primary);flex:none;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:10px;font-weight:700}.aYQbCq_taskDetailSubject{min-width:0;color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;font-size:11px;font-weight:600;line-height:16px;overflow:hidden}.aYQbCq_taskDetailBadge{background:var(--dsw-alias-button-ghost-active-fill);color:var(--dsw-alias-label-secondary);border-radius:4px;flex:none;padding:0 5px;font-size:8.5px;font-weight:600;line-height:14px}.aYQbCq_taskDetailBadge[data-state=running]{background:var(--dsw-alias-state-business-primary);color:var(--dsw-alias-label-primary-inverted)}.aYQbCq_taskDetailBadge[data-state=blocked]{background:var(--dsw-alias-state-warn-primary);color:var(--dsw-alias-label-primary-inverted)}.aYQbCq_taskDetailBadge[data-state=completed]{background:var(--dsw-alias-state-success-primary);color:var(--dsw-alias-label-primary-inverted)}.aYQbCq_taskDetailBadge[data-state=failed]{background:var(--dsw-alias-state-error-primary);color:var(--dsw-alias-label-primary-inverted)}.aYQbCq_taskDetailLine,.aYQbCq_taskDetailMeta{color:var(--dsw-alias-label-secondary);font-size:9.5px;line-height:14px}.aYQbCq_taskDetailMeta{color:var(--dsw-alias-label-tertiary)}.aYQbCq_emptyHint{color:var(--dsw-alias-label-tertiary);padding:10px 12px;font-size:11px;line-height:16px}.aYQbCq_planEditor{border:1px solid color-mix(in srgb, var(--dsw-alias-state-business-primary) 30%, var(--dsw-alias-border-l2));background:color-mix(in srgb, var(--dsw-alias-bg-module-platform) 94%, var(--dsw-alias-state-business-primary));box-shadow:inset 0 1px 0 color-mix(in srgb, var(--dsw-alias-label-primary) 5%, transparent);border-radius:10px;flex-direction:column;gap:12px;margin:0 10px 12px;padding:12px;display:flex}.aYQbCq_planHeader>span{justify-content:space-between;align-items:center;gap:8px;display:flex}.aYQbCq_planHeader>span>span{flex-direction:column;gap:2px;min-width:0;display:flex}.aYQbCq_planHeader strong{color:var(--dsw-alias-label-primary);font-size:12px}.aYQbCq_planHeader small{color:var(--dsw-alias-label-secondary);font-size:9px;font-weight:500;line-height:13px}.aYQbCq_planHeader em{background:var(--dsw-alias-state-business-primary);color:var(--dsw-alias-label-primary-inverted);border-radius:999px;flex:none;padding:1px 7px;font-size:9px;font-style:normal;line-height:16px}.aYQbCq_planHeader p{color:var(--dsw-alias-label-secondary);margin:5px 0 0;font-size:10px;line-height:15px}.aYQbCq_planFlow{grid-template-columns:repeat(3,minmax(0,1fr));margin:0;padding:0;list-style:none;display:grid}.aYQbCq_planFlow li{min-width:0;color:var(--dsw-alias-label-tertiary);align-items:center;gap:5px;font-size:9px;font-weight:600;line-height:14px;display:flex;position:relative}.aYQbCq_planFlow li:not(:last-child):after{background:var(--dsw-alias-border-l2);content:\"\";flex:1;min-width:8px;height:1px;margin-right:5px}.aYQbCq_planFlow li>span{border:1px solid var(--dsw-alias-border-l2);border-radius:50%;flex:none;place-items:center;width:18px;height:18px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:9px;display:grid}.aYQbCq_planFlow li[data-active]{color:var(--dsw-alias-state-business-primary)}.aYQbCq_planFlow li[data-active]>span{border-color:var(--dsw-alias-state-business-primary);background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 12%, transparent)}.aYQbCq_planSection{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-module-platform);border-radius:8px;overflow:hidden}.aYQbCq_planSectionToggle,.aYQbCq_planCardHeader{box-sizing:border-box;width:100%;color:var(--dsw-alias-label-primary);cursor:pointer;text-align:left;background:0 0;border:0}.aYQbCq_planSectionToggle{justify-content:space-between;align-items:center;gap:8px;min-height:42px;padding:7px 9px;display:flex}.aYQbCq_planSectionToggle:hover,.aYQbCq_planCardHeader:hover{background:color-mix(in srgb, var(--dsw-alias-button-ghost-active-fill) 46%, transparent)}.aYQbCq_planSectionToggle>span{align-items:baseline;gap:7px;min-width:0;display:flex}.aYQbCq_planSectionToggle strong{font-size:10.5px}.aYQbCq_planSectionToggle small{color:var(--dsw-alias-label-tertiary);font-size:9px}.aYQbCq_planList{border-top:1px solid var(--dsw-alias-border-l2);flex-direction:column;gap:0;display:flex}.aYQbCq_planEmpty{color:var(--dsw-alias-label-tertiary);text-align:center;margin:0;padding:12px;font-size:10px}.aYQbCq_planCard{background:0 0;border:0;border-radius:0;min-width:0;margin:0;padding:0;display:block;position:relative}.aYQbCq_planCard+.aYQbCq_planCard{border-top:1px solid var(--dsw-alias-border-l2)}.aYQbCq_planCard[data-open=true]{background:color-mix(in srgb, var(--dsw-alias-bg-base) 62%, transparent)}.aYQbCq_planCardHeader{grid-template-columns:minmax(80px,.9fr) minmax(72px,1.15fr) auto 12px;align-items:center;gap:7px;min-height:40px;padding:6px 9px;display:grid}.aYQbCq_planCardIdentity{flex-direction:column;gap:1px;min-width:0;display:flex}.aYQbCq_planCardIdentity strong,.aYQbCq_planTaskSummary{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;font-size:10px;font-weight:650;line-height:14px;overflow:hidden}.aYQbCq_planCardIdentity>span,.aYQbCq_planCardMeta{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;font-size:8.5px;line-height:12px;overflow:hidden}.aYQbCq_planTaskId{background:var(--dsw-alias-button-ghost-active-fill);width:max-content;color:var(--dsw-alias-label-secondary);border-radius:4px;padding:1px 5px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:8.5px;font-weight:700;line-height:14px}.aYQbCq_planDirty{background:color-mix(in srgb, var(--dsw-alias-state-warn-primary) 13%, transparent);color:var(--dsw-alias-state-warn-primary);border-radius:999px;justify-self:end;padding:1px 5px;font-size:8px;font-style:normal;font-weight:650;line-height:14px}.aYQbCq_planChevron{color:var(--dsw-alias-label-tertiary);flex:none;transition:transform .18s cubic-bezier(.2,.7,.2,1)}.aYQbCq_planChevron[data-open=true]{transform:rotate(90deg)}.aYQbCq_planCardBody{flex-direction:column;gap:8px;padding:0 9px 9px;display:flex}.aYQbCq_planCardBody fieldset{border:0;flex-direction:column;gap:7px;min-width:0;margin:0;padding:0;display:flex}.aYQbCq_planCardBody label,.aYQbCq_planNewTask label{min-width:0;color:var(--dsw-alias-label-tertiary);flex-direction:column;flex:1;gap:4px;font-size:9px;display:flex}.aYQbCq_planCardBody label small{color:var(--dsw-alias-label-tertiary);font-size:8px;line-height:11px}.aYQbCq_planCard input,.aYQbCq_planCard textarea,.aYQbCq_planCard select,.aYQbCq_planNewTask input{box-sizing:border-box;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base);width:100%;min-width:0;color:var(--dsw-alias-label-primary);font:inherit;border-radius:6px;outline:none;font-size:10.5px;line-height:16px;transition:border-color .16s,box-shadow .16s}.aYQbCq_planCard input,.aYQbCq_planCard select,.aYQbCq_planNewTask input{min-height:32px;padding:6px 8px}.aYQbCq_planCard textarea{resize:vertical;min-height:58px;padding:7px 8px}.aYQbCq_planCard input:focus-visible,.aYQbCq_planCard textarea:focus-visible,.aYQbCq_planCard select:focus-visible,.aYQbCq_planNewTask input:focus-visible{border-color:var(--dsw-alias-state-business-primary);box-shadow:0 0 0 2px color-mix(in srgb, var(--dsw-alias-state-business-primary) 16%, transparent)}.aYQbCq_planGrid{grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:6px;display:grid}.aYQbCq_planModelPicker{grid-template-columns:minmax(0,1fr);gap:5px;display:grid}.aYQbCq_planModelMenu{width:100%;display:flex}.aYQbCq_planModelTrigger{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base);width:100%;min-height:38px;color:var(--dsw-alias-label-primary);cursor:pointer;text-align:left;border-radius:7px;justify-content:space-between;align-items:center;gap:8px;padding:7px 9px;transition:border-color .16s,background-color .16s,transform .12s;display:flex}.aYQbCq_planModelTrigger:hover:not(:disabled){border-color:var(--dsw-alias-border-l3);background:var(--dsw-alias-interactive-bg-hover)}.aYQbCq_planModelTrigger:active:not(:disabled){transform:translateY(1px)}.aYQbCq_planModelTrigger:focus-visible{border-color:var(--dsw-alias-state-business-primary);outline:2px solid color-mix(in srgb, var(--dsw-alias-state-business-primary) 16%, transparent);outline-offset:1px}.aYQbCq_planModelTrigger:disabled{cursor:wait;opacity:.64}.aYQbCq_planModelTriggerCopy{align-items:baseline;gap:6px;min-width:0;display:flex}.aYQbCq_planModelTriggerCopy strong,.aYQbCq_planModelTriggerCopy span{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.aYQbCq_planModelTriggerCopy strong{color:var(--dsw-alias-label-primary);font-size:10px;font-weight:650;line-height:15px}.aYQbCq_planModelTriggerCopy span{color:var(--dsw-alias-label-tertiary);font-size:9px;line-height:14px}.aYQbCq_planModelMenuRow{grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:8px;width:100%;min-width:0;display:grid}.aYQbCq_planModelMenuRow>span:first-child{color:var(--dsw-alias-label-primary)}.aYQbCq_planModelMenuRow strong{color:var(--dsw-alias-label-tertiary);text-align:right;text-overflow:ellipsis;white-space:nowrap;font-weight:450;overflow:hidden}.aYQbCq_planModelMenuBack{align-items:center;gap:7px;display:inline-flex}.aYQbCq_planModelMenuBack svg{transform:rotate(180deg)}.aYQbCq_planModelEffortRow{flex-direction:column;align-items:flex-start;min-width:0;display:flex}.aYQbCq_planModelEffortRow small{width:100%;color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;font-size:10px;line-height:14px;overflow:hidden}.aYQbCq_planModelHint{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;font-size:8.5px;line-height:12px;overflow:hidden}.aYQbCq_planModelNotice{background:color-mix(in srgb, var(--dsw-alias-state-warn-primary) 9%, transparent);color:var(--dsw-alias-label-secondary);border-radius:6px;grid-column:1/-1;justify-content:space-between;align-items:center;gap:8px;padding:6px 7px;font-size:8.5px;line-height:12px;display:flex}.aYQbCq_planModelNotice button{color:var(--dsw-alias-state-business-primary);cursor:pointer;font:inherit;background:0 0;border:0;flex:none;padding:2px 6px;font-weight:650}.aYQbCq_planActions,.aYQbCq_planApproveRow,.aYQbCq_planNewTask,.aYQbCq_planConfirm,.aYQbCq_planApproveActions,.aYQbCq_planSecondaryActions{align-items:center;gap:7px;display:flex}.aYQbCq_planReviewActions{grid-template-columns:minmax(0,1fr);gap:6px;width:100%;display:grid}.aYQbCq_planSecondaryActions{grid-template-columns:minmax(0,1fr) auto;display:grid}.aYQbCq_planActions{justify-content:flex-end}.aYQbCq_planActions button,.aYQbCq_planNewTask button,.aYQbCq_planApproveRow button,.aYQbCq_planConfirm button{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-button-ghost-active-fill);min-height:30px;color:var(--dsw-alias-label-primary);cursor:pointer;border-radius:6px;flex:none;padding:5px 10px;font-size:9.5px;font-weight:600;transition:background .16s,border-color .16s,transform .16s}.aYQbCq_planActions button:hover:not(:disabled),.aYQbCq_planNewTask button:hover:not(:disabled),.aYQbCq_planApproveRow button:hover:not(:disabled),.aYQbCq_planConfirm button:hover:not(:disabled){border-color:var(--dsw-alias-label-tertiary)}.aYQbCq_planActions button:active:not(:disabled),.aYQbCq_planNewTask button:active:not(:disabled),.aYQbCq_planApproveRow button:active:not(:disabled),.aYQbCq_planConfirm button:active:not(:disabled){transform:scale(.98)}.aYQbCq_planActions button[data-danger],.aYQbCq_planConfirm button[data-danger]{color:var(--dsw-alias-state-error-primary)}.aYQbCq_planFeedback{min-width:0;color:var(--dsw-alias-label-secondary);flex:1;align-items:center;gap:5px;font-size:9px;line-height:13px;animation:.18s ease-out aYQbCq_plan-feedback-in;display:inline-flex}.aYQbCq_planFeedback[data-tone=success]{color:var(--dsw-alias-state-success-primary)}.aYQbCq_planFeedback[data-tone=error]{color:var(--dsw-alias-state-error-primary)}.aYQbCq_planFeedback>span{border:1px solid;border-radius:50%;flex:none;place-items:center;width:15px;height:15px;display:grid}.aYQbCq_planFeedback svg{width:11px;height:11px}@keyframes aYQbCq_plan-feedback-in{0%{opacity:0;transform:translateY(-2px)}to{opacity:1;transform:translateY(0)}}.aYQbCq_planConfirm{border:1px solid color-mix(in srgb, var(--dsw-alias-state-error-primary) 30%, var(--dsw-alias-border-l2));background:color-mix(in srgb, var(--dsw-alias-state-error-primary) 7%, transparent);border-radius:7px;flex-wrap:wrap;justify-content:flex-end;padding:7px}.aYQbCq_planConfirm>span{min-width:140px;color:var(--dsw-alias-label-secondary);flex:1;font-size:9px;line-height:13px}.aYQbCq_planNewTask{align-items:flex-end}.aYQbCq_planNewTask label{gap:4px}.aYQbCq_planNewTask label>span{line-height:13px}.aYQbCq_planApproveRow{z-index:1;border:1px solid var(--dsw-alias-border-l2);background:color-mix(in srgb, var(--dsw-alias-bg-module-platform) 94%, transparent);min-height:50px;box-shadow:0 -5px 16px color-mix(in srgb, var(--dsw-alias-bg-base) 35%, transparent);backdrop-filter:blur(8px);border-radius:8px;flex-direction:column;justify-content:flex-end;align-items:stretch;margin:0 -4px -4px;padding:8px;position:sticky;bottom:0}.aYQbCq_planApproveRow[data-armed=true]{border-color:color-mix(in srgb, var(--dsw-alias-state-business-primary) 45%, var(--dsw-alias-border-l2))}.aYQbCq_planApproveRow[data-discard=true]{border-color:color-mix(in srgb, var(--dsw-alias-state-error-primary) 45%, var(--dsw-alias-border-l2))}.aYQbCq_planApproveCopy{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.aYQbCq_planApproveCopy strong{color:var(--dsw-alias-label-primary);font-size:9.5px;line-height:13px}.aYQbCq_planApproveCopy small{color:var(--dsw-alias-label-tertiary);font-size:8.5px;line-height:12px}.aYQbCq_planApproveRow button{background:var(--dsw-alias-state-business-primary);min-height:32px;color:var(--dsw-alias-label-primary-inverted);padding-inline:13px}.aYQbCq_planReviewActions>button[data-plan-approve]{width:100%}.aYQbCq_planApproveActions>button:first-child{background:var(--dsw-alias-button-ghost-active-fill);color:var(--dsw-alias-label-primary)}.aYQbCq_planSecondaryActions>button,.aYQbCq_planApproveActions>button[data-danger]{border-color:var(--dsw-alias-border-l2);background:var(--dsw-alias-button-ghost-active-fill);color:var(--dsw-alias-label-primary)}.aYQbCq_planSecondaryActions>button[data-danger],.aYQbCq_planApproveActions>button[data-danger]{color:var(--dsw-alias-state-error-primary)}.aYQbCq_planSectionToggle:focus-visible,.aYQbCq_planCardHeader:focus-visible,.aYQbCq_planActions button:focus-visible,.aYQbCq_planNewTask button:focus-visible,.aYQbCq_planApproveRow button:focus-visible,.aYQbCq_planConfirm button:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:-2px}.aYQbCq_planActions button:disabled,.aYQbCq_planNewTask button:disabled,.aYQbCq_planApproveRow button:disabled{cursor:default;opacity:.55}.aYQbCq_historicPill{background:var(--dsw-alias-button-ghost-active-fill);color:var(--dsw-alias-label-tertiary);border-radius:4px;flex:none;margin-left:auto;padding:1px 7px;font-size:9.5px;font-weight:600;line-height:15px}.aYQbCq_members{flex-direction:column;gap:3px;display:flex}.aYQbCq_archiveLabel{color:var(--dsw-alias-label-tertiary);padding:5px 14px 0;font-size:9.5px;font-weight:600;line-height:14px;display:block}@media (prefers-reduced-motion:reduce){.aYQbCq_panel,.aYQbCq_badge,.aYQbCq_badgeDot,.aYQbCq_panelDot,.aYQbCq_workGlyph rect,.aYQbCq_stateArt,.aYQbCq_memberAvatar[data-unread=true]:after,.aYQbCq_planChevron,.aYQbCq_planFeedback,.aYQbCq_planActions button,.aYQbCq_planNewTask button,.aYQbCq_planApproveRow button,.aYQbCq_planConfirm button,.aYQbCq_planCard input,.aYQbCq_planCard textarea,.aYQbCq_planCard select,.aYQbCq_planNewTask input{transition:none;animation:none}}@media (width<=960px){html[data-agent-teams-panel-open] [data-phase=active]{padding-right:0}}@media (width<=640px){.aYQbCq_badge{top:56px;right:10px}.aYQbCq_teamStats span[data-stat=messages]{display:none}.aYQbCq_captainNode{grid-template-columns:48px minmax(0,1fr)}.aYQbCq_captainState{display:none}.aYQbCq_delegationTree{margin-left:12px;padding-left:15px}.aYQbCq_memberBranch{width:15px}.aYQbCq_assignmentLine{padding-left:53px}.aYQbCq_planFlow li{gap:4px;font-size:8px}.aYQbCq_planFlow li:not(:last-child):after{margin-right:3px}.aYQbCq_planCardHeader{grid-template-columns:auto minmax(0,1fr) auto}.aYQbCq_planCardHeader .aYQbCq_planCardMeta{display:none}.aYQbCq_planGrid,.aYQbCq_planModelPicker{grid-template-columns:minmax(0,1fr)}.aYQbCq_planNewTask,.aYQbCq_planApproveRow{flex-direction:column;align-items:stretch}.aYQbCq_planNewTask button,.aYQbCq_planApproveRow>button,.aYQbCq_planApproveActions,.aYQbCq_planReviewActions{width:100%}.aYQbCq_planApproveActions button,.aYQbCq_planReviewActions button,.aYQbCq_planSecondaryActions button{flex:1}}@container aYQbCq_agent-team (width<=360px){.aYQbCq_planEditor{margin-inline:0;padding-inline:10px}.aYQbCq_planHeader>span{align-items:flex-start}.aYQbCq_planFlow li{gap:3px;font-size:7.5px}.aYQbCq_planFlow li:not(:last-child):after{min-width:4px;margin-right:2px}.aYQbCq_planSecondaryActions,.aYQbCq_planApproveActions{grid-template-columns:minmax(0,1fr);width:100%;display:grid}.aYQbCq_planSecondaryActions button,.aYQbCq_planApproveActions button{width:100%}}.aYQbCq_dagOwner{text-overflow:ellipsis;max-width:64px;margin-left:auto;font-size:9px;font-weight:400;overflow:hidden}.aYQbCq_team[data-workspace-team]{--workspace-surface:var(--dsw-alias-bg-layer-1);--workspace-line:color-mix(in srgb, var(--dsw-alias-border-l2) 75%, transparent);--workspace-shadow:0 3px 14px color-mix(in srgb, var(--dsw-alias-label-primary) 3%, transparent);background:0 0;border:0;gap:14px;padding:0;container:none}.aYQbCq_team[data-workspace-team] .aYQbCq_teamHead{flex-wrap:wrap;gap:8px;padding:0 2px 2px}.aYQbCq_team[data-workspace-team] .aYQbCq_teamName{flex-basis:160px;font-size:14px;line-height:1.5}.aYQbCq_team[data-workspace-team] .aYQbCq_teamStats{flex-wrap:wrap;font-size:11px}.aYQbCq_team[data-workspace-team] .aYQbCq_teamStopButton{border-radius:9px;width:32px;height:32px}.aYQbCq_team[data-workspace-team] .aYQbCq_delegationSection,.aYQbCq_team[data-workspace-team] .aYQbCq_dependencySection,.aYQbCq_completionCard,.aYQbCq_inboxCard{border:1px solid var(--workspace-line);background:var(--workspace-surface);min-width:0;box-shadow:var(--workspace-shadow);box-sizing:border-box;border-radius:18px;margin:0;padding:18px}.aYQbCq_team[data-workspace-team] .aYQbCq_captainNode{background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 4%, var(--dsw-alias-bg-module-platform));border-color:var(--workspace-line);border-radius:12px;grid-template-columns:44px minmax(0,1fr);gap:8px;padding:10px}.aYQbCq_team[data-workspace-team] .aYQbCq_captainState{grid-column:2;justify-self:start;font-size:11px}.aYQbCq_team[data-workspace-team] .aYQbCq_captainName{font-size:14px}.aYQbCq_team[data-workspace-team] .aYQbCq_captainRole{font-size:11px}.aYQbCq_team[data-workspace-team] .aYQbCq_captainSummary{white-space:normal;font-size:12px;line-height:1.6}.aYQbCq_team[data-workspace-team] .aYQbCq_progressOverview{gap:9px;margin:16px 0}.aYQbCq_team[data-workspace-team] .aYQbCq_progressSegments{gap:4px}.aYQbCq_team[data-workspace-team] .aYQbCq_progressSegments>span{border-radius:4px;height:6px}.aYQbCq_team[data-workspace-team] .aYQbCq_progressLegend{gap:8px 12px;font-size:11px}.aYQbCq_team[data-workspace-team] .aYQbCq_progressSummary{font-size:11px;line-height:1.6}.aYQbCq_team[data-workspace-team] .aYQbCq_progressSummary>span:last-child{white-space:normal}.aYQbCq_team[data-workspace-team] .aYQbCq_membersToggle{background:var(--dsw-alias-bg-module-platform);border-radius:9px;padding:10px;font-size:11px}.aYQbCq_team[data-workspace-team] .aYQbCq_memberBlock{padding-top:14px;padding-bottom:8px}.aYQbCq_team[data-workspace-team] .aYQbCq_memberRow{border-radius:9px}.aYQbCq_team[data-workspace-team] .aYQbCq_memberLine{flex-wrap:wrap;gap:4px 6px}.aYQbCq_team[data-workspace-team] .aYQbCq_memberName{font-size:13px}.aYQbCq_team[data-workspace-team] .aYQbCq_memberRole,.aYQbCq_team[data-workspace-team] .aYQbCq_memberState,.aYQbCq_team[data-workspace-team] .aYQbCq_memberCount{font-size:11px}.aYQbCq_team[data-workspace-team] .aYQbCq_memberRole{background:var(--dsw-alias-bg-module-platform);border-radius:5px;padding:1px 5px}.aYQbCq_team[data-workspace-team] .aYQbCq_memberStatusLine{white-space:normal;font-size:12px;line-height:1.6}.aYQbCq_team[data-workspace-team] .aYQbCq_assignmentLine{flex-wrap:wrap;row-gap:5px}.aYQbCq_team[data-workspace-team] .aYQbCq_assignmentLabel{font-size:10px}.aYQbCq_team[data-workspace-team] .aYQbCq_assignmentChip{border-radius:5px;font-size:10px;line-height:18px}.aYQbCq_team[data-workspace-team] .aYQbCq_memberBlock[data-selected-member] .aYQbCq_memberRow{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:3px}.aYQbCq_team[data-workspace-team] .aYQbCq_sectionHead{flex-wrap:wrap;gap:8px;margin-bottom:18px}.aYQbCq_team[data-workspace-team] .aYQbCq_sectionToggleTitle{font-size:12px}.aYQbCq_team[data-workspace-team] .aYQbCq_sectionHint{white-space:normal;font-size:11px;line-height:1.6}.aYQbCq_team[data-workspace-team] .aYQbCq_dagViewport{padding:4px 2px 14px}.aYQbCq_team[data-workspace-team] .aYQbCq_dagNode{background:var(--workspace-surface);border-radius:11px;padding:10px 11px}.aYQbCq_team[data-workspace-team] .aYQbCq_dagNodeHead{margin-bottom:6px;font-size:11px}.aYQbCq_team[data-workspace-team] .aYQbCq_dagNodeLabel{white-space:normal;-webkit-line-clamp:2;letter-spacing:0;-webkit-box-orient:vertical;font-size:12px;line-height:1.4;display:-webkit-box;overflow:hidden}.aYQbCq_team[data-workspace-team] .aYQbCq_dagOwner{white-space:nowrap;max-width:105px;font-size:10px}.aYQbCq_team[data-workspace-team] .aYQbCq_taskDetail{border-radius:11px;margin-top:14px;padding:14px}.aYQbCq_team[data-workspace-team] .aYQbCq_taskDetailSubject{white-space:normal;font-size:13px;line-height:1.6}.aYQbCq_team[data-workspace-team] .aYQbCq_taskDetailLine,.aYQbCq_team[data-workspace-team] .aYQbCq_taskDetailMeta{font-size:12px;line-height:1.6}.aYQbCq_team[data-workspace-team] .aYQbCq_planEditor{background:var(--workspace-surface);border-color:var(--workspace-line);border-radius:18px;margin:0;padding:18px}.aYQbCq_team[data-workspace-team] .aYQbCq_planApproveRow{position:static}.aYQbCq_workspaceSummary{grid-template-columns:minmax(0,1fr);gap:14px;min-width:0;display:grid}.aYQbCq_completionCard h3,.aYQbCq_inboxCard h3{color:var(--dsw-alias-label-secondary);margin:0;font-size:12px;font-weight:600;line-height:1.6}.aYQbCq_completionBody{flex-wrap:wrap;align-items:center;gap:20px;margin-top:16px;display:flex}.aYQbCq_completionRing{flex:none;width:132px;height:132px;position:relative}.aYQbCq_completionRing svg{width:100%;height:100%;transform:rotate(-90deg)}.aYQbCq_completionRing circle{fill:none;stroke-width:7px}.aYQbCq_ringTrack{stroke:var(--dsw-alias-border-l2)}.aYQbCq_ringValue{stroke:var(--dsw-alias-state-business-primary)}.aYQbCq_completionRing>span{color:var(--dsw-alias-label-secondary);flex-direction:column;justify-content:center;align-items:center;gap:5px;font-size:11px;display:flex;position:absolute;inset:0}.aYQbCq_completionRing strong{color:var(--dsw-alias-label-primary);letter-spacing:-.7px;font-variant-numeric:tabular-nums;font-size:26px;font-weight:600;line-height:1.2}.aYQbCq_completionRing small{font-size:18px;font-weight:450}.aYQbCq_completionTasks{flex:200px;min-width:0;max-height:216px;margin:0;padding:2px;list-style:none;overflow:auto}.aYQbCq_completionTasks li{border-bottom:1px solid var(--workspace-line);grid-template-columns:18px auto minmax(0,1fr) auto;align-items:center;gap:8px;padding:7px 0;font-size:11px;display:grid}.aYQbCq_completionTasks li:last-child{border:0}.aYQbCq_completionDot{background:var(--dsw-alias-bg-module-platform);width:16px;height:16px;color:var(--dsw-alias-label-secondary);border-radius:50%;place-items:center;display:grid}.aYQbCq_completionTasks li[data-state=completed] .aYQbCq_completionDot{background:var(--dsw-alias-state-business-primary);color:var(--dsw-alias-label-primary-inverted)}.aYQbCq_completionTasks li[data-state=failed] .aYQbCq_completionDot{background:var(--dsw-alias-state-error-primary);color:var(--dsw-alias-label-primary-inverted)}.aYQbCq_completionTaskId{text-overflow:ellipsis;white-space:nowrap;max-width:6em;color:var(--dsw-alias-label-secondary);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;overflow:hidden}.aYQbCq_completionTaskSubject{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.aYQbCq_completionTaskStatus{color:var(--dsw-alias-label-secondary);font-size:10px}.aYQbCq_completionTasks li[data-verdict-stale] .aYQbCq_completionDot{background:var(--dsw-alias-state-warn-primary);color:var(--dsw-alias-label-primary)}.aYQbCq_completionTasks li[data-verdict-stale] .aYQbCq_completionTaskStatus{font-weight:600}.aYQbCq_completionTasks:focus-visible,.aYQbCq_inboxMessages:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:3px;border-radius:4px}.aYQbCq_inboxCard>header{flex-wrap:wrap;align-items:baseline;gap:6px 12px;display:flex}.aYQbCq_inboxCard>header>span{color:var(--dsw-alias-label-secondary);font-size:10px}.aYQbCq_inboxMessages{max-height:260px;margin:14px 0 0;padding:0;list-style:none;overflow:auto}.aYQbCq_inboxMessages li{align-items:start;gap:9px;margin:0 0 12px;display:flex}.aYQbCq_inboxMessages img,.aYQbCq_inboxInitial{object-fit:contain;flex:none;width:30px;height:30px}.aYQbCq_inboxInitial{background:var(--dsw-alias-bg-module-platform);border-radius:9px;place-items:center;font-size:12px;display:grid}.aYQbCq_inboxMessages li>div{flex:1;min-width:0}.aYQbCq_inboxMessages strong{overflow-wrap:anywhere;font-size:11px;font-weight:550}.aYQbCq_inboxMessages p{background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 6%, var(--dsw-alias-bg-module-platform));white-space:pre-wrap;overflow-wrap:anywhere;border-radius:0 10px 10px;margin:5px 0 0;padding:9px 11px;font-size:12px;line-height:1.6}.aYQbCq_summaryEmpty{color:var(--dsw-alias-label-secondary);margin:14px 0 0;font-size:12px;line-height:1.8}@container (width>=800px){.aYQbCq_team[data-workspace-team]{grid-template-columns:minmax(280px,.8fr) minmax(0,1.4fr);align-items:start;gap:16px;display:grid}.aYQbCq_team[data-workspace-team]>.aYQbCq_teamHead,.aYQbCq_team[data-workspace-team]>[data-staging-editor],.aYQbCq_workspaceSummary{grid-column:1/-1}.aYQbCq_workspaceSummary{grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:16px}.aYQbCq_team[data-workspace-team] .aYQbCq_dependencySection{align-self:stretch}.aYQbCq_team[data-workspace-team] .aYQbCq_dagCanvas[data-layout=parallel]{grid-template-columns:repeat(2,minmax(0,1fr))}}@container (width<=400px){.aYQbCq_team[data-workspace-team] .aYQbCq_delegationSection,.aYQbCq_team[data-workspace-team] .aYQbCq_dependencySection,.aYQbCq_completionCard,.aYQbCq_inboxCard{border-radius:14px;padding:12px}.aYQbCq_team[data-workspace-team] .aYQbCq_teamStats{gap:6px;font-size:10px}.aYQbCq_completionBody{justify-content:center}}.aYQbCq_progressSegments>span[data-state=claimed],.aYQbCq_dagNode[data-state=claimed] .aYQbCq_dagNodeDot{background:var(--dsw-alias-state-warn-primary)}.aYQbCq_progressLegend>span[data-state=claimed]{color:var(--dsw-alias-state-warn-primary)}.aYQbCq_dagNode[data-state=claimed]{border-color:var(--dsw-alias-state-warn-primary)}.aYQbCq_dagNode[data-state=claimed] .aYQbCq_dagNodeHead{padding-right:38px}.aYQbCq_dagClaimedState{color:var(--dsw-alias-state-warn-primary);font-size:8px;line-height:10px;position:absolute;top:4px;right:5px}.aYQbCq_assignmentChip[data-state=claimed],.aYQbCq_taskDetailBadge[data-state=claimed]{background:var(--dsw-alias-state-warn-primary);color:var(--dsw-alias-label-primary-inverted)}"; |
| 843 | const tagId$1 = "@nanmicoder/dsh-agent-teams/ActivityPanel.module.css"; |
| 844 | if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$1) + "]") === null) { |
| 845 | const tag = document.createElement("style"); |
| 846 | tag.dataset.plugin = "@nanmicoder/dsh-agent-teams"; |
| 847 | tag.dataset.pluginCss = tagId$1; |
| 848 | tag.textContent = css$1; |
| 849 | document.head.appendChild(tag); |
| 850 | } |
| 851 | var ActivityPanel_module_css_default = { |
| 852 | "agent-team": "aYQbCq_agent-team", |
| 853 | "agentTeamsBreathe": "aYQbCq_agentTeamsBreathe", |
| 854 | "agentTeamsDot": "aYQbCq_agentTeamsDot", |
| 855 | "agentTeamsFloat": "aYQbCq_agentTeamsFloat", |
| 856 | "agentTeamsPanelIn": "aYQbCq_agentTeamsPanelIn", |
| 857 | "agentTeamsPulse": "aYQbCq_agentTeamsPulse", |
| 858 | "agentTeamsThink": "aYQbCq_agentTeamsThink", |
| 859 | "agentTeamsUnreadPulse": "aYQbCq_agentTeamsUnreadPulse", |
| 860 | "archiveLabel": "aYQbCq_archiveLabel", |
| 861 | "assignmentChip": "aYQbCq_assignmentChip", |
| 862 | "assignmentLabel": "aYQbCq_assignmentLabel", |
| 863 | "assignmentLine": "aYQbCq_assignmentLine", |
| 864 | "assignmentTasks": "aYQbCq_assignmentTasks", |
| 865 | "badge": "aYQbCq_badge", |
| 866 | "badgeCount": "aYQbCq_badgeCount", |
| 867 | "badgeDot": "aYQbCq_badgeDot", |
| 868 | "captainAvatar": "aYQbCq_captainAvatar", |
| 869 | "captainInfo": "aYQbCq_captainInfo", |
| 870 | "captainLine": "aYQbCq_captainLine", |
| 871 | "captainName": "aYQbCq_captainName", |
| 872 | "captainNode": "aYQbCq_captainNode", |
| 873 | "captainRole": "aYQbCq_captainRole", |
| 874 | "captainState": "aYQbCq_captainState", |
| 875 | "captainSummary": "aYQbCq_captainSummary", |
| 876 | "chevron": "aYQbCq_chevron", |
| 877 | "completionBody": "aYQbCq_completionBody", |
| 878 | "completionCard": "aYQbCq_completionCard", |
| 879 | "completionDot": "aYQbCq_completionDot", |
| 880 | "completionRing": "aYQbCq_completionRing", |
| 881 | "completionTaskId": "aYQbCq_completionTaskId", |
| 882 | "completionTaskStatus": "aYQbCq_completionTaskStatus", |
| 883 | "completionTaskSubject": "aYQbCq_completionTaskSubject", |
| 884 | "completionTasks": "aYQbCq_completionTasks", |
| 885 | "dagCanvas": "aYQbCq_dagCanvas", |
| 886 | "dagClaimedState": "aYQbCq_dagClaimedState", |
| 887 | "dagEdges": "aYQbCq_dagEdges", |
| 888 | "dagNode": "aYQbCq_dagNode", |
| 889 | "dagNodeDot": "aYQbCq_dagNodeDot", |
| 890 | "dagNodeHead": "aYQbCq_dagNodeHead", |
| 891 | "dagNodeLabel": "aYQbCq_dagNodeLabel", |
| 892 | "dagOwner": "aYQbCq_dagOwner", |
| 893 | "dagRunningState": "aYQbCq_dagRunningState", |
| 894 | "dagViewport": "aYQbCq_dagViewport", |
| 895 | "delegationSection": "aYQbCq_delegationSection", |
| 896 | "delegationTree": "aYQbCq_delegationTree", |
| 897 | "dependencySection": "aYQbCq_dependencySection", |
| 898 | "emptyHint": "aYQbCq_emptyHint", |
| 899 | "historicPill": "aYQbCq_historicPill", |
| 900 | "iconButton": "aYQbCq_iconButton", |
| 901 | "inboxCard": "aYQbCq_inboxCard", |
| 902 | "inboxInitial": "aYQbCq_inboxInitial", |
| 903 | "inboxMessages": "aYQbCq_inboxMessages", |
| 904 | "leadAvatar": "aYQbCq_leadAvatar", |
| 905 | "memberArt": "aYQbCq_memberArt", |
| 906 | "memberAvatar": "aYQbCq_memberAvatar", |
| 907 | "memberBlock": "aYQbCq_memberBlock", |
| 908 | "memberBranch": "aYQbCq_memberBranch", |
| 909 | "memberCount": "aYQbCq_memberCount", |
| 910 | "memberInfo": "aYQbCq_memberInfo", |
| 911 | "memberInitial": "aYQbCq_memberInitial", |
| 912 | "memberLine": "aYQbCq_memberLine", |
| 913 | "memberModel": "aYQbCq_memberModel", |
| 914 | "memberName": "aYQbCq_memberName", |
| 915 | "memberRole": "aYQbCq_memberRole", |
| 916 | "memberRow": "aYQbCq_memberRow", |
| 917 | "memberState": "aYQbCq_memberState", |
| 918 | "memberStatusLine": "aYQbCq_memberStatusLine", |
| 919 | "members": "aYQbCq_members", |
| 920 | "membersToggle": "aYQbCq_membersToggle", |
| 921 | "panel": "aYQbCq_panel", |
| 922 | "panelControls": "aYQbCq_panelControls", |
| 923 | "panelDot": "aYQbCq_panelDot", |
| 924 | "panelHead": "aYQbCq_panelHead", |
| 925 | "panelTitle": "aYQbCq_panelTitle", |
| 926 | "plan-feedback-in": "aYQbCq_plan-feedback-in", |
| 927 | "planActions": "aYQbCq_planActions", |
| 928 | "planApproveActions": "aYQbCq_planApproveActions", |
| 929 | "planApproveCopy": "aYQbCq_planApproveCopy", |
| 930 | "planApproveRow": "aYQbCq_planApproveRow", |
| 931 | "planCard": "aYQbCq_planCard", |
| 932 | "planCardBody": "aYQbCq_planCardBody", |
| 933 | "planCardHeader": "aYQbCq_planCardHeader", |
| 934 | "planCardIdentity": "aYQbCq_planCardIdentity", |
| 935 | "planCardMeta": "aYQbCq_planCardMeta", |
| 936 | "planChevron": "aYQbCq_planChevron", |
| 937 | "planConfirm": "aYQbCq_planConfirm", |
| 938 | "planDirty": "aYQbCq_planDirty", |
| 939 | "planEditor": "aYQbCq_planEditor", |
| 940 | "planEmpty": "aYQbCq_planEmpty", |
| 941 | "planFeedback": "aYQbCq_planFeedback", |
| 942 | "planFlow": "aYQbCq_planFlow", |
| 943 | "planGrid": "aYQbCq_planGrid", |
| 944 | "planHeader": "aYQbCq_planHeader", |
| 945 | "planList": "aYQbCq_planList", |
| 946 | "planModelEffortRow": "aYQbCq_planModelEffortRow", |
| 947 | "planModelHint": "aYQbCq_planModelHint", |
| 948 | "planModelMenu": "aYQbCq_planModelMenu", |
| 949 | "planModelMenuBack": "aYQbCq_planModelMenuBack", |
| 950 | "planModelMenuRow": "aYQbCq_planModelMenuRow", |
| 951 | "planModelNotice": "aYQbCq_planModelNotice", |
| 952 | "planModelPicker": "aYQbCq_planModelPicker", |
| 953 | "planModelTrigger": "aYQbCq_planModelTrigger", |
| 954 | "planModelTriggerCopy": "aYQbCq_planModelTriggerCopy", |
| 955 | "planNewTask": "aYQbCq_planNewTask", |
| 956 | "planReviewActions": "aYQbCq_planReviewActions", |
| 957 | "planSecondaryActions": "aYQbCq_planSecondaryActions", |
| 958 | "planSection": "aYQbCq_planSection", |
| 959 | "planSectionToggle": "aYQbCq_planSectionToggle", |
| 960 | "planTaskId": "aYQbCq_planTaskId", |
| 961 | "planTaskSummary": "aYQbCq_planTaskSummary", |
| 962 | "progressEmpty": "aYQbCq_progressEmpty", |
| 963 | "progressLegend": "aYQbCq_progressLegend", |
| 964 | "progressOverview": "aYQbCq_progressOverview", |
| 965 | "progressSegments": "aYQbCq_progressSegments", |
| 966 | "progressSummary": "aYQbCq_progressSummary", |
| 967 | "progressSummaryDot": "aYQbCq_progressSummaryDot", |
| 968 | "progressTitle": "aYQbCq_progressTitle", |
| 969 | "resizeHandle": "aYQbCq_resizeHandle", |
| 970 | "ringTrack": "aYQbCq_ringTrack", |
| 971 | "ringValue": "aYQbCq_ringValue", |
| 972 | "sectionHead": "aYQbCq_sectionHead", |
| 973 | "sectionHint": "aYQbCq_sectionHint", |
| 974 | "sectionTitle": "aYQbCq_sectionTitle", |
| 975 | "sectionToggleTitle": "aYQbCq_sectionToggleTitle", |
| 976 | "stageLabel": "aYQbCq_stageLabel", |
| 977 | "stateArt": "aYQbCq_stateArt", |
| 978 | "stopModalActions": "aYQbCq_stopModalActions", |
| 979 | "stopModalError": "aYQbCq_stopModalError", |
| 980 | "summaryEmpty": "aYQbCq_summaryEmpty", |
| 981 | "taskDetail": "aYQbCq_taskDetail", |
| 982 | "taskDetailBadge": "aYQbCq_taskDetailBadge", |
| 983 | "taskDetailHead": "aYQbCq_taskDetailHead", |
| 984 | "taskDetailId": "aYQbCq_taskDetailId", |
| 985 | "taskDetailLine": "aYQbCq_taskDetailLine", |
| 986 | "taskDetailMeta": "aYQbCq_taskDetailMeta", |
| 987 | "taskDetailModel": "aYQbCq_taskDetailModel", |
| 988 | "taskDetailSubject": "aYQbCq_taskDetailSubject", |
| 989 | "taskEmpty": "aYQbCq_taskEmpty", |
| 990 | "taskId": "aYQbCq_taskId", |
| 991 | "team": "aYQbCq_team", |
| 992 | "teamHead": "aYQbCq_teamHead", |
| 993 | "teamName": "aYQbCq_teamName", |
| 994 | "teamStats": "aYQbCq_teamStats", |
| 995 | "teamStopButton": "aYQbCq_teamStopButton", |
| 996 | "teams": "aYQbCq_teams", |
| 997 | "unreadPill": "aYQbCq_unreadPill", |
| 998 | "workGlyph": "aYQbCq_workGlyph", |
| 999 | "workspaceSummary": "aYQbCq_workspaceSummary" |
| 1000 | }; |
| 1001 | //#endregion |
| 1002 | //#region lib/client/StagingPlanEditor.js |
| 1003 | /** |
| 1004 | * Editable pre-run roster and DAG review for staged AgentTeams plans. |
| 1005 | * |
| 1006 | * This leaf owns only transient form/disclosure state. Durable truth remains |
| 1007 | * on the host and returns through the ordinary activity polling snapshot. |
| 1008 | * @module dsh-agent-teams/client/staging-plan |
| 1009 | */ |
| 1010 | const PLAN_URL = "/plugins/dsh-agent-teams/plan"; |
| 1011 | function useDismissSuccess(feedback, setFeedback) { |
| 1012 | (0, react.useEffect)(() => { |
| 1013 | if (feedback?.tone !== "success") return; |
| 1014 | const timeout = window.setTimeout(() => { |
| 1015 | setFeedback(void 0); |
| 1016 | }, 3500); |
| 1017 | return () => { |
| 1018 | window.clearTimeout(timeout); |
| 1019 | }; |
| 1020 | }, [feedback, setFeedback]); |
| 1021 | } |
| 1022 | async function mutatePlan(payload) { |
| 1023 | const response = await fetch(PLAN_URL, { |
| 1024 | method: "POST", |
| 1025 | cache: "no-store", |
| 1026 | headers: { "content-type": "application/json" }, |
| 1027 | body: JSON.stringify(payload) |
| 1028 | }); |
| 1029 | if (response.ok) return; |
| 1030 | let message = `HTTP ${response.status}`; |
| 1031 | try { |
| 1032 | const body = await response.json(); |
| 1033 | if (typeof body.error === "string" && body.error.trim() !== "") message = body.error; |
| 1034 | } catch {} |
| 1035 | throw new Error(message); |
| 1036 | } |
| 1037 | function errorMessage(error) { |
| 1038 | return error instanceof Error ? error.message : String(error); |
| 1039 | } |
| 1040 | function DisclosureChevron({ open }) { |
| 1041 | return (0, react_jsx_runtime.jsx)("svg", { |
| 1042 | className: ActivityPanel_module_css_default.planChevron, |
| 1043 | "data-open": open, |
| 1044 | width: "12", |
| 1045 | height: "12", |
| 1046 | viewBox: "0 0 12 12", |
| 1047 | fill: "none", |
| 1048 | stroke: "currentColor", |
| 1049 | strokeWidth: "1.5", |
| 1050 | strokeLinecap: "round", |
| 1051 | "aria-hidden": true, |
| 1052 | children: (0, react_jsx_runtime.jsx)("path", { d: "M4 2.5 7.5 6 4 9.5" }) |
| 1053 | }); |
| 1054 | } |
| 1055 | function Feedback({ value }) { |
| 1056 | if (value === void 0) return null; |
| 1057 | return (0, react_jsx_runtime.jsxs)("span", { |
| 1058 | className: ActivityPanel_module_css_default.planFeedback, |
| 1059 | "data-tone": value.tone, |
| 1060 | role: value.tone === "error" ? "alert" : "status", |
| 1061 | "aria-live": value.tone === "error" ? "assertive" : "polite", |
| 1062 | children: [(0, react_jsx_runtime.jsx)("span", { |
| 1063 | "aria-hidden": true, |
| 1064 | children: value.tone === "success" ? (0, react_jsx_runtime.jsx)("svg", { |
| 1065 | viewBox: "0 0 12 12", |
| 1066 | fill: "none", |
| 1067 | stroke: "currentColor", |
| 1068 | strokeWidth: "1.8", |
| 1069 | children: (0, react_jsx_runtime.jsx)("path", { d: "m2.5 6.2 2.2 2.2 4.8-5" }) |
| 1070 | }) : (0, react_jsx_runtime.jsx)("svg", { |
| 1071 | viewBox: "0 0 12 12", |
| 1072 | fill: "none", |
| 1073 | stroke: "currentColor", |
| 1074 | strokeWidth: "1.8", |
| 1075 | children: (0, react_jsx_runtime.jsx)("path", { d: "M6 2.3v4.1M6 8.8v.1" }) |
| 1076 | }) |
| 1077 | }), value.message] |
| 1078 | }); |
| 1079 | } |
| 1080 | function routeKey(provider, model) { |
| 1081 | return JSON.stringify([provider, model]); |
| 1082 | } |
| 1083 | const MODEL_MENU_OPEN_MODELS = "open:models"; |
| 1084 | const MODEL_MENU_OPEN_EFFORT = "open:effort"; |
| 1085 | const MODEL_MENU_BACK = "navigate:back"; |
| 1086 | const MODEL_MENU_RETRY = "action:retry"; |
| 1087 | const MODEL_MENU_DEFAULT_EFFORT = "effort:default"; |
| 1088 | function modelMenuId(provider, model) { |
| 1089 | return `model:${routeKey(provider, model)}`; |
| 1090 | } |
| 1091 | function effortMenuId(effort) { |
| 1092 | return `effort:${effort}`; |
| 1093 | } |
| 1094 | /** |
| 1095 | * Thin staged-plan adapter over the official model directory. It deliberately |
| 1096 | * reads only catalog metadata: choosing a member route must not change the |
| 1097 | * captain session's composer model. |
| 1098 | */ |
| 1099 | function StagedModelPicker({ directory, provider, model, reasoningEffort, busy, onChange, t }) { |
| 1100 | const state = (0, react.useSyncExternalStore)(directory.store.subscribe, directory.store.getSnapshot); |
| 1101 | const [open, setOpen] = (0, react.useState)(false); |
| 1102 | const [pane, setPane] = (0, react.useState)("root"); |
| 1103 | const catalogRoutes = state.groups.flatMap((group) => group.models.map((candidate) => ({ |
| 1104 | key: routeKey(group.id, candidate.id), |
| 1105 | provider: group.id, |
| 1106 | providerName: group.name, |
| 1107 | model: candidate |
| 1108 | }))); |
| 1109 | const selectedKey = routeKey(provider, model); |
| 1110 | const selected = catalogRoutes.find((candidate) => candidate.key === selectedKey); |
| 1111 | const efforts = selected?.model.reasoning?.efforts ?? []; |
| 1112 | const currentMissing = provider !== "" && model !== "" && selected === void 0; |
| 1113 | const defaultEffort = selected?.model.reasoning?.defaultEffort; |
| 1114 | const effectiveEffort = reasoningEffort === "" || reasoningEffort === "default" ? defaultEffort : reasoningEffort; |
| 1115 | const selectedEffort = efforts.find((effort) => effort.id === effectiveEffort); |
| 1116 | const modelLabel = selected?.model.name ?? (model === "" ? t("plan.model.choose") : model); |
| 1117 | const effortLabel = selectedEffort?.name ?? (effectiveEffort === void 0 ? t("plan.model.providerDefault") : effectiveEffort); |
| 1118 | const unavailable = state.status === "error" || state.failures.length > 0; |
| 1119 | const close = () => { |
| 1120 | setOpen(false); |
| 1121 | setPane("root"); |
| 1122 | }; |
| 1123 | const rootItems = [{ |
| 1124 | id: MODEL_MENU_OPEN_MODELS, |
| 1125 | label: (0, react_jsx_runtime.jsxs)("span", { |
| 1126 | className: ActivityPanel_module_css_default.planModelMenuRow, |
| 1127 | children: [ |
| 1128 | (0, react_jsx_runtime.jsx)("span", { children: t("plan.member.model") }), |
| 1129 | (0, react_jsx_runtime.jsx)("strong", { children: modelLabel }), |
| 1130 | (0, react_jsx_runtime.jsx)(DisclosureChevron, { open: false }) |
| 1131 | ] |
| 1132 | }), |
| 1133 | disabled: state.status === "loading" && catalogRoutes.length === 0 |
| 1134 | }, { |
| 1135 | id: MODEL_MENU_OPEN_EFFORT, |
| 1136 | label: (0, react_jsx_runtime.jsxs)("span", { |
| 1137 | className: ActivityPanel_module_css_default.planModelMenuRow, |
| 1138 | children: [ |
| 1139 | (0, react_jsx_runtime.jsx)("span", { children: t("plan.member.reasoning") }), |
| 1140 | (0, react_jsx_runtime.jsx)("strong", { children: effortLabel }), |
| 1141 | (0, react_jsx_runtime.jsx)(DisclosureChevron, { open: false }) |
| 1142 | ] |
| 1143 | }), |
| 1144 | disabled: selected?.model.reasoning === void 0 |
| 1145 | }]; |
| 1146 | const modelItems = [{ |
| 1147 | id: MODEL_MENU_BACK, |
| 1148 | label: (0, react_jsx_runtime.jsxs)("span", { |
| 1149 | className: ActivityPanel_module_css_default.planModelMenuBack, |
| 1150 | children: [(0, react_jsx_runtime.jsx)(DisclosureChevron, { open: false }), t("plan.model.back")] |
| 1151 | }) |
| 1152 | }, { |
| 1153 | type: "separator", |
| 1154 | id: "models:separator" |
| 1155 | }]; |
| 1156 | if (catalogRoutes.length === 0) modelItems.push({ |
| 1157 | id: "models:empty", |
| 1158 | label: state.status === "loading" ? t("plan.model.loading") : t("plan.model.empty"), |
| 1159 | disabled: true |
| 1160 | }); |
| 1161 | else for (const group of state.groups) { |
| 1162 | modelItems.push({ |
| 1163 | type: "label", |
| 1164 | id: `provider:${group.id}`, |
| 1165 | text: group.name |
| 1166 | }); |
| 1167 | for (const candidate of group.models) modelItems.push({ |
| 1168 | id: modelMenuId(group.id, candidate.id), |
| 1169 | label: candidate.name |
| 1170 | }); |
| 1171 | } |
| 1172 | const effortItems = [ |
| 1173 | { |
| 1174 | id: MODEL_MENU_BACK, |
| 1175 | label: (0, react_jsx_runtime.jsxs)("span", { |
| 1176 | className: ActivityPanel_module_css_default.planModelMenuBack, |
| 1177 | children: [(0, react_jsx_runtime.jsx)(DisclosureChevron, { open: false }), t("plan.model.back")] |
| 1178 | }) |
| 1179 | }, |
| 1180 | { |
| 1181 | type: "separator", |
| 1182 | id: "effort:separator" |
| 1183 | }, |
| 1184 | { |
| 1185 | id: MODEL_MENU_DEFAULT_EFFORT, |
| 1186 | label: defaultEffort === void 0 ? t("plan.model.providerDefault") : t("plan.model.modelDefault", { effort: efforts.find((effort) => effort.id === defaultEffort)?.name ?? defaultEffort }) |
| 1187 | }, |
| 1188 | ...efforts.map((effort) => ({ |
| 1189 | id: effortMenuId(effort.id), |
| 1190 | label: (0, react_jsx_runtime.jsxs)("span", { |
| 1191 | className: ActivityPanel_module_css_default.planModelEffortRow, |
| 1192 | children: [(0, react_jsx_runtime.jsx)("span", { children: effort.name }), effort.description !== void 0 && (0, react_jsx_runtime.jsx)("small", { children: effort.description })] |
| 1193 | }) |
| 1194 | })) |
| 1195 | ]; |
| 1196 | const items = pane === "models" ? modelItems : pane === "effort" ? effortItems : rootItems; |
| 1197 | const selectedId = pane === "models" ? modelMenuId(provider, model) : pane === "effort" ? reasoningEffort === "" || reasoningEffort === "default" ? MODEL_MENU_DEFAULT_EFFORT : effortMenuId(reasoningEffort) : void 0; |
| 1198 | const choose = (id) => { |
| 1199 | if (id === MODEL_MENU_OPEN_MODELS) { |
| 1200 | setPane("models"); |
| 1201 | return; |
| 1202 | } |
| 1203 | if (id === MODEL_MENU_OPEN_EFFORT) { |
| 1204 | setPane("effort"); |
| 1205 | return; |
| 1206 | } |
| 1207 | if (id === MODEL_MENU_BACK) { |
| 1208 | setPane("root"); |
| 1209 | return; |
| 1210 | } |
| 1211 | if (id === MODEL_MENU_RETRY) { |
| 1212 | directory.load().catch(() => void 0); |
| 1213 | return; |
| 1214 | } |
| 1215 | const nextModel = catalogRoutes.find((candidate) => modelMenuId(candidate.provider, candidate.model.id) === id); |
| 1216 | if (nextModel !== void 0) { |
| 1217 | close(); |
| 1218 | if (nextModel.provider === provider && nextModel.model.id === model) return; |
| 1219 | onChange({ |
| 1220 | provider: nextModel.provider, |
| 1221 | model: nextModel.model.id, |
| 1222 | reasoningEffort: "default" |
| 1223 | }); |
| 1224 | return; |
| 1225 | } |
| 1226 | if (id === MODEL_MENU_DEFAULT_EFFORT) { |
| 1227 | close(); |
| 1228 | if (effectiveEffort === defaultEffort) return; |
| 1229 | onChange({ |
| 1230 | provider, |
| 1231 | model, |
| 1232 | reasoningEffort: "default" |
| 1233 | }); |
| 1234 | return; |
| 1235 | } |
| 1236 | const nextEffort = efforts.find((effort) => effortMenuId(effort.id) === id); |
| 1237 | if (nextEffort === void 0) return; |
| 1238 | close(); |
| 1239 | if (nextEffort.id === reasoningEffort) return; |
| 1240 | onChange({ |
| 1241 | provider, |
| 1242 | model, |
| 1243 | reasoningEffort: nextEffort.id |
| 1244 | }); |
| 1245 | }; |
| 1246 | return (0, react_jsx_runtime.jsxs)("div", { |
| 1247 | className: ActivityPanel_module_css_default.planModelPicker, |
| 1248 | "data-model-directory-status": state.status, |
| 1249 | children: [ |
| 1250 | (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, { |
| 1251 | open, |
| 1252 | portal: true, |
| 1253 | align: "end", |
| 1254 | compact: true, |
| 1255 | className: ActivityPanel_module_css_default.planModelMenu, |
| 1256 | items, |
| 1257 | footer: unavailable ? [{ |
| 1258 | id: MODEL_MENU_RETRY, |
| 1259 | label: t("plan.model.retry") |
| 1260 | }] : void 0, |
| 1261 | selectedId, |
| 1262 | onSelect: choose, |
| 1263 | onClose: close, |
| 1264 | anchor: (0, react_jsx_runtime.jsxs)("button", { |
| 1265 | type: "button", |
| 1266 | className: ActivityPanel_module_css_default.planModelTrigger, |
| 1267 | "data-plan-model-trigger": true, |
| 1268 | "aria-label": t("plan.model.triggerAria", { |
| 1269 | model: modelLabel, |
| 1270 | effort: effortLabel |
| 1271 | }), |
| 1272 | "aria-haspopup": "menu", |
| 1273 | "aria-expanded": open, |
| 1274 | disabled: busy, |
| 1275 | onClick: () => { |
| 1276 | if (open) close(); |
| 1277 | else { |
| 1278 | setPane("root"); |
| 1279 | setOpen(true); |
| 1280 | directory.load().catch(() => void 0); |
| 1281 | } |
| 1282 | }, |
| 1283 | children: [(0, react_jsx_runtime.jsxs)("span", { |
| 1284 | className: ActivityPanel_module_css_default.planModelTriggerCopy, |
| 1285 | children: [(0, react_jsx_runtime.jsx)("strong", { children: state.status === "loading" && catalogRoutes.length === 0 ? t("plan.model.loading") : modelLabel }), (0, react_jsx_runtime.jsx)("span", { children: effortLabel })] |
| 1286 | }), (0, react_jsx_runtime.jsx)(DisclosureChevron, { open })] |
| 1287 | }) |
| 1288 | }), |
| 1289 | (0, react_jsx_runtime.jsx)("small", { |
| 1290 | className: ActivityPanel_module_css_default.planModelHint, |
| 1291 | children: currentMissing ? t("plan.model.currentUnavailable", { |
| 1292 | provider, |
| 1293 | model |
| 1294 | }) : selected?.model.description ?? t("plan.model.route", { |
| 1295 | provider, |
| 1296 | model |
| 1297 | }) |
| 1298 | }), |
| 1299 | unavailable && (0, react_jsx_runtime.jsxs)("span", { |
| 1300 | className: ActivityPanel_module_css_default.planModelNotice, |
| 1301 | role: state.status === "error" ? "alert" : "status", |
| 1302 | children: [(0, react_jsx_runtime.jsx)("span", { children: state.error ?? t("plan.model.partialFailure", { count: state.failures.length }) }), (0, react_jsx_runtime.jsx)("button", { |
| 1303 | type: "button", |
| 1304 | disabled: busy || state.status === "loading", |
| 1305 | onClick: () => { |
| 1306 | directory.load().catch(() => void 0); |
| 1307 | }, |
| 1308 | children: t("plan.model.retry") |
| 1309 | })] |
| 1310 | }) |
| 1311 | ] |
| 1312 | }); |
| 1313 | } |
| 1314 | function StagedMemberEditor({ team, member, modelDirectory, onPendingChange, t }) { |
| 1315 | const bodyId = (0, react.useId)(); |
| 1316 | const [open, setOpen] = (0, react.useState)(false); |
| 1317 | const [role, setRole] = (0, react.useState)(member.role); |
| 1318 | const [provider, setProvider] = (0, react.useState)(member.provider ?? ""); |
| 1319 | const [model, setModel] = (0, react.useState)(member.model ?? ""); |
| 1320 | const [reasoningEffort, setReasoningEffort] = (0, react.useState)(member.reasoningEffort ?? ""); |
| 1321 | const [executionPrompt, setExecutionPrompt] = (0, react.useState)(member.executionPrompt ?? ""); |
| 1322 | const remoteSignature = JSON.stringify([ |
| 1323 | member.role, |
| 1324 | member.provider ?? "", |
| 1325 | member.model ?? "", |
| 1326 | member.reasoningEffort ?? "", |
| 1327 | member.executionPrompt ?? "" |
| 1328 | ]); |
| 1329 | const [savedSignature, setSavedSignature] = (0, react.useState)(remoteSignature); |
| 1330 | const [busy, setBusy] = (0, react.useState)(false); |
| 1331 | const [feedback, setFeedback] = (0, react.useState)(); |
| 1332 | useDismissSuccess(feedback, setFeedback); |
| 1333 | const dirty = JSON.stringify([ |
| 1334 | role, |
| 1335 | provider, |
| 1336 | model, |
| 1337 | reasoningEffort, |
| 1338 | executionPrompt |
| 1339 | ]) !== savedSignature; |
| 1340 | (0, react.useEffect)(() => { |
| 1341 | onPendingChange(`member:${member.name}`, dirty || busy); |
| 1342 | return () => { |
| 1343 | onPendingChange(`member:${member.name}`, false); |
| 1344 | }; |
| 1345 | }, [ |
| 1346 | busy, |
| 1347 | dirty, |
| 1348 | member.name, |
| 1349 | onPendingChange |
| 1350 | ]); |
| 1351 | (0, react.useEffect)(() => { |
| 1352 | setRole(member.role); |
| 1353 | setProvider(member.provider ?? ""); |
| 1354 | setModel(member.model ?? ""); |
| 1355 | setReasoningEffort(member.reasoningEffort ?? ""); |
| 1356 | setExecutionPrompt(member.executionPrompt ?? ""); |
| 1357 | setSavedSignature(remoteSignature); |
| 1358 | }, [ |
| 1359 | member.role, |
| 1360 | member.provider, |
| 1361 | member.model, |
| 1362 | member.reasoningEffort, |
| 1363 | member.executionPrompt, |
| 1364 | remoteSignature |
| 1365 | ]); |
| 1366 | const markEdited = () => { |
| 1367 | setFeedback(void 0); |
| 1368 | }; |
| 1369 | const persist = async (selection = { |
| 1370 | provider, |
| 1371 | model, |
| 1372 | reasoningEffort |
| 1373 | }) => { |
| 1374 | const nextSignature = JSON.stringify([ |
| 1375 | role, |
| 1376 | selection.provider, |
| 1377 | selection.model, |
| 1378 | selection.reasoningEffort, |
| 1379 | executionPrompt |
| 1380 | ]); |
| 1381 | setProvider(selection.provider); |
| 1382 | setModel(selection.model); |
| 1383 | setReasoningEffort(selection.reasoningEffort); |
| 1384 | setBusy(true); |
| 1385 | setFeedback(void 0); |
| 1386 | try { |
| 1387 | await mutatePlan({ |
| 1388 | sessionId: team.captainSessionId, |
| 1389 | teamId: team.teamId, |
| 1390 | action: "update_member", |
| 1391 | memberName: member.name, |
| 1392 | role, |
| 1393 | provider: selection.provider, |
| 1394 | model: selection.model, |
| 1395 | reasoningEffort: selection.reasoningEffort, |
| 1396 | executionPrompt |
| 1397 | }); |
| 1398 | setSavedSignature(nextSignature); |
| 1399 | setFeedback({ |
| 1400 | tone: "success", |
| 1401 | message: t("plan.saved") |
| 1402 | }); |
| 1403 | } catch (error) { |
| 1404 | setFeedback({ |
| 1405 | tone: "error", |
| 1406 | message: t("plan.failed", { message: errorMessage(error) }) |
| 1407 | }); |
| 1408 | } finally { |
| 1409 | setBusy(false); |
| 1410 | } |
| 1411 | }; |
| 1412 | const save = async (event) => { |
| 1413 | event.preventDefault(); |
| 1414 | await persist(); |
| 1415 | }; |
| 1416 | const route = `${provider}/${model}`.replace(/^\//u, ""); |
| 1417 | return (0, react_jsx_runtime.jsxs)("article", { |
| 1418 | className: ActivityPanel_module_css_default.planCard, |
| 1419 | "data-plan-member": member.name, |
| 1420 | "data-open": open, |
| 1421 | children: [(0, react_jsx_runtime.jsxs)("button", { |
| 1422 | type: "button", |
| 1423 | className: ActivityPanel_module_css_default.planCardHeader, |
| 1424 | "aria-expanded": open, |
| 1425 | "aria-controls": bodyId, |
| 1426 | onClick: () => { |
| 1427 | setOpen((current) => !current); |
| 1428 | }, |
| 1429 | children: [ |
| 1430 | (0, react_jsx_runtime.jsxs)("span", { |
| 1431 | className: ActivityPanel_module_css_default.planCardIdentity, |
| 1432 | children: [(0, react_jsx_runtime.jsx)("strong", { children: member.name }), (0, react_jsx_runtime.jsx)("span", { children: role || t("plan.member.roleFallback") })] |
| 1433 | }), |
| 1434 | (0, react_jsx_runtime.jsx)("span", { |
| 1435 | className: ActivityPanel_module_css_default.planCardMeta, |
| 1436 | title: route, |
| 1437 | children: route |
| 1438 | }), |
| 1439 | dirty && (0, react_jsx_runtime.jsx)("em", { |
| 1440 | className: ActivityPanel_module_css_default.planDirty, |
| 1441 | children: t("plan.unsaved") |
| 1442 | }), |
| 1443 | (0, react_jsx_runtime.jsx)(DisclosureChevron, { open }) |
| 1444 | ] |
| 1445 | }), open && (0, react_jsx_runtime.jsxs)("form", { |
| 1446 | id: bodyId, |
| 1447 | className: ActivityPanel_module_css_default.planCardBody, |
| 1448 | onSubmit: (event) => { |
| 1449 | save(event); |
| 1450 | }, |
| 1451 | children: [(0, react_jsx_runtime.jsxs)("fieldset", { |
| 1452 | disabled: busy, |
| 1453 | children: [ |
| 1454 | (0, react_jsx_runtime.jsxs)("label", { children: [t("plan.member.role"), (0, react_jsx_runtime.jsx)("input", { |
| 1455 | name: "role", |
| 1456 | value: role, |
| 1457 | onChange: (event) => { |
| 1458 | setRole(event.currentTarget.value); |
| 1459 | markEdited(); |
| 1460 | } |
| 1461 | })] }), |
| 1462 | (0, react_jsx_runtime.jsx)(StagedModelPicker, { |
| 1463 | directory: modelDirectory, |
| 1464 | provider, |
| 1465 | model, |
| 1466 | reasoningEffort, |
| 1467 | busy, |
| 1468 | onChange: (selection) => { |
| 1469 | persist(selection); |
| 1470 | }, |
| 1471 | t |
| 1472 | }), |
| 1473 | (0, react_jsx_runtime.jsxs)("label", { children: [t("plan.member.prompt"), (0, react_jsx_runtime.jsx)("textarea", { |
| 1474 | name: "executionPrompt", |
| 1475 | value: executionPrompt, |
| 1476 | onChange: (event) => { |
| 1477 | setExecutionPrompt(event.currentTarget.value); |
| 1478 | markEdited(); |
| 1479 | }, |
| 1480 | rows: 3 |
| 1481 | })] }) |
| 1482 | ] |
| 1483 | }), (0, react_jsx_runtime.jsxs)("span", { |
| 1484 | className: ActivityPanel_module_css_default.planActions, |
| 1485 | children: [(0, react_jsx_runtime.jsx)(Feedback, { value: feedback }), (0, react_jsx_runtime.jsx)("button", { |
| 1486 | type: "submit", |
| 1487 | disabled: busy || !dirty || provider.trim() === "" || model.trim() === "", |
| 1488 | children: busy ? t("plan.saving") : t("plan.save") |
| 1489 | })] |
| 1490 | })] |
| 1491 | })] |
| 1492 | }); |
| 1493 | } |
| 1494 | function StagedTaskEditor({ team, task, onPendingChange, t }) { |
| 1495 | const bodyId = (0, react.useId)(); |
| 1496 | const taskDependencies = task.dependencies.join(", "); |
| 1497 | const [open, setOpen] = (0, react.useState)(false); |
| 1498 | const [subject, setSubject] = (0, react.useState)(task.subject); |
| 1499 | const [description, setDescription] = (0, react.useState)(task.description ?? ""); |
| 1500 | const [assignee, setAssignee] = (0, react.useState)(task.assignee); |
| 1501 | const [dependencies, setDependencies] = (0, react.useState)(taskDependencies); |
| 1502 | const remoteSignature = JSON.stringify([ |
| 1503 | task.subject, |
| 1504 | task.description ?? "", |
| 1505 | task.assignee, |
| 1506 | taskDependencies |
| 1507 | ]); |
| 1508 | const [savedSignature, setSavedSignature] = (0, react.useState)(remoteSignature); |
| 1509 | const [busy, setBusy] = (0, react.useState)(false); |
| 1510 | const [confirmingRemove, setConfirmingRemove] = (0, react.useState)(false); |
| 1511 | const [feedback, setFeedback] = (0, react.useState)(); |
| 1512 | useDismissSuccess(feedback, setFeedback); |
| 1513 | const signature = JSON.stringify([ |
| 1514 | subject, |
| 1515 | description, |
| 1516 | assignee, |
| 1517 | dependencies |
| 1518 | ]); |
| 1519 | const dirty = signature !== savedSignature; |
| 1520 | (0, react.useEffect)(() => { |
| 1521 | onPendingChange(`task:${task.id}`, dirty || busy); |
| 1522 | return () => { |
| 1523 | onPendingChange(`task:${task.id}`, false); |
| 1524 | }; |
| 1525 | }, [ |
| 1526 | busy, |
| 1527 | dirty, |
| 1528 | onPendingChange, |
| 1529 | task.id |
| 1530 | ]); |
| 1531 | (0, react.useEffect)(() => { |
| 1532 | setSubject(task.subject); |
| 1533 | setDescription(task.description ?? ""); |
| 1534 | setAssignee(task.assignee); |
| 1535 | setDependencies(taskDependencies); |
| 1536 | setSavedSignature(remoteSignature); |
| 1537 | }, [ |
| 1538 | task.subject, |
| 1539 | task.description, |
| 1540 | task.assignee, |
| 1541 | taskDependencies, |
| 1542 | remoteSignature |
| 1543 | ]); |
| 1544 | const markEdited = () => { |
| 1545 | setFeedback(void 0); |
| 1546 | setConfirmingRemove(false); |
| 1547 | }; |
| 1548 | const save = async (event) => { |
| 1549 | event.preventDefault(); |
| 1550 | setBusy(true); |
| 1551 | setFeedback(void 0); |
| 1552 | try { |
| 1553 | await mutatePlan({ |
| 1554 | sessionId: team.captainSessionId, |
| 1555 | teamId: team.teamId, |
| 1556 | action: "update_task", |
| 1557 | taskId: task.id, |
| 1558 | subject, |
| 1559 | description, |
| 1560 | assignee, |
| 1561 | dependencies: dependencies.split(",").map((item) => item.trim()).filter(Boolean) |
| 1562 | }); |
| 1563 | setSavedSignature(signature); |
| 1564 | setFeedback({ |
| 1565 | tone: "success", |
| 1566 | message: t("plan.saved") |
| 1567 | }); |
| 1568 | } catch (error) { |
| 1569 | setFeedback({ |
| 1570 | tone: "error", |
| 1571 | message: t("plan.failed", { message: errorMessage(error) }) |
| 1572 | }); |
| 1573 | } finally { |
| 1574 | setBusy(false); |
| 1575 | } |
| 1576 | }; |
| 1577 | const remove = async () => { |
| 1578 | setBusy(true); |
| 1579 | setFeedback(void 0); |
| 1580 | try { |
| 1581 | await mutatePlan({ |
| 1582 | sessionId: team.captainSessionId, |
| 1583 | teamId: team.teamId, |
| 1584 | action: "remove_task", |
| 1585 | taskId: task.id |
| 1586 | }); |
| 1587 | setFeedback({ |
| 1588 | tone: "success", |
| 1589 | message: t("plan.removed") |
| 1590 | }); |
| 1591 | } catch (error) { |
| 1592 | setFeedback({ |
| 1593 | tone: "error", |
| 1594 | message: t("plan.failed", { message: errorMessage(error) }) |
| 1595 | }); |
| 1596 | setBusy(false); |
| 1597 | } |
| 1598 | }; |
| 1599 | const dependencySummary = task.dependencies.length === 0 ? t("plan.dependencies.none") : t("plan.dependencies.count", { count: task.dependencies.length }); |
| 1600 | return (0, react_jsx_runtime.jsxs)("article", { |
| 1601 | className: ActivityPanel_module_css_default.planCard, |
| 1602 | "data-plan-task": task.id, |
| 1603 | "data-open": open, |
| 1604 | children: [(0, react_jsx_runtime.jsxs)("button", { |
| 1605 | type: "button", |
| 1606 | className: ActivityPanel_module_css_default.planCardHeader, |
| 1607 | "aria-expanded": open, |
| 1608 | "aria-controls": bodyId, |
| 1609 | onClick: () => { |
| 1610 | setOpen((current) => !current); |
| 1611 | }, |
| 1612 | children: [ |
| 1613 | (0, react_jsx_runtime.jsx)("span", { |
| 1614 | className: ActivityPanel_module_css_default.planTaskId, |
| 1615 | children: task.id |
| 1616 | }), |
| 1617 | (0, react_jsx_runtime.jsx)("span", { |
| 1618 | className: ActivityPanel_module_css_default.planTaskSummary, |
| 1619 | title: subject, |
| 1620 | children: subject |
| 1621 | }), |
| 1622 | (0, react_jsx_runtime.jsxs)("span", { |
| 1623 | className: ActivityPanel_module_css_default.planCardMeta, |
| 1624 | children: [ |
| 1625 | assignee || t("plan.task.unassigned"), |
| 1626 | " · ", |
| 1627 | dependencySummary |
| 1628 | ] |
| 1629 | }), |
| 1630 | dirty && (0, react_jsx_runtime.jsx)("em", { |
| 1631 | className: ActivityPanel_module_css_default.planDirty, |
| 1632 | children: t("plan.unsaved") |
| 1633 | }), |
| 1634 | (0, react_jsx_runtime.jsx)(DisclosureChevron, { open }) |
| 1635 | ] |
| 1636 | }), open && (0, react_jsx_runtime.jsxs)("form", { |
| 1637 | id: bodyId, |
| 1638 | className: ActivityPanel_module_css_default.planCardBody, |
| 1639 | onSubmit: (event) => { |
| 1640 | save(event); |
| 1641 | }, |
| 1642 | children: [ |
| 1643 | (0, react_jsx_runtime.jsxs)("fieldset", { |
| 1644 | disabled: busy, |
| 1645 | children: [ |
| 1646 | (0, react_jsx_runtime.jsxs)("label", { children: [t("plan.task.subject"), (0, react_jsx_runtime.jsx)("input", { |
| 1647 | name: "subject", |
| 1648 | required: true, |
| 1649 | value: subject, |
| 1650 | onChange: (event) => { |
| 1651 | setSubject(event.currentTarget.value); |
| 1652 | markEdited(); |
| 1653 | } |
| 1654 | })] }), |
| 1655 | (0, react_jsx_runtime.jsxs)("label", { children: [t("plan.task.description"), (0, react_jsx_runtime.jsx)("textarea", { |
| 1656 | name: "description", |
| 1657 | value: description, |
| 1658 | onChange: (event) => { |
| 1659 | setDescription(event.currentTarget.value); |
| 1660 | markEdited(); |
| 1661 | }, |
| 1662 | rows: 3 |
| 1663 | })] }), |
| 1664 | (0, react_jsx_runtime.jsxs)("span", { |
| 1665 | className: ActivityPanel_module_css_default.planGrid, |
| 1666 | children: [(0, react_jsx_runtime.jsxs)("label", { children: [t("plan.task.assignee"), (0, react_jsx_runtime.jsxs)("select", { |
| 1667 | name: "assignee", |
| 1668 | value: assignee, |
| 1669 | onChange: (event) => { |
| 1670 | setAssignee(event.currentTarget.value); |
| 1671 | markEdited(); |
| 1672 | }, |
| 1673 | children: [(0, react_jsx_runtime.jsx)("option", { |
| 1674 | value: "", |
| 1675 | children: t("plan.task.unassigned") |
| 1676 | }), team.members.map((member) => (0, react_jsx_runtime.jsx)("option", { |
| 1677 | value: member.name, |
| 1678 | children: member.name |
| 1679 | }, member.name))] |
| 1680 | })] }), (0, react_jsx_runtime.jsxs)("label", { children: [ |
| 1681 | t("plan.task.dependencies"), |
| 1682 | (0, react_jsx_runtime.jsx)("input", { |
| 1683 | name: "dependencies", |
| 1684 | value: dependencies, |
| 1685 | onChange: (event) => { |
| 1686 | setDependencies(event.currentTarget.value); |
| 1687 | markEdited(); |
| 1688 | } |
| 1689 | }), |
| 1690 | (0, react_jsx_runtime.jsx)("small", { children: t("plan.task.dependenciesHint") }) |
| 1691 | ] })] |
| 1692 | }) |
| 1693 | ] |
| 1694 | }), |
| 1695 | confirmingRemove && (0, react_jsx_runtime.jsxs)("span", { |
| 1696 | className: ActivityPanel_module_css_default.planConfirm, |
| 1697 | role: "alert", |
| 1698 | children: [ |
| 1699 | (0, react_jsx_runtime.jsx)("span", { children: t("plan.removeWarning", { task: task.id }) }), |
| 1700 | (0, react_jsx_runtime.jsx)("button", { |
| 1701 | type: "button", |
| 1702 | onClick: () => { |
| 1703 | setConfirmingRemove(false); |
| 1704 | }, |
| 1705 | children: t("plan.cancel") |
| 1706 | }), |
| 1707 | (0, react_jsx_runtime.jsx)("button", { |
| 1708 | type: "button", |
| 1709 | "data-danger": true, |
| 1710 | "data-confirming": true, |
| 1711 | onClick: () => { |
| 1712 | remove(); |
| 1713 | }, |
| 1714 | children: t("plan.removeConfirm") |
| 1715 | }) |
| 1716 | ] |
| 1717 | }), |
| 1718 | (0, react_jsx_runtime.jsxs)("span", { |
| 1719 | className: ActivityPanel_module_css_default.planActions, |
| 1720 | children: [ |
| 1721 | (0, react_jsx_runtime.jsx)(Feedback, { value: feedback }), |
| 1722 | (0, react_jsx_runtime.jsx)("button", { |
| 1723 | type: "button", |
| 1724 | "data-danger": true, |
| 1725 | onClick: () => { |
| 1726 | setConfirmingRemove(true); |
| 1727 | setFeedback(void 0); |
| 1728 | }, |
| 1729 | disabled: busy || confirmingRemove, |
| 1730 | children: t("plan.remove") |
| 1731 | }), |
| 1732 | (0, react_jsx_runtime.jsx)("button", { |
| 1733 | type: "submit", |
| 1734 | disabled: busy || !dirty || subject.trim() === "", |
| 1735 | children: busy ? t("plan.saving") : t("plan.save") |
| 1736 | }) |
| 1737 | ] |
| 1738 | }) |
| 1739 | ] |
| 1740 | })] |
| 1741 | }); |
| 1742 | } |
| 1743 | function StagingPlanEditor({ team, modelDirectory, onContinuePlanning, onDiscarded, t }) { |
| 1744 | const membersId = (0, react.useId)(); |
| 1745 | const tasksId = (0, react.useId)(); |
| 1746 | const [membersOpen, setMembersOpen] = (0, react.useState)(true); |
| 1747 | const [tasksOpen, setTasksOpen] = (0, react.useState)(true); |
| 1748 | const [newTask, setNewTask] = (0, react.useState)(""); |
| 1749 | const [busy, setBusy] = (0, react.useState)(false); |
| 1750 | const [discardArmed, setDiscardArmed] = (0, react.useState)(false); |
| 1751 | const [pendingEditors, setPendingEditors] = (0, react.useState)(/* @__PURE__ */ new Set()); |
| 1752 | const [feedback, setFeedback] = (0, react.useState)(); |
| 1753 | useDismissSuccess(feedback, setFeedback); |
| 1754 | const dependencyLinks = team.tasks.reduce((total, task) => total + task.dependencies.length, 0); |
| 1755 | const runnable = team.members.length > 0 && team.tasks.length > 0; |
| 1756 | const hasPendingEdits = pendingEditors.size > 0 || newTask.trim() !== ""; |
| 1757 | const waitingForFeedback = team.planReviewState === "awaiting_feedback"; |
| 1758 | (0, react.useEffect)(() => { |
| 1759 | modelDirectory.load().catch(() => void 0); |
| 1760 | }, [modelDirectory]); |
| 1761 | const onPendingChange = (0, react.useCallback)((key, pending) => { |
| 1762 | setPendingEditors((current) => { |
| 1763 | if (pending === current.has(key)) return current; |
| 1764 | const next = new Set(current); |
| 1765 | if (pending) next.add(key); |
| 1766 | else next.delete(key); |
| 1767 | return next; |
| 1768 | }); |
| 1769 | }, []); |
| 1770 | const addTask = async (event) => { |
| 1771 | event.preventDefault(); |
| 1772 | setBusy(true); |
| 1773 | setFeedback(void 0); |
| 1774 | try { |
| 1775 | await mutatePlan({ |
| 1776 | sessionId: team.captainSessionId, |
| 1777 | teamId: team.teamId, |
| 1778 | action: "add_task", |
| 1779 | subject: newTask, |
| 1780 | dependencies: [] |
| 1781 | }); |
| 1782 | setNewTask(""); |
| 1783 | setFeedback({ |
| 1784 | tone: "success", |
| 1785 | message: t("plan.taskAdded") |
| 1786 | }); |
| 1787 | setTasksOpen(true); |
| 1788 | } catch (error) { |
| 1789 | setFeedback({ |
| 1790 | tone: "error", |
| 1791 | message: t("plan.failed", { message: errorMessage(error) }) |
| 1792 | }); |
| 1793 | } finally { |
| 1794 | setBusy(false); |
| 1795 | } |
| 1796 | }; |
| 1797 | const approve = async () => { |
| 1798 | setBusy(true); |
| 1799 | setFeedback(void 0); |
| 1800 | try { |
| 1801 | await mutatePlan({ |
| 1802 | sessionId: team.captainSessionId, |
| 1803 | teamId: team.teamId, |
| 1804 | action: "approve" |
| 1805 | }); |
| 1806 | } catch (error) { |
| 1807 | setFeedback({ |
| 1808 | tone: "error", |
| 1809 | message: t("plan.failed", { message: errorMessage(error) }) |
| 1810 | }); |
| 1811 | setBusy(false); |
| 1812 | } |
| 1813 | }; |
| 1814 | const continueInChat = async () => { |
| 1815 | if (waitingForFeedback) { |
| 1816 | onContinuePlanning(); |
| 1817 | return; |
| 1818 | } |
| 1819 | setBusy(true); |
| 1820 | setFeedback(void 0); |
| 1821 | try { |
| 1822 | await mutatePlan({ |
| 1823 | sessionId: team.captainSessionId, |
| 1824 | teamId: team.teamId, |
| 1825 | action: "continue" |
| 1826 | }); |
| 1827 | onContinuePlanning(); |
| 1828 | } catch (error) { |
| 1829 | setFeedback({ |
| 1830 | tone: "error", |
| 1831 | message: t("plan.failed", { message: errorMessage(error) }) |
| 1832 | }); |
| 1833 | setBusy(false); |
| 1834 | } |
| 1835 | }; |
| 1836 | const discard = async () => { |
| 1837 | setBusy(true); |
| 1838 | setFeedback(void 0); |
| 1839 | try { |
| 1840 | await mutatePlan({ |
| 1841 | sessionId: team.captainSessionId, |
| 1842 | teamId: team.teamId, |
| 1843 | action: "discard" |
| 1844 | }); |
| 1845 | onDiscarded(); |
| 1846 | } catch (error) { |
| 1847 | setFeedback({ |
| 1848 | tone: "error", |
| 1849 | message: t("plan.failed", { message: errorMessage(error) }) |
| 1850 | }); |
| 1851 | setBusy(false); |
| 1852 | setDiscardArmed(false); |
| 1853 | } |
| 1854 | }; |
| 1855 | return (0, react_jsx_runtime.jsxs)("section", { |
| 1856 | className: ActivityPanel_module_css_default.planEditor, |
| 1857 | "data-staging-editor": true, |
| 1858 | children: [ |
| 1859 | (0, react_jsx_runtime.jsxs)("header", { |
| 1860 | className: ActivityPanel_module_css_default.planHeader, |
| 1861 | children: [(0, react_jsx_runtime.jsxs)("span", { children: [(0, react_jsx_runtime.jsxs)("span", { children: [(0, react_jsx_runtime.jsx)("strong", { children: t("plan.title") }), (0, react_jsx_runtime.jsx)("small", { children: t("plan.readySummary", { |
| 1862 | members: team.members.length, |
| 1863 | tasks: team.tasks.length, |
| 1864 | links: dependencyLinks |
| 1865 | }) })] }), (0, react_jsx_runtime.jsx)("em", { children: t("plan.badge") })] }), (0, react_jsx_runtime.jsx)("p", { children: t("plan.description") })] |
| 1866 | }), |
| 1867 | (0, react_jsx_runtime.jsxs)("ol", { |
| 1868 | className: ActivityPanel_module_css_default.planFlow, |
| 1869 | "aria-label": t("plan.flow.aria"), |
| 1870 | children: [ |
| 1871 | (0, react_jsx_runtime.jsxs)("li", { |
| 1872 | "data-active": true, |
| 1873 | children: [(0, react_jsx_runtime.jsx)("span", { children: "1" }), t("plan.flow.review")] |
| 1874 | }), |
| 1875 | (0, react_jsx_runtime.jsxs)("li", { children: [(0, react_jsx_runtime.jsx)("span", { children: "2" }), t("plan.flow.spawn")] }), |
| 1876 | (0, react_jsx_runtime.jsxs)("li", { children: [(0, react_jsx_runtime.jsx)("span", { children: "3" }), t("plan.flow.run")] }) |
| 1877 | ] |
| 1878 | }), |
| 1879 | (0, react_jsx_runtime.jsxs)("section", { |
| 1880 | className: ActivityPanel_module_css_default.planSection, |
| 1881 | children: [(0, react_jsx_runtime.jsxs)("button", { |
| 1882 | type: "button", |
| 1883 | className: ActivityPanel_module_css_default.planSectionToggle, |
| 1884 | "aria-expanded": membersOpen, |
| 1885 | "aria-controls": membersId, |
| 1886 | onClick: () => { |
| 1887 | setMembersOpen((current) => !current); |
| 1888 | }, |
| 1889 | children: [(0, react_jsx_runtime.jsxs)("span", { children: [(0, react_jsx_runtime.jsx)("strong", { children: t("plan.members.title") }), (0, react_jsx_runtime.jsx)("small", { children: t("plan.members.count", { count: team.members.length }) })] }), (0, react_jsx_runtime.jsx)(DisclosureChevron, { open: membersOpen })] |
| 1890 | }), membersOpen && (0, react_jsx_runtime.jsx)("div", { |
| 1891 | id: membersId, |
| 1892 | className: ActivityPanel_module_css_default.planList, |
| 1893 | children: team.members.length === 0 ? (0, react_jsx_runtime.jsx)("p", { |
| 1894 | className: ActivityPanel_module_css_default.planEmpty, |
| 1895 | children: t("plan.members.empty") |
| 1896 | }) : team.members.map((member) => (0, react_jsx_runtime.jsx)(StagedMemberEditor, { |
| 1897 | team, |
| 1898 | member, |
| 1899 | modelDirectory, |
| 1900 | onPendingChange, |
| 1901 | t |
| 1902 | }, member.name)) |
| 1903 | })] |
| 1904 | }), |
| 1905 | (0, react_jsx_runtime.jsxs)("section", { |
| 1906 | className: ActivityPanel_module_css_default.planSection, |
| 1907 | children: [(0, react_jsx_runtime.jsxs)("button", { |
| 1908 | type: "button", |
| 1909 | className: ActivityPanel_module_css_default.planSectionToggle, |
| 1910 | "aria-expanded": tasksOpen, |
| 1911 | "aria-controls": tasksId, |
| 1912 | onClick: () => { |
| 1913 | setTasksOpen((current) => !current); |
| 1914 | }, |
| 1915 | children: [(0, react_jsx_runtime.jsxs)("span", { children: [(0, react_jsx_runtime.jsx)("strong", { children: t("plan.tasks.title") }), (0, react_jsx_runtime.jsx)("small", { children: t("plan.tasks.count", { |
| 1916 | count: team.tasks.length, |
| 1917 | links: dependencyLinks |
| 1918 | }) })] }), (0, react_jsx_runtime.jsx)(DisclosureChevron, { open: tasksOpen })] |
| 1919 | }), tasksOpen && (0, react_jsx_runtime.jsx)("div", { |
| 1920 | id: tasksId, |
| 1921 | className: ActivityPanel_module_css_default.planList, |
| 1922 | children: team.tasks.length === 0 ? (0, react_jsx_runtime.jsx)("p", { |
| 1923 | className: ActivityPanel_module_css_default.planEmpty, |
| 1924 | children: t("plan.tasks.empty") |
| 1925 | }) : team.tasks.map((task) => (0, react_jsx_runtime.jsx)(StagedTaskEditor, { |
| 1926 | team, |
| 1927 | task, |
| 1928 | onPendingChange, |
| 1929 | t |
| 1930 | }, task.id)) |
| 1931 | })] |
| 1932 | }), |
| 1933 | (0, react_jsx_runtime.jsxs)("form", { |
| 1934 | className: ActivityPanel_module_css_default.planNewTask, |
| 1935 | onSubmit: (event) => { |
| 1936 | addTask(event); |
| 1937 | }, |
| 1938 | children: [(0, react_jsx_runtime.jsxs)("label", { children: [(0, react_jsx_runtime.jsx)("span", { children: t("plan.newTaskLabel") }), (0, react_jsx_runtime.jsx)("input", { |
| 1939 | name: "newTask", |
| 1940 | value: newTask, |
| 1941 | onChange: (event) => { |
| 1942 | setNewTask(event.currentTarget.value); |
| 1943 | setFeedback(void 0); |
| 1944 | }, |
| 1945 | placeholder: t("plan.newTask"), |
| 1946 | disabled: busy |
| 1947 | })] }), (0, react_jsx_runtime.jsx)("button", { |
| 1948 | type: "submit", |
| 1949 | disabled: busy || newTask.trim() === "", |
| 1950 | children: busy ? t("plan.adding") : t("plan.addTask") |
| 1951 | })] |
| 1952 | }), |
| 1953 | (0, react_jsx_runtime.jsxs)("div", { |
| 1954 | className: ActivityPanel_module_css_default.planApproveRow, |
| 1955 | "data-armed": discardArmed || void 0, |
| 1956 | "data-discard": discardArmed || void 0, |
| 1957 | "data-review-state": waitingForFeedback ? "awaiting-feedback" : "awaiting-review", |
| 1958 | children: [ |
| 1959 | (0, react_jsx_runtime.jsxs)("span", { |
| 1960 | className: ActivityPanel_module_css_default.planApproveCopy, |
| 1961 | children: [(0, react_jsx_runtime.jsx)("strong", { children: discardArmed ? t("plan.discardConfirmTitle") : waitingForFeedback ? t("plan.feedbackTitle") : t("plan.approveTitle") }), (0, react_jsx_runtime.jsx)("small", { children: discardArmed ? t("plan.discardWarning") : waitingForFeedback ? t("plan.feedbackHint") : hasPendingEdits ? t("plan.pendingEdits") : t("plan.approveHint", { |
| 1962 | members: team.members.length, |
| 1963 | tasks: team.tasks.length |
| 1964 | }) })] |
| 1965 | }), |
| 1966 | (0, react_jsx_runtime.jsx)(Feedback, { value: feedback }), |
| 1967 | discardArmed ? (0, react_jsx_runtime.jsxs)("span", { |
| 1968 | className: ActivityPanel_module_css_default.planApproveActions, |
| 1969 | children: [(0, react_jsx_runtime.jsx)("button", { |
| 1970 | type: "button", |
| 1971 | disabled: busy, |
| 1972 | onClick: () => { |
| 1973 | setDiscardArmed(false); |
| 1974 | }, |
| 1975 | children: t("plan.cancel") |
| 1976 | }), (0, react_jsx_runtime.jsx)("button", { |
| 1977 | type: "button", |
| 1978 | "data-plan-discard": true, |
| 1979 | "data-danger": true, |
| 1980 | "data-confirming": true, |
| 1981 | disabled: busy, |
| 1982 | onClick: () => { |
| 1983 | discard(); |
| 1984 | }, |
| 1985 | children: busy ? t("plan.discarding") : t("plan.discardConfirm") |
| 1986 | })] |
| 1987 | }) : (0, react_jsx_runtime.jsxs)("span", { |
| 1988 | className: ActivityPanel_module_css_default.planReviewActions, |
| 1989 | children: [(0, react_jsx_runtime.jsx)("button", { |
| 1990 | type: "button", |
| 1991 | "data-plan-approve": true, |
| 1992 | disabled: busy || !runnable || hasPendingEdits, |
| 1993 | onClick: () => { |
| 1994 | approve(); |
| 1995 | }, |
| 1996 | children: t("plan.approve") |
| 1997 | }), (0, react_jsx_runtime.jsxs)("span", { |
| 1998 | className: ActivityPanel_module_css_default.planSecondaryActions, |
| 1999 | children: [(0, react_jsx_runtime.jsx)("button", { |
| 2000 | type: "button", |
| 2001 | "data-plan-continue": true, |
| 2002 | disabled: busy, |
| 2003 | onClick: () => { |
| 2004 | continueInChat(); |
| 2005 | }, |
| 2006 | children: t(waitingForFeedback ? "plan.returnToChat" : "plan.continue") |
| 2007 | }), (0, react_jsx_runtime.jsx)("button", { |
| 2008 | type: "button", |
| 2009 | "data-plan-discard": true, |
| 2010 | "data-danger": true, |
| 2011 | disabled: busy, |
| 2012 | onClick: () => { |
| 2013 | setDiscardArmed(true); |
| 2014 | setFeedback(void 0); |
| 2015 | }, |
| 2016 | children: t("plan.discard") |
| 2017 | })] |
| 2018 | })] |
| 2019 | }) |
| 2020 | ] |
| 2021 | }) |
| 2022 | ] |
| 2023 | }); |
| 2024 | } |
| 2025 | //#endregion |
| 2026 | //#region lib/client/panel-geometry.js |
| 2027 | /** Pure persisted geometry rules for the AgentTeams shell-overlay panel. */ |
| 2028 | const PANEL_LAYOUT_STORAGE_KEY = "dsh-agent-teams:activity-panel:v1"; |
| 2029 | const DEFAULT_PANEL_LAYOUT = Object.freeze({ |
| 2030 | mode: "docked", |
| 2031 | x: 0, |
| 2032 | y: 64, |
| 2033 | width: 388, |
| 2034 | height: 640, |
| 2035 | heightMode: "auto" |
| 2036 | }); |
| 2037 | function clamp(value, minimum, maximum) { |
| 2038 | return Math.min(Math.max(value, minimum), maximum); |
| 2039 | } |
| 2040 | function finite(value) { |
| 2041 | return typeof value === "number" && Number.isFinite(value); |
| 2042 | } |
| 2043 | /** Decode one versioned localStorage value, rejecting partial/corrupt state. */ |
| 2044 | function parsePanelLayout(value) { |
| 2045 | if (value === null) return DEFAULT_PANEL_LAYOUT; |
| 2046 | try { |
| 2047 | const parsed = JSON.parse(value); |
| 2048 | if (typeof parsed !== "object" || parsed === null) return DEFAULT_PANEL_LAYOUT; |
| 2049 | const record = parsed; |
| 2050 | if (record.mode !== "docked" && record.mode !== "floating" || !finite(record.x) || !finite(record.y) || !finite(record.width) || !finite(record.height)) return DEFAULT_PANEL_LAYOUT; |
| 2051 | return { |
| 2052 | mode: record.mode, |
| 2053 | x: record.x, |
| 2054 | y: record.y, |
| 2055 | width: record.width, |
| 2056 | height: record.height, |
| 2057 | heightMode: record.mode === "floating" && record.heightMode === "manual" ? "manual" : "auto" |
| 2058 | }; |
| 2059 | } catch { |
| 2060 | return DEFAULT_PANEL_LAYOUT; |
| 2061 | } |
| 2062 | } |
| 2063 | /** Whether the panel should become a simple inset overlay with no gestures. */ |
| 2064 | function compactPanelForBounds(bounds) { |
| 2065 | return bounds.width <= 960; |
| 2066 | } |
| 2067 | /** Docked and compact panels always fit content; floating panels may be user-sized. */ |
| 2068 | function panelUsesAutoHeight(layout, bounds) { |
| 2069 | return compactPanelForBounds(bounds) || layout.mode === "docked" || layout.heightMode === "auto"; |
| 2070 | } |
| 2071 | /** CSS max-height ceiling that keeps an auto-height panel inside its shell. */ |
| 2072 | function panelMaximumHeight(layout, bounds) { |
| 2073 | const bottomInset = compactPanelForBounds(bounds) || layout.mode === "floating" ? 12 : 48; |
| 2074 | return Math.max(1, bounds.height - layout.y - bottomInset); |
| 2075 | } |
| 2076 | /** Resolve persisted state into a visible rectangle inside the current shell. */ |
| 2077 | function resolvePanelGeometry(layout, bounds) { |
| 2078 | const boundsWidth = Math.max(1, bounds.width); |
| 2079 | const boundsHeight = Math.max(1, bounds.height); |
| 2080 | if (compactPanelForBounds(bounds)) return { |
| 2081 | ...layout, |
| 2082 | x: 12, |
| 2083 | y: 12, |
| 2084 | width: Math.max(1, boundsWidth - 24), |
| 2085 | height: Math.max(1, boundsHeight - 24) |
| 2086 | }; |
| 2087 | const maximumWidth = Math.max(1, Math.min(640, boundsWidth - 24)); |
| 2088 | const minimumWidth = Math.min(320, maximumWidth); |
| 2089 | const width = clamp(layout.width, minimumWidth, maximumWidth); |
| 2090 | const maximumHeight = Math.max(1, boundsHeight - 24); |
| 2091 | const minimumHeight = Math.min(360, maximumHeight); |
| 2092 | if (layout.mode === "docked") { |
| 2093 | const y = clamp(64, 12, Math.max(12, boundsHeight - minimumHeight - 12)); |
| 2094 | const availableHeight = Math.max(1, boundsHeight - y - 48); |
| 2095 | const height = clamp(availableHeight, Math.min(minimumHeight, availableHeight), maximumHeight); |
| 2096 | const anchorRight = clamp(bounds.anchorRight, 0, boundsWidth); |
| 2097 | const maximumX = Math.max(12, boundsWidth - width - 12); |
| 2098 | return { |
| 2099 | mode: "docked", |
| 2100 | x: clamp(anchorRight - 18 - width, 12, maximumX), |
| 2101 | y, |
| 2102 | width, |
| 2103 | height, |
| 2104 | heightMode: layout.heightMode |
| 2105 | }; |
| 2106 | } |
| 2107 | const height = clamp(layout.height, minimumHeight, maximumHeight); |
| 2108 | return { |
| 2109 | mode: "floating", |
| 2110 | x: clamp(layout.x, 12, Math.max(12, boundsWidth - width - 12)), |
| 2111 | y: clamp(layout.y, 12, Math.max(12, boundsHeight - height - 12)), |
| 2112 | width, |
| 2113 | height, |
| 2114 | heightMode: layout.heightMode |
| 2115 | }; |
| 2116 | } |
| 2117 | /** Undock without a visual jump by adopting the panel's resolved rectangle. */ |
| 2118 | function floatPanelLayout(geometry, bounds) { |
| 2119 | return resolvePanelGeometry({ |
| 2120 | ...geometry, |
| 2121 | mode: "floating" |
| 2122 | }, bounds); |
| 2123 | } |
| 2124 | /** Return to the right dock, preserving width and restoring content-fit height. */ |
| 2125 | function dockPanelLayout(layout, bounds) { |
| 2126 | return resolvePanelGeometry({ |
| 2127 | ...layout, |
| 2128 | mode: "docked", |
| 2129 | heightMode: "auto" |
| 2130 | }, bounds); |
| 2131 | } |
| 2132 | /** Translate a floating panel and clamp it back into the visible shell. */ |
| 2133 | function movePanelLayout(start, dx, dy, bounds) { |
| 2134 | return resolvePanelGeometry({ |
| 2135 | ...start, |
| 2136 | mode: "floating", |
| 2137 | x: start.x + dx, |
| 2138 | y: start.y + dy |
| 2139 | }, bounds); |
| 2140 | } |
| 2141 | /** Resize while keeping the edge opposite the active handle stationary. */ |
| 2142 | function resizePanelLayout(start, edge, dx, dy, bounds) { |
| 2143 | if (start.mode === "docked") { |
| 2144 | if (edge !== "left") return resolvePanelGeometry(start, bounds); |
| 2145 | return resolvePanelGeometry({ |
| 2146 | ...start, |
| 2147 | width: start.width - dx |
| 2148 | }, bounds); |
| 2149 | } |
| 2150 | const resolved = resolvePanelGeometry(start, bounds); |
| 2151 | const minimumWidth = Math.min(320, resolved.x + resolved.width - 12); |
| 2152 | const minimumHeight = Math.min(360, bounds.height - resolved.y - 12); |
| 2153 | if (edge === "left") { |
| 2154 | const right = resolved.x + resolved.width; |
| 2155 | const maximumWidth = Math.max(1, Math.min(640, right - 12)); |
| 2156 | const width = clamp(resolved.width - dx, Math.min(minimumWidth, maximumWidth), maximumWidth); |
| 2157 | return { |
| 2158 | ...resolved, |
| 2159 | x: right - width, |
| 2160 | width |
| 2161 | }; |
| 2162 | } |
| 2163 | const maximumHeight = Math.max(1, bounds.height - resolved.y - 12); |
| 2164 | const height = clamp(resolved.height + dy, Math.min(minimumHeight, maximumHeight), maximumHeight); |
| 2165 | if (edge === "bottom") return { |
| 2166 | ...resolved, |
| 2167 | height, |
| 2168 | heightMode: "manual" |
| 2169 | }; |
| 2170 | const maximumWidth = Math.max(1, Math.min(640, bounds.width - resolved.x - 12)); |
| 2171 | const width = clamp(resolved.width + dx, Math.min(minimumWidth, maximumWidth), maximumWidth); |
| 2172 | return { |
| 2173 | ...resolved, |
| 2174 | width, |
| 2175 | height, |
| 2176 | heightMode: "manual" |
| 2177 | }; |
| 2178 | } |
| 2179 | //#endregion |
| 2180 | //#region lib/client/ActivityPanel.js |
| 2181 | /** |
| 2182 | * AgentTeams activity panel: the top-right floater monitoring every team. |
| 2183 | * |
| 2184 | * Modeled on the Claude Code desktop SessionActivityPanel: a shell-overlay |
| 2185 | * panel that docks at the conversation's top-right edge by default, can be |
| 2186 | * dragged into a floating window, resized, and folded into an activity badge. |
| 2187 | * On wide viewports the docked panel makes the conversation column yield |
| 2188 | * space; narrow viewports keep a simple inset overlay. It |
| 2189 | * polls the host `/plugins/dsh-agent-teams/state` route for |
| 2190 | * server-side snapshots (durable files + live subagent activity), with a |
| 2191 | * collapsed badge that auto-expands once when activity appears. Archived |
| 2192 | * teams stay available for the owning conversation after live work ends. |
| 2193 | * |
| 2194 | * The floater mounts in ui-layout's additive `shell.overlay`; it is not a |
| 2195 | * conversation node — the in-conversation panel was removed in favor of this |
| 2196 | * always-available monitor. |
| 2197 | * @module dsh-agent-teams/client/activity |
| 2198 | */ |
| 2199 | /** Grace before the panel collapses once no team remains. */ |
| 2200 | const AUTOCLOSE_GRACE_MS = 2e3; |
| 2201 | /** |
| 2202 | * Page-settle window after mount: activity restored on page load only shows |
| 2203 | * the collapsed badge, so the panel never yanks the conversation column |
| 2204 | * right after load. New activity after this window auto-expands as usual. |
| 2205 | */ |
| 2206 | const AUTO_OPEN_SETTLE_MS = 4e3; |
| 2207 | /** Root marker shared with the panel CSS while the shell overlay is expanded. */ |
| 2208 | const PANEL_OPEN_ATTRIBUTE = "data-agent-teams-panel-open"; |
| 2209 | /** Shared width concession consumed by the conversation root CSS. */ |
| 2210 | const PANEL_SHIFT_PROPERTY = "--agent-teams-panel-shift"; |
| 2211 | const PANEL_CONVERSATION_GAP = 14; |
| 2212 | const MOVE_THRESHOLD = 4; |
| 2213 | const CAPTAIN_ASSIGNEE = "captain"; |
| 2214 | function initialPanelLayout() { |
| 2215 | if (typeof window === "undefined") return DEFAULT_PANEL_LAYOUT; |
| 2216 | return parsePanelLayout(window.localStorage.getItem(PANEL_LAYOUT_STORAGE_KEY)); |
| 2217 | } |
| 2218 | function initialPanelBounds() { |
| 2219 | if (typeof window === "undefined") return { |
| 2220 | width: 1440, |
| 2221 | height: 900, |
| 2222 | anchorRight: 1440 |
| 2223 | }; |
| 2224 | return { |
| 2225 | width: window.innerWidth, |
| 2226 | height: window.innerHeight, |
| 2227 | anchorRight: window.innerWidth |
| 2228 | }; |
| 2229 | } |
| 2230 | /** Initial-letter fallback for unmatched roles. */ |
| 2231 | function memberInitial(name) { |
| 2232 | return name.trim().slice(0, 1).toUpperCase() || "?"; |
| 2233 | } |
| 2234 | function stableHash(value) { |
| 2235 | let hash = 0; |
| 2236 | for (let index = 0; index < value.length; index += 1) hash = (hash << 5) - hash + value.charCodeAt(index) | 0; |
| 2237 | return Math.abs(hash); |
| 2238 | } |
| 2239 | const ACCENTS = [ |
| 2240 | "var(--dsw-alias-state-business-primary)", |
| 2241 | "var(--dsw-alias-state-success-primary)", |
| 2242 | "var(--dsw-alias-state-error-primary)", |
| 2243 | "var(--dsw-alias-state-warn-primary)", |
| 2244 | "var(--dsw-alias-label-tertiary)" |
| 2245 | ]; |
| 2246 | function accentOf(id) { |
| 2247 | return ACCENTS[stableHash(id) % ACCENTS.length] ?? ACCENTS[0]; |
| 2248 | } |
| 2249 | /** Badge text follows the raw task status: |
| 2250 | * claimed/pending/failed/cancelled keep their own labels and colors. */ |
| 2251 | const TASK_STATUS_LABEL = { |
| 2252 | pending: "task.status.pending", |
| 2253 | claimed: "task.status.claimed", |
| 2254 | in_progress: "task.status.inProgress", |
| 2255 | completed: "task.status.completed", |
| 2256 | failed: "task.status.failed", |
| 2257 | cancelled: "task.status.cancelled" |
| 2258 | }; |
| 2259 | function taskStatusLabel(status, t) { |
| 2260 | const key = TASK_STATUS_LABEL[status]; |
| 2261 | return key === void 0 ? status : t(key); |
| 2262 | } |
| 2263 | function formatTaskIds(ids, t) { |
| 2264 | return ids.join(t("format.listSeparator")); |
| 2265 | } |
| 2266 | function taskTitle(task, model) { |
| 2267 | const extras = [ |
| 2268 | task.kind, |
| 2269 | task.round === void 0 ? void 0 : `r${task.round}`, |
| 2270 | task.verdict, |
| 2271 | task.verdictStale === void 0 ? void 0 : `⚠ ${task.verdictStale}`, |
| 2272 | model === "" ? void 0 : model |
| 2273 | ].filter((item) => item !== void 0); |
| 2274 | return extras.length === 0 ? `${task.id} · ${task.subject}` : `${task.id} · ${task.subject} · ${extras.join(" · ")}`; |
| 2275 | } |
| 2276 | /** Badge/bar coloring key: visual state, widened for terminal statuses. */ |
| 2277 | function taskTone(state, status) { |
| 2278 | if (status === "failed") return "failed"; |
| 2279 | if (status === "cancelled") return "cancelled"; |
| 2280 | return state; |
| 2281 | } |
| 2282 | function Chevron({ open }) { |
| 2283 | return (0, react_jsx_runtime.jsx)("svg", { |
| 2284 | className: ActivityPanel_module_css_default.chevron, |
| 2285 | "data-open": open, |
| 2286 | width: "9", |
| 2287 | height: "9", |
| 2288 | viewBox: "0 0 10 10", |
| 2289 | fill: "none", |
| 2290 | stroke: "currentColor", |
| 2291 | strokeWidth: "1.5", |
| 2292 | strokeLinecap: "round", |
| 2293 | "aria-hidden": true, |
| 2294 | children: (0, react_jsx_runtime.jsx)("path", { d: "M3.5 2l3 3-3 3" }) |
| 2295 | }); |
| 2296 | } |
| 2297 | function WorkGlyph({ active }) { |
| 2298 | return (0, react_jsx_runtime.jsx)("svg", { |
| 2299 | className: ActivityPanel_module_css_default.workGlyph, |
| 2300 | "data-active": active, |
| 2301 | width: "11", |
| 2302 | height: "11", |
| 2303 | viewBox: "0 0 11 11", |
| 2304 | fill: "currentColor", |
| 2305 | "aria-hidden": true, |
| 2306 | children: [ |
| 2307 | [0, 0], |
| 2308 | [4.2, 0], |
| 2309 | [8.4, 0], |
| 2310 | [0, 4.2], |
| 2311 | [4.2, 4.2], |
| 2312 | [8.4, 4.2] |
| 2313 | ].map(([x, y], index) => (0, react_jsx_runtime.jsx)("rect", { |
| 2314 | x, |
| 2315 | y, |
| 2316 | width: "2.6", |
| 2317 | height: "2.6", |
| 2318 | rx: ".6", |
| 2319 | style: { animationDelay: `${index * .15}s` } |
| 2320 | }, `${x}:${y}`)) |
| 2321 | }); |
| 2322 | } |
| 2323 | /** Collapsed badge: an always-visible corner pill while any team exists. */ |
| 2324 | function CollapsedBadge({ count, busy, onClick, t }) { |
| 2325 | return (0, react_jsx_runtime.jsxs)("button", { |
| 2326 | type: "button", |
| 2327 | className: ActivityPanel_module_css_default.badge, |
| 2328 | "data-agent-teams-collapsed": true, |
| 2329 | "data-busy": busy, |
| 2330 | onClick, |
| 2331 | "aria-label": t("activity.badgeAria", { count }), |
| 2332 | children: [(0, react_jsx_runtime.jsx)("span", { |
| 2333 | className: ActivityPanel_module_css_default.badgeDot, |
| 2334 | "data-busy": busy, |
| 2335 | "aria-hidden": true |
| 2336 | }), (0, react_jsx_runtime.jsx)("span", { |
| 2337 | className: ActivityPanel_module_css_default.badgeCount, |
| 2338 | children: count |
| 2339 | })] |
| 2340 | }); |
| 2341 | } |
| 2342 | function memberStateLabel(member, tasks, historic, t) { |
| 2343 | const owned = tasks.filter((task) => task.assignee === member.name); |
| 2344 | if (member.activity === "working") return t("member.state.working"); |
| 2345 | if (owned.some((task) => task.status === "failed")) return t("member.state.failed"); |
| 2346 | if (owned.some((task) => task.state === "blocked")) return t("member.state.waiting"); |
| 2347 | if (owned.length > 0 && owned.every((task) => task.status === "completed")) return t("member.state.delivered"); |
| 2348 | if (member.status === "removed") return t(historic ? "member.state.left" : "member.state.removed"); |
| 2349 | if (owned.length > 0) return t("member.state.pending"); |
| 2350 | return t("member.state.unassigned"); |
| 2351 | } |
| 2352 | function memberStatusText(member, tasks, t) { |
| 2353 | const owned = tasks.filter((task) => task.assignee === member.name); |
| 2354 | const current = owned.find((task) => task.id === member.currentTask); |
| 2355 | const blocked = owned.find((task) => task.state === "blocked"); |
| 2356 | if (member.activity === "working" && current !== void 0) { |
| 2357 | const model = taskModelLabel(current, [member]); |
| 2358 | return model === "" ? t("member.status.executing", { taskId: current.id }) : t("member.status.executingModel", { |
| 2359 | taskId: current.id, |
| 2360 | model |
| 2361 | }); |
| 2362 | } |
| 2363 | if (member.activity === "working") return t("member.status.working"); |
| 2364 | if (blocked !== void 0) { |
| 2365 | const dependency = tasks.find((task) => blocked.dependencies.includes(task.id) && task.state !== "completed"); |
| 2366 | if (dependency !== void 0) return t("member.status.waitingOn", { |
| 2367 | taskId: dependency.id, |
| 2368 | assignee: dependency.assignee || t("task.assignee.unclaimed") |
| 2369 | }); |
| 2370 | return t("member.status.waitingPrerequisite"); |
| 2371 | } |
| 2372 | if (member.total === 0) return t("member.status.waitingAssignment"); |
| 2373 | if (member.done === member.total) return t("member.status.delivered"); |
| 2374 | if (owned.some((task) => task.status === "failed")) return t("task.detail.failed"); |
| 2375 | if (owned.length > 0 && owned.every((task) => task.status === "completed" || task.status === "cancelled")) return t("member.status.settled"); |
| 2376 | return t(member.activity === "idle" ? "member.status.idle" : "member.status.unknown"); |
| 2377 | } |
| 2378 | function compactTaskLabel(subject) { |
| 2379 | const withoutVerb = subject.replace(/^开发\s*/u, "").replace(/^\d+[-_.、\s]*/u, ""); |
| 2380 | const head = withoutVerb.split(/[((·::]/u)[0]?.trim() ?? withoutVerb; |
| 2381 | return head.length > 18 ? `${head.slice(0, 17)}…` : head; |
| 2382 | } |
| 2383 | function taskSummary(team, t, discarded = false) { |
| 2384 | const completed = team.tasks.filter((task) => task.status === "completed"); |
| 2385 | const cancelled = team.tasks.filter((task) => task.status === "cancelled"); |
| 2386 | const running = team.tasks.filter((task) => task.state === "running"); |
| 2387 | const claimed = team.tasks.filter((task) => task.state === "claimed"); |
| 2388 | const blocked = team.tasks.filter((task) => task.state === "blocked"); |
| 2389 | const ready = team.tasks.filter((task) => task.state === "open" && task.status !== "completed" && task.status !== "failed" && task.status !== "cancelled"); |
| 2390 | const failed = team.tasks.filter((task) => task.status === "failed"); |
| 2391 | if (discarded) return t("task.summary.discarded", { count: team.tasks.length }); |
| 2392 | if (team.tasks.length === 0) return t("task.summary.waitingBreakdown"); |
| 2393 | if (team.phase === "staged") return t("task.summary.staged", { count: team.tasks.length }); |
| 2394 | if (completed.length === team.tasks.length) return t("task.summary.allDelivered", { count: completed.length }); |
| 2395 | if (completed.length + cancelled.length + failed.length === team.tasks.length) return t("task.summary.ended", { |
| 2396 | completed: completed.length, |
| 2397 | cancelled: cancelled.length, |
| 2398 | failed: failed.length |
| 2399 | }); |
| 2400 | if (failed.length > 0 && running.length === 0 && claimed.length === 0 && ready.length === 0 && blocked.length === 0) return t("task.summary.failedSettled", { count: failed.length }); |
| 2401 | if (blocked.length > 0 && running.length > 0) return t("task.summary.blockedAndRunning", { |
| 2402 | tasks: formatTaskIds(blocked.slice(0, 3).map((task) => task.id), t), |
| 2403 | more: blocked.length > 3 ? t("task.summary.more", { count: blocked.length - 3 }) : "" |
| 2404 | }); |
| 2405 | if (running.length > 0) return t("task.summary.running", { tasks: formatTaskIds(running.map((task) => task.id), t) }); |
| 2406 | if (claimed.length > 0) return t("task.summary.claimed", { tasks: formatTaskIds(claimed.map((task) => task.id), t) }); |
| 2407 | if (ready.length > 0) return t("task.summary.ready", { tasks: formatTaskIds(ready.map((task) => task.id), t) }); |
| 2408 | if (blocked.length > 0) return t("task.summary.blocked", { tasks: formatTaskIds(blocked.map((task) => task.id), t) }); |
| 2409 | return t("task.summary.waitingSchedule"); |
| 2410 | } |
| 2411 | function ProgressOverview({ team, t, discarded = false }) { |
| 2412 | const running = discarded ? 0 : team.tasks.filter((task) => task.state === "running").length; |
| 2413 | const claimed = discarded ? 0 : team.tasks.filter((task) => task.state === "claimed").length; |
| 2414 | const blocked = discarded ? 0 : team.tasks.filter((task) => task.state === "blocked").length; |
| 2415 | const completed = discarded ? 0 : team.tasks.filter((task) => task.status === "completed").length; |
| 2416 | const settled = !discarded && team.tasks.length > 0 && team.tasks.every((task) => task.status === "completed" || task.status === "failed" || task.status === "cancelled"); |
| 2417 | const summaryTone = discarded ? "discarded" : blocked > 0 || team.tasks.some((task) => task.status === "failed" || task.status === "cancelled") ? "warning" : settled ? "completed" : "running"; |
| 2418 | return (0, react_jsx_runtime.jsxs)("section", { |
| 2419 | className: ActivityPanel_module_css_default.progressOverview, |
| 2420 | "aria-label": t("progress.aria"), |
| 2421 | "data-progress-summary": true, |
| 2422 | children: [ |
| 2423 | (0, react_jsx_runtime.jsx)("span", { |
| 2424 | className: ActivityPanel_module_css_default.progressTitle, |
| 2425 | children: t("progress.title") |
| 2426 | }), |
| 2427 | team.tasks.length > 0 ? (0, react_jsx_runtime.jsx)("span", { |
| 2428 | className: ActivityPanel_module_css_default.progressSegments, |
| 2429 | "aria-hidden": true, |
| 2430 | children: team.tasks.map((task) => (0, react_jsx_runtime.jsx)("span", { "data-state": discarded ? "cancelled" : taskTone(task.state, task.status) }, task.id)) |
| 2431 | }) : (0, react_jsx_runtime.jsx)("span", { className: ActivityPanel_module_css_default.progressEmpty }), |
| 2432 | (0, react_jsx_runtime.jsxs)("span", { |
| 2433 | className: ActivityPanel_module_css_default.progressLegend, |
| 2434 | children: [ |
| 2435 | (0, react_jsx_runtime.jsx)("span", { |
| 2436 | "data-state": "running", |
| 2437 | children: t("progress.running", { count: running }) |
| 2438 | }), |
| 2439 | claimed > 0 && (0, react_jsx_runtime.jsx)("span", { |
| 2440 | "data-state": "claimed", |
| 2441 | children: t("progress.claimed", { count: claimed }) |
| 2442 | }), |
| 2443 | (0, react_jsx_runtime.jsx)("span", { |
| 2444 | "data-state": "blocked", |
| 2445 | children: t("progress.blocked", { count: blocked }) |
| 2446 | }), |
| 2447 | (0, react_jsx_runtime.jsx)("span", { |
| 2448 | "data-state": "completed", |
| 2449 | children: t("progress.delivered", { count: completed }) |
| 2450 | }) |
| 2451 | ] |
| 2452 | }), |
| 2453 | (0, react_jsx_runtime.jsxs)("span", { |
| 2454 | className: ActivityPanel_module_css_default.progressSummary, |
| 2455 | "data-state": summaryTone, |
| 2456 | children: [(0, react_jsx_runtime.jsx)("span", { className: ActivityPanel_module_css_default.progressSummaryDot }), (0, react_jsx_runtime.jsx)("span", { children: taskSummary(team, t, discarded) })] |
| 2457 | }) |
| 2458 | ] |
| 2459 | }); |
| 2460 | } |
| 2461 | /** Workspace-only summary of durable completion and the current unread inbox. |
| 2462 | * The snapshot is not a chat transcript: it provides at most five unread |
| 2463 | * captain messages, with no timestamps, so do not imply a complete history. |
| 2464 | */ |
| 2465 | function WorkspaceSummary({ team, t, discarded }) { |
| 2466 | const completed = discarded ? 0 : team.tasks.filter((task) => task.status === "completed").length; |
| 2467 | const total = team.tasks.length; |
| 2468 | return (0, react_jsx_runtime.jsxs)("div", { |
| 2469 | className: ActivityPanel_module_css_default.workspaceSummary, |
| 2470 | children: [(0, react_jsx_runtime.jsxs)("section", { |
| 2471 | className: ActivityPanel_module_css_default.completionCard, |
| 2472 | "aria-label": t("progress.aria"), |
| 2473 | children: [(0, react_jsx_runtime.jsx)("h3", { children: t("progress.title") }), (0, react_jsx_runtime.jsxs)("div", { |
| 2474 | className: ActivityPanel_module_css_default.completionBody, |
| 2475 | children: [(0, react_jsx_runtime.jsxs)("div", { |
| 2476 | className: ActivityPanel_module_css_default.completionRing, |
| 2477 | role: "img", |
| 2478 | "aria-label": t("team.stats.completed", { |
| 2479 | completed, |
| 2480 | total |
| 2481 | }), |
| 2482 | "data-completed": completed, |
| 2483 | "data-total": total, |
| 2484 | children: [(0, react_jsx_runtime.jsxs)("svg", { |
| 2485 | viewBox: "0 0 120 120", |
| 2486 | "aria-hidden": true, |
| 2487 | children: [(0, react_jsx_runtime.jsx)("circle", { |
| 2488 | className: ActivityPanel_module_css_default.ringTrack, |
| 2489 | cx: "60", |
| 2490 | cy: "60", |
| 2491 | r: "51" |
| 2492 | }), (0, react_jsx_runtime.jsx)("circle", { |
| 2493 | className: ActivityPanel_module_css_default.ringValue, |
| 2494 | cx: "60", |
| 2495 | cy: "60", |
| 2496 | r: "51", |
| 2497 | pathLength: "100", |
| 2498 | strokeDasharray: `${total === 0 ? 0 : completed / total * 100} 100` |
| 2499 | })] |
| 2500 | }), (0, react_jsx_runtime.jsxs)("span", { |
| 2501 | "aria-hidden": true, |
| 2502 | children: [(0, react_jsx_runtime.jsxs)("strong", { children: [completed, (0, react_jsx_runtime.jsxs)("small", { children: [" / ", total] })] }), (0, react_jsx_runtime.jsx)("span", { children: t(discarded ? "task.status.notRun" : "workspace.completed") })] |
| 2503 | })] |
| 2504 | }), total === 0 ? (0, react_jsx_runtime.jsx)("p", { |
| 2505 | className: ActivityPanel_module_css_default.summaryEmpty, |
| 2506 | children: t("workspace.noTasks") |
| 2507 | }) : (0, react_jsx_runtime.jsx)("ul", { |
| 2508 | className: ActivityPanel_module_css_default.completionTasks, |
| 2509 | tabIndex: 0, |
| 2510 | "aria-label": t("workspace.taskSummary"), |
| 2511 | children: team.tasks.map((task) => (0, react_jsx_runtime.jsxs)("li", { |
| 2512 | "data-state": discarded ? "cancelled" : taskTone(task.state, task.status), |
| 2513 | "data-verdict-stale": task.verdictStale === void 0 ? void 0 : "true", |
| 2514 | title: taskTitle(task, taskModelLabel(task, team.members)), |
| 2515 | children: [ |
| 2516 | (0, react_jsx_runtime.jsx)("span", { |
| 2517 | className: ActivityPanel_module_css_default.completionDot, |
| 2518 | "aria-hidden": true, |
| 2519 | children: task.verdictStale !== void 0 ? "!" : !discarded && task.status === "completed" ? "✓" : "·" |
| 2520 | }), |
| 2521 | (0, react_jsx_runtime.jsx)("span", { |
| 2522 | className: ActivityPanel_module_css_default.completionTaskId, |
| 2523 | children: task.id |
| 2524 | }), |
| 2525 | (0, react_jsx_runtime.jsx)("span", { |
| 2526 | className: ActivityPanel_module_css_default.completionTaskSubject, |
| 2527 | title: task.subject, |
| 2528 | children: task.subject |
| 2529 | }), |
| 2530 | (0, react_jsx_runtime.jsx)("span", { |
| 2531 | className: ActivityPanel_module_css_default.completionTaskStatus, |
| 2532 | children: discarded ? t("task.status.notRun") : task.verdictStale !== void 0 ? t("workspace.verdictStale") : taskStatusLabel(task.status, t) |
| 2533 | }) |
| 2534 | ] |
| 2535 | }, task.id)) |
| 2536 | })] |
| 2537 | })] |
| 2538 | }), (0, react_jsx_runtime.jsxs)("section", { |
| 2539 | className: ActivityPanel_module_css_default.inboxCard, |
| 2540 | "aria-label": t("workspace.inbox"), |
| 2541 | children: [(0, react_jsx_runtime.jsxs)("header", { children: [(0, react_jsx_runtime.jsx)("h3", { children: t("workspace.inbox") }), (0, react_jsx_runtime.jsx)("span", { children: t("workspace.inboxHint") })] }), team.captainInbox.length === 0 ? (0, react_jsx_runtime.jsx)("p", { |
| 2542 | className: ActivityPanel_module_css_default.summaryEmpty, |
| 2543 | children: t("workspace.inboxEmpty") |
| 2544 | }) : (0, react_jsx_runtime.jsx)("ul", { |
| 2545 | className: ActivityPanel_module_css_default.inboxMessages, |
| 2546 | tabIndex: 0, |
| 2547 | "aria-label": t("workspace.inbox"), |
| 2548 | children: team.captainInbox.map((message, index) => { |
| 2549 | const member = team.members.find((candidate) => candidate.name === message.from); |
| 2550 | const art = message.from === CAPTAIN_ASSIGNEE ? LEAD_ART : memberArtUrl(message.from, member?.role ?? ""); |
| 2551 | return (0, react_jsx_runtime.jsxs)("li", { children: [art === null ? (0, react_jsx_runtime.jsx)("span", { |
| 2552 | className: ActivityPanel_module_css_default.inboxInitial, |
| 2553 | "aria-hidden": true, |
| 2554 | children: memberInitial(message.from) |
| 2555 | }) : (0, react_jsx_runtime.jsx)("img", { |
| 2556 | src: art, |
| 2557 | alt: "", |
| 2558 | "aria-hidden": true |
| 2559 | }), (0, react_jsx_runtime.jsxs)("div", { children: [(0, react_jsx_runtime.jsx)("strong", { children: message.from }), (0, react_jsx_runtime.jsx)("p", { children: message.content })] })] }, `${index}:${message.from}`); |
| 2560 | }) |
| 2561 | })] |
| 2562 | })] |
| 2563 | }); |
| 2564 | } |
| 2565 | function DependencyMap({ tasks, members, t, discarded = false, workspace = false, onSelectTask }) { |
| 2566 | const [open, setOpen] = (0, react.useState)(true); |
| 2567 | const [hoverTaskId, setHoverTaskId] = (0, react.useState)(null); |
| 2568 | const [keyboardTaskId, setKeyboardTaskId] = (0, react.useState)(null); |
| 2569 | const [pinnedTaskId, setPinnedTaskId] = (0, react.useState)(null); |
| 2570 | const hoverTimer = (0, react.useRef)(null); |
| 2571 | const focusedTaskId = dependencyFocusTaskId(pinnedTaskId, keyboardTaskId, hoverTaskId); |
| 2572 | const nodeWidth = workspace ? 164 : 92; |
| 2573 | const nodeHeight = workspace ? 76 : 30; |
| 2574 | const layout = (0, react.useMemo)(() => compactDagLayout(tasks, workspace ? { |
| 2575 | nodeWidth: 164, |
| 2576 | nodeHeight: 76, |
| 2577 | columnGap: 36, |
| 2578 | rowGap: 16 |
| 2579 | } : void 0), [tasks, workspace]); |
| 2580 | const parallel = (0, react.useMemo)(() => usesParallelTaskGrid(tasks), [tasks]); |
| 2581 | const related = (0, react.useMemo)(() => focusedTaskId === null ? null : relatedTaskIds(focusedTaskId, tasks), [focusedTaskId, tasks]); |
| 2582 | const scheduleHover = (id) => { |
| 2583 | if (hoverTimer.current !== null) { |
| 2584 | clearTimeout(hoverTimer.current); |
| 2585 | hoverTimer.current = null; |
| 2586 | } |
| 2587 | if (id === null) { |
| 2588 | setHoverTaskId(null); |
| 2589 | return; |
| 2590 | } |
| 2591 | hoverTimer.current = setTimeout(() => { |
| 2592 | hoverTimer.current = null; |
| 2593 | setHoverTaskId(id); |
| 2594 | }, 180); |
| 2595 | }; |
| 2596 | (0, react.useEffect)(() => () => { |
| 2597 | if (hoverTimer.current !== null) clearTimeout(hoverTimer.current); |
| 2598 | }, []); |
| 2599 | (0, react.useEffect)(() => { |
| 2600 | const onKeyDown = (event) => { |
| 2601 | if (event.key === "Escape") { |
| 2602 | setPinnedTaskId(null); |
| 2603 | onSelectTask?.(null); |
| 2604 | } |
| 2605 | }; |
| 2606 | window.addEventListener("keydown", onKeyDown); |
| 2607 | return () => { |
| 2608 | window.removeEventListener("keydown", onKeyDown); |
| 2609 | }; |
| 2610 | }, [onSelectTask]); |
| 2611 | if (tasks.length === 0) return null; |
| 2612 | const fallbackTask = tasks.find((task) => task.state === "blocked") ?? tasks.find((task) => task.state === "running") ?? tasks.find((task) => task.state === "claimed") ?? tasks[0]; |
| 2613 | const detailTask = tasks.find((task) => task.id === focusedTaskId) ?? fallbackTask; |
| 2614 | const detailModel = taskModelLabel(detailTask, members); |
| 2615 | const waitingOn = detailTask.dependencies.filter((dependency) => tasks.find((task) => task.id === dependency)?.status !== "completed"); |
| 2616 | const dependents = tasks.filter((task) => task.dependencies.includes(detailTask.id)); |
| 2617 | return (0, react_jsx_runtime.jsxs)("section", { |
| 2618 | className: ActivityPanel_module_css_default.dependencySection, |
| 2619 | "aria-label": t("dependency.aria"), |
| 2620 | "data-dependency-map": true, |
| 2621 | children: [(0, react_jsx_runtime.jsxs)("header", { |
| 2622 | className: ActivityPanel_module_css_default.sectionHead, |
| 2623 | children: [(0, react_jsx_runtime.jsxs)("button", { |
| 2624 | type: "button", |
| 2625 | className: ActivityPanel_module_css_default.sectionToggleTitle, |
| 2626 | onClick: () => { |
| 2627 | setOpen((current) => !current); |
| 2628 | }, |
| 2629 | "aria-expanded": open, |
| 2630 | children: [ |
| 2631 | (0, react_jsx_runtime.jsx)(Chevron, { open }), |
| 2632 | (0, react_jsx_runtime.jsx)(IconBranchOutline16, {}), |
| 2633 | " ", |
| 2634 | t(parallel ? "dependency.parallel" : "dependency.title") |
| 2635 | ] |
| 2636 | }), (0, react_jsx_runtime.jsx)("span", { |
| 2637 | className: ActivityPanel_module_css_default.sectionHint, |
| 2638 | children: pinnedTaskId === null ? t(parallel ? "dependency.hint.parallel" : workspace ? "workspace.dependencies" : "dependency.hint.chain") : t("dependency.hint.pinned", { taskId: pinnedTaskId }) |
| 2639 | })] |
| 2640 | }), open && (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)("div", { |
| 2641 | className: ActivityPanel_module_css_default.dagViewport, |
| 2642 | children: (0, react_jsx_runtime.jsxs)("div", { |
| 2643 | className: ActivityPanel_module_css_default.dagCanvas, |
| 2644 | "data-layout": parallel ? "parallel" : "dependency", |
| 2645 | style: parallel ? void 0 : { |
| 2646 | width: layout.width, |
| 2647 | height: layout.height |
| 2648 | }, |
| 2649 | children: [!parallel && (0, react_jsx_runtime.jsx)("svg", { |
| 2650 | className: ActivityPanel_module_css_default.dagEdges, |
| 2651 | width: layout.width, |
| 2652 | height: layout.height, |
| 2653 | "aria-hidden": true, |
| 2654 | children: layout.edges.map((edge) => { |
| 2655 | const active = related !== null && related.has(edge.from) && related.has(edge.to); |
| 2656 | return (0, react_jsx_runtime.jsx)("path", { |
| 2657 | d: edge.path, |
| 2658 | "data-active": active, |
| 2659 | "data-dimmed": related !== null && !active |
| 2660 | }, `${edge.from}:${edge.to}`); |
| 2661 | }) |
| 2662 | }), layout.nodes.map(({ task, x, y }) => { |
| 2663 | const model = taskModelLabel(task, members); |
| 2664 | return (0, react_jsx_runtime.jsxs)("button", { |
| 2665 | type: "button", |
| 2666 | className: ActivityPanel_module_css_default.dagNode, |
| 2667 | style: parallel ? { height: nodeHeight } : { |
| 2668 | left: x, |
| 2669 | top: y, |
| 2670 | width: nodeWidth, |
| 2671 | height: nodeHeight |
| 2672 | }, |
| 2673 | "data-task-id": task.id, |
| 2674 | "data-state": discarded ? "cancelled" : taskTone(task.state, task.status), |
| 2675 | "data-verdict-stale": task.verdictStale === void 0 ? void 0 : "true", |
| 2676 | "data-task-model": model || void 0, |
| 2677 | "data-focused": related?.has(task.id) ?? false, |
| 2678 | "data-dimmed": related !== null && !related.has(task.id), |
| 2679 | "aria-pressed": pinnedTaskId === task.id, |
| 2680 | title: taskTitle(task, model), |
| 2681 | onClick: () => { |
| 2682 | const next = pinnedTaskId === task.id ? null : task.id; |
| 2683 | setPinnedTaskId(next); |
| 2684 | onSelectTask?.(next); |
| 2685 | }, |
| 2686 | onMouseEnter: () => { |
| 2687 | scheduleHover(task.id); |
| 2688 | }, |
| 2689 | onMouseLeave: () => { |
| 2690 | scheduleHover(null); |
| 2691 | }, |
| 2692 | onFocus: () => { |
| 2693 | setKeyboardTaskId(task.id); |
| 2694 | }, |
| 2695 | onBlur: () => { |
| 2696 | setKeyboardTaskId(null); |
| 2697 | }, |
| 2698 | children: [ |
| 2699 | (0, react_jsx_runtime.jsxs)("span", { |
| 2700 | className: ActivityPanel_module_css_default.dagNodeHead, |
| 2701 | children: [ |
| 2702 | (0, react_jsx_runtime.jsx)("span", { className: ActivityPanel_module_css_default.dagNodeDot }), |
| 2703 | task.id, |
| 2704 | workspace && (0, react_jsx_runtime.jsx)("span", { |
| 2705 | className: ActivityPanel_module_css_default.dagOwner, |
| 2706 | children: task.assignee || t("task.assignee.unclaimed") |
| 2707 | }) |
| 2708 | ] |
| 2709 | }), |
| 2710 | (0, react_jsx_runtime.jsx)("span", { |
| 2711 | className: ActivityPanel_module_css_default.dagNodeLabel, |
| 2712 | children: workspace ? task.subject : compactTaskLabel(task.subject) |
| 2713 | }), |
| 2714 | !discarded && task.state === "claimed" && (0, react_jsx_runtime.jsx)("span", { |
| 2715 | className: ActivityPanel_module_css_default.dagClaimedState, |
| 2716 | children: t("task.status.claimed") |
| 2717 | }), |
| 2718 | task.state === "running" && (0, react_jsx_runtime.jsx)("span", { |
| 2719 | className: ActivityPanel_module_css_default.dagRunningState, |
| 2720 | "aria-label": t("task.runningAria"), |
| 2721 | children: (0, react_jsx_runtime.jsx)(WorkGlyph, { active: true }) |
| 2722 | }) |
| 2723 | ] |
| 2724 | }, task.id); |
| 2725 | })] |
| 2726 | }) |
| 2727 | }), (0, react_jsx_runtime.jsxs)("section", { |
| 2728 | className: ActivityPanel_module_css_default.taskDetail, |
| 2729 | "data-task-detail": detailTask.id, |
| 2730 | children: [ |
| 2731 | (0, react_jsx_runtime.jsxs)("span", { |
| 2732 | className: ActivityPanel_module_css_default.taskDetailHead, |
| 2733 | children: [ |
| 2734 | (0, react_jsx_runtime.jsx)("span", { |
| 2735 | className: ActivityPanel_module_css_default.taskDetailId, |
| 2736 | children: detailTask.id |
| 2737 | }), |
| 2738 | (0, react_jsx_runtime.jsx)("span", { |
| 2739 | className: ActivityPanel_module_css_default.taskDetailSubject, |
| 2740 | title: detailTask.subject, |
| 2741 | children: detailTask.subject.replace(/^开发\s*/u, "") |
| 2742 | }), |
| 2743 | (0, react_jsx_runtime.jsx)("span", { |
| 2744 | className: ActivityPanel_module_css_default.taskDetailBadge, |
| 2745 | "data-state": discarded ? "cancelled" : taskTone(detailTask.state, detailTask.status), |
| 2746 | children: discarded ? t("task.status.notRun") : taskStatusLabel(detailTask.status, t) |
| 2747 | }) |
| 2748 | ] |
| 2749 | }), |
| 2750 | (0, react_jsx_runtime.jsxs)("span", { |
| 2751 | className: ActivityPanel_module_css_default.taskDetailLine, |
| 2752 | children: [ |
| 2753 | detailTask.assignee || t("task.assignee.unclaimed"), |
| 2754 | " · ", |
| 2755 | discarded ? t("task.detail.notRun") : detailTask.status === "completed" ? t("task.detail.completed") : detailTask.status === "cancelled" ? t("task.detail.cancelled") : detailTask.status === "failed" ? t("task.detail.failed") : detailTask.dependencies.length === 0 ? t("task.detail.noPrerequisite") : waitingOn.length === 0 ? t("task.detail.ready") : t("task.detail.waitingOn", { tasks: formatTaskIds(waitingOn, t) }) |
| 2756 | ] |
| 2757 | }), |
| 2758 | detailModel !== "" && (0, react_jsx_runtime.jsx)("span", { |
| 2759 | className: ActivityPanel_module_css_default.taskDetailModel, |
| 2760 | "data-task-model": detailModel, |
| 2761 | children: t("task.model", { model: detailModel }) |
| 2762 | }), |
| 2763 | (0, react_jsx_runtime.jsx)("span", { |
| 2764 | className: ActivityPanel_module_css_default.taskDetailMeta, |
| 2765 | children: dependents.length === 0 ? t("task.detail.noDownstream") : t("task.detail.unlocks", { tasks: formatTaskIds(dependents.map((task) => task.id), t) }) |
| 2766 | }) |
| 2767 | ] |
| 2768 | })] })] |
| 2769 | }); |
| 2770 | } |
| 2771 | function TeamSection({ team, modelDirectory, onContinuePlanning, onDiscarded, onNavigate, t, historic = false, workspace = false }) { |
| 2772 | const [selectedTaskId, setSelectedTaskId] = (0, react.useState)(null); |
| 2773 | const selectedAssignee = team.tasks.find((task) => task.id === selectedTaskId)?.assignee; |
| 2774 | const [membersOpen, setMembersOpen] = (0, react.useState)(workspace); |
| 2775 | const [stopOpen, setStopOpen] = (0, react.useState)(false); |
| 2776 | const [stopping, setStopping] = (0, react.useState)(false); |
| 2777 | const [stopError, setStopError] = (0, react.useState)(""); |
| 2778 | const discarded = historic && team.phase === "staged"; |
| 2779 | const stopped = !historic && team.halted === true; |
| 2780 | const busyCount = team.members.filter((member) => member.activity === "working").length; |
| 2781 | const assignedCount = team.tasks.filter((task) => task.assignee !== "" && task.assignee !== CAPTAIN_ASSIGNEE).length; |
| 2782 | const captainOwned = team.tasks.filter((task) => task.assignee === CAPTAIN_ASSIGNEE && task.status !== "completed" && task.status !== "failed" && task.status !== "cancelled"); |
| 2783 | const captainBusy = captainOwned.length > 0; |
| 2784 | const captainTaskIds = formatTaskIds(captainOwned.map((task) => task.id), t); |
| 2785 | const completedCount = team.tasks.filter((task) => task.status === "completed").length; |
| 2786 | const allCompleted = team.tasks.length > 0 && completedCount === team.tasks.length; |
| 2787 | const allSettled = team.tasks.length > 0 && team.tasks.every((task) => task.status === "completed" || task.status === "failed" || task.status === "cancelled"); |
| 2788 | const unfinishedCount = team.tasks.filter((task) => task.status !== "completed" && task.status !== "failed" && task.status !== "cancelled").length; |
| 2789 | const canStop = !historic && team.phase === "running" && team.halted !== true && teamIsActive(team); |
| 2790 | const stopTeam = async () => { |
| 2791 | if (stopping) return; |
| 2792 | setStopping(true); |
| 2793 | setStopError(""); |
| 2794 | try { |
| 2795 | const response = await fetch(ACTIVITY_HALT_URL, { |
| 2796 | method: "POST", |
| 2797 | cache: "no-store", |
| 2798 | headers: { "content-type": "application/json" }, |
| 2799 | body: JSON.stringify({ |
| 2800 | sessionId: team.captainSessionId, |
| 2801 | teamId: team.teamId |
| 2802 | }) |
| 2803 | }); |
| 2804 | if (!response.ok) { |
| 2805 | let message = t("team.stopRequestFailed"); |
| 2806 | try { |
| 2807 | const body = await response.json(); |
| 2808 | if (typeof body.error === "string" && body.error.trim() !== "") message = body.error; |
| 2809 | } catch {} |
| 2810 | throw new Error(message); |
| 2811 | } |
| 2812 | setStopOpen(false); |
| 2813 | } catch (error) { |
| 2814 | setStopError(t("team.stopFailed", { message: error instanceof Error ? error.message : String(error) })); |
| 2815 | } finally { |
| 2816 | setStopping(false); |
| 2817 | } |
| 2818 | }; |
| 2819 | return (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsxs)("section", { |
| 2820 | className: ActivityPanel_module_css_default.team, |
| 2821 | "data-team-id": team.teamId, |
| 2822 | "data-workspace-team": workspace || void 0, |
| 2823 | children: [ |
| 2824 | (0, react_jsx_runtime.jsxs)("header", { |
| 2825 | className: ActivityPanel_module_css_default.teamHead, |
| 2826 | children: [ |
| 2827 | (0, react_jsx_runtime.jsx)("span", { |
| 2828 | className: ActivityPanel_module_css_default.teamName, |
| 2829 | title: team.name, |
| 2830 | children: team.name |
| 2831 | }), |
| 2832 | historic && (0, react_jsx_runtime.jsx)("span", { |
| 2833 | className: ActivityPanel_module_css_default.historicPill, |
| 2834 | children: t(discarded ? "team.discarded" : "team.ended") |
| 2835 | }), |
| 2836 | stopped && (0, react_jsx_runtime.jsx)("span", { |
| 2837 | className: ActivityPanel_module_css_default.historicPill, |
| 2838 | children: t("team.stopped") |
| 2839 | }), |
| 2840 | (0, react_jsx_runtime.jsxs)("span", { |
| 2841 | className: ActivityPanel_module_css_default.teamStats, |
| 2842 | children: [ |
| 2843 | (0, react_jsx_runtime.jsx)("span", { |
| 2844 | "data-stat": "members", |
| 2845 | children: t("team.stats.members", { count: team.members.length }) |
| 2846 | }), |
| 2847 | (0, react_jsx_runtime.jsx)("span", { |
| 2848 | "data-stat": "tasks", |
| 2849 | children: t("team.stats.completed", { |
| 2850 | completed: completedCount, |
| 2851 | total: team.tasks.length |
| 2852 | }) |
| 2853 | }), |
| 2854 | (0, react_jsx_runtime.jsx)("span", { |
| 2855 | "data-stat": "messages", |
| 2856 | children: t("team.stats.messages", { count: team.messageCount }) |
| 2857 | }) |
| 2858 | ] |
| 2859 | }), |
| 2860 | canStop && (0, react_jsx_runtime.jsx)("button", { |
| 2861 | type: "button", |
| 2862 | className: ActivityPanel_module_css_default.teamStopButton, |
| 2863 | "aria-label": t("team.stop"), |
| 2864 | title: t("team.stop"), |
| 2865 | onClick: () => { |
| 2866 | setStopError(""); |
| 2867 | setStopOpen(true); |
| 2868 | }, |
| 2869 | children: (0, react_jsx_runtime.jsx)(IconStopFill16, {}) |
| 2870 | }) |
| 2871 | ] |
| 2872 | }), |
| 2873 | team.phase === "staged" && !historic && modelDirectory !== void 0 && onContinuePlanning !== void 0 && onDiscarded !== void 0 && (0, react_jsx_runtime.jsx)(StagingPlanEditor, { |
| 2874 | team, |
| 2875 | modelDirectory, |
| 2876 | onContinuePlanning, |
| 2877 | onDiscarded, |
| 2878 | t |
| 2879 | }), |
| 2880 | (0, react_jsx_runtime.jsxs)("section", { |
| 2881 | className: ActivityPanel_module_css_default.delegationSection, |
| 2882 | "aria-label": t("delegation.aria"), |
| 2883 | "data-delegation-map": true, |
| 2884 | children: [ |
| 2885 | (0, react_jsx_runtime.jsxs)("div", { |
| 2886 | className: ActivityPanel_module_css_default.captainNode, |
| 2887 | children: [ |
| 2888 | (0, react_jsx_runtime.jsx)("span", { |
| 2889 | className: ActivityPanel_module_css_default.captainAvatar, |
| 2890 | children: (0, react_jsx_runtime.jsx)("img", { |
| 2891 | className: ActivityPanel_module_css_default.leadAvatar, |
| 2892 | src: LEAD_ART, |
| 2893 | alt: "", |
| 2894 | "aria-hidden": true |
| 2895 | }) |
| 2896 | }), |
| 2897 | (0, react_jsx_runtime.jsxs)("span", { |
| 2898 | className: ActivityPanel_module_css_default.captainInfo, |
| 2899 | children: [(0, react_jsx_runtime.jsxs)("span", { |
| 2900 | className: ActivityPanel_module_css_default.captainLine, |
| 2901 | children: [(0, react_jsx_runtime.jsx)("span", { |
| 2902 | className: ActivityPanel_module_css_default.captainName, |
| 2903 | children: t("captain.name") |
| 2904 | }), (0, react_jsx_runtime.jsx)("span", { |
| 2905 | className: ActivityPanel_module_css_default.captainRole, |
| 2906 | children: t("captain.role") |
| 2907 | })] |
| 2908 | }), (0, react_jsx_runtime.jsx)("span", { |
| 2909 | className: ActivityPanel_module_css_default.captainSummary, |
| 2910 | children: discarded ? t("captain.summary.discarded", { |
| 2911 | tasks: team.tasks.length, |
| 2912 | members: team.members.length |
| 2913 | }) : captainBusy ? t("captain.summary.withTakeover", { |
| 2914 | tasks: assignedCount, |
| 2915 | captainTasks: captainTaskIds |
| 2916 | }) : team.phase === "staged" ? t(team.planReviewState === "awaiting_feedback" ? "captain.summary.awaitingFeedback" : "captain.summary.staged", { |
| 2917 | tasks: team.tasks.length, |
| 2918 | members: team.members.length |
| 2919 | }) : t("captain.summary", { |
| 2920 | tasks: assignedCount, |
| 2921 | members: team.members.length |
| 2922 | }) |
| 2923 | })] |
| 2924 | }), |
| 2925 | (0, react_jsx_runtime.jsxs)("span", { |
| 2926 | className: ActivityPanel_module_css_default.captainState, |
| 2927 | "data-busy": captainBusy || busyCount > 0, |
| 2928 | children: [(0, react_jsx_runtime.jsx)(WorkGlyph, { active: captainBusy || busyCount > 0 }), discarded ? t("captain.state.discarded") : captainBusy ? t("captain.state.takeover", { tasks: captainTaskIds }) : team.phase === "staged" ? t(team.planReviewState === "awaiting_feedback" ? "captain.state.awaitingFeedback" : "captain.state.staged") : busyCount > 0 ? t("captain.state.working", { count: busyCount }) : t(allCompleted ? "captain.state.collected" : allSettled ? "captain.state.settled" : "captain.state.waiting")] |
| 2929 | }) |
| 2930 | ] |
| 2931 | }), |
| 2932 | (0, react_jsx_runtime.jsx)(ProgressOverview, { |
| 2933 | team, |
| 2934 | t, |
| 2935 | discarded |
| 2936 | }), |
| 2937 | (() => { |
| 2938 | const orderedMembers = orderDelegationMembers(team.members, team.tasks); |
| 2939 | const runningMembers = orderedMembers.filter((member) => member.activity === "working" || member.status === "working" || team.tasks.some((task) => task.assignee === member.name && (task.status === "pending" || task.status === "claimed" || task.status === "in_progress"))); |
| 2940 | const visibleMembers = membersOpen ? orderedMembers : runningMembers; |
| 2941 | const hiddenFinishedCount = orderedMembers.length - visibleMembers.length; |
| 2942 | const expandLabel = membersOpen ? t("members.collapse") : hiddenFinishedCount > 0 ? t("members.expandFinished", { count: hiddenFinishedCount }) : t("members.expand"); |
| 2943 | return (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsxs)("button", { |
| 2944 | type: "button", |
| 2945 | className: ActivityPanel_module_css_default.membersToggle, |
| 2946 | onClick: () => { |
| 2947 | setMembersOpen((current) => !current); |
| 2948 | }, |
| 2949 | "aria-expanded": membersOpen, |
| 2950 | "data-members-toggle": true, |
| 2951 | children: [(0, react_jsx_runtime.jsxs)("span", { children: [(0, react_jsx_runtime.jsx)(Chevron, { open: membersOpen }), t("members.toggle", { count: team.members.length })] }), (0, react_jsx_runtime.jsx)("span", { children: expandLabel })] |
| 2952 | }), (membersOpen || visibleMembers.length > 0) && (0, react_jsx_runtime.jsxs)("div", { |
| 2953 | className: ActivityPanel_module_css_default.delegationTree, |
| 2954 | children: [team.members.length === 0 && (0, react_jsx_runtime.jsx)("span", { |
| 2955 | className: ActivityPanel_module_css_default.emptyHint, |
| 2956 | children: t("members.empty") |
| 2957 | }), visibleMembers.map((member) => { |
| 2958 | const owned = team.tasks.filter((task) => task.assignee === member.name); |
| 2959 | const memberModel = memberRouteLabel(member); |
| 2960 | return (0, react_jsx_runtime.jsxs)("div", { |
| 2961 | className: ActivityPanel_module_css_default.memberBlock, |
| 2962 | "data-activity": member.activity, |
| 2963 | "data-selected-member": workspace && selectedAssignee === member.name || void 0, |
| 2964 | children: [ |
| 2965 | (0, react_jsx_runtime.jsx)("span", { |
| 2966 | className: ActivityPanel_module_css_default.memberBranch, |
| 2967 | "aria-hidden": true, |
| 2968 | children: (0, react_jsx_runtime.jsx)("span", {}) |
| 2969 | }), |
| 2970 | (0, react_jsx_runtime.jsxs)("button", { |
| 2971 | type: "button", |
| 2972 | className: ActivityPanel_module_css_default.memberRow, |
| 2973 | "data-activity": member.activity, |
| 2974 | onClick: () => { |
| 2975 | if (member.id !== "") onNavigate(team.captainSessionId, member.id); |
| 2976 | }, |
| 2977 | children: [ |
| 2978 | (0, react_jsx_runtime.jsxs)("span", { |
| 2979 | className: ActivityPanel_module_css_default.memberAvatar, |
| 2980 | "data-unread": member.unread > 0, |
| 2981 | children: [memberArtUrl(member.name, member.role) !== null ? (0, react_jsx_runtime.jsx)("img", { |
| 2982 | className: ActivityPanel_module_css_default.memberArt, |
| 2983 | src: memberArtUrl(member.name, member.role) ?? "", |
| 2984 | alt: "", |
| 2985 | "aria-hidden": true |
| 2986 | }) : (0, react_jsx_runtime.jsx)("span", { |
| 2987 | className: ActivityPanel_module_css_default.memberInitial, |
| 2988 | style: { background: accentOf(member.id) }, |
| 2989 | children: memberInitial(member.name) |
| 2990 | }), (0, react_jsx_runtime.jsx)("img", { |
| 2991 | className: ActivityPanel_module_css_default.stateArt, |
| 2992 | "data-activity": member.activity, |
| 2993 | src: ACTION_ART[member.activity], |
| 2994 | alt: "", |
| 2995 | "aria-hidden": true |
| 2996 | })] |
| 2997 | }), |
| 2998 | (0, react_jsx_runtime.jsxs)("span", { |
| 2999 | className: ActivityPanel_module_css_default.memberInfo, |
| 3000 | children: [(0, react_jsx_runtime.jsxs)("span", { |
| 3001 | className: ActivityPanel_module_css_default.memberLine, |
| 3002 | children: [ |
| 3003 | (0, react_jsx_runtime.jsx)("span", { |
| 3004 | className: ActivityPanel_module_css_default.memberName, |
| 3005 | children: member.name |
| 3006 | }), |
| 3007 | member.role !== "" && (0, react_jsx_runtime.jsx)("span", { |
| 3008 | className: ActivityPanel_module_css_default.memberRole, |
| 3009 | children: member.role |
| 3010 | }), |
| 3011 | memberModel !== "" && (0, react_jsx_runtime.jsx)("span", { |
| 3012 | className: ActivityPanel_module_css_default.memberModel, |
| 3013 | role: "img", |
| 3014 | "data-member-model": memberModel, |
| 3015 | title: memberModel, |
| 3016 | "aria-label": memberModel, |
| 3017 | children: compactModelLabel(memberModel) |
| 3018 | }), |
| 3019 | (0, react_jsx_runtime.jsxs)("span", { |
| 3020 | className: ActivityPanel_module_css_default.memberState, |
| 3021 | "data-activity": member.activity, |
| 3022 | children: [(0, react_jsx_runtime.jsx)(WorkGlyph, { active: member.activity === "working" }), discarded ? t("member.state.notCreated") : stopped ? t("member.state.stopped") : team.phase === "staged" ? t("member.state.staged") : memberStateLabel(member, team.tasks, historic, t)] |
| 3023 | }) |
| 3024 | ] |
| 3025 | }), (0, react_jsx_runtime.jsx)("span", { |
| 3026 | className: ActivityPanel_module_css_default.memberStatusLine, |
| 3027 | children: discarded ? t("member.status.discarded") : stopped ? t("member.status.stopped") : team.phase === "staged" ? t("member.status.staged") : historic && owned.length > 0 && owned.every((task) => task.status === "completed" || task.status === "failed" || task.status === "cancelled") ? t("member.status.settled") : memberStatusText(member, team.tasks, t) |
| 3028 | })] |
| 3029 | }), |
| 3030 | (0, react_jsx_runtime.jsxs)("span", { |
| 3031 | className: ActivityPanel_module_css_default.memberCount, |
| 3032 | children: [ |
| 3033 | member.done, |
| 3034 | "/", |
| 3035 | member.total |
| 3036 | ] |
| 3037 | }) |
| 3038 | ] |
| 3039 | }), |
| 3040 | (0, react_jsx_runtime.jsxs)("div", { |
| 3041 | className: ActivityPanel_module_css_default.assignmentLine, |
| 3042 | children: [(0, react_jsx_runtime.jsx)("span", { |
| 3043 | className: ActivityPanel_module_css_default.assignmentLabel, |
| 3044 | children: t(discarded ? "assignment.discarded" : team.phase === "staged" ? "assignment.staged" : "assignment.label") |
| 3045 | }), (0, react_jsx_runtime.jsx)("span", { |
| 3046 | className: ActivityPanel_module_css_default.assignmentTasks, |
| 3047 | children: owned.length === 0 ? (0, react_jsx_runtime.jsx)("span", { |
| 3048 | className: ActivityPanel_module_css_default.taskEmpty, |
| 3049 | children: t("assignment.empty") |
| 3050 | }) : owned.map((task) => { |
| 3051 | const model = taskModelLabel(task, team.members); |
| 3052 | const shortModel = compactModelLabel(model); |
| 3053 | return (0, react_jsx_runtime.jsx)("span", { |
| 3054 | className: ActivityPanel_module_css_default.assignmentChip, |
| 3055 | "data-state": discarded ? "cancelled" : taskTone(task.state, task.status), |
| 3056 | "data-verdict-stale": task.verdictStale === void 0 ? void 0 : "true", |
| 3057 | "data-task-model": model || void 0, |
| 3058 | title: taskTitle(task, model), |
| 3059 | children: task.state === "running" && shortModel !== "" ? `${task.id} · ${shortModel}` : task.id |
| 3060 | }, task.id); |
| 3061 | }) |
| 3062 | })] |
| 3063 | }) |
| 3064 | ] |
| 3065 | }, member.id || member.name); |
| 3066 | })] |
| 3067 | })] }); |
| 3068 | })() |
| 3069 | ] |
| 3070 | }), |
| 3071 | (0, react_jsx_runtime.jsx)(DependencyMap, { |
| 3072 | tasks: team.tasks, |
| 3073 | members: team.members, |
| 3074 | t, |
| 3075 | discarded, |
| 3076 | workspace, |
| 3077 | onSelectTask: setSelectedTaskId |
| 3078 | }), |
| 3079 | workspace && (0, react_jsx_runtime.jsx)(WorkspaceSummary, { |
| 3080 | team, |
| 3081 | t, |
| 3082 | discarded |
| 3083 | }) |
| 3084 | ] |
| 3085 | }), (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Modal, { |
| 3086 | open: stopOpen, |
| 3087 | onClose: () => { |
| 3088 | if (!stopping) setStopOpen(false); |
| 3089 | }, |
| 3090 | title: t("team.stopTitle", { team: team.name }), |
| 3091 | closeLabel: t("plan.cancel"), |
| 3092 | description: t("team.stopDescription", { |
| 3093 | tasks: unfinishedCount, |
| 3094 | members: busyCount |
| 3095 | }), |
| 3096 | footer: (0, react_jsx_runtime.jsxs)("span", { |
| 3097 | className: ActivityPanel_module_css_default.stopModalActions, |
| 3098 | children: [(0, react_jsx_runtime.jsx)("button", { |
| 3099 | type: "button", |
| 3100 | disabled: stopping, |
| 3101 | onClick: () => { |
| 3102 | setStopOpen(false); |
| 3103 | }, |
| 3104 | children: t("team.stopCancel") |
| 3105 | }), (0, react_jsx_runtime.jsxs)("button", { |
| 3106 | type: "button", |
| 3107 | "data-danger": true, |
| 3108 | disabled: stopping, |
| 3109 | onClick: () => { |
| 3110 | stopTeam(); |
| 3111 | }, |
| 3112 | children: [(0, react_jsx_runtime.jsx)(IconStopFill16, {}), stopping ? t("team.stopping") : t("team.stopConfirm")] |
| 3113 | })] |
| 3114 | }), |
| 3115 | children: stopError !== "" && (0, react_jsx_runtime.jsxs)("p", { |
| 3116 | className: ActivityPanel_module_css_default.stopModalError, |
| 3117 | role: "alert", |
| 3118 | children: [(0, react_jsx_runtime.jsx)(IconWarningOutline16, {}), stopError] |
| 3119 | }) |
| 3120 | })] }); |
| 3121 | } |
| 3122 | /** Legacy conversation cards may outlive their host archive. Project their |
| 3123 | * durable roster through the same rebuilt panel instead of a second UI. */ |
| 3124 | function historicCardTeam(data, owner) { |
| 3125 | return { |
| 3126 | workspace: "", |
| 3127 | teamId: data.teamId, |
| 3128 | name: data.teamName, |
| 3129 | captainSessionId: data.captainSessionId || owner, |
| 3130 | phase: "running", |
| 3131 | members: data.members.map((member) => ({ |
| 3132 | ...member, |
| 3133 | status: "removed", |
| 3134 | activity: "idle", |
| 3135 | progress: 0, |
| 3136 | done: 0, |
| 3137 | total: 0, |
| 3138 | currentTask: "", |
| 3139 | unread: 0 |
| 3140 | })), |
| 3141 | tasks: [], |
| 3142 | messageCount: 0, |
| 3143 | captainInbox: [] |
| 3144 | }; |
| 3145 | } |
| 3146 | function ActivityPanel({ sessionsList, modelDirectories, openMember, t, conversationVisible = true }) { |
| 3147 | const navigateToSession = (parentId, childId) => { |
| 3148 | setOpen(false); |
| 3149 | setWasActive(false); |
| 3150 | openMember(parentId, childId); |
| 3151 | }; |
| 3152 | const [open, setOpen] = (0, react.useState)(false); |
| 3153 | const [openOwner, setOpenOwner] = (0, react.useState)(); |
| 3154 | const [autoOpened, setAutoOpened] = (0, react.useState)(false); |
| 3155 | const [wasActive, setWasActive] = (0, react.useState)(false); |
| 3156 | const [historic, setHistoric] = (0, react.useState)(/* @__PURE__ */ new Map()); |
| 3157 | const [layout, setLayout] = (0, react.useState)(initialPanelLayout); |
| 3158 | const [bounds, setBounds] = (0, react.useState)(initialPanelBounds); |
| 3159 | const [interaction, setInteraction] = (0, react.useState)(null); |
| 3160 | const panelRef = (0, react.useRef)(null); |
| 3161 | const boundsRef = (0, react.useRef)(bounds); |
| 3162 | const gestureRef = (0, react.useRef)(null); |
| 3163 | const frameRef = (0, react.useRef)(null); |
| 3164 | const pendingLayoutRef = (0, react.useRef)(null); |
| 3165 | const current = currentSessionId((0, react.useSyncExternalStore)(sessionsList.subscribe, sessionsList.getSnapshot)); |
| 3166 | const autoOpenTrackerRef = (0, react.useRef)({ |
| 3167 | sessionId: current, |
| 3168 | restoreComplete: false, |
| 3169 | liveTeamIds: /* @__PURE__ */ new Set() |
| 3170 | }); |
| 3171 | const monitorTargets = (0, react.useSyncExternalStore)(subscribeActivityMonitorTargets, getActivityMonitorTargetsSnapshot); |
| 3172 | const returnToComposer = () => { |
| 3173 | setOpen(false); |
| 3174 | setOpenOwner(void 0); |
| 3175 | window.requestAnimationFrame(() => { |
| 3176 | document.querySelector("[data-composer-card] [contenteditable=\"true\"][role=\"textbox\"], [data-composer-card] textarea")?.focus(); |
| 3177 | }); |
| 3178 | }; |
| 3179 | const { teams, archivedTeams } = (0, react.useSyncExternalStore)(subscribeActivitySnapshots, getActivitySnapshotsSnapshot); |
| 3180 | const currentTargets = (0, react.useMemo)(() => current === void 0 ? [] : monitorTargets.filter((target) => target.sessionId === current), [current, monitorTargets]); |
| 3181 | const currentRef = (0, react.useRef)(current); |
| 3182 | (0, react.useEffect)(() => { |
| 3183 | currentRef.current = current; |
| 3184 | }, [current]); |
| 3185 | const mountedAtRef = (0, react.useRef)(performance.now()); |
| 3186 | const expanded = conversationVisible && activityPanelExpandedForSession(open, openOwner, current); |
| 3187 | const geometry = (0, react.useMemo)(() => resolvePanelGeometry(layout, bounds), [layout, bounds]); |
| 3188 | const compact = compactPanelForBounds(bounds); |
| 3189 | const commitLayout = (0, react.useCallback)((next) => { |
| 3190 | setLayout(next); |
| 3191 | }, []); |
| 3192 | (0, react.useEffect)(() => { |
| 3193 | window.localStorage.setItem(PANEL_LAYOUT_STORAGE_KEY, JSON.stringify(layout)); |
| 3194 | }, [layout]); |
| 3195 | (0, react.useLayoutEffect)(() => { |
| 3196 | const overlay = document.querySelector("[data-shell-overlay]"); |
| 3197 | if (overlay === null) return; |
| 3198 | const conversation = document.querySelector("[data-phase='active']"); |
| 3199 | let frame = null; |
| 3200 | const measure = () => { |
| 3201 | frame = null; |
| 3202 | const overlayRect = overlay.getBoundingClientRect(); |
| 3203 | const conversationRect = conversation?.getBoundingClientRect(); |
| 3204 | const next = { |
| 3205 | width: overlayRect.width, |
| 3206 | height: overlayRect.height, |
| 3207 | anchorRight: conversationRect === void 0 ? overlayRect.width : Math.min(Math.max(conversationRect.right - overlayRect.left, 0), overlayRect.width) |
| 3208 | }; |
| 3209 | const previous = boundsRef.current; |
| 3210 | if (previous.width === next.width && previous.height === next.height && previous.anchorRight === next.anchorRight) return; |
| 3211 | boundsRef.current = next; |
| 3212 | setBounds(next); |
| 3213 | }; |
| 3214 | const scheduleMeasure = () => { |
| 3215 | frame ??= requestAnimationFrame(measure); |
| 3216 | }; |
| 3217 | measure(); |
| 3218 | const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(scheduleMeasure); |
| 3219 | observer?.observe(overlay); |
| 3220 | if (conversation !== null) observer?.observe(conversation); |
| 3221 | window.addEventListener("resize", scheduleMeasure); |
| 3222 | return () => { |
| 3223 | if (frame !== null) cancelAnimationFrame(frame); |
| 3224 | observer?.disconnect(); |
| 3225 | window.removeEventListener("resize", scheduleMeasure); |
| 3226 | }; |
| 3227 | }, [current]); |
| 3228 | (0, react.useLayoutEffect)(() => { |
| 3229 | const tracker = autoOpenTrackerRef.current; |
| 3230 | if (tracker.sessionId !== current) { |
| 3231 | tracker.sessionId = current; |
| 3232 | tracker.restoreComplete = false; |
| 3233 | tracker.liveTeamIds = /* @__PURE__ */ new Set(); |
| 3234 | setWasActive(false); |
| 3235 | setAutoOpened(false); |
| 3236 | } |
| 3237 | if (openOwner === void 0 || openOwner === current) return; |
| 3238 | setOpen(false); |
| 3239 | setOpenOwner(void 0); |
| 3240 | }, [current, openOwner]); |
| 3241 | (0, react.useLayoutEffect)(() => { |
| 3242 | const root = document.documentElement; |
| 3243 | if (expanded && geometry.mode === "docked" && !compact) { |
| 3244 | root.setAttribute(PANEL_OPEN_ATTRIBUTE, ""); |
| 3245 | root.style.setProperty(PANEL_SHIFT_PROPERTY, `${geometry.width + PANEL_CONVERSATION_GAP + 18}px`); |
| 3246 | } else { |
| 3247 | root.removeAttribute(PANEL_OPEN_ATTRIBUTE); |
| 3248 | root.style.removeProperty(PANEL_SHIFT_PROPERTY); |
| 3249 | } |
| 3250 | return () => { |
| 3251 | root.removeAttribute(PANEL_OPEN_ATTRIBUTE); |
| 3252 | root.style.removeProperty(PANEL_SHIFT_PROPERTY); |
| 3253 | }; |
| 3254 | }, [ |
| 3255 | compact, |
| 3256 | expanded, |
| 3257 | geometry.mode, |
| 3258 | geometry.width |
| 3259 | ]); |
| 3260 | (0, react.useEffect)(() => { |
| 3261 | if (current === void 0) return; |
| 3262 | const controller = startActivityPolling(currentTargets, { discoverySessionId: current }); |
| 3263 | let active = true; |
| 3264 | const tracker = autoOpenTrackerRef.current; |
| 3265 | if (tracker.sessionId === current && !tracker.restoreComplete) controller.firstTick.then(() => { |
| 3266 | const latest = autoOpenTrackerRef.current; |
| 3267 | if (!active || latest.sessionId !== current || latest.restoreComplete) return; |
| 3268 | latest.liveTeamIds = new Set(getActivitySnapshotsSnapshot().teams.filter((team) => team.captainSessionId === current).map((team) => team.teamId)); |
| 3269 | latest.restoreComplete = true; |
| 3270 | }); |
| 3271 | return () => { |
| 3272 | active = false; |
| 3273 | controller.stop(); |
| 3274 | }; |
| 3275 | }, [current, currentTargets]); |
| 3276 | (0, react.useEffect)(() => { |
| 3277 | const onOpenPanel = (event) => { |
| 3278 | const activeSession = currentRef.current; |
| 3279 | if (activeSession === void 0) return; |
| 3280 | setOpenOwner(activeSession); |
| 3281 | setOpen(true); |
| 3282 | const detail = event.detail; |
| 3283 | if (detail?.teamId !== void 0) { |
| 3284 | const owner = detail.captainSessionId !== "" ? detail.captainSessionId : currentRef.current ?? ""; |
| 3285 | const teamKey = `${owner}:${detail.teamId}`; |
| 3286 | setHistoric((previous) => { |
| 3287 | const next = new Map(previous); |
| 3288 | next.set(teamKey, { |
| 3289 | data: detail, |
| 3290 | owner |
| 3291 | }); |
| 3292 | return next; |
| 3293 | }); |
| 3294 | } |
| 3295 | }; |
| 3296 | window.addEventListener(OPEN_PANEL_EVENT, onOpenPanel); |
| 3297 | return () => { |
| 3298 | window.removeEventListener(OPEN_PANEL_EVENT, onOpenPanel); |
| 3299 | }; |
| 3300 | }, []); |
| 3301 | const visibleTeams = (0, react.useMemo)(() => current === void 0 ? [] : teams.filter((team) => team.captainSessionId === current), [teams, current]); |
| 3302 | const visibleHistoric = (0, react.useMemo)(() => current === void 0 ? [] : [...historic.values()].filter(({ data, owner }) => owner === current && !teams.some((live) => live.captainSessionId === current && live.teamId === data.teamId) && !archivedTeams.some((archived) => archived.captainSessionId === current && archived.teamId === data.teamId)), [ |
| 3303 | historic, |
| 3304 | current, |
| 3305 | teams, |
| 3306 | archivedTeams |
| 3307 | ]); |
| 3308 | const visibleArchived = (0, react.useMemo)(() => current === void 0 ? [] : archivedTeams.filter((team) => team.captainSessionId === current && !teams.some((live) => live.captainSessionId === current && live.teamId === team.teamId)), [ |
| 3309 | archivedTeams, |
| 3310 | current, |
| 3311 | teams |
| 3312 | ]); |
| 3313 | const visibleCount = visibleTeams.length + visibleArchived.length + visibleHistoric.length; |
| 3314 | const visibleLiveTeamIds = (0, react.useMemo)(() => visibleTeams.map((team) => team.teamId).sort(), [visibleTeams]); |
| 3315 | (0, react.useEffect)(() => { |
| 3316 | const tracker = autoOpenTrackerRef.current; |
| 3317 | const settled = performance.now() - mountedAtRef.current >= AUTO_OPEN_SETTLE_MS; |
| 3318 | const shouldAutoExpand = tracker.sessionId === current && activityPanelShouldAutoExpand({ |
| 3319 | alreadyAutoOpened: autoOpened, |
| 3320 | pageSettled: settled, |
| 3321 | restoreComplete: tracker.restoreComplete, |
| 3322 | previousLiveTeamIds: tracker.liveTeamIds, |
| 3323 | currentLiveTeamIds: visibleLiveTeamIds |
| 3324 | }); |
| 3325 | if (tracker.sessionId === current && tracker.restoreComplete) tracker.liveTeamIds = new Set(visibleLiveTeamIds); |
| 3326 | if (visibleCount > 0) { |
| 3327 | setWasActive(true); |
| 3328 | if (shouldAutoExpand) { |
| 3329 | setOpenOwner(current); |
| 3330 | setOpen(true); |
| 3331 | setAutoOpened(true); |
| 3332 | } |
| 3333 | return; |
| 3334 | } |
| 3335 | if (!wasActive) return; |
| 3336 | const timer = setTimeout(() => { |
| 3337 | setOpen(false); |
| 3338 | setOpenOwner(void 0); |
| 3339 | setWasActive(false); |
| 3340 | setAutoOpened(false); |
| 3341 | }, AUTOCLOSE_GRACE_MS); |
| 3342 | return () => { |
| 3343 | clearTimeout(timer); |
| 3344 | }; |
| 3345 | }, [ |
| 3346 | visibleCount, |
| 3347 | visibleLiveTeamIds.join("\0"), |
| 3348 | autoOpened, |
| 3349 | wasActive, |
| 3350 | current |
| 3351 | ]); |
| 3352 | const busy = (0, react.useMemo)(() => visibleTeams.some((team) => team.members.some((member) => member.activity === "working")), [visibleTeams]); |
| 3353 | const hasTeams = visibleCount > 0; |
| 3354 | const panelGeometryForGesture = (0, react.useCallback)(() => { |
| 3355 | const measuredHeight = panelRef.current?.getBoundingClientRect().height; |
| 3356 | if (measuredHeight === void 0 || measuredHeight <= 0) return geometry; |
| 3357 | return { |
| 3358 | ...geometry, |
| 3359 | height: measuredHeight |
| 3360 | }; |
| 3361 | }, [geometry]); |
| 3362 | const flushScheduledLayout = (0, react.useCallback)(() => { |
| 3363 | if (frameRef.current !== null) { |
| 3364 | cancelAnimationFrame(frameRef.current); |
| 3365 | frameRef.current = null; |
| 3366 | } |
| 3367 | const pending = pendingLayoutRef.current; |
| 3368 | pendingLayoutRef.current = null; |
| 3369 | if (pending !== null) commitLayout(pending); |
| 3370 | }, [commitLayout]); |
| 3371 | const scheduleLayout = (0, react.useCallback)((next) => { |
| 3372 | pendingLayoutRef.current = next; |
| 3373 | frameRef.current ??= requestAnimationFrame(() => { |
| 3374 | frameRef.current = null; |
| 3375 | const pending = pendingLayoutRef.current; |
| 3376 | pendingLayoutRef.current = null; |
| 3377 | if (pending !== null) commitLayout(pending); |
| 3378 | }); |
| 3379 | }, [commitLayout]); |
| 3380 | (0, react.useEffect)(() => () => { |
| 3381 | if (frameRef.current !== null) cancelAnimationFrame(frameRef.current); |
| 3382 | }, []); |
| 3383 | const beginMove = (0, react.useCallback)((event) => { |
| 3384 | if (compact || event.button !== 0 || event.target.closest("button") !== null) return; |
| 3385 | event.preventDefault(); |
| 3386 | event.currentTarget.setPointerCapture(event.pointerId); |
| 3387 | gestureRef.current = { |
| 3388 | kind: "move", |
| 3389 | pointerId: event.pointerId, |
| 3390 | originX: event.clientX, |
| 3391 | originY: event.clientY, |
| 3392 | start: panelGeometryForGesture(), |
| 3393 | activated: false |
| 3394 | }; |
| 3395 | }, [compact, panelGeometryForGesture]); |
| 3396 | const beginResize = (0, react.useCallback)((edge, event) => { |
| 3397 | if (compact || event.button !== 0 || geometry.mode === "docked" && edge !== "left") return; |
| 3398 | event.preventDefault(); |
| 3399 | event.stopPropagation(); |
| 3400 | event.currentTarget.setPointerCapture(event.pointerId); |
| 3401 | gestureRef.current = { |
| 3402 | kind: "resize", |
| 3403 | edge, |
| 3404 | pointerId: event.pointerId, |
| 3405 | originX: event.clientX, |
| 3406 | originY: event.clientY, |
| 3407 | start: panelGeometryForGesture(), |
| 3408 | activated: true |
| 3409 | }; |
| 3410 | setInteraction("resizing"); |
| 3411 | }, [ |
| 3412 | compact, |
| 3413 | geometry.mode, |
| 3414 | panelGeometryForGesture |
| 3415 | ]); |
| 3416 | const updateGesture = (0, react.useCallback)((event) => { |
| 3417 | const gesture = gestureRef.current; |
| 3418 | if (gesture === null || gesture.pointerId !== event.pointerId || !event.currentTarget.hasPointerCapture(event.pointerId)) return; |
| 3419 | const dx = event.clientX - gesture.originX; |
| 3420 | const dy = event.clientY - gesture.originY; |
| 3421 | const activeBounds = boundsRef.current; |
| 3422 | if (gesture.kind === "move") { |
| 3423 | if (!gesture.activated && Math.hypot(dx, dy) < MOVE_THRESHOLD) return; |
| 3424 | if (!gesture.activated) { |
| 3425 | gesture.activated = true; |
| 3426 | setInteraction("dragging"); |
| 3427 | } |
| 3428 | scheduleLayout(movePanelLayout(floatPanelLayout(gesture.start, activeBounds), dx, dy, activeBounds)); |
| 3429 | return; |
| 3430 | } |
| 3431 | scheduleLayout(resizePanelLayout(gesture.start, gesture.edge ?? "left", dx, dy, activeBounds)); |
| 3432 | }, [scheduleLayout]); |
| 3433 | const endGesture = (0, react.useCallback)((event) => { |
| 3434 | const gesture = gestureRef.current; |
| 3435 | if (gesture === null || gesture.pointerId !== event.pointerId) return; |
| 3436 | updateGesture(event); |
| 3437 | flushScheduledLayout(); |
| 3438 | if (event.currentTarget.hasPointerCapture(event.pointerId)) event.currentTarget.releasePointerCapture(event.pointerId); |
| 3439 | gestureRef.current = null; |
| 3440 | setInteraction(null); |
| 3441 | }, [flushScheduledLayout, updateGesture]); |
| 3442 | const cancelGesture = (0, react.useCallback)((event) => { |
| 3443 | const gesture = gestureRef.current; |
| 3444 | if (gesture === null || gesture.pointerId !== event.pointerId) return; |
| 3445 | flushScheduledLayout(); |
| 3446 | gestureRef.current = null; |
| 3447 | setInteraction(null); |
| 3448 | }, [flushScheduledLayout]); |
| 3449 | const toggleDock = (0, react.useCallback)(() => { |
| 3450 | const liveGeometry = panelGeometryForGesture(); |
| 3451 | commitLayout(liveGeometry.mode === "docked" ? floatPanelLayout(liveGeometry, boundsRef.current) : dockPanelLayout(liveGeometry, boundsRef.current)); |
| 3452 | }, [commitLayout, panelGeometryForGesture]); |
| 3453 | const autoHeight = panelUsesAutoHeight(geometry, bounds); |
| 3454 | const panelStyle = { |
| 3455 | width: geometry.width, |
| 3456 | height: autoHeight ? "auto" : geometry.height, |
| 3457 | maxHeight: panelMaximumHeight(geometry, bounds), |
| 3458 | transform: `translate3d(${geometry.x}px, ${geometry.y}px, 0)` |
| 3459 | }; |
| 3460 | if (!conversationVisible || !hasTeams && !expanded) return null; |
| 3461 | return (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [!expanded && (0, react_jsx_runtime.jsx)(CollapsedBadge, { |
| 3462 | count: visibleCount, |
| 3463 | busy, |
| 3464 | t, |
| 3465 | onClick: () => { |
| 3466 | if (current === void 0) return; |
| 3467 | setOpenOwner(current); |
| 3468 | setOpen(true); |
| 3469 | } |
| 3470 | }), expanded && (0, react_jsx_runtime.jsxs)("aside", { |
| 3471 | ref: panelRef, |
| 3472 | className: ActivityPanel_module_css_default.panel, |
| 3473 | style: panelStyle, |
| 3474 | "data-agent-teams-activity": true, |
| 3475 | "data-panel-mode": geometry.mode, |
| 3476 | "data-height-mode": autoHeight ? "auto" : "manual", |
| 3477 | "data-compact": compact || void 0, |
| 3478 | "data-dragging": interaction === "dragging" || void 0, |
| 3479 | "data-resizing": interaction === "resizing" || void 0, |
| 3480 | "aria-label": t("activity.panelAria"), |
| 3481 | children: [ |
| 3482 | (0, react_jsx_runtime.jsxs)("header", { |
| 3483 | className: ActivityPanel_module_css_default.panelHead, |
| 3484 | onPointerDown: beginMove, |
| 3485 | onPointerMove: updateGesture, |
| 3486 | onPointerUp: endGesture, |
| 3487 | onPointerCancel: cancelGesture, |
| 3488 | "data-drag-handle": !compact || void 0, |
| 3489 | children: [(0, react_jsx_runtime.jsxs)("span", { |
| 3490 | className: ActivityPanel_module_css_default.panelTitle, |
| 3491 | children: [t("activity.title"), (0, react_jsx_runtime.jsx)("span", { |
| 3492 | className: ActivityPanel_module_css_default.panelDot, |
| 3493 | "data-busy": busy, |
| 3494 | "aria-hidden": true |
| 3495 | })] |
| 3496 | }), (0, react_jsx_runtime.jsxs)("span", { |
| 3497 | className: ActivityPanel_module_css_default.panelControls, |
| 3498 | children: [!compact && (0, react_jsx_runtime.jsx)("button", { |
| 3499 | type: "button", |
| 3500 | className: ActivityPanel_module_css_default.iconButton, |
| 3501 | "data-control": "dock", |
| 3502 | "data-mode": geometry.mode, |
| 3503 | onClick: toggleDock, |
| 3504 | "aria-label": t(geometry.mode === "docked" ? "activity.float" : "activity.dockRight"), |
| 3505 | title: t(geometry.mode === "docked" ? "activity.float" : "activity.dockRight"), |
| 3506 | children: (0, react_jsx_runtime.jsx)(IconPanelLeftOutline16, {}) |
| 3507 | }), (0, react_jsx_runtime.jsx)("button", { |
| 3508 | type: "button", |
| 3509 | className: ActivityPanel_module_css_default.iconButton, |
| 3510 | "data-control": "collapse", |
| 3511 | onClick: () => { |
| 3512 | setOpen(false); |
| 3513 | setOpenOwner(void 0); |
| 3514 | }, |
| 3515 | "aria-label": t("activity.collapse"), |
| 3516 | title: t("activity.collapse"), |
| 3517 | children: (0, react_jsx_runtime.jsx)(IconChevronDownOutline14, {}) |
| 3518 | })] |
| 3519 | })] |
| 3520 | }), |
| 3521 | (0, react_jsx_runtime.jsx)("div", { |
| 3522 | className: ActivityPanel_module_css_default.teams, |
| 3523 | children: visibleCount === 0 ? (0, react_jsx_runtime.jsx)("span", { |
| 3524 | className: ActivityPanel_module_css_default.emptyHint, |
| 3525 | children: t("activity.empty") |
| 3526 | }) : (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [ |
| 3527 | visibleTeams.map((team) => (0, react_jsx_runtime.jsx)(TeamSection, { |
| 3528 | team, |
| 3529 | modelDirectory: team.phase === "staged" ? modelDirectories.directoryFor(team.captainSessionId) : void 0, |
| 3530 | onContinuePlanning: returnToComposer, |
| 3531 | onDiscarded: returnToComposer, |
| 3532 | onNavigate: navigateToSession, |
| 3533 | t |
| 3534 | }, team.teamId)), |
| 3535 | visibleArchived.map((team) => (0, react_jsx_runtime.jsxs)("div", { |
| 3536 | "data-team-id": team.teamId, |
| 3537 | "data-historic": true, |
| 3538 | className: ActivityPanel_module_css_default.archivedWrap, |
| 3539 | children: [(0, react_jsx_runtime.jsx)("span", { |
| 3540 | className: ActivityPanel_module_css_default.archiveLabel, |
| 3541 | children: t(team.phase === "staged" ? "archive.discardedLabel" : "archive.label") |
| 3542 | }), (0, react_jsx_runtime.jsx)(TeamSection, { |
| 3543 | team, |
| 3544 | onNavigate: navigateToSession, |
| 3545 | t, |
| 3546 | historic: true |
| 3547 | })] |
| 3548 | }, `${team.captainSessionId}:${team.teamId}`)), |
| 3549 | visibleHistoric.map(({ data: team, owner }) => { |
| 3550 | const teamKey = `${owner}:${team.teamId}`; |
| 3551 | return (0, react_jsx_runtime.jsx)(TeamSection, { |
| 3552 | team: historicCardTeam(team, owner), |
| 3553 | onNavigate: navigateToSession, |
| 3554 | t, |
| 3555 | historic: true |
| 3556 | }, teamKey); |
| 3557 | }) |
| 3558 | ] }) |
| 3559 | }), |
| 3560 | !compact && (0, react_jsx_runtime.jsx)("div", { |
| 3561 | className: ActivityPanel_module_css_default.resizeHandle, |
| 3562 | "data-resize-edge": "left", |
| 3563 | onPointerDown: (event) => { |
| 3564 | beginResize("left", event); |
| 3565 | }, |
| 3566 | onPointerMove: updateGesture, |
| 3567 | onPointerUp: endGesture, |
| 3568 | onPointerCancel: cancelGesture, |
| 3569 | "aria-hidden": true |
| 3570 | }), |
| 3571 | !compact && geometry.mode === "floating" && (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)("div", { |
| 3572 | className: ActivityPanel_module_css_default.resizeHandle, |
| 3573 | "data-resize-edge": "bottom", |
| 3574 | onPointerDown: (event) => { |
| 3575 | beginResize("bottom", event); |
| 3576 | }, |
| 3577 | onPointerMove: updateGesture, |
| 3578 | onPointerUp: endGesture, |
| 3579 | onPointerCancel: cancelGesture, |
| 3580 | "aria-hidden": true |
| 3581 | }), (0, react_jsx_runtime.jsx)("div", { |
| 3582 | className: ActivityPanel_module_css_default.resizeHandle, |
| 3583 | "data-resize-edge": "corner", |
| 3584 | onPointerDown: (event) => { |
| 3585 | beginResize("corner", event); |
| 3586 | }, |
| 3587 | onPointerMove: updateGesture, |
| 3588 | onPointerUp: endGesture, |
| 3589 | onPointerCancel: cancelGesture, |
| 3590 | "aria-hidden": true |
| 3591 | })] }) |
| 3592 | ] |
| 3593 | })] }); |
| 3594 | } |
| 3595 | //#endregion |
| 3596 | //#region lib/client/workspace-state.js |
| 3597 | function createWorkspaceState() { |
| 3598 | let snapshot = { |
| 3599 | statuses: /* @__PURE__ */ new Map(), |
| 3600 | history: /* @__PURE__ */ new Map(), |
| 3601 | selected: /* @__PURE__ */ new Map() |
| 3602 | }; |
| 3603 | const listeners = /* @__PURE__ */ new Set(); |
| 3604 | const publish = (next) => { |
| 3605 | snapshot = next; |
| 3606 | for (const listener of listeners) listener(); |
| 3607 | }; |
| 3608 | return { |
| 3609 | getSnapshot: () => snapshot, |
| 3610 | subscribe: (listener) => { |
| 3611 | listeners.add(listener); |
| 3612 | return () => { |
| 3613 | listeners.delete(listener); |
| 3614 | }; |
| 3615 | }, |
| 3616 | status(session, status) { |
| 3617 | if (snapshot.statuses.get(session) === status) return; |
| 3618 | publish({ |
| 3619 | ...snapshot, |
| 3620 | statuses: new Map(snapshot.statuses).set(session, status) |
| 3621 | }); |
| 3622 | }, |
| 3623 | select(session, team) { |
| 3624 | if (snapshot.selected.get(session) === team) return; |
| 3625 | publish({ |
| 3626 | ...snapshot, |
| 3627 | selected: new Map(snapshot.selected).set(session, team) |
| 3628 | }); |
| 3629 | }, |
| 3630 | remember(session, data) { |
| 3631 | const owner = data.captainSessionId || session; |
| 3632 | if (owner !== session) return; |
| 3633 | publish({ |
| 3634 | ...snapshot, |
| 3635 | history: new Map(snapshot.history).set(`${owner}:${data.teamId}`, { |
| 3636 | ...data, |
| 3637 | captainSessionId: owner |
| 3638 | }), |
| 3639 | selected: new Map(snapshot.selected).set(owner, data.teamId) |
| 3640 | }); |
| 3641 | } |
| 3642 | }; |
| 3643 | } |
| 3644 | /** Records restored at mount never reopen a closed tab; new teams are announced once. */ |
| 3645 | function createTeamDiscovery() { |
| 3646 | let restored = false; |
| 3647 | let known = /* @__PURE__ */ new Set(); |
| 3648 | return (teams) => { |
| 3649 | const added = restored ? teams.find((team) => !known.has(team.teamId))?.teamId : void 0; |
| 3650 | known = new Set(teams.map((team) => team.teamId)); |
| 3651 | restored = true; |
| 3652 | return added; |
| 3653 | }; |
| 3654 | } |
| 3655 | //#endregion |
| 3656 | //#region \0dsh-css:/home/runner/work/dsh-agent-teams/dsh-agent-teams/src/client/WorkspaceActivity.module.css.mjs |
| 3657 | const css = ".eDfHrq_root{--dsw-alias-state-business-primary:light-dark(#2866d7,#82b4ff);height:100%;min-height:0;color:var(--dsw-alias-label-primary);background:color-mix(in srgb, var(--dsw-alias-bg-module-platform) 78%, var(--dsw-alias-bg-base));font-variant-numeric:tabular-nums;font-family:inherit;overflow:auto;container:eDfHrq_team-workspace/inline-size}.eDfHrq_content{max-width:1400px;margin:0 auto;padding:16px 14px 28px}.eDfHrq_heading{flex-wrap:wrap;align-items:center;gap:8px;margin-bottom:20px;display:flex}.eDfHrq_heading img{object-fit:contain;width:32px;height:32px}.eDfHrq_heading h2{letter-spacing:-.4px;margin:0;font-size:17px;font-weight:650}.eDfHrq_heading>span{color:var(--dsw-alias-label-secondary);margin-left:auto;font-size:12px}.eDfHrq_selector{flex-wrap:wrap;gap:8px;margin-bottom:18px;display:flex}.eDfHrq_selector button{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);text-align:left;overflow-wrap:anywhere;border-radius:10px;align-items:center;gap:10px;max-width:100%;padding:10px 12px;font-size:12px;transition:background-color .14s,border-color .14s;display:flex}.eDfHrq_selector span{color:var(--dsw-alias-label-secondary);white-space:nowrap;font-size:10px}.eDfHrq_selector button[aria-pressed=true]{background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 8%, var(--dsw-alias-bg-layer-1));border-color:var(--dsw-alias-state-business-primary)}.eDfHrq_selector button:hover{border-color:var(--dsw-alias-state-business-primary)}.eDfHrq_root button{cursor:pointer;font-family:inherit}.eDfHrq_selector button,.eDfHrq_empty button,.eDfHrq_error button{color:inherit}.eDfHrq_root button:active{transform:scale(.98)}.eDfHrq_root button:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:3px}.eDfHrq_empty{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);border-radius:18px;padding:32px 24px}.eDfHrq_emptyMark{width:44px;height:44px;color:var(--dsw-alias-state-business-primary);background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 8%, transparent);border-radius:13px;place-items:center;font-size:26px;display:grid}.eDfHrq_empty h3{margin:20px 0 10px;font-size:16px;font-weight:600}.eDfHrq_empty p{max-width:45ch;color:var(--dsw-alias-label-secondary);font-size:13px;line-height:1.8}.eDfHrq_empty button,.eDfHrq_error button{background:var(--dsw-alias-bg-module-platform);border:1px solid var(--dsw-alias-border-l2);border-radius:9px;padding:9px 13px;font-size:12px}.eDfHrq_empty button:hover,.eDfHrq_error button:hover{border-color:var(--dsw-alias-state-business-primary)}.eDfHrq_error{border:1px solid color-mix(in srgb, var(--dsw-alias-state-error-primary) 30%, var(--dsw-alias-border-l2));background:var(--dsw-alias-bg-layer-1);border-radius:12px;flex-wrap:wrap;align-items:start;gap:12px;margin-bottom:18px;padding:14px;font-size:12px;line-height:1.65;display:flex}.eDfHrq_error>span{flex:180px}.eDfHrq_error button{flex:none}.eDfHrq_skeleton{gap:14px;display:grid}.eDfHrq_skeleton i{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);border-radius:16px;height:130px;animation:1.8s ease-in-out infinite alternate eDfHrq_breathe}.eDfHrq_skeleton i:first-child{height:74px}.eDfHrq_skeleton i:last-child{animation-delay:.3s}@keyframes eDfHrq_breathe{to{opacity:.45}}@container eDfHrq_team-workspace (width>=720px){.eDfHrq_content{padding:24px 24px 32px}.eDfHrq_heading{margin-bottom:24px}}@media (prefers-reduced-motion:reduce){.eDfHrq_skeleton i{animation:none}.eDfHrq_root button{transition:none}}"; |
| 3658 | const tagId = "@nanmicoder/dsh-agent-teams/WorkspaceActivity.module.css"; |
| 3659 | if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) { |
| 3660 | const tag = document.createElement("style"); |
| 3661 | tag.dataset.plugin = "@nanmicoder/dsh-agent-teams"; |
| 3662 | tag.dataset.pluginCss = tagId; |
| 3663 | tag.textContent = css; |
| 3664 | document.head.appendChild(tag); |
| 3665 | } |
| 3666 | var WorkspaceActivity_module_css_default = { |
| 3667 | "breathe": "eDfHrq_breathe", |
| 3668 | "content": "eDfHrq_content", |
| 3669 | "empty": "eDfHrq_empty", |
| 3670 | "emptyMark": "eDfHrq_emptyMark", |
| 3671 | "error": "eDfHrq_error", |
| 3672 | "heading": "eDfHrq_heading", |
| 3673 | "root": "eDfHrq_root", |
| 3674 | "selector": "eDfHrq_selector", |
| 3675 | "skeleton": "eDfHrq_skeleton", |
| 3676 | "team-workspace": "eDfHrq_team-workspace" |
| 3677 | }; |
| 3678 | //#endregion |
| 3679 | //#region lib/client/WorkspaceActivity.js |
| 3680 | /** Native workspace content; discovery remains mounted independently of tab lifetime. */ |
| 3681 | const TEAM_TAB_KIND = "agent-teams"; |
| 3682 | const TEAM_TAB_ID = "@nanmicoder/dsh-agent-teams/activity"; |
| 3683 | /** Optional host integration is observable so installing/removing it also switches the fallback. */ |
| 3684 | function createWorkspaceBridge() { |
| 3685 | let sidebar; |
| 3686 | const listeners = /* @__PURE__ */ new Set(); |
| 3687 | return { |
| 3688 | getSnapshot: () => sidebar, |
| 3689 | subscribe: (listener) => { |
| 3690 | listeners.add(listener); |
| 3691 | return () => { |
| 3692 | listeners.delete(listener); |
| 3693 | }; |
| 3694 | }, |
| 3695 | set(value) { |
| 3696 | sidebar = value; |
| 3697 | for (const listener of listeners) listener(); |
| 3698 | } |
| 3699 | }; |
| 3700 | } |
| 3701 | function ActivitySurface({ bridge, state, ...props }) { |
| 3702 | const sidebar = (0, react.useSyncExternalStore)(bridge.subscribe, bridge.getSnapshot); |
| 3703 | return sidebar === void 0 ? (0, react_jsx_runtime.jsx)(ActivityPanel, { ...props }) : (0, react_jsx_runtime.jsx)(WorkspaceMonitor, { |
| 3704 | ...props, |
| 3705 | sidebar, |
| 3706 | state |
| 3707 | }); |
| 3708 | } |
| 3709 | function WorkspaceMonitor({ sessionsList, sidebar, state }) { |
| 3710 | const current = currentSessionId((0, react.useSyncExternalStore)(sessionsList.subscribe, sessionsList.getSnapshot)); |
| 3711 | const targets = (0, react.useSyncExternalStore)(subscribeActivityMonitorTargets, getActivityMonitorTargetsSnapshot); |
| 3712 | const currentTargets = (0, react.useMemo)(() => targets.filter((target) => target.sessionId === current), [targets, current]); |
| 3713 | const discover = (0, react.useMemo)(() => createTeamDiscovery(), [current]); |
| 3714 | (0, react.useEffect)(() => { |
| 3715 | if (current === void 0) return; |
| 3716 | state.status(current, "loading"); |
| 3717 | const controller = startActivityPolling(currentTargets, { |
| 3718 | discoverySessionId: current, |
| 3719 | getPublishedRows: getPublishedActivityRows, |
| 3720 | onStatus(status) { |
| 3721 | state.status(current, status); |
| 3722 | }, |
| 3723 | publishSnapshots(update, scope) { |
| 3724 | updateActivitySnapshots(update, scope); |
| 3725 | if (update.teams === void 0) return; |
| 3726 | const added = discover(update.teams.filter((team) => team.captainSessionId === current)); |
| 3727 | if (added !== void 0 && sidebar.mounted.getSnapshot() === current && !sidebar.isExpanded()) { |
| 3728 | state.select(current, added); |
| 3729 | sidebar.openTab(TEAM_TAB_KIND); |
| 3730 | } |
| 3731 | } |
| 3732 | }); |
| 3733 | return () => { |
| 3734 | controller.stop(); |
| 3735 | }; |
| 3736 | }, [ |
| 3737 | current, |
| 3738 | currentTargets, |
| 3739 | discover, |
| 3740 | sidebar, |
| 3741 | state |
| 3742 | ]); |
| 3743 | (0, react.useEffect)(() => { |
| 3744 | const open = (event) => { |
| 3745 | if (current === void 0 || sidebar.mounted.getSnapshot() !== current) return; |
| 3746 | const data = event.detail; |
| 3747 | if (data?.captainSessionId && data.captainSessionId !== current) return; |
| 3748 | if (data?.teamId) state.remember(current, data); |
| 3749 | sidebar.openTab(TEAM_TAB_KIND); |
| 3750 | }; |
| 3751 | window.addEventListener(OPEN_PANEL_EVENT, open); |
| 3752 | return () => { |
| 3753 | window.removeEventListener(OPEN_PANEL_EVENT, open); |
| 3754 | }; |
| 3755 | }, [ |
| 3756 | current, |
| 3757 | sidebar, |
| 3758 | state |
| 3759 | ]); |
| 3760 | return null; |
| 3761 | } |
| 3762 | function WorkspaceActivity({ sessionId, useTabInfo, t, state, modelDirectories, openMember }) { |
| 3763 | const { tab } = useTabInfo(); |
| 3764 | const snapshots = (0, react.useSyncExternalStore)(subscribeActivitySnapshots, getActivitySnapshotsSnapshot); |
| 3765 | const local = (0, react.useSyncExternalStore)(state.subscribe, state.getSnapshot); |
| 3766 | const [retry, setRetry] = (0, react.useState)(0); |
| 3767 | const live = snapshots.teams.filter((team) => team.captainSessionId === sessionId); |
| 3768 | const archived = snapshots.archivedTeams.filter((team) => team.captainSessionId === sessionId && !live.some((item) => item.teamId === team.teamId)); |
| 3769 | const historic = [...local.history.values()].filter((team) => team.captainSessionId === sessionId && !live.some((item) => item.teamId === team.teamId) && !archived.some((item) => item.teamId === team.teamId)).map((team) => historicCardTeam(team, sessionId)); |
| 3770 | const records = [ |
| 3771 | ...live, |
| 3772 | ...archived, |
| 3773 | ...historic |
| 3774 | ]; |
| 3775 | const selected = records.find((team) => team.teamId === local.selected.get(sessionId)) ?? records[0]; |
| 3776 | const history = selected !== void 0 && !live.includes(selected); |
| 3777 | const status = local.statuses.get(sessionId) ?? "loading"; |
| 3778 | (0, react.useEffect)(() => { |
| 3779 | if (retry === 0 || !tab.visible) return; |
| 3780 | const controller = startActivityPolling([], { |
| 3781 | discoverySessionId: sessionId, |
| 3782 | onStatus: (value) => state.status(sessionId, value) |
| 3783 | }); |
| 3784 | controller.firstTick.finally(() => { |
| 3785 | controller.stop(); |
| 3786 | }); |
| 3787 | return () => { |
| 3788 | controller.stop(); |
| 3789 | }; |
| 3790 | }, [ |
| 3791 | retry, |
| 3792 | sessionId, |
| 3793 | state, |
| 3794 | tab.visible |
| 3795 | ]); |
| 3796 | const backToChat = () => { |
| 3797 | tab.actions.close(); |
| 3798 | requestAnimationFrame(() => document.querySelector("[data-composer-card] [contenteditable=\"true\"][role=\"textbox\"], [data-composer-card] textarea")?.focus()); |
| 3799 | }; |
| 3800 | return (0, react_jsx_runtime.jsx)("div", { |
| 3801 | className: WorkspaceActivity_module_css_default.root, |
| 3802 | "data-agent-teams-workspace": true, |
| 3803 | "data-session-id": sessionId, |
| 3804 | children: (0, react_jsx_runtime.jsxs)("div", { |
| 3805 | className: WorkspaceActivity_module_css_default.content, |
| 3806 | children: [ |
| 3807 | (0, react_jsx_runtime.jsxs)("header", { |
| 3808 | className: WorkspaceActivity_module_css_default.heading, |
| 3809 | children: [ |
| 3810 | (0, react_jsx_runtime.jsx)("img", { |
| 3811 | src: LEAD_ART, |
| 3812 | alt: "", |
| 3813 | "aria-hidden": true |
| 3814 | }), |
| 3815 | (0, react_jsx_runtime.jsx)("h2", { children: "AgentTeams" }), |
| 3816 | (0, react_jsx_runtime.jsx)("span", { children: t("workspace.title") }) |
| 3817 | ] |
| 3818 | }), |
| 3819 | status === "error" && (0, react_jsx_runtime.jsxs)("div", { |
| 3820 | className: WorkspaceActivity_module_css_default.error, |
| 3821 | role: "alert", |
| 3822 | children: [(0, react_jsx_runtime.jsx)("span", { children: t("workspace.error") }), (0, react_jsx_runtime.jsx)("button", { |
| 3823 | onClick: () => setRetry((value) => value + 1), |
| 3824 | children: t("workspace.retry") |
| 3825 | })] |
| 3826 | }), |
| 3827 | records.length > 1 && (0, react_jsx_runtime.jsx)("nav", { |
| 3828 | className: WorkspaceActivity_module_css_default.selector, |
| 3829 | "aria-label": t("workspace.title"), |
| 3830 | children: records.map((team) => (0, react_jsx_runtime.jsxs)("button", { |
| 3831 | "aria-pressed": selected?.teamId === team.teamId, |
| 3832 | onClick: () => state.select(sessionId, team.teamId), |
| 3833 | children: [team.name, (0, react_jsx_runtime.jsx)("span", { children: t(live.includes(team) ? "workspace.current" : "workspace.history") })] |
| 3834 | }, team.teamId)) |
| 3835 | }), |
| 3836 | selected === void 0 ? status === "loading" ? (0, react_jsx_runtime.jsxs)("div", { |
| 3837 | className: WorkspaceActivity_module_css_default.skeleton, |
| 3838 | role: "status", |
| 3839 | "aria-label": t("workspace.loading"), |
| 3840 | children: [ |
| 3841 | (0, react_jsx_runtime.jsx)("i", {}), |
| 3842 | (0, react_jsx_runtime.jsx)("i", {}), |
| 3843 | (0, react_jsx_runtime.jsx)("i", {}) |
| 3844 | ] |
| 3845 | }) : (0, react_jsx_runtime.jsxs)("section", { |
| 3846 | className: WorkspaceActivity_module_css_default.empty, |
| 3847 | children: [ |
| 3848 | (0, react_jsx_runtime.jsx)("span", { |
| 3849 | className: WorkspaceActivity_module_css_default.emptyMark, |
| 3850 | "aria-hidden": true, |
| 3851 | children: "↳" |
| 3852 | }), |
| 3853 | (0, react_jsx_runtime.jsx)("h3", { children: t("workspace.emptyTitle") }), |
| 3854 | (0, react_jsx_runtime.jsx)("p", { children: t("workspace.emptyBody") }), |
| 3855 | (0, react_jsx_runtime.jsx)("button", { |
| 3856 | onClick: backToChat, |
| 3857 | children: t("workspace.back") |
| 3858 | }) |
| 3859 | ] |
| 3860 | }) : (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: (0, react_jsx_runtime.jsx)(TeamSection, { |
| 3861 | team: selected, |
| 3862 | workspace: true, |
| 3863 | historic: history, |
| 3864 | modelDirectory: selected.phase === "staged" ? modelDirectories.directoryFor(sessionId) : void 0, |
| 3865 | onContinuePlanning: backToChat, |
| 3866 | onDiscarded: backToChat, |
| 3867 | onNavigate: openMember, |
| 3868 | t |
| 3869 | }, `${sessionId}:${selected.teamId}`) }) |
| 3870 | ] |
| 3871 | }) |
| 3872 | }); |
| 3873 | } |
| 3874 | //#endregion |
| 3875 | //#region lib/client/agent-teams-card-definition.js |
| 3876 | /** |
| 3877 | * AgentTeams conversation card: a lightweight in-conversation summary shown |
| 3878 | * when a team is created — the captain's name, the member roster with whale |
| 3879 | * avatars, and an entry point that re-activates the top-right activity |
| 3880 | * panel (useful after the floater was closed, or when re-opening an old |
| 3881 | * session for review). |
| 3882 | * |
| 3883 | * The fold anchors to the Harness's durable `tool/call` + `tool/result` |
| 3884 | * records for `agent_teams_create`. Those are first-party session events, so |
| 3885 | * the card survives restarts without writing an out-of-repo event type. |
| 3886 | * @module dsh-agent-teams/client/card |
| 3887 | */ |
| 3888 | /** |
| 3889 | * Fold a team name the way the host's `sanitizeKey` does, minus the host's |
| 3890 | * digest fallback. The host keeps Unicode letters and digits, so an ASCII-only |
| 3891 | * client derivation turned every CJK name into the shared `team` key and the |
| 3892 | * card could never match its live team (issue #203). Names with no letters or |
| 3893 | * digits at all, and names longer than the host's key limit, still need the |
| 3894 | * host's canonical id; the create result now carries it. |
| 3895 | * @param name - the create call's team name. |
| 3896 | * @returns the host-shaped key for the name. |
| 3897 | */ |
| 3898 | function teamKeyFromName(name) { |
| 3899 | const cleaned = name.normalize("NFC").trim().toLowerCase().replace(/[^\p{L}\p{N}]+/gu, "-").replace(/^-+|-+$/g, ""); |
| 3900 | return cleaned === "" ? "team" : cleaned; |
| 3901 | } |
| 3902 | /** Parse the only create-call fields the historic card owns. */ |
| 3903 | function parseAgentTeamsCreateArgs(value) { |
| 3904 | try { |
| 3905 | const parsed = JSON.parse(value); |
| 3906 | if (typeof parsed !== "object" || parsed === null || !("name" in parsed) || typeof parsed.name !== "string") return; |
| 3907 | const name = parsed.name.trim(); |
| 3908 | if (name === "") return void 0; |
| 3909 | return { |
| 3910 | teamId: teamKeyFromName(name), |
| 3911 | name |
| 3912 | }; |
| 3913 | } catch { |
| 3914 | return; |
| 3915 | } |
| 3916 | } |
| 3917 | /** |
| 3918 | * Read the canonical identity the host attaches to the `agent_teams_create` |
| 3919 | * result. Records written before the host published it carry no metadata, so |
| 3920 | * an absent or malformed payload falls back to the client derivation. |
| 3921 | * @param meta - the durable `tool/result` metadata payload, if any. |
| 3922 | * @returns the canonical identity, or `undefined` when the host published none. |
| 3923 | */ |
| 3924 | function parseAgentTeamsCreateResult(meta) { |
| 3925 | if (typeof meta !== "object" || meta === null) return void 0; |
| 3926 | const record = meta; |
| 3927 | const teamId = typeof record.team_id === "string" ? record.team_id.trim() : ""; |
| 3928 | if (teamId === "") return void 0; |
| 3929 | const captainSessionId = typeof record.captain_session_id === "string" ? record.captain_session_id.trim() : ""; |
| 3930 | const members = []; |
| 3931 | if (Array.isArray(record.members)) for (const entry of record.members) { |
| 3932 | if (typeof entry !== "object" || entry === null) continue; |
| 3933 | const member = entry; |
| 3934 | const name = typeof member.name === "string" ? member.name : ""; |
| 3935 | if (name === "") continue; |
| 3936 | members.push({ |
| 3937 | id: typeof member.id === "string" ? member.id : "", |
| 3938 | name, |
| 3939 | role: typeof member.role === "string" ? member.role : "" |
| 3940 | }); |
| 3941 | } |
| 3942 | return { |
| 3943 | teamId, |
| 3944 | captainSessionId, |
| 3945 | members |
| 3946 | }; |
| 3947 | } |
| 3948 | /** |
| 3949 | * Read the canonical team id out of a `tool/result` recorded before the host |
| 3950 | * published {@link parseAgentTeamsCreateResult}'s metadata. Both historic |
| 3951 | * renderings carry it and have been stable since they were introduced: |
| 3952 | * `Team "<name>" created (id <canonical>) under <state_dir>. You are the |
| 3953 | * captain.` and the staged `Team "<name>" plan created under <state_dir>. It is |
| 3954 | * staged: …`, whose `state_dir` ends in the canonical id. This is the only |
| 3955 | * legacy path for names the client cannot re-derive (host digest fallback, |
| 3956 | * over-long names). Matches are taken right-to-left because the team name sits |
| 3957 | * in front of the canonical segment and may itself contain a look-alike. |
| 3958 | * @param text - the concatenated text blocks of one successful create result. |
| 3959 | * @returns the canonical id, or `undefined` when the text carries none. |
| 3960 | */ |
| 3961 | function teamIdFromCreateResultText(text) { |
| 3962 | const created = [...text.matchAll(/" created \(id ([^()\s]+)\) under /gu)].at(-1)?.[1]; |
| 3963 | if (created !== void 0 && created !== "") return created; |
| 3964 | const stagedPath = [...text.matchAll(/plan created under (.+?)\. It is staged: /gu)].at(-1)?.[1]; |
| 3965 | if (stagedPath === void 0) return void 0; |
| 3966 | const segment = stagedPath.split(/[\\/]/u).filter((part) => part !== "").at(-1); |
| 3967 | return segment === void 0 || segment === "" ? void 0 : segment; |
| 3968 | } |
| 3969 | /** Durable first-party tool events folded into one keyed Chat node. */ |
| 3970 | const agentTeamsCardDefinition = { |
| 3971 | kind: "agent-teams", |
| 3972 | target: "chat", |
| 3973 | match: (event) => { |
| 3974 | if (event.type === "tool/call" && event.data.name === "agent_teams_create") return parseAgentTeamsCreateArgs(event.data.arguments) === void 0 ? null : { |
| 3975 | id: String(event.data.callId), |
| 3976 | role: "start" |
| 3977 | }; |
| 3978 | if (event.type === "tool/result" && event.data.message.source.kind === "tool") return { |
| 3979 | id: String(event.data.message.source.callId), |
| 3980 | role: "update" |
| 3981 | }; |
| 3982 | return null; |
| 3983 | }, |
| 3984 | start: (_context, match) => { |
| 3985 | if (match.event.type !== "tool/call") throw new Error("agent-teams card start requires agent_teams_create tool/call"); |
| 3986 | const parsed = parseAgentTeamsCreateArgs(match.event.data.arguments); |
| 3987 | if (parsed === void 0) throw new Error("agent-teams card start requires valid create arguments"); |
| 3988 | return { |
| 3989 | ...parsed, |
| 3990 | accepted: false, |
| 3991 | captainSessionId: "", |
| 3992 | members: [] |
| 3993 | }; |
| 3994 | }, |
| 3995 | update: (context, match) => { |
| 3996 | if (match.event.type !== "tool/result") return context.state; |
| 3997 | if (match.event.data.error !== void 0 || toolResultFailed(match.event.data.message)) return context.state; |
| 3998 | const canonical = parseAgentTeamsCreateResult(match.event.data.meta); |
| 3999 | const legacyId = canonical === void 0 ? teamIdFromCreateResultText(resultText(match.event.data.message)) : void 0; |
| 4000 | if (canonical === void 0 && legacyId === void 0) return { |
| 4001 | ...context.state, |
| 4002 | accepted: true |
| 4003 | }; |
| 4004 | return { |
| 4005 | ...context.state, |
| 4006 | accepted: true, |
| 4007 | teamId: canonical?.teamId ?? legacyId ?? context.state.teamId, |
| 4008 | captainSessionId: canonical?.captainSessionId ?? "", |
| 4009 | members: canonical?.members ?? [] |
| 4010 | }; |
| 4011 | }, |
| 4012 | buildViewNode: (context) => { |
| 4013 | if (context.start === void 0) return null; |
| 4014 | const state = context.state; |
| 4015 | if (!state.accepted) return null; |
| 4016 | return { |
| 4017 | key: context.key, |
| 4018 | kind: "agent-teams", |
| 4019 | id: context.id, |
| 4020 | target: "chat", |
| 4021 | anchorSeq: context.start.event.seq, |
| 4022 | location: context.start.location, |
| 4023 | visibility: "visible", |
| 4024 | data: { |
| 4025 | teamId: state.teamId, |
| 4026 | captainSessionId: state.captainSessionId, |
| 4027 | teamName: state.name, |
| 4028 | members: state.members |
| 4029 | } |
| 4030 | }; |
| 4031 | } |
| 4032 | }; |
| 4033 | /** Concatenate the text blocks of one durable tool-result message. */ |
| 4034 | function resultText(message) { |
| 4035 | return message.content.filter((block) => typeof block === "object" && block !== null && "type" in block && block.type === "text" && "text" in block && typeof block.text === "string").map((block) => block.text).join("\n"); |
| 4036 | } |
| 4037 | /** V4 tool-role results carry isError directly; older logs nest tool-result blocks. */ |
| 4038 | function toolResultFailed(message) { |
| 4039 | return message.isError === true || message.content.some((block) => typeof block === "object" && block !== null && "type" in block && block.type === "tool-result" && "isError" in block && block.isError === true); |
| 4040 | } |
| 4041 | /** Keep summaries tied to the create turn, including multiple teams in one turn. */ |
| 4042 | function teamCardsForTurn(nodes, turn) { |
| 4043 | return [...nodes].filter((node) => node.kind === "agent-teams" && (node.location.kind === "turn" || node.location.kind === "step") && node.location.turn.turn === turn); |
| 4044 | } |
| 4045 | //#endregion |
| 4046 | //#region lib/client/TeamChatEntry.js |
| 4047 | /** Session-owned entry points: a persistent title action and a durable turn card. */ |
| 4048 | function TeamChatEntry({ sessionId, t }) { |
| 4049 | const { teams, archivedTeams } = (0, react.useSyncExternalStore)(subscribeActivitySnapshots, getActivitySnapshotsSnapshot); |
| 4050 | const team = [...teams, ...archivedTeams].find((team) => team.captainSessionId === sessionId); |
| 4051 | if (!team) return null; |
| 4052 | return (0, react_jsx_runtime.jsxs)("button", { |
| 4053 | className: AgentTeamsCard_module_css_default.chatEntry, |
| 4054 | "data-team-chat-entry": true, |
| 4055 | type: "button", |
| 4056 | title: t("workspace.focus"), |
| 4057 | onClick: () => openActivityPanel({ |
| 4058 | teamId: team.teamId, |
| 4059 | captainSessionId: sessionId, |
| 4060 | teamName: team.name, |
| 4061 | members: team.members |
| 4062 | }), |
| 4063 | children: [(0, react_jsx_runtime.jsx)("img", { |
| 4064 | src: LEAD_ART, |
| 4065 | alt: "", |
| 4066 | "aria-hidden": true |
| 4067 | }), t("workspace.focus")] |
| 4068 | }); |
| 4069 | } |
| 4070 | function TeamTurnCard({ sessionId, turn, useChat, t, openMember }) { |
| 4071 | const cards = teamCardsForTurn(useChat((snapshot) => snapshot.nodes).values(), turn.turn); |
| 4072 | if (turn.status !== "closed" || cards.length === 0) return null; |
| 4073 | return (0, react_jsx_runtime.jsx)("div", { |
| 4074 | className: AgentTeamsCard_module_css_default.turnCards, |
| 4075 | "data-team-turn-cards": true, |
| 4076 | children: cards.map((node) => (0, react_jsx_runtime.jsx)(AgentTeamsSummary, { |
| 4077 | data: node.data, |
| 4078 | sessionId, |
| 4079 | t, |
| 4080 | openMember |
| 4081 | }, node.key)) |
| 4082 | }); |
| 4083 | } |
| 4084 | //#endregion |
| 4085 | //#region lib/client/locales.js |
| 4086 | /** `agentTeams` namespace dictionaries for every plugin-owned Web surface. */ |
| 4087 | /** Dictionary namespace owned by the AgentTeams client plugin. */ |
| 4088 | const AGENT_TEAMS_LOCALE_NAMESPACE = "agentTeams"; |
| 4089 | /** Simplified Chinese dictionary (the key-set source of truth). */ |
| 4090 | const zh = { |
| 4091 | "workspace.dependencies": "从左到右:完成前置后解锁 · 点击查看详情", |
| 4092 | "workspace.title": "团队协作", |
| 4093 | "workspace.guide": "查看成员分工、任务依赖与执行进度", |
| 4094 | "workspace.eyebrow": "AGENT TEAMS", |
| 4095 | "workspace.description": "队长统筹分工,成员按任务依赖并行协作。", |
| 4096 | "workspace.relationships": "队长协调成员分工;任务连线表示前置依赖。点击任务可定位负责成员。", |
| 4097 | "workspace.emptyTitle": "当前会话还没有团队", |
| 4098 | "workspace.emptyBody": "在聊天中使用 /agent-teams 描述目标,确认计划后即可在这里查看协作进度。", |
| 4099 | "workspace.loading": "正在读取团队状态", |
| 4100 | "workspace.error": "暂时无法连接团队服务,正在自动重试。已加载的状态可能不是最新。", |
| 4101 | "workspace.retry": "重新连接", |
| 4102 | "workspace.current": "当前团队", |
| 4103 | "workspace.history": "历史记录", |
| 4104 | "workspace.back": "返回对话", |
| 4105 | "workspace.tasks": "项任务", |
| 4106 | "workspace.members": "名成员", |
| 4107 | "workspace.completed": "已完成", |
| 4108 | "workspace.focus": "查看团队", |
| 4109 | "workspace.noTasks": "等待队长拆解任务", |
| 4110 | "workspace.inbox": "队长收件箱", |
| 4111 | "workspace.inboxHint": "最近 5 条未读消息", |
| 4112 | "workspace.inboxEmpty": "暂无未读消息。成员回报会在这里显示,队长读取后移出。", |
| 4113 | "workspace.taskSummary": "任务完成情况", |
| 4114 | "workspace.verdictStale": "结论已过期", |
| 4115 | "card.memberCount": "{count} 名成员", |
| 4116 | "action.openActivityPanel": "打开活动面板", |
| 4117 | "activity.panelButton": "活动面板", |
| 4118 | "activity.badgeAria": "AgentTeams 活动与历史,{count} 条团队记录", |
| 4119 | "activity.panelAria": "AgentTeams 活动面板", |
| 4120 | "activity.title": "AgentTeams 活动", |
| 4121 | "activity.float": "切换为浮动面板", |
| 4122 | "activity.dockRight": "停靠到右侧", |
| 4123 | "activity.collapse": "收起活动面板", |
| 4124 | "activity.empty": "暂无团队活动", |
| 4125 | "team.stop": "停止团队", |
| 4126 | "team.stopped": "已停止", |
| 4127 | "team.stopTitle": "确认停止“{team}”?", |
| 4128 | "team.stopDescription": "将取消 {tasks} 项未完成任务,并停止 {members} 名正在工作的成员。已完成的结果会保留。", |
| 4129 | "team.stopCancel": "继续运行", |
| 4130 | "team.stopConfirm": "确认停止", |
| 4131 | "team.stopping": "正在停止…", |
| 4132 | "team.stopFailed": "停止失败:{message}", |
| 4133 | "team.stopRequestFailed": "服务器未能停止团队,请重试", |
| 4134 | "team.discarded": "已放弃", |
| 4135 | "format.listSeparator": "、", |
| 4136 | "task.status.pending": "待领取", |
| 4137 | "task.status.claimed": "已认领", |
| 4138 | "task.status.inProgress": "进行中", |
| 4139 | "task.status.completed": "已完成", |
| 4140 | "task.status.failed": "失败", |
| 4141 | "task.status.cancelled": "已取消", |
| 4142 | "task.status.notRun": "未执行", |
| 4143 | "member.state.working": "工作中", |
| 4144 | "member.state.failed": "有失败", |
| 4145 | "member.state.waiting": "等待", |
| 4146 | "member.state.delivered": "已交付", |
| 4147 | "member.state.left": "已离队", |
| 4148 | "member.state.removed": "已移除", |
| 4149 | "member.state.pending": "待执行", |
| 4150 | "member.state.unassigned": "待派工", |
| 4151 | "member.state.staged": "待创建", |
| 4152 | "member.state.notCreated": "未创建", |
| 4153 | "member.state.stopped": "已停止", |
| 4154 | "member.status.executing": "正在执行 {taskId}", |
| 4155 | "member.status.executingModel": "正在执行 {taskId} · {model}", |
| 4156 | "member.status.working": "正在处理已派任务", |
| 4157 | "member.status.waitingOn": "等待 {taskId} · {assignee}", |
| 4158 | "member.status.waitingPrerequisite": "等待前置任务", |
| 4159 | "member.status.waitingAssignment": "等待队长派工", |
| 4160 | "member.status.delivered": "任务已交付", |
| 4161 | "member.status.idle": "待继续执行", |
| 4162 | "member.status.unknown": "状态未知", |
| 4163 | "member.status.staged": "确认后创建并启动", |
| 4164 | "member.status.settled": "任务均已终结", |
| 4165 | "member.status.discarded": "计划已放弃,未创建", |
| 4166 | "member.status.stopped": "团队已停止,需显式恢复", |
| 4167 | "task.assignee.unclaimed": "待认领", |
| 4168 | "task.summary.waitingBreakdown": "等待队长拆解任务", |
| 4169 | "task.summary.staged": "{count} 项计划等待确认", |
| 4170 | "task.summary.discarded": "{count} 项计划已放弃,均未执行", |
| 4171 | "task.summary.allDelivered": "全部 {count} 项任务已交付", |
| 4172 | "task.summary.ended": "终态:{completed} 已交付 · {cancelled} 已取消 · {failed} 失败", |
| 4173 | "task.summary.blockedAndRunning": "{tasks}{more} 等待前置,其余已开工", |
| 4174 | "task.summary.more": " 等 {count} 项", |
| 4175 | "task.summary.running": "{tasks} 正在执行", |
| 4176 | "task.summary.claimed": "已认领:{tasks}", |
| 4177 | "task.summary.ready": "{tasks} 已就绪待开工", |
| 4178 | "task.summary.blocked": "{tasks} 等待前置", |
| 4179 | "task.summary.failedSettled": "{count} 项已失败,自动循环已停止", |
| 4180 | "task.summary.waitingSchedule": "等待下一轮调度", |
| 4181 | "progress.aria": "团队总进度", |
| 4182 | "progress.title": "总进度", |
| 4183 | "progress.running": "■ 进行中 {count}", |
| 4184 | "progress.claimed": "■ 已认领 {count}", |
| 4185 | "progress.blocked": "■ 等待依赖 {count}", |
| 4186 | "progress.delivered": "■ 已交付 {count}", |
| 4187 | "dependency.aria": "任务依赖链", |
| 4188 | "dependency.parallel": "并行任务", |
| 4189 | "dependency.title": "任务依赖", |
| 4190 | "dependency.hint.parallel": "无前后依赖 · 点击查看详情", |
| 4191 | "dependency.hint.chain": "悬停高亮依赖链 · 点击固定", |
| 4192 | "dependency.hint.pinned": "{taskId} 已固定 · Esc 取消", |
| 4193 | "task.runningAria": "运行中", |
| 4194 | "task.model": "{model}", |
| 4195 | "task.detail.cancelled": "任务已取消,不会继续执行", |
| 4196 | "task.detail.failed": "任务失败,等待明确重试", |
| 4197 | "task.detail.completed": "已完成并交付", |
| 4198 | "task.detail.noPrerequisite": "无前置,可立即开工", |
| 4199 | "task.detail.ready": "前置已就绪,可开工", |
| 4200 | "task.detail.waitingOn": "等待 {tasks}", |
| 4201 | "task.detail.notRun": "计划已放弃,任务未执行", |
| 4202 | "task.detail.noDownstream": "无下游任务", |
| 4203 | "task.detail.unlocks": "完成后解锁 {tasks}", |
| 4204 | "team.ended": "已结束", |
| 4205 | "plan.badge": "待确认", |
| 4206 | "plan.title": "执行前计划审查", |
| 4207 | "plan.description": "成员尚未创建、任务尚未调度。可直接调整计划,也可返回对话告诉队长哪里需要修改。", |
| 4208 | "plan.member.role": "角色", |
| 4209 | "plan.member.provider": "Provider", |
| 4210 | "plan.member.model": "模型", |
| 4211 | "plan.member.reasoning": "推理等级", |
| 4212 | "plan.member.reasoningHint": "留空使用默认值;可用 low、medium、high、xhigh 等", |
| 4213 | "plan.model.choose": "选择模型", |
| 4214 | "plan.model.currentUnavailable": "{provider}/{model}(当前目录不可用)", |
| 4215 | "plan.model.route": "路由:{provider}/{model}", |
| 4216 | "plan.model.defaultReasoning": "默认推理等级", |
| 4217 | "plan.model.providerDefault": "Provider 默认值", |
| 4218 | "plan.model.modelDefault": "模型默认值({effort})", |
| 4219 | "plan.model.triggerAria": "选择成员模型,当前 {model},推理等级 {effort}", |
| 4220 | "plan.model.back": "返回", |
| 4221 | "plan.model.loading": "正在加载模型…", |
| 4222 | "plan.model.empty": "暂无可用模型", |
| 4223 | "plan.model.partialFailure": "{count} 个 Provider 的模型目录加载失败", |
| 4224 | "plan.model.retry": "重试", |
| 4225 | "plan.member.prompt": "角色提示词", |
| 4226 | "plan.member.roleFallback": "未设置角色", |
| 4227 | "plan.task.subject": "任务名称", |
| 4228 | "plan.task.description": "任务说明", |
| 4229 | "plan.task.assignee": "负责人", |
| 4230 | "plan.task.dependencies": "依赖任务 ID(逗号分隔)", |
| 4231 | "plan.task.dependenciesHint": "例如 task-1, task-2;不得形成循环依赖", |
| 4232 | "plan.task.unassigned": "共享任务池", |
| 4233 | "plan.unsaved": "未保存", |
| 4234 | "plan.save": "保存", |
| 4235 | "plan.saving": "保存中…", |
| 4236 | "plan.remove": "删除", |
| 4237 | "plan.removed": "任务已删除", |
| 4238 | "plan.removeConfirm": "确认删除", |
| 4239 | "plan.removeWarning": "删除 {task} 后将重新计算依赖关系。", |
| 4240 | "plan.cancel": "取消", |
| 4241 | "plan.addTask": "添加任务", |
| 4242 | "plan.adding": "添加中…", |
| 4243 | "plan.taskAdded": "任务已添加", |
| 4244 | "plan.newTask": "新任务名称", |
| 4245 | "plan.newTaskLabel": "新增计划任务", |
| 4246 | "plan.readySummary": "{members} 名成员 · {tasks} 项任务 · {links} 条依赖", |
| 4247 | "plan.flow.aria": "团队启动流程", |
| 4248 | "plan.flow.review": "审查计划", |
| 4249 | "plan.flow.spawn": "创建成员", |
| 4250 | "plan.flow.run": "开始执行", |
| 4251 | "plan.members.title": "成员与模型路由", |
| 4252 | "plan.members.count": "{count} 名成员", |
| 4253 | "plan.members.empty": "尚未规划成员", |
| 4254 | "plan.tasks.title": "任务与依赖", |
| 4255 | "plan.tasks.count": "{count} 项任务 · {links} 条依赖", |
| 4256 | "plan.tasks.empty": "尚未规划任务", |
| 4257 | "plan.dependencies.none": "无依赖", |
| 4258 | "plan.dependencies.count": "{count} 条依赖", |
| 4259 | "plan.approve": "确认并启动团队", |
| 4260 | "plan.approving": "正在创建成员…", |
| 4261 | "plan.approveTitle": "计划检查完毕?", |
| 4262 | "plan.approveHint": "确认后将创建 {members} 名成员并调度 {tasks} 项任务。", |
| 4263 | "plan.approveConfirmTitle": "确认启动此团队", |
| 4264 | "plan.approveWarning": "启动后不能再在此处编辑成员和依赖。", |
| 4265 | "plan.approveConfirm": "确认启动", |
| 4266 | "plan.continue": "返回对话修改", |
| 4267 | "plan.returnToChat": "回到对话", |
| 4268 | "plan.feedbackTitle": "正在等你说明修改方向", |
| 4269 | "plan.feedbackHint": "队长会在对话中追问;收到你的回复后,只修改这份草案并再次等待确认。", |
| 4270 | "plan.discard": "放弃本次计划", |
| 4271 | "plan.discardConfirmTitle": "放弃本次计划?", |
| 4272 | "plan.discardWarning": "该计划会结束并归档;尚未创建任何成员,也不会执行任务。", |
| 4273 | "plan.discardConfirm": "确认放弃", |
| 4274 | "plan.discarding": "正在放弃…", |
| 4275 | "plan.pendingEdits": "请先保存当前修改,再启动团队。", |
| 4276 | "plan.saved": "计划已保存", |
| 4277 | "plan.failed": "操作失败:{message}", |
| 4278 | "team.stats.members": "{count} 名成员", |
| 4279 | "team.stats.completed": "{completed}/{total} 完成", |
| 4280 | "team.stats.messages": "{count} 条消息", |
| 4281 | "delegation.aria": "队长派工关系", |
| 4282 | "captain.name": "队长", |
| 4283 | "captain.role": "拆解 · 派发 · 汇总", |
| 4284 | "captain.summary": "已派发 {tasks} 项任务给 {members} 名成员", |
| 4285 | "captain.summary.staged": "已规划 {tasks} 项任务与 {members} 名成员,等待确认", |
| 4286 | "captain.summary.awaitingFeedback": "草案已保留,等待你在对话中说明修改方向", |
| 4287 | "captain.summary.discarded": "计划已放弃:{members} 名成员未创建,{tasks} 项任务未执行", |
| 4288 | "captain.summary.withTakeover": "已派发 {tasks} 项给成员 · 队长接管 {captainTasks}", |
| 4289 | "captain.state.working": "{count} 人执行中", |
| 4290 | "captain.state.takeover": "正在执行 {tasks}", |
| 4291 | "captain.state.collected": "已收齐", |
| 4292 | "captain.state.waiting": "等待回报", |
| 4293 | "captain.state.staged": "待确认", |
| 4294 | "captain.state.awaitingFeedback": "待反馈", |
| 4295 | "captain.state.discarded": "已放弃", |
| 4296 | "captain.state.settled": "已终结", |
| 4297 | "members.toggle": "{count} 名成员", |
| 4298 | "members.collapse": "收起", |
| 4299 | "members.expand": "展开", |
| 4300 | "members.expandFinished": "展开已结束({count})", |
| 4301 | "members.empty": "暂无成员,等待队长组建团队", |
| 4302 | "assignment.label": "队长派发", |
| 4303 | "assignment.staged": "计划任务", |
| 4304 | "assignment.discarded": "未执行的计划", |
| 4305 | "assignment.empty": "暂无任务", |
| 4306 | "archive.label": "已结束 · 历史归档", |
| 4307 | "archive.discardedLabel": "计划已放弃 · 历史归档" |
| 4308 | }; |
| 4309 | /** English dictionary, checked complete against the Chinese source key set. */ |
| 4310 | const en = { |
| 4311 | "workspace.dependencies": "Left to right: prerequisites unlock tasks · Select for details", |
| 4312 | "workspace.title": "Team workspace", |
| 4313 | "workspace.guide": "Members, task dependencies, and execution progress", |
| 4314 | "workspace.eyebrow": "AGENT TEAMS", |
| 4315 | "workspace.description": "The captain coordinates. Members work in parallel as dependencies clear.", |
| 4316 | "workspace.relationships": "The captain coordinates members. Connections show task prerequisites. Select a task to locate its owner.", |
| 4317 | "workspace.emptyTitle": "No team in this conversation yet", |
| 4318 | "workspace.emptyBody": "Use /agent-teams in chat to describe your goal. Review the plan, then follow the team here.", |
| 4319 | "workspace.loading": "Loading team activity", |
| 4320 | "workspace.error": "The team service is unavailable. Retrying automatically; loaded activity may be out of date.", |
| 4321 | "workspace.retry": "Reconnect", |
| 4322 | "workspace.current": "Current team", |
| 4323 | "workspace.history": "History", |
| 4324 | "workspace.back": "Back to conversation", |
| 4325 | "workspace.tasks": "tasks", |
| 4326 | "workspace.members": "members", |
| 4327 | "workspace.completed": "completed", |
| 4328 | "workspace.focus": "View team", |
| 4329 | "workspace.noTasks": "Waiting for the captain to define tasks", |
| 4330 | "workspace.inbox": "Captain inbox", |
| 4331 | "workspace.inboxHint": "Up to 5 recent unread messages", |
| 4332 | "workspace.inboxEmpty": "No unread messages. Member reports appear here until the captain reads them.", |
| 4333 | "workspace.taskSummary": "Task completion summary", |
| 4334 | "workspace.verdictStale": "Verdict outdated", |
| 4335 | "card.memberCount": "{count} members", |
| 4336 | "action.openActivityPanel": "Open activity panel", |
| 4337 | "activity.panelButton": "Activity panel", |
| 4338 | "activity.badgeAria": "AgentTeams activity and history, {count} team records", |
| 4339 | "activity.panelAria": "AgentTeams activity panel", |
| 4340 | "activity.title": "AgentTeams activity", |
| 4341 | "activity.float": "Switch to floating panel", |
| 4342 | "activity.dockRight": "Dock to the right", |
| 4343 | "activity.collapse": "Collapse activity panel", |
| 4344 | "activity.empty": "No team activity", |
| 4345 | "team.stop": "Stop team", |
| 4346 | "team.stopped": "Stopped", |
| 4347 | "team.stopTitle": "Stop “{team}”?", |
| 4348 | "team.stopDescription": "This cancels {tasks} unfinished tasks and stops {members} working members. Completed results are kept.", |
| 4349 | "team.stopCancel": "Keep running", |
| 4350 | "team.stopConfirm": "Stop team", |
| 4351 | "team.stopping": "Stopping…", |
| 4352 | "team.stopFailed": "Could not stop team: {message}", |
| 4353 | "team.stopRequestFailed": "The server could not stop this team. Try again.", |
| 4354 | "team.discarded": "Discarded", |
| 4355 | "format.listSeparator": ", ", |
| 4356 | "task.status.pending": "Unclaimed", |
| 4357 | "task.status.claimed": "Claimed", |
| 4358 | "task.status.inProgress": "In progress", |
| 4359 | "task.status.completed": "Completed", |
| 4360 | "task.status.failed": "Failed", |
| 4361 | "task.status.cancelled": "Cancelled", |
| 4362 | "task.status.notRun": "Not run", |
| 4363 | "member.state.working": "Working", |
| 4364 | "member.state.failed": "Has failures", |
| 4365 | "member.state.waiting": "Waiting", |
| 4366 | "member.state.delivered": "Delivered", |
| 4367 | "member.state.left": "Left team", |
| 4368 | "member.state.removed": "Removed", |
| 4369 | "member.state.pending": "Pending", |
| 4370 | "member.state.unassigned": "Awaiting assignment", |
| 4371 | "member.state.staged": "Not spawned", |
| 4372 | "member.state.notCreated": "Not created", |
| 4373 | "member.state.stopped": "Stopped", |
| 4374 | "member.status.executing": "Working on {taskId}", |
| 4375 | "member.status.executingModel": "Working on {taskId} · {model}", |
| 4376 | "member.status.working": "Working on assigned tasks", |
| 4377 | "member.status.waitingOn": "Waiting for {taskId} · {assignee}", |
| 4378 | "member.status.waitingPrerequisite": "Waiting for prerequisites", |
| 4379 | "member.status.waitingAssignment": "Waiting for the captain to assign work", |
| 4380 | "member.status.delivered": "Tasks delivered", |
| 4381 | "member.status.idle": "Ready to continue", |
| 4382 | "member.status.unknown": "Status unknown", |
| 4383 | "member.status.staged": "Will be spawned after approval", |
| 4384 | "member.status.settled": "All assigned work is settled", |
| 4385 | "member.status.discarded": "Plan discarded; member was not created", |
| 4386 | "member.status.stopped": "Team stopped; explicit resume required", |
| 4387 | "task.assignee.unclaimed": "Unclaimed", |
| 4388 | "task.summary.waitingBreakdown": "Waiting for the captain to break down the work", |
| 4389 | "task.summary.staged": "{count} planned tasks awaiting approval", |
| 4390 | "task.summary.discarded": "{count} planned tasks discarded; none ran", |
| 4391 | "task.summary.allDelivered": "All {count} tasks delivered", |
| 4392 | "task.summary.ended": "Final: {completed} delivered · {cancelled} cancelled · {failed} failed", |
| 4393 | "task.summary.blockedAndRunning": "{tasks}{more} waiting on prerequisites; other work has started", |
| 4394 | "task.summary.more": " and {count} more", |
| 4395 | "task.summary.running": "{tasks} in progress", |
| 4396 | "task.summary.claimed": "Claimed: {tasks}", |
| 4397 | "task.summary.ready": "{tasks} ready to start", |
| 4398 | "task.summary.blocked": "{tasks} waiting on prerequisites", |
| 4399 | "task.summary.failedSettled": "{count} failed; the automatic loop has stopped", |
| 4400 | "task.summary.waitingSchedule": "Waiting for the next scheduling round", |
| 4401 | "progress.aria": "Overall team progress", |
| 4402 | "progress.title": "Overall progress", |
| 4403 | "progress.running": "■ In progress {count}", |
| 4404 | "progress.claimed": "■ Claimed {count}", |
| 4405 | "progress.blocked": "■ Waiting {count}", |
| 4406 | "progress.delivered": "■ Delivered {count}", |
| 4407 | "dependency.aria": "Task dependency chain", |
| 4408 | "dependency.parallel": "Parallel tasks", |
| 4409 | "dependency.title": "Task dependencies", |
| 4410 | "dependency.hint.parallel": "No dependencies · Click for details", |
| 4411 | "dependency.hint.chain": "Hover to highlight dependencies · Click to pin", |
| 4412 | "dependency.hint.pinned": "{taskId} pinned · Esc to clear", |
| 4413 | "task.runningAria": "Running", |
| 4414 | "task.model": "{model}", |
| 4415 | "task.detail.cancelled": "Cancelled; execution will not continue", |
| 4416 | "task.detail.failed": "Failed; awaiting an explicit retry", |
| 4417 | "task.detail.completed": "Completed and delivered", |
| 4418 | "task.detail.noPrerequisite": "No prerequisites; ready to start", |
| 4419 | "task.detail.ready": "Prerequisites ready; can start", |
| 4420 | "task.detail.waitingOn": "Waiting for {tasks}", |
| 4421 | "task.detail.notRun": "Plan discarded; task was not run", |
| 4422 | "task.detail.noDownstream": "No downstream tasks", |
| 4423 | "task.detail.unlocks": "Unlocks {tasks} when complete", |
| 4424 | "team.ended": "Ended", |
| 4425 | "plan.badge": "Awaiting approval", |
| 4426 | "plan.title": "Pre-run plan review", |
| 4427 | "plan.description": "Members have not been spawned and tasks have not been scheduled. Edit the draft here, or return to chat and tell the Captain what should change.", |
| 4428 | "plan.member.role": "Role", |
| 4429 | "plan.member.provider": "Provider", |
| 4430 | "plan.member.model": "Model", |
| 4431 | "plan.member.reasoning": "Reasoning effort", |
| 4432 | "plan.member.reasoningHint": "Leave blank for default; accepts low, medium, high, xhigh, and more", |
| 4433 | "plan.model.choose": "Choose a model", |
| 4434 | "plan.model.currentUnavailable": "{provider}/{model} (not in the current catalog)", |
| 4435 | "plan.model.route": "Route: {provider}/{model}", |
| 4436 | "plan.model.defaultReasoning": "Default reasoning effort", |
| 4437 | "plan.model.providerDefault": "Provider default", |
| 4438 | "plan.model.modelDefault": "Model default ({effort})", |
| 4439 | "plan.model.triggerAria": "Choose member model, currently {model}, reasoning effort {effort}", |
| 4440 | "plan.model.back": "Back", |
| 4441 | "plan.model.loading": "Loading models…", |
| 4442 | "plan.model.empty": "No models available", |
| 4443 | "plan.model.partialFailure": "{count} provider catalogs could not be loaded", |
| 4444 | "plan.model.retry": "Retry", |
| 4445 | "plan.member.prompt": "Role prompt", |
| 4446 | "plan.member.roleFallback": "Role not set", |
| 4447 | "plan.task.subject": "Task subject", |
| 4448 | "plan.task.description": "Task description", |
| 4449 | "plan.task.assignee": "Assignee", |
| 4450 | "plan.task.dependencies": "Dependency task IDs (comma-separated)", |
| 4451 | "plan.task.dependenciesHint": "For example task-1, task-2; cycles are rejected", |
| 4452 | "plan.task.unassigned": "Shared task pool", |
| 4453 | "plan.unsaved": "Unsaved", |
| 4454 | "plan.save": "Save", |
| 4455 | "plan.saving": "Saving…", |
| 4456 | "plan.remove": "Remove", |
| 4457 | "plan.removed": "Task removed", |
| 4458 | "plan.removeConfirm": "Confirm remove", |
| 4459 | "plan.removeWarning": "Removing {task} will recalculate downstream dependencies.", |
| 4460 | "plan.cancel": "Cancel", |
| 4461 | "plan.addTask": "Add task", |
| 4462 | "plan.adding": "Adding…", |
| 4463 | "plan.taskAdded": "Task added", |
| 4464 | "plan.newTask": "New task subject", |
| 4465 | "plan.newTaskLabel": "Add a planned task", |
| 4466 | "plan.readySummary": "{members} members · {tasks} tasks · {links} dependencies", |
| 4467 | "plan.flow.aria": "Team launch flow", |
| 4468 | "plan.flow.review": "Review plan", |
| 4469 | "plan.flow.spawn": "Create members", |
| 4470 | "plan.flow.run": "Start work", |
| 4471 | "plan.members.title": "Members & model routes", |
| 4472 | "plan.members.count": "{count} members", |
| 4473 | "plan.members.empty": "No members planned yet", |
| 4474 | "plan.tasks.title": "Tasks & dependencies", |
| 4475 | "plan.tasks.count": "{count} tasks · {links} dependencies", |
| 4476 | "plan.tasks.empty": "No tasks planned yet", |
| 4477 | "plan.dependencies.none": "No dependencies", |
| 4478 | "plan.dependencies.count": "{count} dependencies", |
| 4479 | "plan.approve": "Approve & Run", |
| 4480 | "plan.approving": "Creating members…", |
| 4481 | "plan.approveTitle": "Plan ready?", |
| 4482 | "plan.approveHint": "Approval creates {members} members and schedules {tasks} tasks.", |
| 4483 | "plan.approveConfirmTitle": "Confirm team launch", |
| 4484 | "plan.approveWarning": "Member routes and dependencies cannot be edited here after launch.", |
| 4485 | "plan.approveConfirm": "Confirm launch", |
| 4486 | "plan.continue": "Return to chat & revise", |
| 4487 | "plan.returnToChat": "Return to chat", |
| 4488 | "plan.feedbackTitle": "Waiting for your revision direction", |
| 4489 | "plan.feedbackHint": "The Captain will ask in chat. After your reply, it will revise this draft and wait for approval again.", |
| 4490 | "plan.discard": "Discard this plan", |
| 4491 | "plan.discardConfirmTitle": "Discard this plan?", |
| 4492 | "plan.discardWarning": "The plan will end and be archived. No members have been spawned and no tasks will run.", |
| 4493 | "plan.discardConfirm": "Discard plan", |
| 4494 | "plan.discarding": "Discarding…", |
| 4495 | "plan.pendingEdits": "Save the current edits before launching the team.", |
| 4496 | "plan.saved": "Plan saved", |
| 4497 | "plan.failed": "Operation failed: {message}", |
| 4498 | "team.stats.members": "{count} members", |
| 4499 | "team.stats.completed": "{completed}/{total} completed", |
| 4500 | "team.stats.messages": "{count} messages", |
| 4501 | "delegation.aria": "Captain delegation map", |
| 4502 | "captain.name": "Captain", |
| 4503 | "captain.role": "Break down · Delegate · Synthesize", |
| 4504 | "captain.summary": "Assigned {tasks} tasks to {members} members", |
| 4505 | "captain.summary.staged": "Planned {tasks} tasks and {members} members; awaiting approval", |
| 4506 | "captain.summary.awaitingFeedback": "Draft preserved; waiting for your revision direction in chat", |
| 4507 | "captain.summary.discarded": "Plan discarded: {members} members were not created and {tasks} tasks did not run", |
| 4508 | "captain.summary.withTakeover": "Assigned {tasks} to members · Captain owns {captainTasks}", |
| 4509 | "captain.state.working": "{count} active", |
| 4510 | "captain.state.takeover": "Working on {tasks}", |
| 4511 | "captain.state.collected": "All reports received", |
| 4512 | "captain.state.waiting": "Waiting for reports", |
| 4513 | "captain.state.staged": "Awaiting approval", |
| 4514 | "captain.state.awaitingFeedback": "Awaiting feedback", |
| 4515 | "captain.state.discarded": "Discarded", |
| 4516 | "captain.state.settled": "Settled", |
| 4517 | "members.toggle": "Members {count}", |
| 4518 | "members.collapse": "Collapse", |
| 4519 | "members.expand": "Expand", |
| 4520 | "members.expandFinished": "Show finished ({count})", |
| 4521 | "members.empty": "No members yet; waiting for the captain to assemble the team", |
| 4522 | "assignment.label": "Captain assigned", |
| 4523 | "assignment.staged": "Planned task", |
| 4524 | "assignment.discarded": "Plan not run", |
| 4525 | "assignment.empty": "No tasks", |
| 4526 | "archive.label": "Ended · Archived history", |
| 4527 | "archive.discardedLabel": "Plan discarded · Archived history" |
| 4528 | }; |
| 4529 | //#endregion |
| 4530 | //#region lib/client/index.js |
| 4531 | /** Required services: conversation nodes, slots, sessions navigation, and locale. */ |
| 4532 | const inject = [ |
| 4533 | "uiConversation", |
| 4534 | "slots", |
| 4535 | "sessions", |
| 4536 | "locale", |
| 4537 | "modelDirectories", |
| 4538 | "layout" |
| 4539 | ]; |
| 4540 | const useLegacyPanelInfo = (select) => select({ activePanelId: null }); |
| 4541 | /** The replayed user message is the canonical transcript entry. */ |
| 4542 | function HiddenAgentTeamsCommand() { |
| 4543 | return null; |
| 4544 | } |
| 4545 | /** |
| 4546 | * Register the activity monitor in the shell's additive overlay and the |
| 4547 | * in-conversation team card. The card's activity button re-opens a folded |
| 4548 | * monitor via a window event — the recovery path for an old session. |
| 4549 | */ |
| 4550 | function apply(ctx) { |
| 4551 | const bridge = createWorkspaceBridge(); |
| 4552 | const state = createWorkspaceState(); |
| 4553 | ctx.effect(() => ctx.locale.register(AGENT_TEAMS_LOCALE_NAMESPACE, { |
| 4554 | zh, |
| 4555 | en |
| 4556 | }), "agent-teams: dictionaries"); |
| 4557 | const openMember = (parentId, childId) => { |
| 4558 | openAgentTeamMember(ctx.sessions, parentId, childId, ctx.layout, ctx.get("uiWorkspace")).catch((error) => { |
| 4559 | console.warn(`agent-teams: failed to open member transcript ${childId}: ${String(error)}`); |
| 4560 | }); |
| 4561 | }; |
| 4562 | const Panel = ({ t, usePanelInfo }) => { |
| 4563 | const conversationVisible = (usePanelInfo ?? useLegacyPanelInfo)((panel) => panel.activePanelId === null); |
| 4564 | return (0, react_jsx_runtime.jsx)(ActivitySurface, { |
| 4565 | bridge, |
| 4566 | state, |
| 4567 | conversationVisible, |
| 4568 | sessionsList: ctx.sessions.list, |
| 4569 | modelDirectories: ctx.modelDirectories, |
| 4570 | openMember, |
| 4571 | t |
| 4572 | }); |
| 4573 | }; |
| 4574 | ctx.inject(["sidebarRight", "sidebarRightTabs"], (native) => { |
| 4575 | const t = native.locale.bind(AGENT_TEAMS_LOCALE_NAMESPACE); |
| 4576 | native.effect(() => native.sidebarRightTabs.register({ |
| 4577 | id: TEAM_TAB_ID, |
| 4578 | kind: TEAM_TAB_KIND, |
| 4579 | title: () => t("workspace.title") |
| 4580 | })); |
| 4581 | native.slots.inject("conversation.session.header.actions", () => native.slots.register({ |
| 4582 | name: "conversation.session.header.actions", |
| 4583 | id: "agent-teams-entry", |
| 4584 | order: 50, |
| 4585 | locale: AGENT_TEAMS_LOCALE_NAMESPACE |
| 4586 | }, TeamChatEntry)); |
| 4587 | native.slots.inject("conversation.chat.turnTail", () => native.slots.register({ |
| 4588 | name: "conversation.chat.turnTail", |
| 4589 | id: "agent-teams-summary", |
| 4590 | order: 50, |
| 4591 | locale: AGENT_TEAMS_LOCALE_NAMESPACE, |
| 4592 | inject: () => ({ openMember }) |
| 4593 | }, TeamTurnCard)); |
| 4594 | native.slots.inject("sidebar.right.pane.tab", () => { |
| 4595 | const dispose = native.slots.register({ |
| 4596 | name: "sidebar.right.pane.tab", |
| 4597 | key: TEAM_TAB_ID, |
| 4598 | locale: AGENT_TEAMS_LOCALE_NAMESPACE, |
| 4599 | inject: () => ({ |
| 4600 | state, |
| 4601 | modelDirectories: native.modelDirectories, |
| 4602 | openMember |
| 4603 | }) |
| 4604 | }, WorkspaceActivity); |
| 4605 | bridge.set(native.sidebarRight); |
| 4606 | return () => { |
| 4607 | bridge.set(void 0); |
| 4608 | dispose(); |
| 4609 | }; |
| 4610 | }); |
| 4611 | }); |
| 4612 | ctx.slots.inject("shell.overlay", () => ctx.slots.register({ |
| 4613 | name: "shell.overlay", |
| 4614 | id: "agent-teams-activity", |
| 4615 | order: 80, |
| 4616 | label: "AgentTeams activity", |
| 4617 | locale: AGENT_TEAMS_LOCALE_NAMESPACE |
| 4618 | }, Panel)); |
| 4619 | ctx.slots.inject("conversation.chat.commandview", () => ctx.slots.register({ |
| 4620 | name: "conversation.chat.commandview", |
| 4621 | key: "agent-teams" |
| 4622 | }, HiddenAgentTeamsCommand)); |
| 4623 | ctx.uiConversation.events.register(agentTeamsCardDefinition); |
| 4624 | ctx.slots.inject("conversation.chat.node", () => ctx.slots.register({ |
| 4625 | name: "conversation.chat.node", |
| 4626 | key: "agent-teams", |
| 4627 | locale: AGENT_TEAMS_LOCALE_NAMESPACE, |
| 4628 | inject: () => ({ |
| 4629 | openMember, |
| 4630 | workspaceBridge: bridge |
| 4631 | }) |
| 4632 | }, AgentTeamsCard)); |
| 4633 | } |
| 4634 | //#endregion |
| 4635 | exports.apply = apply; |
| 4636 | exports.inject = inject; |
| 4637 | return module.exports; |
| 4638 | } |
| 4639 | }); |
| 4640 | |
| 4641 | //# sourceMappingURL=client.js.map |