@agimon-ai/doompi-task 0.0.1-alpha.87 → 0.0.1-alpha.89

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/commands.d.mts +1 -1
  2. package/dist/{delegation-BtzyLnYM.cjs → delegation-3hMdTFXF.cjs} +4 -1
  3. package/dist/delegation-3hMdTFXF.cjs.map +1 -0
  4. package/dist/{delegation-CTFGZtwp.mjs → delegation-CkGbRaOl.mjs} +4 -1
  5. package/dist/delegation-CkGbRaOl.mjs.map +1 -0
  6. package/dist/delegationManager.cjs +1 -1
  7. package/dist/delegationManager.d.mts +1 -1
  8. package/dist/delegationManager.mjs +1 -1
  9. package/dist/extensions/mcp-ui.mjs +23 -0
  10. package/dist/extensions/mcp-ui.mjs.map +1 -0
  11. package/dist/extensions/mcp.cjs +11 -1
  12. package/dist/extensions/mcp.cjs.map +1 -1
  13. package/dist/extensions/mcp.d.mts.map +1 -1
  14. package/dist/extensions/mcp.mjs +11 -1
  15. package/dist/extensions/mcp.mjs.map +1 -1
  16. package/dist/extensions/pi.cjs +6 -5
  17. package/dist/extensions/pi.cjs.map +1 -1
  18. package/dist/extensions/pi.mjs +6 -5
  19. package/dist/extensions/pi.mjs.map +1 -1
  20. package/dist/extensions/server.cjs +1 -1
  21. package/dist/extensions/server.mjs +1 -1
  22. package/dist/{format.cli-CKxfl-lR.cjs → format.cli-ChQsP1MQ.cjs} +2 -2
  23. package/dist/{format.cli-CKxfl-lR.cjs.map → format.cli-ChQsP1MQ.cjs.map} +1 -1
  24. package/dist/{format.cli-CuTlvk8J.mjs → format.cli-Cnc591eb.mjs} +2 -2
  25. package/dist/{format.cli-CuTlvk8J.mjs.map → format.cli-Cnc591eb.mjs.map} +1 -1
  26. package/dist/{index-BUmf786V.d.mts → index-3-3ZJlaH.d.mts} +2 -1
  27. package/dist/index-3-3ZJlaH.d.mts.map +1 -0
  28. package/dist/index.cjs +1 -1
  29. package/dist/index.d.mts +2 -2
  30. package/dist/index.mjs +1 -1
  31. package/dist/{root.cli-BfEKqt8s.d.mts → root.cli-swHZqusx.d.mts} +2 -2
  32. package/dist/{root.cli-BfEKqt8s.d.mts.map → root.cli-swHZqusx.d.mts.map} +1 -1
  33. package/dist/{task-space.cli-BdDqn-_h.cjs → task-space.cli-BH4Iy_7m.cjs} +2 -2
  34. package/dist/{task-space.cli-BdDqn-_h.cjs.map → task-space.cli-BH4Iy_7m.cjs.map} +1 -1
  35. package/dist/{task-space.cli-DowNll0k.mjs → task-space.cli-CMYNjgOW.mjs} +2 -2
  36. package/dist/{task-space.cli-DowNll0k.mjs.map → task-space.cli-CMYNjgOW.mjs.map} +1 -1
  37. package/dist/{taskOverlay-BKiu4cVj.cjs → taskOverlay-B5wJHiml.cjs} +2 -2
  38. package/dist/{taskOverlay-BKiu4cVj.cjs.map → taskOverlay-B5wJHiml.cjs.map} +1 -1
  39. package/dist/{taskOverlay-DVvLdTtf.mjs → taskOverlay-CljDoTj_.mjs} +2 -2
  40. package/dist/{taskOverlay-DVvLdTtf.mjs.map → taskOverlay-CljDoTj_.mjs.map} +1 -1
  41. package/dist/toolTaskTool.d.mts +1 -1
  42. package/dist/tuiFormat.cjs +1 -1
  43. package/dist/tuiFormat.d.mts +1 -1
  44. package/dist/tuiFormat.mjs +1 -1
  45. package/dist/tuiTaskOverlay.cjs +1 -1
  46. package/dist/tuiTaskOverlay.d.mts +1 -1
  47. package/dist/tuiTaskOverlay.mjs +1 -1
  48. package/dist/tuiTaskSpace.cjs +1 -1
  49. package/dist/tuiTaskSpace.mjs +1 -1
  50. package/package.json +15 -8
  51. package/dist/delegation-BtzyLnYM.cjs.map +0 -1
  52. package/dist/delegation-CTFGZtwp.mjs.map +0 -1
  53. package/dist/index-BUmf786V.d.mts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"format.cli-CKxfl-lR.cjs","names":["DelegationManager","agentIdentityColor","renderToolHeading","DoomToolCall","truncateToWidth","visibleWidth","Text"],"sources":["../src/extensions/workspaces/sessions/(frontend)/_shared/format.cli.ts"],"sourcesContent":["import { agentIdentityColor } from '@agimon-ai/doompi-ui/theme';\nimport { DoomToolCall, renderToolHeading } from '@agimon-ai/doompi-ui/toolChrome';\nimport type { Theme } from '@earendil-works/pi-coding-agent';\nimport { type Component, Text, truncateToWidth, visibleWidth } from '@earendil-works/pi-tui';\n\nimport type {\n Task,\n TaskAction,\n TaskDetails,\n TaskItemMutation,\n TaskMutationParams,\n TaskStatus,\n} from '../../../../../models/task';\nimport { DelegationManager, type DelegationProgress } from '../../../../../services/delegation';\n\nexport const STATUS_GLYPH: Record<TaskStatus, string> = {\n pending: '○',\n in_progress: '◐',\n completed: '●',\n failed: '✗',\n deleted: '⊘',\n};\n\ntype TaskStatusColor = 'dim' | 'warning' | 'success' | 'error' | 'muted';\n\nexport const STATUS_COLOR: Record<TaskStatus, TaskStatusColor> = {\n pending: 'dim',\n in_progress: 'warning',\n completed: 'success',\n failed: 'error',\n deleted: 'muted',\n};\n\nexport const STATUS_LABEL: Record<TaskStatus, string> = {\n pending: 'pending',\n in_progress: 'in progress',\n completed: 'completed',\n failed: 'failed',\n deleted: 'deleted',\n};\n\nconst OVERLAY_STATUS_GLYPH: Record<TaskStatus, string> = {\n ...STATUS_GLYPH,\n completed: '✓',\n deleted: STATUS_GLYPH.failed,\n};\n\nconst OVERLAY_STATUS_COLOR: Record<TaskStatus, TaskStatusColor> = {\n ...STATUS_COLOR,\n deleted: 'error',\n};\nconst MILLISECONDS_PER_SECOND = 1000;\nconst SECONDS_PER_MINUTE = 60;\nconst MINUTES_PER_HOUR = 60;\nconst TOKENS_PER_KILO = 1000;\nconst TOKEN_DECIMAL_LIMIT = 10_000;\nconst REDUNDANT_WORKING_PREFIX = /^working:\\s*/i;\nconst INLINE_WHITESPACE = /\\s+/gu;\n\n/** Keep dynamic content inside the overlay's one-physical-line contract. */\nfunction inlineText(text: string): string {\n return text.replace(INLINE_WHITESPACE, ' ').trim();\n}\n\n/** Thinking text already communicates activity; keep only its useful content. */\nfunction progressText(currentTool: string | undefined): string | undefined {\n if (!currentTool) return undefined;\n const text = inlineText(currentTool.replace(REDUNDANT_WORKING_PREFIX, ''));\n return text || undefined;\n}\n\nexport const ACTION_GLYPH: Record<TaskAction, string> = {\n upsert: '✎',\n delete: '×',\n get: '›',\n list: '☰',\n clear: '∅',\n assign: '⇒',\n cancel: '⊗',\n};\n\n/**\n * `upsert` is two operations behind one name, so a homogeneous batch narrows to\n * the glyph the operator already reads: `+` means new work appeared, `→` means\n * work moved. A mixed batch keeps the neutral write glyph.\n */\nconst UPSERT_CREATE_GLYPH = '+';\nconst UPSERT_UPDATE_GLYPH = '→';\n\nfunction upsertGlyph(items: readonly TaskItemMutation[]): string {\n if (items.length === 0) return ACTION_GLYPH.upsert;\n if (items.every((item) => item.id === undefined)) return UPSERT_CREATE_GLYPH;\n if (items.every((item) => item.id !== undefined)) return UPSERT_UPDATE_GLYPH;\n return ACTION_GLYPH.upsert;\n}\n\nexport function overlayStatusGlyph(status: TaskStatus, theme: Theme): string {\n return theme.fg(OVERLAY_STATUS_COLOR[status], OVERLAY_STATUS_GLYPH[status]);\n}\n\nexport function formatElapsedMs(durationMs: number): string {\n const totalSeconds = Math.max(0, Math.floor(durationMs / MILLISECONDS_PER_SECOND));\n const seconds = totalSeconds % SECONDS_PER_MINUTE;\n const totalMinutes = Math.floor(totalSeconds / SECONDS_PER_MINUTE);\n if (totalMinutes < MINUTES_PER_HOUR) {\n return totalMinutes === 0 ? `${seconds}s` : `${totalMinutes}m${String(seconds).padStart(2, '0')}s`;\n }\n const minutes = totalMinutes % MINUTES_PER_HOUR;\n const hours = Math.floor(totalMinutes / MINUTES_PER_HOUR);\n return `${hours}h${String(minutes).padStart(2, '0')}m${String(seconds).padStart(2, '0')}s`;\n}\n\nexport function formatTokenCount(tokens: number): string {\n const count = Math.max(0, Math.round(tokens));\n if (count < TOKENS_PER_KILO) return String(count);\n if (count < TOKEN_DECIMAL_LIMIT) return `${(count / TOKENS_PER_KILO).toFixed(1)}k`;\n return `${Math.round(count / TOKENS_PER_KILO)}k`;\n}\n\n/**\n * One task row for the persistent overlay.\n *\n * A delegated row carries the agent name and its current tool so the operator\n * can see that background work is progressing without opening a transcript.\n */\nexport function formatOverlayTaskLine(\n task: Task,\n theme: Theme,\n showId: boolean,\n progress?: DelegationProgress,\n nowMs = Date.now(),\n agentColor?: Parameters<Theme['fg']>[0],\n): string {\n const subjectColor =\n task.status === 'in_progress'\n ? 'accent'\n : task.status === 'completed' || task.status === 'deleted'\n ? 'muted'\n : 'text';\n let subject = theme.fg(subjectColor, inlineText(task.subject));\n if (task.status === 'completed' || task.status === 'deleted') {\n subject = theme.strikethrough(subject);\n }\n\n let line = overlayStatusGlyph(task.status, theme);\n if (showId) line += ` ${theme.fg('dim', `#${task.id}`)}`;\n line += ` ${subject}`;\n\n const agent = task.delegation?.agent;\n const agentLabel = agent ? inlineText(agent) : undefined;\n if (agentLabel && task.delegation?.state === 'running') {\n // No progress means no timing is known, so the chips are omitted rather than\n // reported as `[0s]`. The transcript renderer has no progress feed at all.\n const chips: string[] = [];\n if (progress) {\n chips.push(theme.fg('muted', `[${formatElapsedMs(DelegationManager.elapsedMs(progress, nowMs))}]`));\n if (progress.tokens !== undefined) chips.push(theme.fg('muted', `[${formatTokenCount(progress.tokens)}]`));\n }\n const identity = task.delegation.runId ?? task.delegation.requestId;\n chips.push(theme.fg(agentColor ?? agentIdentityColor(identity), `[${agentLabel}]`));\n line += ` ${chips.join('')}`;\n const activity = progressText(progress?.currentTool);\n if (activity) line += ` ${theme.fg('muted', `· ${activity}`)}`;\n } else if (agentLabel) {\n line += ` ${theme.fg('muted', `[${agentLabel}]`)}`;\n }\n\n if (task.status === 'in_progress' && task.activeForm) {\n line += ` ${theme.fg('muted', `(${inlineText(task.activeForm)})`)}`;\n }\n if (task.blockedBy?.length) {\n line += ` ${theme.fg('muted', `⛓ ${task.blockedBy.map((id) => `#${id}`).join(',')}`)}`;\n }\n return line;\n}\n\n/** One task line for the `/tasks` command output. */\nexport function formatCommandTaskLine(task: Task, glyph: string): string {\n const form = task.status === 'in_progress' && task.activeForm ? ` (${task.activeForm})` : '';\n const agent = task.delegation?.agent ? ` [${task.delegation.agent}]` : '';\n const block = task.blockedBy?.length ? ` ⛓ ${task.blockedBy.map((id) => `#${id}`).join(',')}` : '';\n return ` ${glyph} #${task.id} ${task.subject}${form}${agent}${block}`;\n}\n\nexport function renderTaskCall(\n args: TaskMutationParams & { action: TaskAction },\n theme: Theme,\n tasks: readonly Task[],\n): Component {\n const items = args.action === 'upsert' ? (args.tasks ?? []) : [];\n const glyph = args.action === 'upsert' ? upsertGlyph(items) : (ACTION_GLYPH[args.action] ?? args.action);\n let text = renderToolHeading('task', `${glyph} ${args.action}`, theme);\n\n if (args.action === 'upsert') {\n // One entry reads exactly as create or update did; a batch reads as a count\n // rather than a subject it would have to pick arbitrarily.\n if (items.length === 1) {\n const only = items[0];\n if (only.id === undefined) {\n if (only.subject) text += ` ${theme.fg('dim', only.subject)}`;\n } else {\n const subject = tasks.find((task) => task.id === only.id)?.subject ?? only.subject ?? `#${only.id}`;\n text += ` ${theme.fg('accent', subject)}`;\n }\n } else if (items.length > 1) {\n text += ` ${theme.fg('dim', `${items.length} tasks`)}`;\n }\n } else if (args.action === 'assign') {\n const assignments = args.assignments ?? [];\n if (assignments.length === 1) {\n const only = assignments[0];\n const subject = tasks.find((task) => task.id === only.id)?.subject ?? `#${only.id}`;\n text += ` ${theme.fg('accent', subject)}`;\n if (only.agent) text += ` ${theme.fg('muted', `→ ${only.agent}`)}`;\n } else if (assignments.length > 1) {\n text += ` ${theme.fg('dim', `${assignments.length} tasks`)}`;\n }\n } else if ((args.action === 'get' || args.action === 'delete' || args.action === 'cancel') && args.id !== undefined) {\n const subject = tasks.find((task) => task.id === args.id)?.subject ?? `#${args.id}`;\n text += ` ${theme.fg('accent', subject)}`;\n } else if (args.action === 'list' && args.status) {\n text += ` ${theme.fg('muted', STATUS_LABEL[args.status])}`;\n }\n return new DoomToolCall(text);\n}\n\n/** Task rows kept in a collapsed result, before `ctrl+o` reveals the rest. */\nconst TRANSCRIPT_TASK_ROWS = 8;\n/** Minimum gap between a row's subject and its right-aligned status. */\nconst STATUS_GUTTER = 2;\n\nexport interface JustifiedRow {\n left: string;\n /** Pinned to the right edge. The subject is truncated before this is dropped. */\n right?: string;\n}\n\n/**\n * Rows whose trailing text is flushed right.\n *\n * `Text` cannot do this: the status has to be placed against the viewport edge,\n * which is only known at render time.\n */\nexport class JustifiedRows implements Component {\n constructor(private readonly rows: readonly JustifiedRow[]) {}\n\n /**\n * Nothing to discard: the rows are themed by the caller and held verbatim, and\n * Pi rebuilds this component from `renderResult` whenever the theme changes.\n */\n invalidate(): void {}\n\n render(width: number): string[] {\n return this.rows.map(({ left, right }) => {\n if (right === undefined || right.length === 0) return truncateToWidth(left, width);\n const rightWidth = visibleWidth(right);\n const room = width - rightWidth - STATUS_GUTTER;\n if (room <= 0) return truncateToWidth(left, width);\n const subject = truncateToWidth(left, room);\n const gap = Math.max(STATUS_GUTTER, width - visibleWidth(subject) - rightWidth);\n return subject + ' '.repeat(gap) + right;\n });\n }\n}\n\n/**\n * Self-owned task shell with the same structural divider as the bash tool.\n *\n * Task rows already carry precise per-task state, so the divider stays neutral\n * instead of competing with or appearing to animate between those states.\n */\nclass TaskResultFrame implements Component {\n constructor(\n private readonly content: Component,\n private readonly theme: Theme,\n ) {}\n\n render(width: number): string[] {\n if (width <= 0) return [];\n if (width < 3) return this.content.render(width);\n\n const contentWidth = width - 2;\n const divider = this.theme.fg('borderMuted', '─'.repeat(contentWidth));\n const lines = this.content.render(contentWidth).map((line) => ` ${line}`);\n return [` ${divider}`, ...lines, ''];\n }\n\n invalidate(): void {\n this.content.invalidate();\n }\n}\n\nexport interface TaskResultLike {\n content?: Array<{ type: string; text?: string }>;\n details?: unknown;\n isError?: boolean;\n}\n\nexport interface TaskResultOptions {\n expanded: boolean;\n isPartial: boolean;\n}\n\n/** Concatenated result text, which is all a thrown failure leaves behind. */\nfunction contentText(result: TaskResultLike): string {\n return (result.content ?? []).map((block) => block.text ?? '').join('');\n}\n\nfunction nonEmptyLines(text: string): string[] {\n return text.split('\\n').filter((line) => line.trim().length > 0);\n}\n\n/**\n * The rows `list` reported to the model.\n *\n * `details.tasks` is the whole post-mutation document, so the filters applied by\n * `formatContent` have to be applied again here or the transcript would disagree\n * with the text the model was given.\n */\nfunction listedTasks(details: TaskDetails): Task[] {\n const params = details.params as TaskMutationParams;\n let view = details.tasks;\n if (params.includeDeleted !== true) view = view.filter((task) => task.status !== 'deleted');\n if (params.status) view = view.filter((task) => task.status === params.status);\n return view;\n}\n\n/** The single task an id-bearing action acted on, so the transcript names it rather than a bare tick. */\nfunction subjectTask(details: TaskDetails): Task | undefined {\n const params = details.params as TaskMutationParams;\n if (params.id === undefined) return undefined;\n return details.tasks.find((task) => task.id === params.id);\n}\n\n/**\n * Tasks an upsert applied, resolved from the ids the reducer reported.\n *\n * The ids are read rather than guessed from the tail of the list: a batch\n * touches many rows, and a failed entry contributes none.\n */\nfunction upsertTasks(details: TaskDetails): Task[] {\n return (details.upsert?.applied ?? []).flatMap((id) => details.tasks.find((task) => task.id === id) ?? []);\n}\n\n/** Tasks successfully handed off by a native assignment batch. */\nfunction assignedTasks(details: TaskDetails): Task[] {\n return (details.assignment?.assigned ?? []).flatMap((id) => details.tasks.find((task) => task.id === id) ?? []);\n}\n\nfunction renderTaskResultBody(result: TaskResultLike, options: TaskResultOptions, theme: Theme): Component {\n const details = result.details as TaskDetails | undefined;\n\n // Running. `assign` and `cancel` stream a placeholder before the run settles.\n if (options.isPartial) {\n const text = nonEmptyLines(contentText(result)).at(-1) ?? 'working';\n return new Text(theme.fg('warning', '◐') + theme.fg('dim', ` ${text}`), 0, 0);\n }\n\n // Failed. Every failure path throws, so Pi hands back error text and no\n // details; without this the block would render a green tick on a failure.\n if (result.isError === true || details?.error !== undefined) {\n const message = details?.error ?? contentText(result);\n const all = nonEmptyLines(message);\n if (all.length <= 1) {\n return new Text(theme.fg('error', '✗') + theme.fg('dim', all[0] ? ` ${all[0]}` : ''), 0, 0);\n }\n const body = options.expanded ? all : all.slice(0, TRANSCRIPT_TASK_ROWS);\n return new Text([...body.map((line) => theme.fg('toolOutput', line)), theme.fg('error', '✗')].join('\\n'), 0, 0);\n }\n\n if (!details) return new Text(theme.fg('success', '✓'), 0, 0);\n\n /** Status rides on the task's own row, flushed right, rather than costing a line. */\n const row = (task: Task): JustifiedRow => ({\n left: formatOverlayTaskLine(task, theme, true),\n right: theme.fg(STATUS_COLOR[task.status], STATUS_LABEL[task.status]),\n });\n\n if (details.action === 'list') {\n const tasks = listedTasks(details);\n const shown = options.expanded ? tasks : tasks.slice(0, TRANSCRIPT_TASK_ROWS);\n const rows: JustifiedRow[] = shown.map(row);\n let summary = tasks.length === 0 ? 'no tasks' : `${tasks.length} task${tasks.length === 1 ? '' : 's'}`;\n if (tasks.length > shown.length) summary += ' · ctrl+o';\n rows.push({ left: theme.fg('success', '✓') + theme.fg('dim', ` ${summary}`) });\n return new JustifiedRows(rows);\n }\n\n if (details.action === 'clear') {\n return new Text(theme.fg('success', '✓') + theme.fg('dim', ' cleared'), 0, 0);\n }\n\n if (details.action === 'assign' && details.assignment) {\n const assigned = assignedTasks(details);\n const failed = details.assignment.failed;\n if (assigned.length === 1 && failed === 0) return new JustifiedRows([row(assigned[0])]);\n\n const shown = options.expanded ? assigned : assigned.slice(0, TRANSCRIPT_TASK_ROWS);\n const rows: JustifiedRow[] = shown.map(row);\n let summary = `${assigned.length} assigned`;\n if (failed > 0) summary += ` · ${failed} failed`;\n if (assigned.length > shown.length) summary += ' · ctrl+o';\n const mark = failed > 0 ? theme.fg('warning', '!') : theme.fg('success', '✓');\n rows.push({ left: mark + theme.fg('dim', ` ${summary}`) });\n return new JustifiedRows(rows);\n }\n\n if (details.action === 'upsert') {\n const touched = upsertTasks(details);\n const failed = details.upsert?.failed ?? 0;\n // One applied task and nothing failed is the common case: keep the single\n // row it has always had rather than dressing it as a bulk report.\n if (touched.length === 1 && failed === 0) return new JustifiedRows([row(touched[0])]);\n\n const shown = options.expanded ? touched : touched.slice(0, TRANSCRIPT_TASK_ROWS);\n const rows: JustifiedRow[] = shown.map(row);\n let summary = `${touched.length} applied`;\n if (failed > 0) summary += ` · ${failed} failed`;\n if (touched.length > shown.length) summary += ' · ctrl+o';\n // Failed entries get no row: there is no task to render, and their messages\n // are already in the text the model was given.\n const mark = failed > 0 ? theme.fg('warning', '!') : theme.fg('success', '✓');\n rows.push({ left: mark + theme.fg('dim', ` ${summary}`) });\n return new JustifiedRows(rows);\n }\n\n const task = subjectTask(details);\n if (!task) return new Text(theme.fg('success', '✓'), 0, 0);\n return new JustifiedRows([row(task)]);\n}\n\nexport function renderTaskResult(result: TaskResultLike, options: TaskResultOptions, theme: Theme): Component {\n return new TaskResultFrame(renderTaskResultBody(result, options, theme), theme);\n}\n"],"mappings":";;;;;AAeA,MAAa,eAA2C;CACtD,SAAS;CACT,aAAa;CACb,WAAW;CACX,QAAQ;CACR,SAAS;AACX;AAIA,MAAa,eAAoD;CAC/D,SAAS;CACT,aAAa;CACb,WAAW;CACX,QAAQ;CACR,SAAS;AACX;AAEA,MAAa,eAA2C;CACtD,SAAS;CACT,aAAa;CACb,WAAW;CACX,QAAQ;CACR,SAAS;AACX;AAEA,MAAM,uBAAmD;CACvD,GAAG;CACH,WAAW;CACX,SAAS,aAAa;AACxB;AAEA,MAAM,uBAA4D;CAChE,GAAG;CACH,SAAS;AACX;AACA,MAAM,0BAA0B;AAChC,MAAM,qBAAqB;AAC3B,MAAM,mBAAmB;AACzB,MAAM,kBAAkB;AACxB,MAAM,sBAAsB;AAC5B,MAAM,2BAA2B;AACjC,MAAM,oBAAoB;;AAG1B,SAAS,WAAW,MAAsB;CACxC,OAAO,KAAK,QAAQ,mBAAmB,GAAG,CAAC,CAAC,KAAK;AACnD;;AAGA,SAAS,aAAa,aAAqD;CACzE,IA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G,CAAC;CACzD,OAAO,IAAI,cAAc,CAAC,IAAI,IAAI,CAAC,CAAC;AACtC;AAEA,SAAgB,iBAAiB,QAAwB,SAA4B,OAAyB;CAC5G,OAAO,IAAI,gBAAgB,qBAAqB,QAAQ,SAAS,KAAK,GAAG,KAAK;AAChF"}
1
+ {"version":3,"file":"format.cli-ChQsP1MQ.cjs","names":["DelegationManager","agentIdentityColor","renderToolHeading","DoomToolCall","truncateToWidth","visibleWidth","Text"],"sources":["../src/extensions/workspaces/sessions/(frontend)/_shared/format.cli.ts"],"sourcesContent":["import { agentIdentityColor } from '@agimon-ai/doompi-ui/theme';\nimport { DoomToolCall, renderToolHeading } from '@agimon-ai/doompi-ui/toolChrome';\nimport type { Theme } from '@earendil-works/pi-coding-agent';\nimport { type Component, Text, truncateToWidth, visibleWidth } from '@earendil-works/pi-tui';\n\nimport type {\n Task,\n TaskAction,\n TaskDetails,\n TaskItemMutation,\n TaskMutationParams,\n TaskStatus,\n} from '../../../../../models/task';\nimport { DelegationManager, type DelegationProgress } from '../../../../../services/delegation';\n\nexport const STATUS_GLYPH: Record<TaskStatus, string> = {\n pending: '○',\n in_progress: '◐',\n completed: '●',\n failed: '✗',\n deleted: '⊘',\n};\n\ntype TaskStatusColor = 'dim' | 'warning' | 'success' | 'error' | 'muted';\n\nexport const STATUS_COLOR: Record<TaskStatus, TaskStatusColor> = {\n pending: 'dim',\n in_progress: 'warning',\n completed: 'success',\n failed: 'error',\n deleted: 'muted',\n};\n\nexport const STATUS_LABEL: Record<TaskStatus, string> = {\n pending: 'pending',\n in_progress: 'in progress',\n completed: 'completed',\n failed: 'failed',\n deleted: 'deleted',\n};\n\nconst OVERLAY_STATUS_GLYPH: Record<TaskStatus, string> = {\n ...STATUS_GLYPH,\n completed: '✓',\n deleted: STATUS_GLYPH.failed,\n};\n\nconst OVERLAY_STATUS_COLOR: Record<TaskStatus, TaskStatusColor> = {\n ...STATUS_COLOR,\n deleted: 'error',\n};\nconst MILLISECONDS_PER_SECOND = 1000;\nconst SECONDS_PER_MINUTE = 60;\nconst MINUTES_PER_HOUR = 60;\nconst TOKENS_PER_KILO = 1000;\nconst TOKEN_DECIMAL_LIMIT = 10_000;\nconst REDUNDANT_WORKING_PREFIX = /^working:\\s*/i;\nconst INLINE_WHITESPACE = /\\s+/gu;\n\n/** Keep dynamic content inside the overlay's one-physical-line contract. */\nfunction inlineText(text: string): string {\n return text.replace(INLINE_WHITESPACE, ' ').trim();\n}\n\n/** Thinking text already communicates activity; keep only its useful content. */\nfunction progressText(currentTool: string | undefined): string | undefined {\n if (!currentTool) return undefined;\n const text = inlineText(currentTool.replace(REDUNDANT_WORKING_PREFIX, ''));\n return text || undefined;\n}\n\nexport const ACTION_GLYPH: Record<TaskAction, string> = {\n upsert: '✎',\n delete: '×',\n get: '›',\n list: '☰',\n clear: '∅',\n assign: '⇒',\n cancel: '⊗',\n};\n\n/**\n * `upsert` is two operations behind one name, so a homogeneous batch narrows to\n * the glyph the operator already reads: `+` means new work appeared, `→` means\n * work moved. A mixed batch keeps the neutral write glyph.\n */\nconst UPSERT_CREATE_GLYPH = '+';\nconst UPSERT_UPDATE_GLYPH = '→';\n\nfunction upsertGlyph(items: readonly TaskItemMutation[]): string {\n if (items.length === 0) return ACTION_GLYPH.upsert;\n if (items.every((item) => item.id === undefined)) return UPSERT_CREATE_GLYPH;\n if (items.every((item) => item.id !== undefined)) return UPSERT_UPDATE_GLYPH;\n return ACTION_GLYPH.upsert;\n}\n\nexport function overlayStatusGlyph(status: TaskStatus, theme: Theme): string {\n return theme.fg(OVERLAY_STATUS_COLOR[status], OVERLAY_STATUS_GLYPH[status]);\n}\n\nexport function formatElapsedMs(durationMs: number): string {\n const totalSeconds = Math.max(0, Math.floor(durationMs / MILLISECONDS_PER_SECOND));\n const seconds = totalSeconds % SECONDS_PER_MINUTE;\n const totalMinutes = Math.floor(totalSeconds / SECONDS_PER_MINUTE);\n if (totalMinutes < MINUTES_PER_HOUR) {\n return totalMinutes === 0 ? `${seconds}s` : `${totalMinutes}m${String(seconds).padStart(2, '0')}s`;\n }\n const minutes = totalMinutes % MINUTES_PER_HOUR;\n const hours = Math.floor(totalMinutes / MINUTES_PER_HOUR);\n return `${hours}h${String(minutes).padStart(2, '0')}m${String(seconds).padStart(2, '0')}s`;\n}\n\nexport function formatTokenCount(tokens: number): string {\n const count = Math.max(0, Math.round(tokens));\n if (count < TOKENS_PER_KILO) return String(count);\n if (count < TOKEN_DECIMAL_LIMIT) return `${(count / TOKENS_PER_KILO).toFixed(1)}k`;\n return `${Math.round(count / TOKENS_PER_KILO)}k`;\n}\n\n/**\n * One task row for the persistent overlay.\n *\n * A delegated row carries the agent name and its current tool so the operator\n * can see that background work is progressing without opening a transcript.\n */\nexport function formatOverlayTaskLine(\n task: Task,\n theme: Theme,\n showId: boolean,\n progress?: DelegationProgress,\n nowMs = Date.now(),\n agentColor?: Parameters<Theme['fg']>[0],\n): string {\n const subjectColor =\n task.status === 'in_progress'\n ? 'accent'\n : task.status === 'completed' || task.status === 'deleted'\n ? 'muted'\n : 'text';\n let subject = theme.fg(subjectColor, inlineText(task.subject));\n if (task.status === 'completed' || task.status === 'deleted') {\n subject = theme.strikethrough(subject);\n }\n\n let line = overlayStatusGlyph(task.status, theme);\n if (showId) line += ` ${theme.fg('dim', `#${task.id}`)}`;\n line += ` ${subject}`;\n\n const agent = task.delegation?.agent;\n const agentLabel = agent ? inlineText(agent) : undefined;\n if (agentLabel && task.delegation?.state === 'running') {\n // No progress means no timing is known, so the chips are omitted rather than\n // reported as `[0s]`. The transcript renderer has no progress feed at all.\n const chips: string[] = [];\n if (progress) {\n chips.push(theme.fg('muted', `[${formatElapsedMs(DelegationManager.elapsedMs(progress, nowMs))}]`));\n if (progress.tokens !== undefined) chips.push(theme.fg('muted', `[${formatTokenCount(progress.tokens)}]`));\n }\n const identity = task.delegation.runId ?? task.delegation.requestId;\n chips.push(theme.fg(agentColor ?? agentIdentityColor(identity), `[${agentLabel}]`));\n line += ` ${chips.join('')}`;\n const activity = progressText(progress?.currentTool);\n if (activity) line += ` ${theme.fg('muted', `· ${activity}`)}`;\n } else if (agentLabel) {\n line += ` ${theme.fg('muted', `[${agentLabel}]`)}`;\n }\n\n if (task.status === 'in_progress' && task.activeForm) {\n line += ` ${theme.fg('muted', `(${inlineText(task.activeForm)})`)}`;\n }\n if (task.blockedBy?.length) {\n line += ` ${theme.fg('muted', `⛓ ${task.blockedBy.map((id) => `#${id}`).join(',')}`)}`;\n }\n return line;\n}\n\n/** One task line for the `/tasks` command output. */\nexport function formatCommandTaskLine(task: Task, glyph: string): string {\n const form = task.status === 'in_progress' && task.activeForm ? ` (${task.activeForm})` : '';\n const agent = task.delegation?.agent ? ` [${task.delegation.agent}]` : '';\n const block = task.blockedBy?.length ? ` ⛓ ${task.blockedBy.map((id) => `#${id}`).join(',')}` : '';\n return ` ${glyph} #${task.id} ${task.subject}${form}${agent}${block}`;\n}\n\nexport function renderTaskCall(\n args: TaskMutationParams & { action: TaskAction },\n theme: Theme,\n tasks: readonly Task[],\n): Component {\n const items = args.action === 'upsert' ? (args.tasks ?? []) : [];\n const glyph = args.action === 'upsert' ? upsertGlyph(items) : (ACTION_GLYPH[args.action] ?? args.action);\n let text = renderToolHeading('task', `${glyph} ${args.action}`, theme);\n\n if (args.action === 'upsert') {\n // One entry reads exactly as create or update did; a batch reads as a count\n // rather than a subject it would have to pick arbitrarily.\n if (items.length === 1) {\n const only = items[0];\n if (only.id === undefined) {\n if (only.subject) text += ` ${theme.fg('dim', only.subject)}`;\n } else {\n const subject = tasks.find((task) => task.id === only.id)?.subject ?? only.subject ?? `#${only.id}`;\n text += ` ${theme.fg('accent', subject)}`;\n }\n } else if (items.length > 1) {\n text += ` ${theme.fg('dim', `${items.length} tasks`)}`;\n }\n } else if (args.action === 'assign') {\n const assignments = args.assignments ?? [];\n if (assignments.length === 1) {\n const only = assignments[0];\n const subject = tasks.find((task) => task.id === only.id)?.subject ?? `#${only.id}`;\n text += ` ${theme.fg('accent', subject)}`;\n if (only.agent) text += ` ${theme.fg('muted', `→ ${only.agent}`)}`;\n } else if (assignments.length > 1) {\n text += ` ${theme.fg('dim', `${assignments.length} tasks`)}`;\n }\n } else if ((args.action === 'get' || args.action === 'delete' || args.action === 'cancel') && args.id !== undefined) {\n const subject = tasks.find((task) => task.id === args.id)?.subject ?? `#${args.id}`;\n text += ` ${theme.fg('accent', subject)}`;\n } else if (args.action === 'list' && args.status) {\n text += ` ${theme.fg('muted', STATUS_LABEL[args.status])}`;\n }\n return new DoomToolCall(text);\n}\n\n/** Task rows kept in a collapsed result, before `ctrl+o` reveals the rest. */\nconst TRANSCRIPT_TASK_ROWS = 8;\n/** Minimum gap between a row's subject and its right-aligned status. */\nconst STATUS_GUTTER = 2;\n\nexport interface JustifiedRow {\n left: string;\n /** Pinned to the right edge. The subject is truncated before this is dropped. */\n right?: string;\n}\n\n/**\n * Rows whose trailing text is flushed right.\n *\n * `Text` cannot do this: the status has to be placed against the viewport edge,\n * which is only known at render time.\n */\nexport class JustifiedRows implements Component {\n constructor(private readonly rows: readonly JustifiedRow[]) {}\n\n /**\n * Nothing to discard: the rows are themed by the caller and held verbatim, and\n * Pi rebuilds this component from `renderResult` whenever the theme changes.\n */\n invalidate(): void {}\n\n render(width: number): string[] {\n return this.rows.map(({ left, right }) => {\n if (right === undefined || right.length === 0) return truncateToWidth(left, width);\n const rightWidth = visibleWidth(right);\n const room = width - rightWidth - STATUS_GUTTER;\n if (room <= 0) return truncateToWidth(left, width);\n const subject = truncateToWidth(left, room);\n const gap = Math.max(STATUS_GUTTER, width - visibleWidth(subject) - rightWidth);\n return subject + ' '.repeat(gap) + right;\n });\n }\n}\n\n/**\n * Self-owned task shell with the same structural divider as the bash tool.\n *\n * Task rows already carry precise per-task state, so the divider stays neutral\n * instead of competing with or appearing to animate between those states.\n */\nclass TaskResultFrame implements Component {\n constructor(\n private readonly content: Component,\n private readonly theme: Theme,\n ) {}\n\n render(width: number): string[] {\n if (width <= 0) return [];\n if (width < 3) return this.content.render(width);\n\n const contentWidth = width - 2;\n const divider = this.theme.fg('borderMuted', '─'.repeat(contentWidth));\n const lines = this.content.render(contentWidth).map((line) => ` ${line}`);\n return [` ${divider}`, ...lines, ''];\n }\n\n invalidate(): void {\n this.content.invalidate();\n }\n}\n\nexport interface TaskResultLike {\n content?: Array<{ type: string; text?: string }>;\n details?: unknown;\n isError?: boolean;\n}\n\nexport interface TaskResultOptions {\n expanded: boolean;\n isPartial: boolean;\n}\n\n/** Concatenated result text, which is all a thrown failure leaves behind. */\nfunction contentText(result: TaskResultLike): string {\n return (result.content ?? []).map((block) => block.text ?? '').join('');\n}\n\nfunction nonEmptyLines(text: string): string[] {\n return text.split('\\n').filter((line) => line.trim().length > 0);\n}\n\n/**\n * The rows `list` reported to the model.\n *\n * `details.tasks` is the whole post-mutation document, so the filters applied by\n * `formatContent` have to be applied again here or the transcript would disagree\n * with the text the model was given.\n */\nfunction listedTasks(details: TaskDetails): Task[] {\n const params = details.params as TaskMutationParams;\n let view = details.tasks;\n if (params.includeDeleted !== true) view = view.filter((task) => task.status !== 'deleted');\n if (params.status) view = view.filter((task) => task.status === params.status);\n return view;\n}\n\n/** The single task an id-bearing action acted on, so the transcript names it rather than a bare tick. */\nfunction subjectTask(details: TaskDetails): Task | undefined {\n const params = details.params as TaskMutationParams;\n if (params.id === undefined) return undefined;\n return details.tasks.find((task) => task.id === params.id);\n}\n\n/**\n * Tasks an upsert applied, resolved from the ids the reducer reported.\n *\n * The ids are read rather than guessed from the tail of the list: a batch\n * touches many rows, and a failed entry contributes none.\n */\nfunction upsertTasks(details: TaskDetails): Task[] {\n return (details.upsert?.applied ?? []).flatMap((id) => details.tasks.find((task) => task.id === id) ?? []);\n}\n\n/** Tasks successfully handed off by a native assignment batch. */\nfunction assignedTasks(details: TaskDetails): Task[] {\n return (details.assignment?.assigned ?? []).flatMap((id) => details.tasks.find((task) => task.id === id) ?? []);\n}\n\nfunction renderTaskResultBody(result: TaskResultLike, options: TaskResultOptions, theme: Theme): Component {\n const details = result.details as TaskDetails | undefined;\n\n // Running. `assign` and `cancel` stream a placeholder before the run settles.\n if (options.isPartial) {\n const text = nonEmptyLines(contentText(result)).at(-1) ?? 'working';\n return new Text(theme.fg('warning', '◐') + theme.fg('dim', ` ${text}`), 0, 0);\n }\n\n // Failed. Every failure path throws, so Pi hands back error text and no\n // details; without this the block would render a green tick on a failure.\n if (result.isError === true || details?.error !== undefined) {\n const message = details?.error ?? contentText(result);\n const all = nonEmptyLines(message);\n if (all.length <= 1) {\n return new Text(theme.fg('error', '✗') + theme.fg('dim', all[0] ? ` ${all[0]}` : ''), 0, 0);\n }\n const body = options.expanded ? all : all.slice(0, TRANSCRIPT_TASK_ROWS);\n return new Text([...body.map((line) => theme.fg('toolOutput', line)), theme.fg('error', '✗')].join('\\n'), 0, 0);\n }\n\n if (!details) return new Text(theme.fg('success', '✓'), 0, 0);\n\n /** Status rides on the task's own row, flushed right, rather than costing a line. */\n const row = (task: Task): JustifiedRow => ({\n left: formatOverlayTaskLine(task, theme, true),\n right: theme.fg(STATUS_COLOR[task.status], STATUS_LABEL[task.status]),\n });\n\n if (details.action === 'list') {\n const tasks = listedTasks(details);\n const shown = options.expanded ? tasks : tasks.slice(0, TRANSCRIPT_TASK_ROWS);\n const rows: JustifiedRow[] = shown.map(row);\n let summary = tasks.length === 0 ? 'no tasks' : `${tasks.length} task${tasks.length === 1 ? '' : 's'}`;\n if (tasks.length > shown.length) summary += ' · ctrl+o';\n rows.push({ left: theme.fg('success', '✓') + theme.fg('dim', ` ${summary}`) });\n return new JustifiedRows(rows);\n }\n\n if (details.action === 'clear') {\n return new Text(theme.fg('success', '✓') + theme.fg('dim', ' cleared'), 0, 0);\n }\n\n if (details.action === 'assign' && details.assignment) {\n const assigned = assignedTasks(details);\n const failed = details.assignment.failed;\n if (assigned.length === 1 && failed === 0) return new JustifiedRows([row(assigned[0])]);\n\n const shown = options.expanded ? assigned : assigned.slice(0, TRANSCRIPT_TASK_ROWS);\n const rows: JustifiedRow[] = shown.map(row);\n let summary = `${assigned.length} assigned`;\n if (failed > 0) summary += ` · ${failed} failed`;\n if (assigned.length > shown.length) summary += ' · ctrl+o';\n const mark = failed > 0 ? theme.fg('warning', '!') : theme.fg('success', '✓');\n rows.push({ left: mark + theme.fg('dim', ` ${summary}`) });\n return new JustifiedRows(rows);\n }\n\n if (details.action === 'upsert') {\n const touched = upsertTasks(details);\n const failed = details.upsert?.failed ?? 0;\n // One applied task and nothing failed is the common case: keep the single\n // row it has always had rather than dressing it as a bulk report.\n if (touched.length === 1 && failed === 0) return new JustifiedRows([row(touched[0])]);\n\n const shown = options.expanded ? touched : touched.slice(0, TRANSCRIPT_TASK_ROWS);\n const rows: JustifiedRow[] = shown.map(row);\n let summary = `${touched.length} applied`;\n if (failed > 0) summary += ` · ${failed} failed`;\n if (touched.length > shown.length) summary += ' · ctrl+o';\n // Failed entries get no row: there is no task to render, and their messages\n // are already in the text the model was given.\n const mark = failed > 0 ? theme.fg('warning', '!') : theme.fg('success', '✓');\n rows.push({ left: mark + theme.fg('dim', ` ${summary}`) });\n return new JustifiedRows(rows);\n }\n\n const task = subjectTask(details);\n if (!task) return new Text(theme.fg('success', '✓'), 0, 0);\n return new JustifiedRows([row(task)]);\n}\n\nexport function renderTaskResult(result: TaskResultLike, options: TaskResultOptions, theme: Theme): Component {\n return new TaskResultFrame(renderTaskResultBody(result, options, theme), theme);\n}\n"],"mappings":";;;;;AAeA,MAAa,eAA2C;CACtD,SAAS;CACT,aAAa;CACb,WAAW;CACX,QAAQ;CACR,SAAS;AACX;AAIA,MAAa,eAAoD;CAC/D,SAAS;CACT,aAAa;CACb,WAAW;CACX,QAAQ;CACR,SAAS;AACX;AAEA,MAAa,eAA2C;CACtD,SAAS;CACT,aAAa;CACb,WAAW;CACX,QAAQ;CACR,SAAS;AACX;AAEA,MAAM,uBAAmD;CACvD,GAAG;CACH,WAAW;CACX,SAAS,aAAa;AACxB;AAEA,MAAM,uBAA4D;CAChE,GAAG;CAC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AM,GAAG,WAAW,GAAG,IAAI,MAAM,GAAG,WAAW,GAAG;EAC5E,KAAK,KAAK,EAAE,MAAM,OAAO,MAAM,GAAG,OAAO,IAAI,SAAS,EAAE,CAAC;EACzD,OAAO,IAAI,cAAc,IAAI;CAC/B;CAEA,MAAM,OAAO,YAAY,OAAO;CAChC,IAAI,CAAC,MAAM,OAAO,IAAIA,uBAAAA,KAAK,MAAM,GAAG,WAAW,GAAG,GAAG,GAAG,CAAC;CACzD,OAAO,IAAI,cAAc,CAAC,IAAI,IAAI,CAAC,CAAC;AACtC;AAEA,SAAgB,iBAAiB,QAAwB,SAA4B,OAAyB;CAC5G,OAAO,IAAI,gBAAgB,qBAAqB,QAAQ,SAAS,KAAK,GAAG,KAAK;AAChF"}
@@ -1,4 +1,4 @@
1
- import { n as DelegationManager } from "./delegation-CTFGZtwp.mjs";
1
+ import { n as DelegationManager } from "./delegation-CkGbRaOl.mjs";
2
2
  import { agentIdentityColor } from "@agimon-ai/doompi-ui/theme";
3
3
  import { DoomToolCall, renderToolHeading } from "@agimon-ai/doompi-ui/toolChrome";
4
4
  import { Text, truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
@@ -319,4 +319,4 @@ function renderTaskResult(result, options, theme) {
319
319
  //#endregion
320
320
  export { STATUS_LABEL as a, formatOverlayTaskLine as c, renderTaskCall as d, renderTaskResult as f, STATUS_GLYPH as i, formatTokenCount as l, JustifiedRows as n, formatCommandTaskLine as o, STATUS_COLOR as r, formatElapsedMs as s, ACTION_GLYPH as t, overlayStatusGlyph as u };
321
321
 
322
- //# sourceMappingURL=format.cli-CuTlvk8J.mjs.map
322
+ //# sourceMappingURL=format.cli-Cnc591eb.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"format.cli-CuTlvk8J.mjs","names":[],"sources":["../src/extensions/workspaces/sessions/(frontend)/_shared/format.cli.ts"],"sourcesContent":["import { agentIdentityColor } from '@agimon-ai/doompi-ui/theme';\nimport { DoomToolCall, renderToolHeading } from '@agimon-ai/doompi-ui/toolChrome';\nimport type { Theme } from '@earendil-works/pi-coding-agent';\nimport { type Component, Text, truncateToWidth, visibleWidth } from '@earendil-works/pi-tui';\n\nimport type {\n Task,\n TaskAction,\n TaskDetails,\n TaskItemMutation,\n TaskMutationParams,\n TaskStatus,\n} from '../../../../../models/task';\nimport { DelegationManager, type DelegationProgress } from '../../../../../services/delegation';\n\nexport const STATUS_GLYPH: Record<TaskStatus, string> = {\n pending: '○',\n in_progress: '◐',\n completed: '●',\n failed: '✗',\n deleted: '⊘',\n};\n\ntype TaskStatusColor = 'dim' | 'warning' | 'success' | 'error' | 'muted';\n\nexport const STATUS_COLOR: Record<TaskStatus, TaskStatusColor> = {\n pending: 'dim',\n in_progress: 'warning',\n completed: 'success',\n failed: 'error',\n deleted: 'muted',\n};\n\nexport const STATUS_LABEL: Record<TaskStatus, string> = {\n pending: 'pending',\n in_progress: 'in progress',\n completed: 'completed',\n failed: 'failed',\n deleted: 'deleted',\n};\n\nconst OVERLAY_STATUS_GLYPH: Record<TaskStatus, string> = {\n ...STATUS_GLYPH,\n completed: '✓',\n deleted: STATUS_GLYPH.failed,\n};\n\nconst OVERLAY_STATUS_COLOR: Record<TaskStatus, TaskStatusColor> = {\n ...STATUS_COLOR,\n deleted: 'error',\n};\nconst MILLISECONDS_PER_SECOND = 1000;\nconst SECONDS_PER_MINUTE = 60;\nconst MINUTES_PER_HOUR = 60;\nconst TOKENS_PER_KILO = 1000;\nconst TOKEN_DECIMAL_LIMIT = 10_000;\nconst REDUNDANT_WORKING_PREFIX = /^working:\\s*/i;\nconst INLINE_WHITESPACE = /\\s+/gu;\n\n/** Keep dynamic content inside the overlay's one-physical-line contract. */\nfunction inlineText(text: string): string {\n return text.replace(INLINE_WHITESPACE, ' ').trim();\n}\n\n/** Thinking text already communicates activity; keep only its useful content. */\nfunction progressText(currentTool: string | undefined): string | undefined {\n if (!currentTool) return undefined;\n const text = inlineText(currentTool.replace(REDUNDANT_WORKING_PREFIX, ''));\n return text || undefined;\n}\n\nexport const ACTION_GLYPH: Record<TaskAction, string> = {\n upsert: '✎',\n delete: '×',\n get: '›',\n list: '☰',\n clear: '∅',\n assign: '⇒',\n cancel: '⊗',\n};\n\n/**\n * `upsert` is two operations behind one name, so a homogeneous batch narrows to\n * the glyph the operator already reads: `+` means new work appeared, `→` means\n * work moved. A mixed batch keeps the neutral write glyph.\n */\nconst UPSERT_CREATE_GLYPH = '+';\nconst UPSERT_UPDATE_GLYPH = '→';\n\nfunction upsertGlyph(items: readonly TaskItemMutation[]): string {\n if (items.length === 0) return ACTION_GLYPH.upsert;\n if (items.every((item) => item.id === undefined)) return UPSERT_CREATE_GLYPH;\n if (items.every((item) => item.id !== undefined)) return UPSERT_UPDATE_GLYPH;\n return ACTION_GLYPH.upsert;\n}\n\nexport function overlayStatusGlyph(status: TaskStatus, theme: Theme): string {\n return theme.fg(OVERLAY_STATUS_COLOR[status], OVERLAY_STATUS_GLYPH[status]);\n}\n\nexport function formatElapsedMs(durationMs: number): string {\n const totalSeconds = Math.max(0, Math.floor(durationMs / MILLISECONDS_PER_SECOND));\n const seconds = totalSeconds % SECONDS_PER_MINUTE;\n const totalMinutes = Math.floor(totalSeconds / SECONDS_PER_MINUTE);\n if (totalMinutes < MINUTES_PER_HOUR) {\n return totalMinutes === 0 ? `${seconds}s` : `${totalMinutes}m${String(seconds).padStart(2, '0')}s`;\n }\n const minutes = totalMinutes % MINUTES_PER_HOUR;\n const hours = Math.floor(totalMinutes / MINUTES_PER_HOUR);\n return `${hours}h${String(minutes).padStart(2, '0')}m${String(seconds).padStart(2, '0')}s`;\n}\n\nexport function formatTokenCount(tokens: number): string {\n const count = Math.max(0, Math.round(tokens));\n if (count < TOKENS_PER_KILO) return String(count);\n if (count < TOKEN_DECIMAL_LIMIT) return `${(count / TOKENS_PER_KILO).toFixed(1)}k`;\n return `${Math.round(count / TOKENS_PER_KILO)}k`;\n}\n\n/**\n * One task row for the persistent overlay.\n *\n * A delegated row carries the agent name and its current tool so the operator\n * can see that background work is progressing without opening a transcript.\n */\nexport function formatOverlayTaskLine(\n task: Task,\n theme: Theme,\n showId: boolean,\n progress?: DelegationProgress,\n nowMs = Date.now(),\n agentColor?: Parameters<Theme['fg']>[0],\n): string {\n const subjectColor =\n task.status === 'in_progress'\n ? 'accent'\n : task.status === 'completed' || task.status === 'deleted'\n ? 'muted'\n : 'text';\n let subject = theme.fg(subjectColor, inlineText(task.subject));\n if (task.status === 'completed' || task.status === 'deleted') {\n subject = theme.strikethrough(subject);\n }\n\n let line = overlayStatusGlyph(task.status, theme);\n if (showId) line += ` ${theme.fg('dim', `#${task.id}`)}`;\n line += ` ${subject}`;\n\n const agent = task.delegation?.agent;\n const agentLabel = agent ? inlineText(agent) : undefined;\n if (agentLabel && task.delegation?.state === 'running') {\n // No progress means no timing is known, so the chips are omitted rather than\n // reported as `[0s]`. The transcript renderer has no progress feed at all.\n const chips: string[] = [];\n if (progress) {\n chips.push(theme.fg('muted', `[${formatElapsedMs(DelegationManager.elapsedMs(progress, nowMs))}]`));\n if (progress.tokens !== undefined) chips.push(theme.fg('muted', `[${formatTokenCount(progress.tokens)}]`));\n }\n const identity = task.delegation.runId ?? task.delegation.requestId;\n chips.push(theme.fg(agentColor ?? agentIdentityColor(identity), `[${agentLabel}]`));\n line += ` ${chips.join('')}`;\n const activity = progressText(progress?.currentTool);\n if (activity) line += ` ${theme.fg('muted', `· ${activity}`)}`;\n } else if (agentLabel) {\n line += ` ${theme.fg('muted', `[${agentLabel}]`)}`;\n }\n\n if (task.status === 'in_progress' && task.activeForm) {\n line += ` ${theme.fg('muted', `(${inlineText(task.activeForm)})`)}`;\n }\n if (task.blockedBy?.length) {\n line += ` ${theme.fg('muted', `⛓ ${task.blockedBy.map((id) => `#${id}`).join(',')}`)}`;\n }\n return line;\n}\n\n/** One task line for the `/tasks` command output. */\nexport function formatCommandTaskLine(task: Task, glyph: string): string {\n const form = task.status === 'in_progress' && task.activeForm ? ` (${task.activeForm})` : '';\n const agent = task.delegation?.agent ? ` [${task.delegation.agent}]` : '';\n const block = task.blockedBy?.length ? ` ⛓ ${task.blockedBy.map((id) => `#${id}`).join(',')}` : '';\n return ` ${glyph} #${task.id} ${task.subject}${form}${agent}${block}`;\n}\n\nexport function renderTaskCall(\n args: TaskMutationParams & { action: TaskAction },\n theme: Theme,\n tasks: readonly Task[],\n): Component {\n const items = args.action === 'upsert' ? (args.tasks ?? []) : [];\n const glyph = args.action === 'upsert' ? upsertGlyph(items) : (ACTION_GLYPH[args.action] ?? args.action);\n let text = renderToolHeading('task', `${glyph} ${args.action}`, theme);\n\n if (args.action === 'upsert') {\n // One entry reads exactly as create or update did; a batch reads as a count\n // rather than a subject it would have to pick arbitrarily.\n if (items.length === 1) {\n const only = items[0];\n if (only.id === undefined) {\n if (only.subject) text += ` ${theme.fg('dim', only.subject)}`;\n } else {\n const subject = tasks.find((task) => task.id === only.id)?.subject ?? only.subject ?? `#${only.id}`;\n text += ` ${theme.fg('accent', subject)}`;\n }\n } else if (items.length > 1) {\n text += ` ${theme.fg('dim', `${items.length} tasks`)}`;\n }\n } else if (args.action === 'assign') {\n const assignments = args.assignments ?? [];\n if (assignments.length === 1) {\n const only = assignments[0];\n const subject = tasks.find((task) => task.id === only.id)?.subject ?? `#${only.id}`;\n text += ` ${theme.fg('accent', subject)}`;\n if (only.agent) text += ` ${theme.fg('muted', `→ ${only.agent}`)}`;\n } else if (assignments.length > 1) {\n text += ` ${theme.fg('dim', `${assignments.length} tasks`)}`;\n }\n } else if ((args.action === 'get' || args.action === 'delete' || args.action === 'cancel') && args.id !== undefined) {\n const subject = tasks.find((task) => task.id === args.id)?.subject ?? `#${args.id}`;\n text += ` ${theme.fg('accent', subject)}`;\n } else if (args.action === 'list' && args.status) {\n text += ` ${theme.fg('muted', STATUS_LABEL[args.status])}`;\n }\n return new DoomToolCall(text);\n}\n\n/** Task rows kept in a collapsed result, before `ctrl+o` reveals the rest. */\nconst TRANSCRIPT_TASK_ROWS = 8;\n/** Minimum gap between a row's subject and its right-aligned status. */\nconst STATUS_GUTTER = 2;\n\nexport interface JustifiedRow {\n left: string;\n /** Pinned to the right edge. The subject is truncated before this is dropped. */\n right?: string;\n}\n\n/**\n * Rows whose trailing text is flushed right.\n *\n * `Text` cannot do this: the status has to be placed against the viewport edge,\n * which is only known at render time.\n */\nexport class JustifiedRows implements Component {\n constructor(private readonly rows: readonly JustifiedRow[]) {}\n\n /**\n * Nothing to discard: the rows are themed by the caller and held verbatim, and\n * Pi rebuilds this component from `renderResult` whenever the theme changes.\n */\n invalidate(): void {}\n\n render(width: number): string[] {\n return this.rows.map(({ left, right }) => {\n if (right === undefined || right.length === 0) return truncateToWidth(left, width);\n const rightWidth = visibleWidth(right);\n const room = width - rightWidth - STATUS_GUTTER;\n if (room <= 0) return truncateToWidth(left, width);\n const subject = truncateToWidth(left, room);\n const gap = Math.max(STATUS_GUTTER, width - visibleWidth(subject) - rightWidth);\n return subject + ' '.repeat(gap) + right;\n });\n }\n}\n\n/**\n * Self-owned task shell with the same structural divider as the bash tool.\n *\n * Task rows already carry precise per-task state, so the divider stays neutral\n * instead of competing with or appearing to animate between those states.\n */\nclass TaskResultFrame implements Component {\n constructor(\n private readonly content: Component,\n private readonly theme: Theme,\n ) {}\n\n render(width: number): string[] {\n if (width <= 0) return [];\n if (width < 3) return this.content.render(width);\n\n const contentWidth = width - 2;\n const divider = this.theme.fg('borderMuted', '─'.repeat(contentWidth));\n const lines = this.content.render(contentWidth).map((line) => ` ${line}`);\n return [` ${divider}`, ...lines, ''];\n }\n\n invalidate(): void {\n this.content.invalidate();\n }\n}\n\nexport interface TaskResultLike {\n content?: Array<{ type: string; text?: string }>;\n details?: unknown;\n isError?: boolean;\n}\n\nexport interface TaskResultOptions {\n expanded: boolean;\n isPartial: boolean;\n}\n\n/** Concatenated result text, which is all a thrown failure leaves behind. */\nfunction contentText(result: TaskResultLike): string {\n return (result.content ?? []).map((block) => block.text ?? '').join('');\n}\n\nfunction nonEmptyLines(text: string): string[] {\n return text.split('\\n').filter((line) => line.trim().length > 0);\n}\n\n/**\n * The rows `list` reported to the model.\n *\n * `details.tasks` is the whole post-mutation document, so the filters applied by\n * `formatContent` have to be applied again here or the transcript would disagree\n * with the text the model was given.\n */\nfunction listedTasks(details: TaskDetails): Task[] {\n const params = details.params as TaskMutationParams;\n let view = details.tasks;\n if (params.includeDeleted !== true) view = view.filter((task) => task.status !== 'deleted');\n if (params.status) view = view.filter((task) => task.status === params.status);\n return view;\n}\n\n/** The single task an id-bearing action acted on, so the transcript names it rather than a bare tick. */\nfunction subjectTask(details: TaskDetails): Task | undefined {\n const params = details.params as TaskMutationParams;\n if (params.id === undefined) return undefined;\n return details.tasks.find((task) => task.id === params.id);\n}\n\n/**\n * Tasks an upsert applied, resolved from the ids the reducer reported.\n *\n * The ids are read rather than guessed from the tail of the list: a batch\n * touches many rows, and a failed entry contributes none.\n */\nfunction upsertTasks(details: TaskDetails): Task[] {\n return (details.upsert?.applied ?? []).flatMap((id) => details.tasks.find((task) => task.id === id) ?? []);\n}\n\n/** Tasks successfully handed off by a native assignment batch. */\nfunction assignedTasks(details: TaskDetails): Task[] {\n return (details.assignment?.assigned ?? []).flatMap((id) => details.tasks.find((task) => task.id === id) ?? []);\n}\n\nfunction renderTaskResultBody(result: TaskResultLike, options: TaskResultOptions, theme: Theme): Component {\n const details = result.details as TaskDetails | undefined;\n\n // Running. `assign` and `cancel` stream a placeholder before the run settles.\n if (options.isPartial) {\n const text = nonEmptyLines(contentText(result)).at(-1) ?? 'working';\n return new Text(theme.fg('warning', '◐') + theme.fg('dim', ` ${text}`), 0, 0);\n }\n\n // Failed. Every failure path throws, so Pi hands back error text and no\n // details; without this the block would render a green tick on a failure.\n if (result.isError === true || details?.error !== undefined) {\n const message = details?.error ?? contentText(result);\n const all = nonEmptyLines(message);\n if (all.length <= 1) {\n return new Text(theme.fg('error', '✗') + theme.fg('dim', all[0] ? ` ${all[0]}` : ''), 0, 0);\n }\n const body = options.expanded ? all : all.slice(0, TRANSCRIPT_TASK_ROWS);\n return new Text([...body.map((line) => theme.fg('toolOutput', line)), theme.fg('error', '✗')].join('\\n'), 0, 0);\n }\n\n if (!details) return new Text(theme.fg('success', '✓'), 0, 0);\n\n /** Status rides on the task's own row, flushed right, rather than costing a line. */\n const row = (task: Task): JustifiedRow => ({\n left: formatOverlayTaskLine(task, theme, true),\n right: theme.fg(STATUS_COLOR[task.status], STATUS_LABEL[task.status]),\n });\n\n if (details.action === 'list') {\n const tasks = listedTasks(details);\n const shown = options.expanded ? tasks : tasks.slice(0, TRANSCRIPT_TASK_ROWS);\n const rows: JustifiedRow[] = shown.map(row);\n let summary = tasks.length === 0 ? 'no tasks' : `${tasks.length} task${tasks.length === 1 ? '' : 's'}`;\n if (tasks.length > shown.length) summary += ' · ctrl+o';\n rows.push({ left: theme.fg('success', '✓') + theme.fg('dim', ` ${summary}`) });\n return new JustifiedRows(rows);\n }\n\n if (details.action === 'clear') {\n return new Text(theme.fg('success', '✓') + theme.fg('dim', ' cleared'), 0, 0);\n }\n\n if (details.action === 'assign' && details.assignment) {\n const assigned = assignedTasks(details);\n const failed = details.assignment.failed;\n if (assigned.length === 1 && failed === 0) return new JustifiedRows([row(assigned[0])]);\n\n const shown = options.expanded ? assigned : assigned.slice(0, TRANSCRIPT_TASK_ROWS);\n const rows: JustifiedRow[] = shown.map(row);\n let summary = `${assigned.length} assigned`;\n if (failed > 0) summary += ` · ${failed} failed`;\n if (assigned.length > shown.length) summary += ' · ctrl+o';\n const mark = failed > 0 ? theme.fg('warning', '!') : theme.fg('success', '✓');\n rows.push({ left: mark + theme.fg('dim', ` ${summary}`) });\n return new JustifiedRows(rows);\n }\n\n if (details.action === 'upsert') {\n const touched = upsertTasks(details);\n const failed = details.upsert?.failed ?? 0;\n // One applied task and nothing failed is the common case: keep the single\n // row it has always had rather than dressing it as a bulk report.\n if (touched.length === 1 && failed === 0) return new JustifiedRows([row(touched[0])]);\n\n const shown = options.expanded ? touched : touched.slice(0, TRANSCRIPT_TASK_ROWS);\n const rows: JustifiedRow[] = shown.map(row);\n let summary = `${touched.length} applied`;\n if (failed > 0) summary += ` · ${failed} failed`;\n if (touched.length > shown.length) summary += ' · ctrl+o';\n // Failed entries get no row: there is no task to render, and their messages\n // are already in the text the model was given.\n const mark = failed > 0 ? theme.fg('warning', '!') : theme.fg('success', '✓');\n rows.push({ left: mark + theme.fg('dim', ` ${summary}`) });\n return new JustifiedRows(rows);\n }\n\n const task = subjectTask(details);\n if (!task) return new Text(theme.fg('success', '✓'), 0, 0);\n return new JustifiedRows([row(task)]);\n}\n\nexport function renderTaskResult(result: TaskResultLike, options: TaskResultOptions, theme: Theme): Component {\n return new TaskResultFrame(renderTaskResultBody(result, options, theme), theme);\n}\n"],"mappings":";;;;;AAeA,MAAa,eAA2C;CACtD,SAAS;CACT,aAAa;CACb,WAAW;CACX,QAAQ;CACR,SAAS;AACX;AAIA,MAAa,eAAoD;CAC/D,SAAS;CACT,aAAa;CACb,WAAW;CACX,QAAQ;CACR,SAAS;AACX;AAEA,MAAa,eAA2C;CACtD,SAAS;CACT,aAAa;CACb,WAAW;CACX,QAAQ;CACR,SAAS;AACX;AAEA,MAAM,uBAAmD;CACvD,GAAG;CACH,WAAW;CACX,SAAS,aAAa;AACxB;AAEA,MAAM,uBAA4D;CAChE,GAAG;CACH,SAAS;AACX;AACA,MAAM,0BAA0B;AAChC,MAAM,qBAAqB;AAC3B,MAAM,mBAAmB;AACzB,MAAM,kBAAkB;AACxB,MAAM,sBAAsB;AAC5B,MAAM,2BAA2B;AACjC,MAAM,oBAAoB;;AAG1B,SAAS,WAAW,MAAsB;CACxC,OAAO,KAAK,QAAQ,mBAAmB,GAAG,CAAC,CAAC,KAAK;AACnD;;AAGA,SAAS,aAAa,aAAqD;CACzE,IAAI,CAAC,aAAa,OAAO,KAAA;CAEzB,OADa,WAAW,YAAY,QAAQ,0BAA0B,EAAE,CAC9D,KAAK,KAAA;AACjB;AAEA,MAAa,eAA2C;CACtD,QAAQ;CACR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GAAG;EAC5E,KAAK,KAAK,EAAE,MAAM,OAAO,MAAM,GAAG,OAAO,IAAI,SAAS,EAAE,CAAC;EACzD,OAAO,IAAI,cAAc,IAAI;CAC/B;CAEA,IAAI,QAAQ,WAAW,UAAU;EAC/B,MAAM,UAAU,YAAY,OAAO;EACnC,MAAM,SAAS,QAAQ,QAAQ,UAAU;EAGzC,IAAI,QAAQ,WAAW,KAAK,WAAW,GAAG,OAAO,IAAI,cAAc,CAAC,IAAI,QAAQ,EAAE,CAAC,CAAC;EAEpF,MAAM,QAAQ,QAAQ,WAAW,UAAU,QAAQ,MAAM,GAAG,oBAAoB;EAChF,MAAM,OAAuB,MAAM,IAAI,GAAG;EAC1C,IAAI,UAAU,GAAG,QAAQ,OAAO;EAChC,IAAI,SAAS,GAAG,WAAW,MAAM,OAAO;EACxC,IAAI,QAAQ,SAAS,MAAM,QAAQ,WAAW;EAG9C,MAAM,OAAO,SAAS,IAAI,MAAM,GAAG,WAAW,GAAG,IAAI,MAAM,GAAG,WAAW,GAAG;EAC5E,KAAK,KAAK,EAAE,MAAM,OAAO,MAAM,GAAG,OAAO,IAAI,SAAS,EAAE,CAAC;EACzD,OAAO,IAAI,cAAc,IAAI;CAC/B;CAEA,MAAM,OAAO,YAAY,OAAO;CAChC,IAAI,CAAC,MAAM,OAAO,IAAI,KAAK,MAAM,GAAG,WAAW,GAAG,GAAG,GAAG,CAAC;CACzD,OAAO,IAAI,cAAc,CAAC,IAAI,IAAI,CAAC,CAAC;AACtC;AAEA,SAAgB,iBAAiB,QAAwB,SAA4B,OAAyB;CAC5G,OAAO,IAAI,gBAAgB,qBAAqB,QAAQ,SAAS,KAAK,GAAG,KAAK;AAChF"}
1
+ {"version":3,"file":"format.cli-Cnc591eb.mjs","names":[],"sources":["../src/extensions/workspaces/sessions/(frontend)/_shared/format.cli.ts"],"sourcesContent":["import { agentIdentityColor } from '@agimon-ai/doompi-ui/theme';\nimport { DoomToolCall, renderToolHeading } from '@agimon-ai/doompi-ui/toolChrome';\nimport type { Theme } from '@earendil-works/pi-coding-agent';\nimport { type Component, Text, truncateToWidth, visibleWidth } from '@earendil-works/pi-tui';\n\nimport type {\n Task,\n TaskAction,\n TaskDetails,\n TaskItemMutation,\n TaskMutationParams,\n TaskStatus,\n} from '../../../../../models/task';\nimport { DelegationManager, type DelegationProgress } from '../../../../../services/delegation';\n\nexport const STATUS_GLYPH: Record<TaskStatus, string> = {\n pending: '○',\n in_progress: '◐',\n completed: '●',\n failed: '✗',\n deleted: '⊘',\n};\n\ntype TaskStatusColor = 'dim' | 'warning' | 'success' | 'error' | 'muted';\n\nexport const STATUS_COLOR: Record<TaskStatus, TaskStatusColor> = {\n pending: 'dim',\n in_progress: 'warning',\n completed: 'success',\n failed: 'error',\n deleted: 'muted',\n};\n\nexport const STATUS_LABEL: Record<TaskStatus, string> = {\n pending: 'pending',\n in_progress: 'in progress',\n completed: 'completed',\n failed: 'failed',\n deleted: 'deleted',\n};\n\nconst OVERLAY_STATUS_GLYPH: Record<TaskStatus, string> = {\n ...STATUS_GLYPH,\n completed: '✓',\n deleted: STATUS_GLYPH.failed,\n};\n\nconst OVERLAY_STATUS_COLOR: Record<TaskStatus, TaskStatusColor> = {\n ...STATUS_COLOR,\n deleted: 'error',\n};\nconst MILLISECONDS_PER_SECOND = 1000;\nconst SECONDS_PER_MINUTE = 60;\nconst MINUTES_PER_HOUR = 60;\nconst TOKENS_PER_KILO = 1000;\nconst TOKEN_DECIMAL_LIMIT = 10_000;\nconst REDUNDANT_WORKING_PREFIX = /^working:\\s*/i;\nconst INLINE_WHITESPACE = /\\s+/gu;\n\n/** Keep dynamic content inside the overlay's one-physical-line contract. */\nfunction inlineText(text: string): string {\n return text.replace(INLINE_WHITESPACE, ' ').trim();\n}\n\n/** Thinking text already communicates activity; keep only its useful content. */\nfunction progressText(currentTool: string | undefined): string | undefined {\n if (!currentTool) return undefined;\n const text = inlineText(currentTool.replace(REDUNDANT_WORKING_PREFIX, ''));\n return text || undefined;\n}\n\nexport const ACTION_GLYPH: Record<TaskAction, string> = {\n upsert: '✎',\n delete: '×',\n get: '›',\n list: '☰',\n clear: '∅',\n assign: '⇒',\n cancel: '⊗',\n};\n\n/**\n * `upsert` is two operations behind one name, so a homogeneous batch narrows to\n * the glyph the operator already reads: `+` means new work appeared, `→` means\n * work moved. A mixed batch keeps the neutral write glyph.\n */\nconst UPSERT_CREATE_GLYPH = '+';\nconst UPSERT_UPDATE_GLYPH = '→';\n\nfunction upsertGlyph(items: readonly TaskItemMutation[]): string {\n if (items.length === 0) return ACTION_GLYPH.upsert;\n if (items.every((item) => item.id === undefined)) return UPSERT_CREATE_GLYPH;\n if (items.every((item) => item.id !== undefined)) return UPSERT_UPDATE_GLYPH;\n return ACTION_GLYPH.upsert;\n}\n\nexport function overlayStatusGlyph(status: TaskStatus, theme: Theme): string {\n return theme.fg(OVERLAY_STATUS_COLOR[status], OVERLAY_STATUS_GLYPH[status]);\n}\n\nexport function formatElapsedMs(durationMs: number): string {\n const totalSeconds = Math.max(0, Math.floor(durationMs / MILLISECONDS_PER_SECOND));\n const seconds = totalSeconds % SECONDS_PER_MINUTE;\n const totalMinutes = Math.floor(totalSeconds / SECONDS_PER_MINUTE);\n if (totalMinutes < MINUTES_PER_HOUR) {\n return totalMinutes === 0 ? `${seconds}s` : `${totalMinutes}m${String(seconds).padStart(2, '0')}s`;\n }\n const minutes = totalMinutes % MINUTES_PER_HOUR;\n const hours = Math.floor(totalMinutes / MINUTES_PER_HOUR);\n return `${hours}h${String(minutes).padStart(2, '0')}m${String(seconds).padStart(2, '0')}s`;\n}\n\nexport function formatTokenCount(tokens: number): string {\n const count = Math.max(0, Math.round(tokens));\n if (count < TOKENS_PER_KILO) return String(count);\n if (count < TOKEN_DECIMAL_LIMIT) return `${(count / TOKENS_PER_KILO).toFixed(1)}k`;\n return `${Math.round(count / TOKENS_PER_KILO)}k`;\n}\n\n/**\n * One task row for the persistent overlay.\n *\n * A delegated row carries the agent name and its current tool so the operator\n * can see that background work is progressing without opening a transcript.\n */\nexport function formatOverlayTaskLine(\n task: Task,\n theme: Theme,\n showId: boolean,\n progress?: DelegationProgress,\n nowMs = Date.now(),\n agentColor?: Parameters<Theme['fg']>[0],\n): string {\n const subjectColor =\n task.status === 'in_progress'\n ? 'accent'\n : task.status === 'completed' || task.status === 'deleted'\n ? 'muted'\n : 'text';\n let subject = theme.fg(subjectColor, inlineText(task.subject));\n if (task.status === 'completed' || task.status === 'deleted') {\n subject = theme.strikethrough(subject);\n }\n\n let line = overlayStatusGlyph(task.status, theme);\n if (showId) line += ` ${theme.fg('dim', `#${task.id}`)}`;\n line += ` ${subject}`;\n\n const agent = task.delegation?.agent;\n const agentLabel = agent ? inlineText(agent) : undefined;\n if (agentLabel && task.delegation?.state === 'running') {\n // No progress means no timing is known, so the chips are omitted rather than\n // reported as `[0s]`. The transcript renderer has no progress feed at all.\n const chips: string[] = [];\n if (progress) {\n chips.push(theme.fg('muted', `[${formatElapsedMs(DelegationManager.elapsedMs(progress, nowMs))}]`));\n if (progress.tokens !== undefined) chips.push(theme.fg('muted', `[${formatTokenCount(progress.tokens)}]`));\n }\n const identity = task.delegation.runId ?? task.delegation.requestId;\n chips.push(theme.fg(agentColor ?? agentIdentityColor(identity), `[${agentLabel}]`));\n line += ` ${chips.join('')}`;\n const activity = progressText(progress?.currentTool);\n if (activity) line += ` ${theme.fg('muted', `· ${activity}`)}`;\n } else if (agentLabel) {\n line += ` ${theme.fg('muted', `[${agentLabel}]`)}`;\n }\n\n if (task.status === 'in_progress' && task.activeForm) {\n line += ` ${theme.fg('muted', `(${inlineText(task.activeForm)})`)}`;\n }\n if (task.blockedBy?.length) {\n line += ` ${theme.fg('muted', `⛓ ${task.blockedBy.map((id) => `#${id}`).join(',')}`)}`;\n }\n return line;\n}\n\n/** One task line for the `/tasks` command output. */\nexport function formatCommandTaskLine(task: Task, glyph: string): string {\n const form = task.status === 'in_progress' && task.activeForm ? ` (${task.activeForm})` : '';\n const agent = task.delegation?.agent ? ` [${task.delegation.agent}]` : '';\n const block = task.blockedBy?.length ? ` ⛓ ${task.blockedBy.map((id) => `#${id}`).join(',')}` : '';\n return ` ${glyph} #${task.id} ${task.subject}${form}${agent}${block}`;\n}\n\nexport function renderTaskCall(\n args: TaskMutationParams & { action: TaskAction },\n theme: Theme,\n tasks: readonly Task[],\n): Component {\n const items = args.action === 'upsert' ? (args.tasks ?? []) : [];\n const glyph = args.action === 'upsert' ? upsertGlyph(items) : (ACTION_GLYPH[args.action] ?? args.action);\n let text = renderToolHeading('task', `${glyph} ${args.action}`, theme);\n\n if (args.action === 'upsert') {\n // One entry reads exactly as create or update did; a batch reads as a count\n // rather than a subject it would have to pick arbitrarily.\n if (items.length === 1) {\n const only = items[0];\n if (only.id === undefined) {\n if (only.subject) text += ` ${theme.fg('dim', only.subject)}`;\n } else {\n const subject = tasks.find((task) => task.id === only.id)?.subject ?? only.subject ?? `#${only.id}`;\n text += ` ${theme.fg('accent', subject)}`;\n }\n } else if (items.length > 1) {\n text += ` ${theme.fg('dim', `${items.length} tasks`)}`;\n }\n } else if (args.action === 'assign') {\n const assignments = args.assignments ?? [];\n if (assignments.length === 1) {\n const only = assignments[0];\n const subject = tasks.find((task) => task.id === only.id)?.subject ?? `#${only.id}`;\n text += ` ${theme.fg('accent', subject)}`;\n if (only.agent) text += ` ${theme.fg('muted', `→ ${only.agent}`)}`;\n } else if (assignments.length > 1) {\n text += ` ${theme.fg('dim', `${assignments.length} tasks`)}`;\n }\n } else if ((args.action === 'get' || args.action === 'delete' || args.action === 'cancel') && args.id !== undefined) {\n const subject = tasks.find((task) => task.id === args.id)?.subject ?? `#${args.id}`;\n text += ` ${theme.fg('accent', subject)}`;\n } else if (args.action === 'list' && args.status) {\n text += ` ${theme.fg('muted', STATUS_LABEL[args.status])}`;\n }\n return new DoomToolCall(text);\n}\n\n/** Task rows kept in a collapsed result, before `ctrl+o` reveals the rest. */\nconst TRANSCRIPT_TASK_ROWS = 8;\n/** Minimum gap between a row's subject and its right-aligned status. */\nconst STATUS_GUTTER = 2;\n\nexport interface JustifiedRow {\n left: string;\n /** Pinned to the right edge. The subject is truncated before this is dropped. */\n right?: string;\n}\n\n/**\n * Rows whose trailing text is flushed right.\n *\n * `Text` cannot do this: the status has to be placed against the viewport edge,\n * which is only known at render time.\n */\nexport class JustifiedRows implements Component {\n constructor(private readonly rows: readonly JustifiedRow[]) {}\n\n /**\n * Nothing to discard: the rows are themed by the caller and held verbatim, and\n * Pi rebuilds this component from `renderResult` whenever the theme changes.\n */\n invalidate(): void {}\n\n render(width: number): string[] {\n return this.rows.map(({ left, right }) => {\n if (right === undefined || right.length === 0) return truncateToWidth(left, width);\n const rightWidth = visibleWidth(right);\n const room = width - rightWidth - STATUS_GUTTER;\n if (room <= 0) return truncateToWidth(left, width);\n const subject = truncateToWidth(left, room);\n const gap = Math.max(STATUS_GUTTER, width - visibleWidth(subject) - rightWidth);\n return subject + ' '.repeat(gap) + right;\n });\n }\n}\n\n/**\n * Self-owned task shell with the same structural divider as the bash tool.\n *\n * Task rows already carry precise per-task state, so the divider stays neutral\n * instead of competing with or appearing to animate between those states.\n */\nclass TaskResultFrame implements Component {\n constructor(\n private readonly content: Component,\n private readonly theme: Theme,\n ) {}\n\n render(width: number): string[] {\n if (width <= 0) return [];\n if (width < 3) return this.content.render(width);\n\n const contentWidth = width - 2;\n const divider = this.theme.fg('borderMuted', '─'.repeat(contentWidth));\n const lines = this.content.render(contentWidth).map((line) => ` ${line}`);\n return [` ${divider}`, ...lines, ''];\n }\n\n invalidate(): void {\n this.content.invalidate();\n }\n}\n\nexport interface TaskResultLike {\n content?: Array<{ type: string; text?: string }>;\n details?: unknown;\n isError?: boolean;\n}\n\nexport interface TaskResultOptions {\n expanded: boolean;\n isPartial: boolean;\n}\n\n/** Concatenated result text, which is all a thrown failure leaves behind. */\nfunction contentText(result: TaskResultLike): string {\n return (result.content ?? []).map((block) => block.text ?? '').join('');\n}\n\nfunction nonEmptyLines(text: string): string[] {\n return text.split('\\n').filter((line) => line.trim().length > 0);\n}\n\n/**\n * The rows `list` reported to the model.\n *\n * `details.tasks` is the whole post-mutation document, so the filters applied by\n * `formatContent` have to be applied again here or the transcript would disagree\n * with the text the model was given.\n */\nfunction listedTasks(details: TaskDetails): Task[] {\n const params = details.params as TaskMutationParams;\n let view = details.tasks;\n if (params.includeDeleted !== true) view = view.filter((task) => task.status !== 'deleted');\n if (params.status) view = view.filter((task) => task.status === params.status);\n return view;\n}\n\n/** The single task an id-bearing action acted on, so the transcript names it rather than a bare tick. */\nfunction subjectTask(details: TaskDetails): Task | undefined {\n const params = details.params as TaskMutationParams;\n if (params.id === undefined) return undefined;\n return details.tasks.find((task) => task.id === params.id);\n}\n\n/**\n * Tasks an upsert applied, resolved from the ids the reducer reported.\n *\n * The ids are read rather than guessed from the tail of the list: a batch\n * touches many rows, and a failed entry contributes none.\n */\nfunction upsertTasks(details: TaskDetails): Task[] {\n return (details.upsert?.applied ?? []).flatMap((id) => details.tasks.find((task) => task.id === id) ?? []);\n}\n\n/** Tasks successfully handed off by a native assignment batch. */\nfunction assignedTasks(details: TaskDetails): Task[] {\n return (details.assignment?.assigned ?? []).flatMap((id) => details.tasks.find((task) => task.id === id) ?? []);\n}\n\nfunction renderTaskResultBody(result: TaskResultLike, options: TaskResultOptions, theme: Theme): Component {\n const details = result.details as TaskDetails | undefined;\n\n // Running. `assign` and `cancel` stream a placeholder before the run settles.\n if (options.isPartial) {\n const text = nonEmptyLines(contentText(result)).at(-1) ?? 'working';\n return new Text(theme.fg('warning', '◐') + theme.fg('dim', ` ${text}`), 0, 0);\n }\n\n // Failed. Every failure path throws, so Pi hands back error text and no\n // details; without this the block would render a green tick on a failure.\n if (result.isError === true || details?.error !== undefined) {\n const message = details?.error ?? contentText(result);\n const all = nonEmptyLines(message);\n if (all.length <= 1) {\n return new Text(theme.fg('error', '✗') + theme.fg('dim', all[0] ? ` ${all[0]}` : ''), 0, 0);\n }\n const body = options.expanded ? all : all.slice(0, TRANSCRIPT_TASK_ROWS);\n return new Text([...body.map((line) => theme.fg('toolOutput', line)), theme.fg('error', '✗')].join('\\n'), 0, 0);\n }\n\n if (!details) return new Text(theme.fg('success', '✓'), 0, 0);\n\n /** Status rides on the task's own row, flushed right, rather than costing a line. */\n const row = (task: Task): JustifiedRow => ({\n left: formatOverlayTaskLine(task, theme, true),\n right: theme.fg(STATUS_COLOR[task.status], STATUS_LABEL[task.status]),\n });\n\n if (details.action === 'list') {\n const tasks = listedTasks(details);\n const shown = options.expanded ? tasks : tasks.slice(0, TRANSCRIPT_TASK_ROWS);\n const rows: JustifiedRow[] = shown.map(row);\n let summary = tasks.length === 0 ? 'no tasks' : `${tasks.length} task${tasks.length === 1 ? '' : 's'}`;\n if (tasks.length > shown.length) summary += ' · ctrl+o';\n rows.push({ left: theme.fg('success', '✓') + theme.fg('dim', ` ${summary}`) });\n return new JustifiedRows(rows);\n }\n\n if (details.action === 'clear') {\n return new Text(theme.fg('success', '✓') + theme.fg('dim', ' cleared'), 0, 0);\n }\n\n if (details.action === 'assign' && details.assignment) {\n const assigned = assignedTasks(details);\n const failed = details.assignment.failed;\n if (assigned.length === 1 && failed === 0) return new JustifiedRows([row(assigned[0])]);\n\n const shown = options.expanded ? assigned : assigned.slice(0, TRANSCRIPT_TASK_ROWS);\n const rows: JustifiedRow[] = shown.map(row);\n let summary = `${assigned.length} assigned`;\n if (failed > 0) summary += ` · ${failed} failed`;\n if (assigned.length > shown.length) summary += ' · ctrl+o';\n const mark = failed > 0 ? theme.fg('warning', '!') : theme.fg('success', '✓');\n rows.push({ left: mark + theme.fg('dim', ` ${summary}`) });\n return new JustifiedRows(rows);\n }\n\n if (details.action === 'upsert') {\n const touched = upsertTasks(details);\n const failed = details.upsert?.failed ?? 0;\n // One applied task and nothing failed is the common case: keep the single\n // row it has always had rather than dressing it as a bulk report.\n if (touched.length === 1 && failed === 0) return new JustifiedRows([row(touched[0])]);\n\n const shown = options.expanded ? touched : touched.slice(0, TRANSCRIPT_TASK_ROWS);\n const rows: JustifiedRow[] = shown.map(row);\n let summary = `${touched.length} applied`;\n if (failed > 0) summary += ` · ${failed} failed`;\n if (touched.length > shown.length) summary += ' · ctrl+o';\n // Failed entries get no row: there is no task to render, and their messages\n // are already in the text the model was given.\n const mark = failed > 0 ? theme.fg('warning', '!') : theme.fg('success', '✓');\n rows.push({ left: mark + theme.fg('dim', ` ${summary}`) });\n return new JustifiedRows(rows);\n }\n\n const task = subjectTask(details);\n if (!task) return new Text(theme.fg('success', '✓'), 0, 0);\n return new JustifiedRows([row(task)]);\n}\n\nexport function renderTaskResult(result: TaskResultLike, options: TaskResultOptions, theme: Theme): Component {\n return new TaskResultFrame(renderTaskResultBody(result, options, theme), theme);\n}\n"],"mappings":";;;;;AAeA,MAAa,eAA2C;CACtD,SAAS;CACT,aAAa;CACb,WAAW;CACX,QAAQ;CACR,SAAS;AACX;AAIA,MAAa,eAAoD;CAC/D,SAAS;CACT,aAAa;CACb,WAAW;CACX,QAAQ;CACR,SAAS;AACX;AAEA,MAAa,eAA2C;CACtD,SAAS;CACT,aAAa;CACb,WAAW;CACX,QAAQ;CACR,SAAS;AACX;AAEA,MAAM,uBAAmD;CACvD,GAAG;CACH,WAAW;CACX,SAAS,aAAa;AACxB;AAEA,MAAM,uBAA4D;CAChE,GAAG;CACH,SAAS;AACX;AACA,MAAM,0BAA0B;AAChC,MAAM,qBAAqB;AAC3B,MAAM,mBAAmB;AACzB,MAAM,kBAAkB;AACxB,MAAM,sBAAsB;AAC5B,MAAM,2BAA2B;AACjC,MAAM,oBAAoB;;AAG1B,SAAS,WAAW,MAAsB;CACxC,OAAO,KAAK,QAAQ,mBAAmB,GAAG,CAAC,CAAC,KAAK;AACnD;;AAGA,SAAS,aAAa,aAAqD;CACzE,IAAI,CAAC,aAAa,OAAO,KAAA;CAEzB,OADa,WAAW,YAAY,QAAQ,0BAA0B,EAAE,CAC9D,KAAK,KAAA;AACjB;AAEA,MAAa,eAA2C;CACtD,QAAQ;CACR,QAAQ;CACR,K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AAK,KAAK,EAAE,MAAM,OAAO,MAAM,GAAG,OAAO,IAAI,SAAS,EAAE,CAAC;EACzD,OAAO,IAAI,cAAc,IAAI;CAC/B;CAEA,IAAI,QAAQ,WAAW,UAAU;EAC/B,MAAM,UAAU,YAAY,OAAO;EACnC,MAAM,SAAS,QAAQ,QAAQ,UAAU;EAGzC,IAAI,QAAQ,WAAW,KAAK,WAAW,GAAG,OAAO,IAAI,cAAc,CAAC,IAAI,QAAQ,EAAE,CAAC,CAAC;EAEpF,MAAM,QAAQ,QAAQ,WAAW,UAAU,QAAQ,MAAM,GAAG,oBAAoB;EAChF,MAAM,OAAuB,MAAM,IAAI,GAAG;EAC1C,IAAI,UAAU,GAAG,QAAQ,OAAO;EAChC,IAAI,SAAS,GAAG,WAAW,MAAM,OAAO;EACxC,IAAI,QAAQ,SAAS,MAAM,QAAQ,WAAW;EAG9C,MAAM,OAAO,SAAS,IAAI,MAAM,GAAG,WAAW,GAAG,IAAI,MAAM,GAAG,WAAW,GAAG;EAC5E,KAAK,KAAK,EAAE,MAAM,OAAO,MAAM,GAAG,OAAO,IAAI,SAAS,EAAE,CAAC;EACzD,OAAO,IAAI,cAAc,IAAI;CAC/B;CAEA,MAAM,OAAO,YAAY,OAAO;CAChC,IAAI,CAAC,MAAM,OAAO,IAAI,KAAK,MAAM,GAAG,WAAW,GAAG,GAAG,GAAG,CAAC;CACzD,OAAO,IAAI,cAAc,CAAC,IAAI,IAAI,CAAC,CAAC;AACtC;AAEA,SAAgB,iBAAiB,QAAwB,SAA4B,OAAyB;CAC5G,OAAO,IAAI,gBAAgB,qBAAqB,QAAQ,SAAS,KAAK,GAAG,KAAK;AAChF"}
@@ -96,6 +96,7 @@ declare class DelegationManager {
96
96
  private readonly subscriptions;
97
97
  private service;
98
98
  constructor(options: DelegationManagerOptions);
99
+ setCwd(cwd: string): void;
99
100
  private now;
100
101
  private nowMs;
101
102
  private get runTimeoutMs();
@@ -188,4 +189,4 @@ declare class DelegationManager {
188
189
  }
189
190
  //#endregion
190
191
  export { DelegationNotifier as a, DelegationProgress as c, ERR_NO_RUNTIME as d, NOTIFY_CUSTOM_TYPE as f, DelegationManagerOptions as i, ERR_CANCEL_UNACKNOWLEDGED as l, BACKGROUND_WORK_PROVIDER as n, DelegationOutcome as o, DelegationManager as r, DelegationPlatform as s, AssignOptions as t, ERR_CHILD_SESSION as u };
191
- //# sourceMappingURL=index-BUmf786V.d.mts.map
192
+ //# sourceMappingURL=index-3-3ZJlaH.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-3-3ZJlaH.d.mts","names":[],"sources":["../src/services/delegation/index.ts"],"mappings":";;;;;;cAuBa;cACA;cAkCA;cAEA;cAEA;;;UAII;EACf;EACA;EACA;EACA;;EAEA;;EAEA;;;EAGA;EACA;;KAGU,sBACV;EAAW;EAAoB;EAAiB;GAChD;EAAY;EAAuB;;UAGpB;WACN,aAAa,SAAS;WACtB;WACA;WACA,kBAAkB,eAAe;;UAG3B;EACf,OAAO;EACP;EACA,UAAU;EACV,SAAS;EACT;EACA;EACA;;EAEA;;EAEA;EACA;EACA;;EAEA,gBAAgB,gBAAgB;;EAEhC,SAAS;;UAGM;EACf;EACA,cAAc;EACd;;;EAGA;;;EAGA;EACA;EACA;EACA,SAAS;;UAGM;EACf;EACA;;;;;;;;;;;;;cAuFW;mBACM;mBACA;mBACA;mBACA;mBACA;mBACA;UACT;EAER,YAAY,SAAS;EAIrB,OAAO;UAIC;UAIA;cAII;UAIJ;;MAKJ;;EAKJ,YAAY,MAAM,OAAO;;SAMlB,UAAU,UAAU,oBAAoB;;EAO/C,KAAK,KAAK,SAAS,SAAS;;EAyB5B;;EAMA,kBAAkB;IAAQ;IAAY;;;;;;;;EAYhC,UAAU,4BAAwC,QAAQ;EAwB1D,OAAO,gBAAgB,SAAS,gBAAgB,QAAQ;EAkHxD,OAAO,iBAAiB,QAAQ;;UAiB9B;;;;;;;;UAkBA;;;;;;;;;UAcA;;;;;;;;UAuBA;UAUA;UAOA;;UAOA;UAKA;UAoCA;UAsBM;;;;;;;;;;;;;UA4BA;UAwDN;;;;;;;;;;UAmDA;EAkBR;;EAMA"}
package/dist/index.cjs CHANGED
@@ -7,7 +7,7 @@ const require_config = require("./config-BPNE_wEU.cjs");
7
7
  const require_taskGraph = require("./taskGraph-BskRslrr.cjs");
8
8
  const require_task$2 = require("./task-CXF9VULl.cjs");
9
9
  const require_reconcile = require("./reconcile-cRL0NjDr.cjs");
10
- const require_delegation$1 = require("./delegation-BtzyLnYM.cjs");
10
+ const require_delegation$1 = require("./delegation-3hMdTFXF.cjs");
11
11
  const require_taskResult = require("./taskResult-D2G7b4w-.cjs");
12
12
  const require_promptGuidelines = require("./promptGuidelines-j_SZTzlH.cjs");
13
13
  const require_reducer = require("./reducer-BV0YIZ2o.cjs");
package/dist/index.d.mts CHANGED
@@ -1,13 +1,13 @@
1
1
  import { _ as UpsertSummary, a as DepToken, c as TaskAction, d as TaskDetails, f as TaskDocument, g as UpsertItemOutcome, h as TaskStatus, i as DelegationState, l as TaskAssignment, m as TaskMutationParams, n as DELETED_STATUS, o as STORE_SCHEMA_VERSION, p as TaskItemMutation, r as DelegationResult, s as Task, t as AssignmentSummary, u as TaskDelegation, v as emptyDocument, y as isDelegationActive } from "./task-hLh4BOO7.mjs";
2
2
  import { n as TaskStoreCommitListener, r as TaskStoreOptions, t as TaskStore } from "./index-B7oVjSey.mjs";
3
3
  import { t as MAX_BRIEF_FILES } from "./delegation-Ot2xltLi.mjs";
4
- import { a as DelegationNotifier, c as DelegationProgress, d as ERR_NO_RUNTIME, f as NOTIFY_CUSTOM_TYPE, i as DelegationManagerOptions, l as ERR_CANCEL_UNACKNOWLEDGED, n as BACKGROUND_WORK_PROVIDER, o as DelegationOutcome, r as DelegationManager, s as DelegationPlatform, t as AssignOptions, u as ERR_CHILD_SESSION } from "./index-BUmf786V.mjs";
4
+ import { a as DelegationNotifier, c as DelegationProgress, d as ERR_NO_RUNTIME, f as NOTIFY_CUSTOM_TYPE, i as DelegationManagerOptions, l as ERR_CANCEL_UNACKNOWLEDGED, n as BACKGROUND_WORK_PROVIDER, o as DelegationOutcome, r as DelegationManager, s as DelegationPlatform, t as AssignOptions, u as ERR_CHILD_SESSION } from "./index-3-3ZJlaH.mjs";
5
5
  import { t as COMMAND_NAME } from "./task-CkFjC3Fo.mjs";
6
6
  import { a as TASK_ACTION_FIELDS, c as TOOL_LABEL, d as TaskAssignmentSchema, f as TaskItemParams, g as taskActionAcceptsField, h as TaskParamsSchema, i as TASK_ACTIONS, l as TOOL_NAME, m as TaskParams, n as MSG_NO_TASKS, o as TASK_CONTEXTS, p as TaskItemSchema, r as MSG_UPSERT_FIELD_MISPLACED, s as TASK_STATUSES, t as ERR_REQUIRES_INTERACTIVE, u as TaskAssignmentParams } from "./task-DHSvdK6E.mjs";
7
7
  import { a as ReducerAction, c as isCommittingOp, i as REF_PATTERN, l as singleItemOutcome, n as MAX_UPSERT_ITEMS, o as applyTaskMutation, r as Op, s as formatUpsertFailure, t as ApplyResult } from "./index-DIpc6_uJ.mjs";
8
8
  import { a as MSG_UPSERT_PARTIAL, c as buildTextResult, d as formatContent, f as formatUpsertFailureText, i as MSG_UPSERT_NONE_APPLIED, l as buildToolResult, n as MSG_ALL_COMPLETE_CLEAR, o as ToolResult, r as MSG_ASSIGN_PARTIAL, s as buildAssignmentResult, t as AssignmentItemResult, u as formatAssignmentResults } from "./index-C3DgOhEm.mjs";
9
9
  import { t as DEFAULT_PROMPT_GUIDELINES } from "./promptGuidelines-DaxWrqud.mjs";
10
- import { i as createTaskTool, n as DEFAULT_PROMPT_SNIPPET, r as TaskToolDependencies } from "./root.cli-BfEKqt8s.mjs";
10
+ import { i as createTaskTool, n as DEFAULT_PROMPT_SNIPPET, r as TaskToolDependencies } from "./root.cli-swHZqusx.mjs";
11
11
  import { _ as parsePiTaskConfig, a as DEFAULT_MAX_TASKS, c as DELEGATION_TIMEOUT_MS_ENV, d as PiTaskConfig, f as STORE_TTL_MS_ENV, g as getStoreTtlMs, h as getMaxWidgetLines, i as DEFAULT_DELEGATION_TIMEOUT_MS, l as MAX_TASKS_ENV, m as getMaxTasks, n as COLLAPSE_KEY_OFF, o as DEFAULT_MAX_WIDGET_LINES, p as getDelegationTimeoutMs, r as DEFAULT_COLLAPSE_KEY, s as DEFAULT_STORE_TTL_MS, t as COLLAPSE_KEY_ENV, u as MAX_WIDGET_LINES_ENV, v as resolveCollapseKey } from "./index-D4goIk4Z.mjs";
12
12
  import { a as removeLegacyStoreDirectory, c as resolveLegacyStoreDirectoryAsync, d as sweepStoreFiles, f as sweepStoreFilesAsync, i as lockPathFor, l as resolveSessionKey, n as StoreSweepResult, o as removeLegacyStoreDirectoryAsync, p as tempPathFor, r as hasStorePathOverride, s as resolveLegacyStoreDirectory, t as STORE_PATH_ENV, u as resolveStorePath } from "./index-XY9VPmfm.mjs";
13
13
  import { a as reconcileOrphanedDelegations, i as ReconcileSelf, n as ERR_ORPHANED_BY_SESSION, r as ReconcileResult, t as ERR_ORPHANED_BY_RESTART } from "./index-BNMm9g0K.mjs";
package/dist/index.mjs CHANGED
@@ -5,7 +5,7 @@ import { _ as resolveCollapseKey, a as DEFAULT_MAX_TASKS, c as DELEGATION_TIMEOU
5
5
  import { a as unresolvedBlockers, i as isTaskListComplete, n as detectCycle, r as isBlocked, t as deriveBlocks } from "./taskGraph-BOQvT0-M.mjs";
6
6
  import { i as isDelegationActive, n as STORE_SCHEMA_VERSION, r as emptyDocument, t as DELETED_STATUS } from "./task-giCbpKzV.mjs";
7
7
  import { n as ERR_ORPHANED_BY_SESSION, r as reconcileOrphanedDelegations, t as ERR_ORPHANED_BY_RESTART } from "./reconcile-BcD-hTbd.mjs";
8
- import { a as ERR_NO_RUNTIME, i as ERR_CHILD_SESSION, n as DelegationManager, o as NOTIFY_CUSTOM_TYPE, r as ERR_CANCEL_UNACKNOWLEDGED, t as BACKGROUND_WORK_PROVIDER } from "./delegation-CTFGZtwp.mjs";
8
+ import { a as ERR_NO_RUNTIME, i as ERR_CHILD_SESSION, n as DelegationManager, o as NOTIFY_CUSTOM_TYPE, r as ERR_CANCEL_UNACKNOWLEDGED, t as BACKGROUND_WORK_PROVIDER } from "./delegation-CkGbRaOl.mjs";
9
9
  import { a as buildAssignmentResult, c as formatAssignmentResults, i as MSG_UPSERT_PARTIAL, l as formatContent, n as MSG_ASSIGN_PARTIAL, o as buildTextResult, r as MSG_UPSERT_NONE_APPLIED, s as buildToolResult, t as MSG_ALL_COMPLETE_CLEAR, u as formatUpsertFailureText } from "./taskResult-edBAAKSH.mjs";
10
10
  import { t as DEFAULT_PROMPT_GUIDELINES } from "./promptGuidelines-g4QT8GNM.mjs";
11
11
  import { a as isCommittingOp, i as formatUpsertFailure, n as REF_PATTERN, o as singleItemOutcome, r as applyTaskMutation, t as MAX_UPSERT_ITEMS } from "./reducer-BEfJFM5L.mjs";
@@ -1,7 +1,7 @@
1
1
  import { s as Task } from "./task-hLh4BOO7.mjs";
2
2
  import { o as TaskFailureReporter } from "./telemetry-DOyZLj8E.mjs";
3
3
  import { t as TaskStore } from "./index-B7oVjSey.mjs";
4
- import { r as DelegationManager } from "./index-BUmf786V.mjs";
4
+ import { r as DelegationManager } from "./index-3-3ZJlaH.mjs";
5
5
  import { h as TaskParamsSchema } from "./task-DHSvdK6E.mjs";
6
6
  import { o as ToolResult } from "./index-C3DgOhEm.mjs";
7
7
  import { WithRoot } from "@agimon-ai/doompi-core/extensionFile";
@@ -53,4 +53,4 @@ declare const createTaskRoot: (presentation: TaskRootPresentation) => import("@a
53
53
  type TaskPiScope = Awaited<ReturnType<ReturnType<typeof createTaskRoot>>>['value'];
54
54
  //#endregion
55
55
  export { createTaskTool as i, DEFAULT_PROMPT_SNIPPET as n, TaskToolDependencies as r, TaskPiScope as t };
56
- //# sourceMappingURL=root.cli-BfEKqt8s.d.mts.map
56
+ //# sourceMappingURL=root.cli-swHZqusx.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"root.cli-BfEKqt8s.d.mts","names":[],"sources":["../src/extensions/workspaces/sessions/(backend)/tool/_lib/task.cli.ts","../src/extensions/workspaces/sessions/(backend)/_lib/root.cli.ts"],"mappings":";;;;;;;;;;;cAgCa;UAGI;EACf,OAAO;EACP,YAAY;EACZ;EACA;EACA,SAAS;EACT,kBAAkB,SAAS,kBAAkB,SAAS,gBAAgB;;iBA+GxD,eACd,cAAc,sBACd,YAAW,KAAK,sBAAsB,kBAAkB,yDACvD,sBAAsB,kBAAkB;;;UChH1B;EACf,SAAS,SAAS;EAClB;EACA;EACA;EACA;;UAGe;EACf,cAAc;IAAW,yBAAyB;IAAQ,YAAY;MAAsB;EAC5F,yBACE,IAAI,KAAK,mCACT,SAAS,qBACT,iBAAiB,SAAS,qBAAqB,eAC/C;;cAoVS,iBAAc,cAAkB,wEAAoB;;;;;EAjQlD,0BAAA;aAAW;KAAwB,SACnC,gBACR;EA4BiB;EAoCgB,eAAA,iBAAO,KAAO,qBAAgB;EA2FjC,mBAAA;IAAE;;;GAoGgF;KAC3G,cAAc,QAAQ,WAAW,kBAAkB"}
1
+ {"version":3,"file":"root.cli-swHZqusx.d.mts","names":[],"sources":["../src/extensions/workspaces/sessions/(backend)/tool/_lib/task.cli.ts","../src/extensions/workspaces/sessions/(backend)/_lib/root.cli.ts"],"mappings":";;;;;;;;;;;cAgCa;UAGI;EACf,OAAO;EACP,YAAY;EACZ;EACA;EACA,SAAS;EACT,kBAAkB,SAAS,kBAAkB,SAAS,gBAAgB;;iBA+GxD,eACd,cAAc,sBACd,YAAW,KAAK,sBAAsB,kBAAkB,yDACvD,sBAAsB,kBAAkB;;;UChH1B;EACf,SAAS,SAAS;EAClB;EACA;EACA;EACA;;UAGe;EACf,cAAc;IAAW,yBAAyB;IAAQ,YAAY;MAAsB;EAC5F,yBACE,IAAI,KAAK,mCACT,SAAS,qBACT,iBAAiB,SAAS,qBAAqB,eAC/C;;cAqVS,iBAAc,cAAkB,wEAAoB;;;;;EAlQlD,0BAAA;aAAW;KAAwB,SACnC,gBACR;EA4BiB;EAoCgB,eAAA,iBAAO,KAAO,qBAAgB;EA4FjC,mBAAA;IAAE;;;GAoGgF;KAC3G,cAAc,QAAQ,WAAW,kBAAkB"}
@@ -2,7 +2,7 @@ const require_task = require("./task-Dqy88_rr.cjs");
2
2
  const require_taskGraph = require("./taskGraph-BskRslrr.cjs");
3
3
  const require_reducer = require("./reducer-BV0YIZ2o.cjs");
4
4
  const require_selectors = require("./selectors-b-69vb4W.cjs");
5
- const require_format_cli = require("./format.cli-CKxfl-lR.cjs");
5
+ const require_format_cli = require("./format.cli-ChQsP1MQ.cjs");
6
6
  let node_os = require("node:os");
7
7
  let _earendil_works_pi_tui = require("@earendil-works/pi-tui");
8
8
  let _agimon_ai_doompi_ui_doomOverlay = require("@agimon-ai/doompi-ui/doomOverlay");
@@ -369,4 +369,4 @@ Object.defineProperty(exports, "openTaskSpace", {
369
369
  }
370
370
  });
371
371
 
372
- //# sourceMappingURL=task-space.cli-BdDqn-_h.cjs.map
372
+ //# sourceMappingURL=task-space.cli-BH4Iy_7m.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"task-space.cli-BdDqn-_h.cjs","names":["DOOM_FULLSCREEN_UI_OPTIONS","homedir","visibleWidth","truncateToWidth","fitStyledLine","DoomOverlay","visibleTasks","applyTaskMutation","isCommittingOp","singleItemOutcome","matchesKey","TASK_STATUSES","MSG_NO_TASKS","overlayStatusGlyph","isBlocked","STATUS_LABEL","countTasks","DOOM_OVERLAY_ACCENT"],"sources":["../src/extensions/workspaces/sessions/(frontend)/overlay/_lib/task-space.cli.ts"],"sourcesContent":["/**\n * Task Space: the `SPC t l` overlay.\n *\n * The task list and detail pane render from plain values so the whole surface\n * can be asserted as text without a live terminal.\n *\n * The overlay reads the store on every render rather than caching rows, so an\n * external write by a delegated child shows up without closing the overlay.\n *\n * Every commit it makes is a single-entry `upsert` that carries the selected\n * task's id. That id is what keeps creating a task a tool-only path: an entry\n * without one would create rather than be rejected.\n */\n\nimport { homedir } from 'node:os';\n\nimport {\n DOOM_FULLSCREEN_UI_OPTIONS,\n DOOM_OVERLAY_ACCENT,\n DoomOverlay,\n type DoomOverlayChrome,\n type DoomOverlayTui,\n} from '@agimon-ai/doompi-ui/doomOverlay';\nimport { fitStyledLine } from '@agimon-ai/doompi-ui/rendering';\nimport type { ExtensionContext, Theme } from '@earendil-works/pi-coding-agent';\nimport { matchesKey, truncateToWidth, visibleWidth } from '@earendil-works/pi-tui';\n\nimport type { Task, TaskItemMutation } from '../../../../../../models/task';\nimport { isBlocked } from '../../../../../../models/taskGraph';\nimport { MSG_NO_TASKS, TASK_STATUSES } from '../../../../../../schemas/task';\nimport { applyTaskMutation, isCommittingOp, type Op, singleItemOutcome } from '../../../../../../services/reducer';\nimport type { TaskStore } from '../../../../../../services/taskStore';\nimport { overlayStatusGlyph, STATUS_LABEL } from '../../_shared/format.cli';\nimport { countTasks, visibleTasks } from '.././_lib/selectors';\n\nexport const TASK_SPACE_OVERLAY_OPTIONS = DOOM_FULLSCREEN_UI_OPTIONS.overlayOptions;\n\nexport interface TaskSpaceOptions {\n store: TaskStore;\n}\n\ntype EditMode = 'browse' | 'status' | 'subject';\n\nconst KEY_BACKSPACE = '\\x7f';\nconst KEY_ENTER = '\\r';\nconst KEY_NEWLINE = '\\n';\nconst FIRST_PRINTABLE_CODE_POINT = 0x20;\nconst DELETE_CODE_POINT = 0x7f;\n\n/**\n * Keystrokes that carry no text: escape sequences, control keys, delete.\n * Indexed rather than iterated so surrogate pairs stay intact; both halves sit\n * far above the control range, so no emoji is ever mistaken for one.\n */\nfunction isControlInput(data: string): boolean {\n for (let index = 0; index < data.length; index++) {\n const code = data.charCodeAt(index);\n if (code < FIRST_PRINTABLE_CODE_POINT || code === DELETE_CODE_POINT) return true;\n }\n return false;\n}\n\n/**\n * Store path for the list heading: home collapses to `~`, and an over-long path\n * loses leading segments rather than its tail, because the file name identifies\n * the store while `/var/folders/...` does not.\n */\nfunction storeLabel(storePath: string, width: number): string {\n const home = homedir();\n const abbreviated = home && storePath.startsWith(home) ? `~${storePath.slice(home.length)}` : storePath;\n if (visibleWidth(abbreviated) <= width) return abbreviated;\n\n const segments = abbreviated.split('/');\n let tail = segments.pop() ?? abbreviated;\n while (segments.length > 0) {\n const candidate = `${segments[segments.length - 1]}/${tail}`;\n if (visibleWidth(`…/${candidate}`) > width) break;\n tail = candidate;\n segments.pop();\n }\n return truncateToWidth(`…/${tail}`, width, '');\n}\n\n/** Neither palette name is exported, so take both from the theme's methods. */\ntype ThemeBg = Parameters<Theme['bg']>[0];\ntype ThemeColor = Parameters<Theme['fg']>[0];\n\n/** Each task occupies a heading row and a metadata row beneath it. */\nconst ROWS_PER_TASK = 2;\n/** Hanging indent for the metadata row: clears marker, glyph and id. */\nconst META_INDENT = 6;\n\nconst MIN_WIDTH = 48;\n/** A third for the list, two thirds for the task being read or edited. */\nconst LIST_PANE_RATIO = 1 / 3;\n/** One blank column each side of the pane divider so neither column touches it. */\nconst PANE_GUTTER = 1;\nconst MIN_PANE_WIDTH = 18;\nconst SELECTION_MARKER = '›';\nconst CURRENT_MARKER = '▸';\nconst CURSOR_BLOCK = '█';\nconst ELLIPSIS = '…';\nconst NO_VALUE = 'none';\n\nconst TITLE = 'TASK SPACE';\nconst BREADCRUMB = 'SPC › t › t / tasks';\n/** Key/label pairs rendered as capped keys, matching the mockup's footer. */\nconst LIST_HINTS: readonly (readonly [string, string])[] = [\n ['↑↓', 'select'],\n ['enter', 'edit subject'],\n ['s', 'status'],\n ['esc', 'close'],\n];\nconst LIST_HEADER_RIGHT = 'esc close';\nconst STATUS_HINT = 'STATUS s cycles · enter commits';\nconst SUBJECT_HINT = 'SUBJECT enter commits · esc cancels';\nfunction fitRow(text: string, width: number): string {\n return fitStyledLine(text, width, ELLIPSIS);\n}\n\nfunction rightAligned(left: string, right: string, width: number): string {\n const rightWidth = visibleWidth(right);\n const leftWidth = Math.max(0, width - rightWidth - 1);\n return fitRow(left, leftWidth) + ' '.repeat(Math.max(1, width - leftWidth - rightWidth)) + fitRow(right, rightWidth);\n}\n\nfunction wrap(text: string, width: number): string[] {\n if (width <= 0) return [];\n const lines: string[] = [];\n let current = '';\n for (const word of text.split(/\\s+/).filter(Boolean)) {\n if (current.length === 0) current = word;\n else if (current.length + 1 + word.length <= width) current += ` ${word}`;\n else {\n lines.push(current);\n current = word;\n }\n }\n if (current.length > 0) lines.push(current);\n return lines;\n}\n\n/**\n * Task Space overlay component.\n *\n * Rendering is pure: `render(width)` reads the live store and returns lines with\n * no side effects, so the fidelity job can capture it and unit tests can assert on it.\n */\nexport class TaskSpaceComponent extends DoomOverlay {\n private readonly options: TaskSpaceOptions;\n private readonly done: (result: undefined) => void;\n private readonly unwatch: () => void;\n\n private mode: EditMode = 'browse';\n private selected = 0;\n private statusIndex = 0;\n private draft = '';\n private notice: string | undefined;\n private bodyHeight = 1;\n\n constructor(tui: DoomOverlayTui, theme: Theme, options: TaskSpaceOptions, done: (result: undefined) => void) {\n super(tui, theme);\n this.options = options;\n this.done = done;\n this.unwatch = options.store.onExternalChange(() => this.tui.requestRender());\n }\n\n private tasks(): Task[] {\n return visibleTasks(this.options.store.snapshot.tasks);\n }\n\n private selectedTask(): Task | undefined {\n const tasks = this.tasks();\n if (tasks.length === 0) return undefined;\n return tasks[Math.min(this.selected, tasks.length - 1)];\n }\n\n private move(delta: number): void {\n const tasks = this.tasks();\n if (tasks.length === 0) return;\n this.selected = Math.max(0, Math.min(tasks.length - 1, this.selected + delta));\n this.tui.requestRender();\n }\n\n /** Commits through the same reducer the task tool uses, so both paths share every invariant. */\n private commit(item: TaskItemMutation): void {\n this.options.store\n .mutate<Op>((document) => {\n const result = applyTaskMutation(document, 'upsert', { tasks: [item] });\n // A rejected mutation must not reach the writer: committing it would\n // bump `rev` for an edit that never happened.\n if (!isCommittingOp(result.op)) return { value: result.op };\n return { document: result.document, value: result.op };\n })\n .then((outcome) => {\n // The reducer's message is unprefixed, so the notice reads\n // \"subject must not be blank\" rather than \"item[0] failed: ...\".\n const single = singleItemOutcome(outcome.value);\n this.notice = single?.kind === 'failed' ? single.message : undefined;\n this.tui.requestRender();\n })\n .catch((error: unknown) => {\n // Shown in the overlay rather than swallowed: a rejected write means the\n // edit the operator just made never landed.\n this.notice = error instanceof Error ? error.message : String(error);\n this.tui.requestRender();\n });\n }\n\n private handleStatusInput(data: string): void {\n const task = this.selectedTask();\n if (matchesKey(data, 'up')) this.statusIndex = Math.max(0, this.statusIndex - 1);\n else if (matchesKey(data, 'down')) this.statusIndex = Math.min(TASK_STATUSES.length - 1, this.statusIndex + 1);\n else if (data === 's') this.statusIndex = (this.statusIndex + 1) % TASK_STATUSES.length;\n else if (data === KEY_ENTER || data === KEY_NEWLINE) {\n this.mode = 'browse';\n if (task) this.commit({ id: task.id, status: TASK_STATUSES[this.statusIndex] });\n } else if (matchesKey(data, 'escape')) this.mode = 'browse';\n this.tui.requestRender();\n }\n\n private handleSubjectInput(data: string): void {\n const task = this.selectedTask();\n if (data === KEY_ENTER || data === KEY_NEWLINE) {\n this.mode = 'browse';\n if (task) this.commit({ id: task.id, subject: this.draft });\n } else if (matchesKey(data, 'escape')) this.mode = 'browse';\n else if (data === KEY_BACKSPACE) this.draft = this.draft.slice(0, -1);\n else if (!isControlInput(data)) this.draft += data;\n this.tui.requestRender();\n }\n\n handleInput(data: string): void {\n if (this.mode === 'status') {\n this.handleStatusInput(data);\n return;\n }\n if (this.mode === 'subject') {\n this.handleSubjectInput(data);\n return;\n }\n\n if (matchesKey(data, 'escape') || matchesKey(data, 'ctrl+c')) {\n this.done(undefined);\n return;\n }\n if (matchesKey(data, 'up')) {\n this.move(-1);\n return;\n }\n if (matchesKey(data, 'down')) {\n this.move(1);\n return;\n }\n\n const task = this.selectedTask();\n if (!task) return;\n if (data === 's') {\n this.mode = 'status';\n this.statusIndex = Math.max(0, TASK_STATUSES.indexOf(task.status));\n this.tui.requestRender();\n return;\n }\n if (data === KEY_ENTER || data === KEY_NEWLINE) {\n this.mode = 'subject';\n this.draft = task.subject;\n this.tui.requestRender();\n }\n }\n\n /**\n * A padded, background-filled chip. Foreground is applied inside the fill so\n * the colour closes with it, rather than a reset stripping the background\n * partway through the label.\n */\n private badge(text: string, background: ThemeBg, colour: ThemeColor = 'text'): string {\n return this.theme.bg(background, this.theme.fg(colour, ` ${text} `));\n }\n\n /** Footer hints as capped keys: `[ enter ] edit subject`, per the mockup. */\n private hintLine(hints: readonly (readonly [string, string])[]): string {\n return hints\n .map(([key, label]) => `${this.badge(key, 'selectedBg')}${this.theme.fg('dim', ` ${label}`)}`)\n .join(this.theme.fg('dim', ' '));\n }\n\n private listLines(width: number): string[] {\n const tasks = this.tasks();\n const label = this.theme.bold('TASKS');\n const pathWidth = Math.max(0, width - visibleWidth('TASKS') - 2);\n const lines = [`${label} ${this.theme.fg('dim', storeLabel(this.options.store.storePath, pathWidth))}`, ''];\n if (tasks.length === 0) {\n lines.push(this.theme.fg('dim', MSG_NO_TASKS));\n return lines;\n }\n\n // Two rows per task: at a third of the width a single row left the subject\n // with a handful of columns once owner and state took their share.\n const budget = Math.max(1, Math.floor((this.bodyHeight - lines.length) / ROWS_PER_TASK));\n const start = Math.max(0, Math.min(this.selected - budget + 1, Math.max(0, tasks.length - budget)));\n for (const [offset, task] of tasks.slice(start, start + budget).entries()) {\n const index = start + offset;\n const active = index === Math.min(this.selected, tasks.length - 1);\n const marker = active ? this.theme.fg('accent', SELECTION_MARKER) : ' ';\n const subject = active ? this.theme.bold(task.subject) : task.subject;\n const glyph = overlayStatusGlyph(task.status, this.theme);\n const owner = task.owner ?? task.delegation?.agent ?? NO_VALUE;\n const blocked = task.status === 'pending' && isBlocked(this.options.store.snapshot.tasks, task);\n const state = blocked\n ? this.theme.fg('warning', `blocked by ${(task.blockedBy ?? []).map((id) => `#${id}`).join(', ')}`)\n : this.theme.fg('dim', STATUS_LABEL[task.status]);\n // Subject owns the first row outright; the metadata hangs under it.\n const heading = `${marker} ${glyph} ${this.theme.fg('dim', `#${task.id}`)} ${subject}`;\n const meta = `${' '.repeat(META_INDENT)}${this.badge(owner, 'userMessageBg', 'muted')} ${state}`;\n // Every task sits on a band, the selected one a shade lighter, as in the\n // mockup; the marker stays so selection survives themes with no background.\n const background: ThemeBg = active ? 'selectedBg' : 'userMessageBg';\n for (const row of [heading, meta]) {\n lines.push(this.theme.bg(background, fitRow(row, width)));\n }\n }\n return lines;\n }\n\n private statusLines(task: Task, width: number): string[] {\n if (this.mode !== 'status') {\n const glyph = overlayStatusGlyph(task.status, this.theme);\n return [this.theme.fg('dim', 'STATUS'), `${glyph} ${STATUS_LABEL[task.status]}`];\n }\n // Editing draws the picker as a filled panel, so the whole option list reads\n // as one surface rather than five loose rows.\n const lines = [this.theme.fg('dim', STATUS_HINT)];\n for (const [index, status] of TASK_STATUSES.entries()) {\n const selected = index === this.statusIndex;\n const marker = selected ? this.theme.fg('accent', CURRENT_MARKER) : ' ';\n const label = selected ? this.theme.bold(this.theme.fg('accent', status)) : this.theme.fg('muted', status);\n const current = status === task.status ? this.theme.fg('dim', 'current') : '';\n const row = rightAligned(` ${marker} ${label}`, current, width);\n lines.push(this.theme.bg(selected ? 'selectedBg' : 'userMessageBg', row));\n }\n return lines;\n }\n\n /** The subject as an input: a filled field with a caret, as in the mockup. */\n private subjectField(task: Task, width: number): string[] {\n const editing = this.mode === 'subject';\n const value = editing ? `${this.draft}${CURSOR_BLOCK}` : task.subject;\n return [\n this.theme.fg('dim', editing ? SUBJECT_HINT : 'SUBJECT'),\n this.theme.bg(editing ? 'selectedBg' : 'userMessageBg', fitRow(` ${value}`, width)),\n ];\n }\n\n private detailLines(width: number): string[] {\n const task = this.selectedTask();\n if (!task) return [this.theme.fg('dim', 'No task selected')];\n\n const editing = this.mode === 'subject' || this.mode === 'status';\n const badge = editing ? this.badge('EDIT', 'toolSuccessBg', 'warning') : '';\n const lines = [rightAligned(this.theme.bold(this.theme.fg('accent', `TASK #${task.id}`)), badge, width), ''];\n lines.push(...this.subjectField(task, width));\n lines.push('', ...this.statusLines(task, width), '');\n\n if (task.activeForm) lines.push(this.theme.fg('dim', 'ACTIVE FORM'), task.activeForm, '');\n const owner = task.owner ?? task.delegation?.agent ?? NO_VALUE;\n const delegated = task.delegation?.runId ? this.theme.fg('success', `delegated run ${task.delegation.runId}`) : '';\n lines.push(\n this.theme.fg('dim', 'OWNER'),\n delegated ? `${owner} ${this.theme.fg('dim', '·')} ${delegated}` : owner,\n '',\n );\n lines.push(\n this.theme.fg('dim', 'BLOCKED BY'),\n task.blockedBy?.length ? task.blockedBy.map((id) => `#${id}`).join(' · ') : NO_VALUE,\n );\n if (task.description) lines.push('', this.theme.fg('dim', 'DESCRIPTION'), ...wrap(task.description, width));\n if (this.notice) lines.push('', this.theme.fg('error', this.notice));\n return lines;\n }\n\n private headerSummary(): string {\n const counts = countTasks(this.options.store.snapshot.tasks);\n const summary = [`${counts.completed}/${counts.total} completed`];\n if (counts.inProgress > 0) summary.push(`${counts.inProgress} in progress`);\n if (counts.blocked > 0) summary.push(`${counts.blocked} blocked`);\n if (counts.failed > 0) summary.push(`${counts.failed} failed`);\n return summary.join(' · ');\n }\n\n protected getChrome(): DoomOverlayChrome {\n return {\n title: TITLE,\n accent: DOOM_OVERLAY_ACCENT,\n breadcrumb: BREADCRUMB,\n headerRight: `${this.headerSummary()} · ${LIST_HEADER_RIGHT}`,\n footer: this.hintLine(LIST_HINTS),\n };\n }\n\n protected renderBody(width: number, height: number): string[] {\n this.bodyHeight = height;\n if (width < MIN_WIDTH) return this.renderStacked(width, height);\n\n const leftWidth = Math.max(MIN_PANE_WIDTH, Math.floor((width - 1) * LIST_PANE_RATIO));\n const rightWidth = Math.max(1, width - leftWidth - 1);\n // Each column gives up one column to the gutter, so content never abuts the\n // divider: a long store path used to run straight into the detail heading.\n const leftContent = Math.max(1, leftWidth - PANE_GUTTER);\n const rightContent = Math.max(1, rightWidth - PANE_GUTTER);\n const left = this.listLines(leftContent);\n const right = this.detailLines(rightContent);\n\n const divider = this.theme.fg('borderMuted', '│');\n return Array.from({ length: height }, (_, index) => {\n const row = `${fitRow(left[index] ?? '', leftContent)} ${divider} ${fitRow(right[index] ?? '', rightContent)}`;\n return truncateToWidth(row, width, ELLIPSIS);\n });\n }\n\n private renderStacked(width: number, height: number): string[] {\n const topHeight = Math.max(1, Math.floor((height - 1) / 2));\n const bottomHeight = Math.max(0, height - topHeight - 1);\n this.bodyHeight = topHeight;\n const top = this.listLines(width);\n const bottom = this.detailLines(width);\n return [\n ...top.slice(0, topHeight),\n ...Array.from({ length: Math.max(0, topHeight - top.length) }, () => ''),\n this.theme.fg('borderMuted', '─'.repeat(width)),\n ...bottom.slice(0, bottomHeight),\n ];\n }\n\n dispose(): void {\n this.unwatch();\n }\n}\n\nexport async function openTaskSpace(ctx: ExtensionContext, options: TaskSpaceOptions): Promise<void> {\n await ctx.ui.custom<undefined>(\n (tui, theme, _keybindings, done) => new TaskSpaceComponent(tui, theme, options, done),\n DOOM_FULLSCREEN_UI_OPTIONS,\n );\n}\n\nexport default openTaskSpace;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAa,6BAA6BA,iCAAAA,2BAA2B;AAQrE,MAAM,gBAAgB;AACtB,MAAM,YAAY;AAClB,MAAM,cAAc;AACpB,MAAM,6BAA6B;AACnC,MAAM,oBAAoB;;;;;;AAO1B,SAAS,eAAe,MAAuB;CAC7C,KAAK,IAAI,QAAQ,GAAG,QAAQ,KAAK,QAAQ,SAAS;EAChD,MAAM,OAAO,KAAK,WAAW,KAAK;EAClC,IAAI,OAAO,8BAA8B,SAAS,mBAAmB,OAAO;CAC9E;CACA,OAAO;AACT;;;;;;AAOA,SAAS,WAAW,WAAmB,OAAuB;CAC5D,MAAM,QAAA,GAAOC,QAAAA,QAAAA,CAAQ;CACrB,MAAM,cAAc,QAAQ,UAAU,WAAW,IAAI,IAAI,IAAI,UAAU,MAAM,KAAK,MAAM,MAAM;CAC9F,KAAA,GAAIC,uBAAAA,aAAAA,CAAa,WAAW,KAAK,OAAO,OAAO;CAE/C,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K,UAAU,WAAW;EACvC,MAAM,QAAQ,KAAK,YAAY,YAAY;EAE3C,MAAM,UAAU,KAAK,MAAM,GAAG,eAAe,GAAG;EAChD,OAAO,MAAM,KAAK,EAAE,QAAQ,OAAO,IAAI,GAAG,UAAU;GAClD,MAAM,MAAM,GAAG,OAAO,KAAK,UAAU,IAAI,WAAW,EAAE,GAAG,QAAQ,GAAG,OAAO,MAAM,UAAU,IAAI,YAAY;GAC3G,QAAA,GAAOd,uBAAAA,gBAAAA,CAAgB,KAAK,OAAO,QAAQ;EAC7C,CAAC;CACH;CAEA,cAAsB,OAAe,QAA0B;EAC7D,MAAM,YAAY,KAAK,IAAI,GAAG,KAAK,OAAO,SAAS,KAAK,CAAC,CAAC;EAC1D,MAAM,eAAe,KAAK,IAAI,GAAG,SAAS,YAAY,CAAC;EACvD,KAAK,aAAa;EAClB,MAAM,MAAM,KAAK,UAAU,KAAK;EAChC,MAAM,SAAS,KAAK,YAAY,KAAK;EACrC,OAAO;GACL,GAAG,IAAI,MAAM,GAAG,SAAS;GACzB,GAAG,MAAM,KAAK,EAAE,QAAQ,KAAK,IAAI,GAAG,YAAY,IAAI,MAAM,EAAE,SAAS,EAAE;GACvE,KAAK,MAAM,GAAG,eAAe,IAAI,OAAO,KAAK,CAAC;GAC9C,GAAG,OAAO,MAAM,GAAG,YAAY;EACjC;CACF;CAEA,UAAgB;EACd,KAAK,QAAQ;CACf;AACF;AAEA,eAAsB,cAAc,KAAuB,SAA0C;CACnG,MAAM,IAAI,GAAG,QACV,KAAK,OAAO,cAAc,SAAS,IAAI,mBAAmB,KAAK,OAAO,SAAS,IAAI,GACpFH,iCAAAA,0BACF;AACF"}
1
+ {"version":3,"file":"task-space.cli-BH4Iy_7m.cjs","names":["DOOM_FULLSCREEN_UI_OPTIONS","homedir","visibleWidth","truncateToWidth","fitStyledLine","DoomOverlay","visibleTasks","applyTaskMutation","isCommittingOp","singleItemOutcome","matchesKey","TASK_STATUSES","MSG_NO_TASKS","overlayStatusGlyph","isBlocked","STATUS_LABEL","countTasks","DOOM_OVERLAY_ACCENT"],"sources":["../src/extensions/workspaces/sessions/(frontend)/overlay/_lib/task-space.cli.ts"],"sourcesContent":["/**\n * Task Space: the `SPC t l` overlay.\n *\n * The task list and detail pane render from plain values so the whole surface\n * can be asserted as text without a live terminal.\n *\n * The overlay reads the store on every render rather than caching rows, so an\n * external write by a delegated child shows up without closing the overlay.\n *\n * Every commit it makes is a single-entry `upsert` that carries the selected\n * task's id. That id is what keeps creating a task a tool-only path: an entry\n * without one would create rather than be rejected.\n */\n\nimport { homedir } from 'node:os';\n\nimport {\n DOOM_FULLSCREEN_UI_OPTIONS,\n DOOM_OVERLAY_ACCENT,\n DoomOverlay,\n type DoomOverlayChrome,\n type DoomOverlayTui,\n} from '@agimon-ai/doompi-ui/doomOverlay';\nimport { fitStyledLine } from '@agimon-ai/doompi-ui/rendering';\nimport type { ExtensionContext, Theme } from '@earendil-works/pi-coding-agent';\nimport { matchesKey, truncateToWidth, visibleWidth } from '@earendil-works/pi-tui';\n\nimport type { Task, TaskItemMutation } from '../../../../../../models/task';\nimport { isBlocked } from '../../../../../../models/taskGraph';\nimport { MSG_NO_TASKS, TASK_STATUSES } from '../../../../../../schemas/task';\nimport { applyTaskMutation, isCommittingOp, type Op, singleItemOutcome } from '../../../../../../services/reducer';\nimport type { TaskStore } from '../../../../../../services/taskStore';\nimport { overlayStatusGlyph, STATUS_LABEL } from '../../_shared/format.cli';\nimport { countTasks, visibleTasks } from '.././_lib/selectors';\n\nexport const TASK_SPACE_OVERLAY_OPTIONS = DOOM_FULLSCREEN_UI_OPTIONS.overlayOptions;\n\nexport interface TaskSpaceOptions {\n store: TaskStore;\n}\n\ntype EditMode = 'browse' | 'status' | 'subject';\n\nconst KEY_BACKSPACE = '\\x7f';\nconst KEY_ENTER = '\\r';\nconst KEY_NEWLINE = '\\n';\nconst FIRST_PRINTABLE_CODE_POINT = 0x20;\nconst DELETE_CODE_POINT = 0x7f;\n\n/**\n * Keystrokes that carry no text: escape sequences, control keys, delete.\n * Indexed rather than iterated so surrogate pairs stay intact; both halves sit\n * far above the control range, so no emoji is ever mistaken for one.\n */\nfunction isControlInput(data: string): boolean {\n for (let index = 0; index < data.length; index++) {\n const code = data.charCodeAt(index);\n if (code < FIRST_PRINTABLE_CODE_POINT || code === DELETE_CODE_POINT) return true;\n }\n return false;\n}\n\n/**\n * Store path for the list heading: home collapses to `~`, and an over-long path\n * loses leading segments rather than its tail, because the file name identifies\n * the store while `/var/folders/...` does not.\n */\nfunction storeLabel(storePath: string, width: number): string {\n const home = homedir();\n const abbreviated = home && storePath.startsWith(home) ? `~${storePath.slice(home.length)}` : storePath;\n if (visibleWidth(abbreviated) <= width) return abbreviated;\n\n const segments = abbreviated.split('/');\n let tail = segments.pop() ?? abbreviated;\n while (segments.length > 0) {\n const candidate = `${segments[segments.length - 1]}/${tail}`;\n if (visibleWidth(`…/${candidate}`) > width) break;\n tail = candidate;\n segments.pop();\n }\n return truncateToWidth(`…/${tail}`, width, '');\n}\n\n/** Neither palette name is exported, so take both from the theme's methods. */\ntype ThemeBg = Parameters<Theme['bg']>[0];\ntype ThemeColor = Parameters<Theme['fg']>[0];\n\n/** Each task occupies a heading row and a metadata row beneath it. */\nconst ROWS_PER_TASK = 2;\n/** Hanging indent for the metadata row: clears marker, glyph and id. */\nconst META_INDENT = 6;\n\nconst MIN_WIDTH = 48;\n/** A third for the list, two thirds for the task being read or edited. */\nconst LIST_PANE_RATIO = 1 / 3;\n/** One blank column each side of the pane divider so neither column touches it. */\nconst PANE_GUTTER = 1;\nconst MIN_PANE_WIDTH = 18;\nconst SELECTION_MARKER = '›';\nconst CURRENT_MARKER = '▸';\nconst CURSOR_BLOCK = '█';\nconst ELLIPSIS = '…';\nconst NO_VALUE = 'none';\n\nconst TITLE = 'TASK SPACE';\nconst BREADCRUMB = 'SPC › t › t / tasks';\n/** Key/label pairs rendered as capped keys, matching the mockup's footer. */\nconst LIST_HINTS: readonly (readonly [string, string])[] = [\n ['↑↓', 'select'],\n ['enter', 'edit subject'],\n ['s', 'status'],\n ['esc', 'close'],\n];\nconst LIST_HEADER_RIGHT = 'esc close';\nconst STATUS_HINT = 'STATUS s cycles · enter commits';\nconst SUBJECT_HINT = 'SUBJECT enter commits · esc cancels';\nfunction fitRow(text: string, width: number): string {\n return fitStyledLine(text, width, ELLIPSIS);\n}\n\nfunction rightAligned(left: string, right: string, width: number): string {\n const rightWidth = visibleWidth(right);\n const leftWidth = Math.max(0, width - rightWidth - 1);\n return fitRow(left, leftWidth) + ' '.repeat(Math.max(1, width - leftWidth - rightWidth)) + fitRow(right, rightWidth);\n}\n\nfunction wrap(text: string, width: number): string[] {\n if (width <= 0) return [];\n const lines: string[] = [];\n let current = '';\n for (const word of text.split(/\\s+/).filter(Boolean)) {\n if (current.length === 0) current = word;\n else if (current.length + 1 + word.length <= width) current += ` ${word}`;\n else {\n lines.push(current);\n current = word;\n }\n }\n if (current.length > 0) lines.push(current);\n return lines;\n}\n\n/**\n * Task Space overlay component.\n *\n * Rendering is pure: `render(width)` reads the live store and returns lines with\n * no side effects, so the fidelity job can capture it and unit tests can assert on it.\n */\nexport class TaskSpaceComponent extends DoomOverlay {\n private readonly options: TaskSpaceOptions;\n private readonly done: (result: undefined) => void;\n private readonly unwatch: () => void;\n\n private mode: EditMode = 'browse';\n private selected = 0;\n private statusIndex = 0;\n private draft = '';\n private notice: string | undefined;\n private bodyHeight = 1;\n\n constructor(tui: DoomOverlayTui, theme: Theme, options: TaskSpaceOptions, done: (result: undefined) => void) {\n super(tui, theme);\n this.options = options;\n this.done = done;\n this.unwatch = options.store.onExternalChange(() => this.tui.requestRender());\n }\n\n private tasks(): Task[] {\n return visibleTasks(this.options.store.snapshot.tasks);\n }\n\n private selectedTask(): Task | undefined {\n const tasks = this.tasks();\n if (tasks.length === 0) return undefined;\n return tasks[Math.min(this.selected, tasks.length - 1)];\n }\n\n private move(delta: number): void {\n const tasks = this.tasks();\n if (tasks.length === 0) return;\n this.selected = Math.max(0, Math.min(tasks.length - 1, this.selected + delta));\n this.tui.requestRender();\n }\n\n /** Commits through the same reducer the task tool uses, so both paths share every invariant. */\n private commit(item: TaskItemMutation): void {\n this.options.store\n .mutate<Op>((document) => {\n const result = applyTaskMutation(document, 'upsert', { tasks: [item] });\n // A rejected mutation must not reach the writer: committing it would\n // bump `rev` for an edit that never happened.\n if (!isCommittingOp(result.op)) return { value: result.op };\n return { document: result.document, value: result.op };\n })\n .then((outcome) => {\n // The reducer's message is unprefixed, so the notice reads\n // \"subject must not be blank\" rather than \"item[0] failed: ...\".\n const single = singleItemOutcome(outcome.value);\n this.notice = single?.kind === 'failed' ? single.message : undefined;\n this.tui.requestRender();\n })\n .catch((error: unknown) => {\n // Shown in the overlay rather than swallowed: a rejected write means the\n // edit the operator just made never landed.\n this.notice = error instanceof Error ? error.message : String(error);\n this.tui.requestRender();\n });\n }\n\n private handleStatusInput(data: string): void {\n const task = this.selectedTask();\n if (matchesKey(data, 'up')) this.statusIndex = Math.max(0, this.statusIndex - 1);\n else if (matchesKey(data, 'down')) this.statusIndex = Math.min(TASK_STATUSES.length - 1, this.statusIndex + 1);\n else if (data === 's') this.statusIndex = (this.statusIndex + 1) % TASK_STATUSES.length;\n else if (data === KEY_ENTER || data === KEY_NEWLINE) {\n this.mode = 'browse';\n if (task) this.commit({ id: task.id, status: TASK_STATUSES[this.statusIndex] });\n } else if (matchesKey(data, 'escape')) this.mode = 'browse';\n this.tui.requestRender();\n }\n\n private handleSubjectInput(data: string): void {\n const task = this.selectedTask();\n if (data === KEY_ENTER || data === KEY_NEWLINE) {\n this.mode = 'browse';\n if (task) this.commit({ id: task.id, subject: this.draft });\n } else if (matchesKey(data, 'escape')) this.mode = 'browse';\n else if (data === KEY_BACKSPACE) this.draft = this.draft.slice(0, -1);\n else if (!isControlInput(data)) this.draft += data;\n this.tui.requestRender();\n }\n\n handleInput(data: string): void {\n if (this.mode === 'status') {\n this.handleStatusInput(data);\n return;\n }\n if (this.mode === 'subject') {\n this.handleSubjectInput(data);\n return;\n }\n\n if (matchesKey(data, 'escape') || matchesKey(data, 'ctrl+c')) {\n this.done(undefined);\n return;\n }\n if (matchesKey(data, 'up')) {\n this.move(-1);\n return;\n }\n if (matchesKey(data, 'down')) {\n this.move(1);\n return;\n }\n\n const task = this.selectedTask();\n if (!task) return;\n if (data === 's') {\n this.mode = 'status';\n this.statusIndex = Math.max(0, TASK_STATUSES.indexOf(task.status));\n this.tui.requestRender();\n return;\n }\n if (data === KEY_ENTER || data === KEY_NEWLINE) {\n this.mode = 'subject';\n this.draft = task.subject;\n this.tui.requestRender();\n }\n }\n\n /**\n * A padded, background-filled chip. Foreground is applied inside the fill so\n * the colour closes with it, rather than a reset stripping the background\n * partway through the label.\n */\n private badge(text: string, background: ThemeBg, colour: ThemeColor = 'text'): string {\n return this.theme.bg(background, this.theme.fg(colour, ` ${text} `));\n }\n\n /** Footer hints as capped keys: `[ enter ] edit subject`, per the mockup. */\n private hintLine(hints: readonly (readonly [string, string])[]): string {\n return hints\n .map(([key, label]) => `${this.badge(key, 'selectedBg')}${this.theme.fg('dim', ` ${label}`)}`)\n .join(this.theme.fg('dim', ' '));\n }\n\n private listLines(width: number): string[] {\n const tasks = this.tasks();\n const label = this.theme.bold('TASKS');\n const pathWidth = Math.max(0, width - visibleWidth('TASKS') - 2);\n const lines = [`${label} ${this.theme.fg('dim', storeLabel(this.options.store.storePath, pathWidth))}`, ''];\n if (tasks.length === 0) {\n lines.push(this.theme.fg('dim', MSG_NO_TASKS));\n return lines;\n }\n\n // Two rows per task: at a third of the width a single row left the subject\n // with a handful of columns once owner and state took their share.\n const budget = Math.max(1, Math.floor((this.bodyHeight - lines.length) / ROWS_PER_TASK));\n const start = Math.max(0, Math.min(this.selected - budget + 1, Math.max(0, tasks.length - budget)));\n for (const [offset, task] of tasks.slice(start, start + budget).entries()) {\n const index = start + offset;\n const active = index === Math.min(this.selected, tasks.length - 1);\n const marker = active ? this.theme.fg('accent', SELECTION_MARKER) : ' ';\n const subject = active ? this.theme.bold(task.subject) : task.subject;\n const glyph = overlayStatusGlyph(task.status, this.theme);\n const owner = task.owner ?? task.delegation?.agent ?? NO_VALUE;\n const blocked = task.status === 'pending' && isBlocked(this.options.store.snapshot.tasks, task);\n const state = blocked\n ? this.theme.fg('warning', `blocked by ${(task.blockedBy ?? []).map((id) => `#${id}`).join(', ')}`)\n : this.theme.fg('dim', STATUS_LABEL[task.status]);\n // Subject owns the first row outright; the metadata hangs under it.\n const heading = `${marker} ${glyph} ${this.theme.fg('dim', `#${task.id}`)} ${subject}`;\n const meta = `${' '.repeat(META_INDENT)}${this.badge(owner, 'userMessageBg', 'muted')} ${state}`;\n // Every task sits on a band, the selected one a shade lighter, as in the\n // mockup; the marker stays so selection survives themes with no background.\n const background: ThemeBg = active ? 'selectedBg' : 'userMessageBg';\n for (const row of [heading, meta]) {\n lines.push(this.theme.bg(background, fitRow(row, width)));\n }\n }\n return lines;\n }\n\n private statusLines(task: Task, width: number): string[] {\n if (this.mode !== 'status') {\n const glyph = overlayStatusGlyph(task.status, this.theme);\n return [this.theme.fg('dim', 'STATUS'), `${glyph} ${STATUS_LABEL[task.status]}`];\n }\n // Editing draws the picker as a filled panel, so the whole option list reads\n // as one surface rather than five loose rows.\n const lines = [this.theme.fg('dim', STATUS_HINT)];\n for (const [index, status] of TASK_STATUSES.entries()) {\n const selected = index === this.statusIndex;\n const marker = selected ? this.theme.fg('accent', CURRENT_MARKER) : ' ';\n const label = selected ? this.theme.bold(this.theme.fg('accent', status)) : this.theme.fg('muted', status);\n const current = status === task.status ? this.theme.fg('dim', 'current') : '';\n const row = rightAligned(` ${marker} ${label}`, current, width);\n lines.push(this.theme.bg(selected ? 'selectedBg' : 'userMessageBg', row));\n }\n return lines;\n }\n\n /** The subject as an input: a filled field with a caret, as in the mockup. */\n private subjectField(task: Task, width: number): string[] {\n const editing = this.mode === 'subject';\n const value = editing ? `${this.draft}${CURSOR_BLOCK}` : task.subject;\n return [\n this.theme.fg('dim', editing ? SUBJECT_HINT : 'SUBJECT'),\n this.theme.bg(editing ? 'selectedBg' : 'userMessageBg', fitRow(` ${value}`, width)),\n ];\n }\n\n private detailLines(width: number): string[] {\n const task = this.selectedTask();\n if (!task) return [this.theme.fg('dim', 'No task selected')];\n\n const editing = this.mode === 'subject' || this.mode === 'status';\n const badge = editing ? this.badge('EDIT', 'toolSuccessBg', 'warning') : '';\n const lines = [rightAligned(this.theme.bold(this.theme.fg('accent', `TASK #${task.id}`)), badge, width), ''];\n lines.push(...this.subjectField(task, width));\n lines.push('', ...this.statusLines(task, width), '');\n\n if (task.activeForm) lines.push(this.theme.fg('dim', 'ACTIVE FORM'), task.activeForm, '');\n const owner = task.owner ?? task.delegation?.agent ?? NO_VALUE;\n const delegated = task.delegation?.runId ? this.theme.fg('success', `delegated run ${task.delegation.runId}`) : '';\n lines.push(\n this.theme.fg('dim', 'OWNER'),\n delegated ? `${owner} ${this.theme.fg('dim', '·')} ${delegated}` : owner,\n '',\n );\n lines.push(\n this.theme.fg('dim', 'BLOCKED BY'),\n task.blockedBy?.length ? task.blockedBy.map((id) => `#${id}`).join(' · ') : NO_VALUE,\n );\n if (task.description) lines.push('', this.theme.fg('dim', 'DESCRIPTION'), ...wrap(task.description, width));\n if (this.notice) lines.push('', this.theme.fg('error', this.notice));\n return lines;\n }\n\n private headerSummary(): string {\n const counts = countTasks(this.options.store.snapshot.tasks);\n const summary = [`${counts.completed}/${counts.total} completed`];\n if (counts.inProgress > 0) summary.push(`${counts.inProgress} in progress`);\n if (counts.blocked > 0) summary.push(`${counts.blocked} blocked`);\n if (counts.failed > 0) summary.push(`${counts.failed} failed`);\n return summary.join(' · ');\n }\n\n protected getChrome(): DoomOverlayChrome {\n return {\n title: TITLE,\n accent: DOOM_OVERLAY_ACCENT,\n breadcrumb: BREADCRUMB,\n headerRight: `${this.headerSummary()} · ${LIST_HEADER_RIGHT}`,\n footer: this.hintLine(LIST_HINTS),\n };\n }\n\n protected renderBody(width: number, height: number): string[] {\n this.bodyHeight = height;\n if (width < MIN_WIDTH) return this.renderStacked(width, height);\n\n const leftWidth = Math.max(MIN_PANE_WIDTH, Math.floor((width - 1) * LIST_PANE_RATIO));\n const rightWidth = Math.max(1, width - leftWidth - 1);\n // Each column gives up one column to the gutter, so content never abuts the\n // divider: a long store path used to run straight into the detail heading.\n const leftContent = Math.max(1, leftWidth - PANE_GUTTER);\n const rightContent = Math.max(1, rightWidth - PANE_GUTTER);\n const left = this.listLines(leftContent);\n const right = this.detailLines(rightContent);\n\n const divider = this.theme.fg('borderMuted', '│');\n return Array.from({ length: height }, (_, index) => {\n const row = `${fitRow(left[index] ?? '', leftContent)} ${divider} ${fitRow(right[index] ?? '', rightContent)}`;\n return truncateToWidth(row, width, ELLIPSIS);\n });\n }\n\n private renderStacked(width: number, height: number): string[] {\n const topHeight = Math.max(1, Math.floor((height - 1) / 2));\n const bottomHeight = Math.max(0, height - topHeight - 1);\n this.bodyHeight = topHeight;\n const top = this.listLines(width);\n const bottom = this.detailLines(width);\n return [\n ...top.slice(0, topHeight),\n ...Array.from({ length: Math.max(0, topHeight - top.length) }, () => ''),\n this.theme.fg('borderMuted', '─'.repeat(width)),\n ...bottom.slice(0, bottomHeight),\n ];\n }\n\n dispose(): void {\n this.unwatch();\n }\n}\n\nexport async function openTaskSpace(ctx: ExtensionContext, options: TaskSpaceOptions): Promise<void> {\n await ctx.ui.custom<undefined>(\n (tui, theme, _keybindings, done) => new TaskSpaceComponent(tui, theme, options, done),\n DOOM_FULLSCREEN_UI_OPTIONS,\n );\n}\n\nexport default openTaskSpace;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAa,6BAA6BA,iCAAAA,2BAA2B;AAQrE,MAAM,gBAAgB;AACtB,MAAM,YAAY;AAClB,MAAM,cAAc;AACpB,MAAM,6BAA6B;AACnC,MAAM,oBAAoB;;;;;;AAO1B,SAAS,eAAe,MAAuB;CAC7C,KAAK,IAAI,QAAQ,GAAG,QAAQ,KAA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AAQ;CACf;AACF;AAEA,eAAsB,cAAc,KAAuB,SAA0C;CACnG,MAAM,IAAI,GAAG,QACV,KAAK,OAAO,cAAc,SAAS,IAAI,mBAAmB,KAAK,OAAO,SAAS,IAAI,GACpFH,iCAAAA,0BACF;AACF"}
@@ -2,7 +2,7 @@ import { n as MSG_NO_TASKS, s as TASK_STATUSES } from "./task-DKHKuems.mjs";
2
2
  import { r as isBlocked } from "./taskGraph-BOQvT0-M.mjs";
3
3
  import { a as isCommittingOp, o as singleItemOutcome, r as applyTaskMutation } from "./reducer-BEfJFM5L.mjs";
4
4
  import { c as visibleTasks, t as countTasks } from "./selectors-BaS6dObz.mjs";
5
- import { a as STATUS_LABEL, u as overlayStatusGlyph } from "./format.cli-CuTlvk8J.mjs";
5
+ import { a as STATUS_LABEL, u as overlayStatusGlyph } from "./format.cli-Cnc591eb.mjs";
6
6
  import { homedir } from "node:os";
7
7
  import { matchesKey, truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
8
8
  import { DOOM_FULLSCREEN_UI_OPTIONS, DOOM_OVERLAY_ACCENT, DoomOverlay } from "@agimon-ai/doompi-ui/doomOverlay";
@@ -352,4 +352,4 @@ async function openTaskSpace(ctx, options) {
352
352
  //#endregion
353
353
  export { TaskSpaceComponent as n, openTaskSpace as r, TASK_SPACE_OVERLAY_OPTIONS as t };
354
354
 
355
- //# sourceMappingURL=task-space.cli-DowNll0k.mjs.map
355
+ //# sourceMappingURL=task-space.cli-CMYNjgOW.mjs.map