@temmo/cli 0.0.0-stage → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +14 -0
- package/.claude-plugin/plugin.json +16 -0
- package/.codex-plugin/plugin.json +30 -0
- package/.cursor-plugin/plugin.json +22 -0
- package/.mcp.json +18 -0
- package/LICENSE +202 -0
- package/README.md +82 -2
- package/THIRD_PARTY_NOTICES +32 -0
- package/commands/afk.md +17 -0
- package/deploy/build-ui.mjs +65 -0
- package/deploy/claude/README.md +16 -0
- package/deploy/claude/auto-mode.json +31 -0
- package/deploy/postgres/compose.yaml +26 -0
- package/deploy/temmo-runner.service +24 -0
- package/deploy/verify-ui.mjs +15 -0
- package/harness-core/README.md +27 -0
- package/harness-core/bin/harness.mjs +17 -0
- package/harness-core/package.json +10 -0
- package/harness-core/stage.mjs +108 -0
- package/harness-core/stages/commit.md +7 -0
- package/harness-core/stages/pr.md +7 -0
- package/harness-core/stages/push.md +7 -0
- package/hooks/codex-hooks.json +14 -0
- package/hooks/cursor-hooks.json +17 -0
- package/hooks/hooks.json +27 -0
- package/lib/acp/permission.js +72 -0
- package/lib/acp/sessionConfig.js +109 -0
- package/lib/activity.js +244 -0
- package/lib/agent-guard.js +72 -0
- package/lib/agents-route.js +55 -0
- package/lib/agents.js +213 -0
- package/lib/agui.js +255 -0
- package/lib/alerts.js +36 -0
- package/lib/analyze-otlp.js +46 -0
- package/lib/analyze-run-code.js +397 -0
- package/lib/analyze-sources.js +372 -0
- package/lib/approval-card.js +54 -0
- package/lib/approval-cli.js +53 -0
- package/lib/approval-request.js +81 -0
- package/lib/approval-signer.js +48 -0
- package/lib/approvals.js +295 -0
- package/lib/attachment-cache.js +236 -0
- package/lib/attachment.js +63 -0
- package/lib/blocked.js +20 -0
- package/lib/build-review.js +90 -0
- package/lib/builder/cli.js +90 -0
- package/lib/builder/policy.js +176 -0
- package/lib/builder/recover.js +189 -0
- package/lib/builder/run.js +240 -0
- package/lib/builder/settle.js +198 -0
- package/lib/builder/stage.js +240 -0
- package/lib/builder/state.js +73 -0
- package/lib/builder/supervisor.js +289 -0
- package/lib/builder-clean.js +223 -0
- package/lib/builder-code.cjs +67 -0
- package/lib/builder.js +9 -0
- package/lib/bus-postgres.js +281 -0
- package/lib/bus.js +349 -0
- package/lib/catalog/author.js +278 -0
- package/lib/catalog/dot.js +426 -0
- package/lib/catalog/pattern-model.js +193 -0
- package/lib/catalog/patterns.js +324 -0
- package/lib/catalog/projects.js +83 -0
- package/lib/catalog/records.js +2 -0
- package/lib/catalog/roster.js +70 -0
- package/lib/catalog/team-files.js +49 -0
- package/lib/catalog/teams.js +109 -0
- package/lib/claude-socket.js +333 -0
- package/lib/cli.js +741 -0
- package/lib/code-mode.js +45 -0
- package/lib/code-read-policy.yaml +9 -0
- package/lib/code-run.js +461 -0
- package/lib/codex-compact.js +141 -0
- package/lib/compaction.js +21 -0
- package/lib/config.js +424 -0
- package/lib/cursor-trace.js +248 -0
- package/lib/deep-link.js +20 -0
- package/lib/deliver-push.js +120 -0
- package/lib/delivery.js +28 -0
- package/lib/deploy-tree.js +227 -0
- package/lib/durable.js +404 -0
- package/lib/factory-tick.js +32 -0
- package/lib/family.js +63 -0
- package/lib/fetch-origin.js +53 -0
- package/lib/format.js +133 -0
- package/lib/harness-surface-cli.js +153 -0
- package/lib/harness-surface.js +486 -0
- package/lib/harness.js +271 -0
- package/lib/hook.mjs +291 -0
- package/lib/idle.js +40 -0
- package/lib/install-cursor.js +115 -0
- package/lib/install-opencode.js +105 -0
- package/lib/job.js +82 -0
- package/lib/land-cli.js +319 -0
- package/lib/land-member.js +64 -0
- package/lib/land.js +320 -0
- package/lib/lessons.js +223 -0
- package/lib/limit-alert.js +423 -0
- package/lib/limits.js +284 -0
- package/lib/machine-prompt.js +19 -0
- package/lib/merge-sweep.js +149 -0
- package/lib/messaging.js +1002 -0
- package/lib/mission-cli.js +103 -0
- package/lib/mission.js +241 -0
- package/lib/mode.js +215 -0
- package/lib/models.js +114 -0
- package/lib/names.js +86 -0
- package/lib/opencode-api.js +57 -0
- package/lib/opencode-plugin.mjs +313 -0
- package/lib/operator-token.js +78 -0
- package/lib/operator.js +187 -0
- package/lib/pad-activity.js +143 -0
- package/lib/pad-fresh.js +44 -0
- package/lib/pad.js +198 -0
- package/lib/pattern-cli.js +120 -0
- package/lib/pattern-compiler.js +68 -0
- package/lib/pattern-runs.js +795 -0
- package/lib/pattern-stall.js +58 -0
- package/lib/pattern-tick.js +45 -0
- package/lib/pattern-workflow.js +69 -0
- package/lib/pi-extension.mjs +98 -0
- package/lib/pi.js +57 -0
- package/lib/plugin-copy.js +76 -0
- package/lib/pm-review.js +32 -0
- package/lib/pm-workspace.js +87 -0
- package/lib/postgres.js +115 -0
- package/lib/pr-card.js +34 -0
- package/lib/probe.js +295 -0
- package/lib/process.js +67 -0
- package/lib/project-pause.js +23 -0
- package/lib/prune.js +793 -0
- package/lib/questions.js +250 -0
- package/lib/receipts.js +63 -0
- package/lib/reflect.js +962 -0
- package/lib/rename-migration.js +118 -0
- package/lib/run-terminal.js +437 -0
- package/lib/runner-request.js +33 -0
- package/lib/sandbox-app.js +120 -0
- package/lib/sandbox-claims.js +258 -0
- package/lib/sandbox-cli.js +188 -0
- package/lib/sandbox-hosts-cli.js +68 -0
- package/lib/sandbox-hosts.js +94 -0
- package/lib/sandbox-pr.js +102 -0
- package/lib/sandbox-proposal.js +367 -0
- package/lib/sandbox-tools.js +143 -0
- package/lib/sandbox.js +501 -0
- package/lib/schedule-session.js +68 -0
- package/lib/session-activity.js +67 -0
- package/lib/session-events.js +94 -0
- package/lib/sessions/control.js +244 -0
- package/lib/sessions/git-refs.js +265 -0
- package/lib/sessions/launch.js +359 -0
- package/lib/sessions/registry.js +450 -0
- package/lib/sessions/scope.js +111 -0
- package/lib/setup.js +377 -0
- package/lib/signed-approval.js +225 -0
- package/lib/slash.js +167 -0
- package/lib/spawn-cli.js +45 -0
- package/lib/spawn.js +107 -0
- package/lib/start-limit.js +58 -0
- package/lib/state.js +24 -0
- package/lib/stop.js +308 -0
- package/lib/store-read.js +62 -0
- package/lib/store.js +252 -0
- package/lib/subagent-guard.js +240 -0
- package/lib/surfaces/channel-post.js +43 -0
- package/lib/surfaces/instructions.js +15 -0
- package/lib/surfaces/mcp-reload.js +144 -0
- package/lib/surfaces/ops.js +629 -0
- package/lib/surfaces/render-mcp.js +33 -0
- package/lib/surfaces/run-terminal-ops.js +40 -0
- package/lib/surfaces/sandbox-ops.js +36 -0
- package/lib/surfaces/schema.js +7 -0
- package/lib/surfaces/task-view.js +90 -0
- package/lib/surfaces/types.js +4 -0
- package/lib/task-cli.js +274 -0
- package/lib/task-order.js +34 -0
- package/lib/task-order.mjs +2 -0
- package/lib/task-route.js +125 -0
- package/lib/tasks.js +631 -0
- package/lib/team-permission.js +34 -0
- package/lib/team-templates/blitz/team.dot +9 -0
- package/lib/team-templates/factory/team.dot +26 -0
- package/lib/team-templates/feature/team.dot +14 -0
- package/lib/team-templates/fix-and-review/team.dot +12 -0
- package/lib/team-templates/product/team.dot +16 -0
- package/lib/team-templates/release/team.dot +7 -0
- package/lib/team-templates/review/team.dot +6 -0
- package/lib/terminal-draft.js +42 -0
- package/lib/thread-branch.js +82 -0
- package/lib/thread-channel-store.js +181 -0
- package/lib/thread-channels.js +116 -0
- package/lib/thread-listening.js +20 -0
- package/lib/thread-routes.js +91 -0
- package/lib/threads.js +441 -0
- package/lib/tool-api.js +33 -0
- package/lib/transcript.js +98 -0
- package/lib/ui-build-output.js +19 -0
- package/lib/ui-capabilities.js +90 -0
- package/lib/usage.js +182 -0
- package/lib/vendor/mcp-sdk.d.mts +4 -0
- package/lib/vendor/mcp-sdk.mjs +17046 -0
- package/lib/waiter.js +127 -0
- package/lib/workflows.js +546 -0
- package/lib/worktree-setup.js +86 -0
- package/package.json +110 -4
- package/runner/adapters/claude.js +465 -0
- package/runner/adapters/cli-sandbox.js +277 -0
- package/runner/adapters/codex.js +675 -0
- package/runner/adapters/cursor.mjs +937 -0
- package/runner/adapters/fake.js +119 -0
- package/runner/adapters/opencode-sandbox.js +370 -0
- package/runner/adapters/opencode.js +486 -0
- package/runner/adapters/pi-sandbox.js +134 -0
- package/runner/adapters/pi.js +364 -0
- package/runner/client.js +40 -0
- package/runner/contract.js +129 -0
- package/runner/control.js +178 -0
- package/runner/delivery.js +184 -0
- package/runner/factory-tick.mjs +10 -0
- package/runner/lock.js +41 -0
- package/runner/main.mjs +118 -0
- package/runner/pattern-tick.mjs +16 -0
- package/runner/publish.js +113 -0
- package/runner/runner.js +2612 -0
- package/runner/sandbox-run.mjs +239 -0
- package/runner/schedules.js +294 -0
- package/runner/task-wake.js +59 -0
- package/scripts/ai-collab +3 -0
- package/scripts/ai-collab-bus.mjs +4 -0
- package/scripts/ai-collab-code-mcp.mjs +3 -0
- package/scripts/ai-collab-hook +3 -0
- package/scripts/ai-collab-hook.mjs +3 -0
- package/scripts/ai-collab-mcp-tools.mjs +2 -0
- package/scripts/ai-collab-mcp.mjs +3 -0
- package/scripts/ai-collab.mjs +3 -0
- package/scripts/install-cursor.mjs +11 -0
- package/scripts/install-opencode.mjs +10 -0
- package/scripts/temmo +3 -0
- package/scripts/temmo-bus.mjs +151 -0
- package/scripts/temmo-code-mcp.mjs +63 -0
- package/scripts/temmo-hook +3 -0
- package/scripts/temmo-hook.mjs +201 -0
- package/scripts/temmo-mcp-tools.mjs +22 -0
- package/scripts/temmo-mcp.mjs +27 -0
- package/scripts/temmo.mjs +4 -0
- package/skills/antislop/SKILL.md +701 -0
- package/skills/antislop/VERSION +1 -0
- package/skills/antislop-code/SKILL.md +128 -0
- package/skills/antislop-human/LICENSE-web-quality-skills +21 -0
- package/skills/antislop-human/SKILL.md +204 -0
- package/skills/antislop-human/contrast-check.py +168 -0
- package/skills/antislop-human/contrast-mcp.py +125 -0
- package/skills/antislop-human/references/A11Y-PATTERNS.md +249 -0
- package/skills/antislop-human/references/WCAG.md +127 -0
- package/skills/antislop-layoutmobile/SKILL.md +170 -0
- package/skills/antislop-ui/LICENSE-web-quality-skills +21 -0
- package/skills/antislop-ui/SKILL.md +351 -0
- package/skills/antislop-ui/references/CORE-WEB-VITALS.md +181 -0
- package/skills/antislop-ui/references/WEB-BASELINE.md +28 -0
- package/skills/harness-surface/SKILL.md +42 -0
- package/skills/land/SKILL.md +32 -0
- package/skills/memory-file/SKILL.md +39 -0
- package/skills/temmo/SKILL.md +101 -0
- package/skills/temmo/references/role-programs.md +47 -0
- package/skills/ui-sdk/SKILL.md +56 -0
- package/skills/ui-sdk/references/agent-ready.md +136 -0
- package/skills/ui-sdk/references/build-interface.md +187 -0
- package/skills/ui-sdk/references/create-component.md +88 -0
- package/skills/ui-sdk/references/patterns.md +246 -0
- package/skills/ui-sdk/references/styles.md +66 -0
- package/skills/ui-sdk/references/testing.md +172 -0
- package/skills/ui-sdk/references/web-components.md +78 -0
- package/tools/screen-state.mjs +119 -0
- package/tools/smoke-ui.mjs +540 -0
- package/web/app/activity.jsx +251 -0
- package/web/app/agent-mark.tsx +43 -0
- package/web/app/alert-level.jsx +16 -0
- package/web/app/api/[action]/route.js +8 -0
- package/web/app/api/auth/[step]/route.js +12 -0
- package/web/app/api/events/route.js +8 -0
- package/web/app/api/file/[name]/route.js +8 -0
- package/web/app/api/land/route.js +12 -0
- package/web/app/api/lessons/route.js +8 -0
- package/web/app/api/push/key/route.js +8 -0
- package/web/app/api/push/subscribe/route.js +12 -0
- package/web/app/api/push/test/route.js +8 -0
- package/web/app/api/refs/route.js +8 -0
- package/web/app/api/review-diff/route.js +8 -0
- package/web/app/api/schedules/route.js +8 -0
- package/web/app/api/thread-diff/route.js +8 -0
- package/web/app/api/version/route.js +6 -0
- package/web/app/cards.jsx +189 -0
- package/web/app/chat-api.js +82 -0
- package/web/app/chat-composer.jsx +313 -0
- package/web/app/chat-console.jsx +691 -0
- package/web/app/chat-image.tsx +61 -0
- package/web/app/chat-message.jsx +122 -0
- package/web/app/chat-shared.jsx +59 -0
- package/web/app/chat-sidebar.jsx +25 -0
- package/web/app/chat-stream.js +127 -0
- package/web/app/chat.jsx +31 -0
- package/web/app/compactions.jsx +57 -0
- package/web/app/composer-actions.tsx +87 -0
- package/web/app/decisions.jsx +53 -0
- package/web/app/fonts/OFL-hanken-grotesk.txt +93 -0
- package/web/app/fonts/OFL-ibm-plex-mono.txt +93 -0
- package/web/app/fonts/hanken-grotesk-latin-wght-normal.woff2 +0 -0
- package/web/app/fonts/ibm-plex-mono-latin-400-normal.woff2 +0 -0
- package/web/app/fonts/ibm-plex-mono-latin-500-normal.woff2 +0 -0
- package/web/app/globals.css +199 -0
- package/web/app/home.jsx +246 -0
- package/web/app/icon.svg +1 -0
- package/web/app/land-panel.jsx +63 -0
- package/web/app/land-reviews.jsx +20 -0
- package/web/app/layout.jsx +17 -0
- package/web/app/lessons.tsx +76 -0
- package/web/app/logo.tsx +13 -0
- package/web/app/logos.jsx +16 -0
- package/web/app/manifest.js +8 -0
- package/web/app/mode-menu.tsx +46 -0
- package/web/app/new-session.jsx +275 -0
- package/web/app/notify.jsx +180 -0
- package/web/app/outcomes.tsx +94 -0
- package/web/app/page.jsx +9 -0
- package/web/app/pattern-graph.jsx +75 -0
- package/web/app/patterns-page.jsx +293 -0
- package/web/app/phone-nav.tsx +36 -0
- package/web/app/progress-feed.tsx +33 -0
- package/web/app/providers.tsx +27 -0
- package/web/app/quote.jsx +15 -0
- package/web/app/run-card.tsx +200 -0
- package/web/app/run-requests.tsx +148 -0
- package/web/app/scheduled.jsx +105 -0
- package/web/app/session-panel.tsx +174 -0
- package/web/app/session-toolbar.tsx +180 -0
- package/web/app/shadcn.css +638 -0
- package/web/app/shipped.jsx +49 -0
- package/web/app/subagent-runs.jsx +31 -0
- package/web/app/task-graph.jsx +67 -0
- package/web/app/tasks-strip.tsx +36 -0
- package/web/app/tasks.jsx +375 -0
- package/web/app/team-author.jsx +145 -0
- package/web/app/team-editor.jsx +88 -0
- package/web/app/thread-agents.tsx +32 -0
- package/web/app/thread-place.tsx +9 -0
- package/web/app/thread-sessions.tsx +149 -0
- package/web/app/thread-sidebar.tsx +418 -0
- package/web/app/thread-switcher.tsx +27 -0
- package/web/app/tool-diff.jsx +94 -0
- package/web/components/a2ui/controls.jsx +36 -0
- package/web/components/a2ui/option-picker.jsx +23 -0
- package/web/components/a2ui/script.tsx +121 -0
- package/web/components/a2ui/surface.jsx +81 -0
- package/web/components/chat/thread.jsx +50 -0
- package/web/components/script-text.tsx +42 -0
- package/web/components/ui/avatar.jsx +115 -0
- package/web/components/ui/badge.jsx +47 -0
- package/web/components/ui/button.jsx +63 -0
- package/web/components/ui/chat-container.jsx +52 -0
- package/web/components/ui/choice-list.tsx +72 -0
- package/web/components/ui/code-block.jsx +60 -0
- package/web/components/ui/copy-button.tsx +41 -0
- package/web/components/ui/dropdown-menu.jsx +257 -0
- package/web/components/ui/markdown.jsx +84 -0
- package/web/components/ui/message.jsx +28 -0
- package/web/components/ui/popover.jsx +33 -0
- package/web/components/ui/scroll-button.jsx +34 -0
- package/web/components/ui/select.jsx +189 -0
- package/web/components/ui/sheet.jsx +152 -0
- package/web/components/ui/sonner.jsx +10 -0
- package/web/components/ui/tabs.jsx +88 -0
- package/web/components/ui/textarea.jsx +20 -0
- package/web/components/ui/tooltip.jsx +56 -0
- package/web/components.json +24 -0
- package/web/instrumentation.js +8 -0
- package/web/lib/a2ui-catalog.js +34 -0
- package/web/lib/a2ui-pr.js +76 -0
- package/web/lib/a2ui-run-catalog.js +18 -0
- package/web/lib/a2ui-run.js +93 -0
- package/web/lib/a2ui.js +262 -0
- package/web/lib/activity-rows.js +275 -0
- package/web/lib/agent-detail.js +5 -0
- package/web/lib/alert-level.js +44 -0
- package/web/lib/approval-mode.js +22 -0
- package/web/lib/chat-turns.js +174 -0
- package/web/lib/child-subagents.js +16 -0
- package/web/lib/compaction-view.js +48 -0
- package/web/lib/composer-actions.js +40 -0
- package/web/lib/context-view.js +57 -0
- package/web/lib/fuzzy.js +26 -0
- package/web/lib/highlight.js +44 -0
- package/web/lib/lessons-view.js +23 -0
- package/web/lib/mentions.js +16 -0
- package/web/lib/message-routing.js +105 -0
- package/web/lib/new-session.js +85 -0
- package/web/lib/operator-messages.js +28 -0
- package/web/lib/pattern-graph.js +165 -0
- package/web/lib/pattern-view.js +33 -0
- package/web/lib/pending-summary.js +18 -0
- package/web/lib/permission-modes.js +30 -0
- package/web/lib/project-feed.js +107 -0
- package/web/lib/quote.js +7 -0
- package/web/lib/reply-quote.js +31 -0
- package/web/lib/scheduled.js +79 -0
- package/web/lib/selection.js +110 -0
- package/web/lib/send-confirmation.js +22 -0
- package/web/lib/session-dead.js +10 -0
- package/web/lib/session-state.js +132 -0
- package/web/lib/sidebar.js +15 -0
- package/web/lib/slash-commands.js +164 -0
- package/web/lib/start-default.js +35 -0
- package/web/lib/start-mode.js +35 -0
- package/web/lib/stream-views.js +49 -0
- package/web/lib/subagent-state.js +20 -0
- package/web/lib/task-board.js +54 -0
- package/web/lib/task-graph.js +183 -0
- package/web/lib/task-tags.js +41 -0
- package/web/lib/team-editor.js +10 -0
- package/web/lib/thread-groups.js +86 -0
- package/web/lib/threads.js +28 -0
- package/web/lib/tool-diff.js +273 -0
- package/web/lib/ui-events.js +58 -0
- package/web/lib/utils.js +5 -0
- package/web/lib/view-memory.js +25 -0
- package/web/next.config.mjs +37 -0
- package/web/postcss.config.mjs +1 -0
- package/web/proxy.js +25 -0
- package/web/public/sw.js +39 -0
- package/web/server/auth.js +178 -0
- package/web/server/dispatch.js +293 -0
- package/web/server/history.js +56 -0
- package/web/server/hosted.js +58 -0
- package/web/server/hub.js +126 -0
- package/web/server/instance.js +5 -0
- package/web/server/land-reviews.js +64 -0
- package/web/server/push.js +148 -0
- package/web/server/run-terminal.js +79 -0
- package/web/server/schedules.js +38 -0
- package/web/server/shipped.js +51 -0
- package/web/server/task-board.js +71 -0
- package/web/server/threads.js +209 -0
- package/web/server/ui.js +2937 -0
- package/web/tsconfig.base.json +16 -0
- package/web/tsconfig.json +9 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
|
+
import { Button } from "@/components/ui/button";
|
|
3
|
+
import { NODE, STATUS_FILL, layeredLayout, listLayout, taskGraph } from "@/lib/task-graph";
|
|
4
|
+
import { priorityOf } from "../../lib/task-order.mjs";
|
|
5
|
+
|
|
6
|
+
const ARROW = "task-arrow";
|
|
7
|
+
const LIST_BELOW = 600;
|
|
8
|
+
const CHAR_WIDTH = 7.5;
|
|
9
|
+
const segmenter = new Intl.Segmenter(undefined, { granularity: "grapheme" });
|
|
10
|
+
|
|
11
|
+
// Graphemes that fit beside the status bar in a node of this width; a cut title ends in an ellipsis.
|
|
12
|
+
function label(title, width) {
|
|
13
|
+
const graphemes = [...segmenter.segment(title)].map(part => part.segment);
|
|
14
|
+
const max = Math.max(8, Math.floor((width - 24) / CHAR_WIDTH));
|
|
15
|
+
return graphemes.length > max ? `${graphemes.slice(0, max - 1).join("")}…` : title;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Tasks as nodes, blockers as arrows, colour by status; done tasks collapse. Tapping a node opens its owner or run. */
|
|
19
|
+
export function TaskGraph({ tasks, open = () => {} }) {
|
|
20
|
+
const [showDone, setShowDone] = useState(true);
|
|
21
|
+
const canvas = useRef(null);
|
|
22
|
+
const [width, setWidth] = useState(0);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
const observer = new ResizeObserver(([entry]) => setWidth(entry.contentRect.width));
|
|
25
|
+
observer.observe(canvas.current);
|
|
26
|
+
return () => observer.disconnect();
|
|
27
|
+
}, []);
|
|
28
|
+
const graph = taskGraph(tasks, { showDone });
|
|
29
|
+
// A phone gets one node per row with arcs in a left gutter; wider screens flow layers left to right.
|
|
30
|
+
const laid = width < LIST_BELOW
|
|
31
|
+
? listLayout(graph.nodes, graph.edges, { maxWidth: width })
|
|
32
|
+
: layeredLayout(graph.nodes, graph.edges, { direction: "right" });
|
|
33
|
+
const byId = new Map(graph.nodes.map(node => [node.id, node]));
|
|
34
|
+
const hasDone = tasks.some(task => task.status === "done");
|
|
35
|
+
return <div className="flex min-h-0 flex-1 flex-col gap-3">
|
|
36
|
+
<div className="flex shrink-0 flex-wrap items-center justify-between gap-2 text-xs text-muted-foreground">
|
|
37
|
+
<span>{graph.nodes.length} tasks · {graph.edges.length} blockers{!showDone && graph.hidden ? ` · ${graph.hidden} done hidden` : ""}</span>
|
|
38
|
+
{hasDone && <Button type="button" size="sm" variant="outline" className="h-8 rounded-md" aria-pressed={!showDone} onClick={() => setShowDone(!showDone)}>
|
|
39
|
+
{showDone ? "Collapse done" : "Show done"}
|
|
40
|
+
</Button>}
|
|
41
|
+
</div>
|
|
42
|
+
<div ref={canvas} role="region" aria-label="Graph canvas" tabIndex={0} className="min-h-0 flex-1 overflow-auto overscroll-contain [scrollbar-gutter:stable]">
|
|
43
|
+
{graph.nodes.length === 0 ? <p className="py-8 text-center text-sm text-muted-foreground">No tasks to graph.</p>
|
|
44
|
+
: <svg role="img" aria-label="Task dependency graph" width={laid.width} height={laid.height} viewBox={`0 0 ${laid.width} ${laid.height}`} className="mx-auto block">
|
|
45
|
+
<defs>
|
|
46
|
+
<marker id={ARROW} viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
|
|
47
|
+
<path d="M0,0 L10,5 L0,10 z" className="fill-muted-foreground"/>
|
|
48
|
+
</marker>
|
|
49
|
+
</defs>
|
|
50
|
+
{laid.edges.map(edge => <path key={`${edge.from}>${edge.to}`} d={edge.d} fill="none" strokeWidth="1.5" className="stroke-muted-foreground" markerEnd={`url(#${ARROW})`}/>)}
|
|
51
|
+
{laid.nodes.map(node => {
|
|
52
|
+
const task = byId.get(node.id);
|
|
53
|
+
const target = task.owner || task.runSession || "";
|
|
54
|
+
const activate = target ? { role: "button", tabIndex: 0, "aria-label": `${task.title}, open ${target}`, onClick: () => open(target), onKeyDown: e => { if (e.key === "Enter") open(target); } } : {};
|
|
55
|
+
return <g key={node.id} transform={`translate(${node.x},${node.y})`} className={target ? "cursor-pointer" : undefined} {...activate}>
|
|
56
|
+
<title>{`${task.title} · ${task.status}`}</title>
|
|
57
|
+
<rect width={laid.nodeWidth} height={NODE.height} rx="10" className="fill-card stroke-border" strokeWidth="1"/>
|
|
58
|
+
<rect width="6" height={NODE.height} rx="3" fill={STATUS_FILL[task.status]}/>
|
|
59
|
+
<text x="16" y="23" fontSize="13" fontWeight="500" className="fill-foreground">{label(task.title, laid.nodeWidth)}</text>
|
|
60
|
+
<text x="16" y="43" fontSize="11" className="fill-muted-foreground">{task.status}{task.owner ? ` · ${task.owner.split("#")[0]}` : ""}</text>
|
|
61
|
+
<text x={laid.nodeWidth - 8} y="20" fontSize="10" textAnchor="end" className="fill-muted-foreground">{priorityOf(task)}</text>
|
|
62
|
+
</g>;
|
|
63
|
+
})}
|
|
64
|
+
</svg>}
|
|
65
|
+
</div>
|
|
66
|
+
</div>;
|
|
67
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
// The sidebar's pinned strip: the project's top open tasks and their count, above the threads; the full board is one tap away.
|
|
3
|
+
import { ListTodo } from "lucide-react";
|
|
4
|
+
import { cn } from "@/lib/utils";
|
|
5
|
+
import { statusLabel } from "@/lib/task-board";
|
|
6
|
+
import { priorityOf, sortTasks } from "../../lib/task-order.mjs";
|
|
7
|
+
|
|
8
|
+
type Task = { id: string; title?: string; status?: string; priority?: unknown; updated?: number; question?: { answer?: string } };
|
|
9
|
+
// Tasks the strip shows before pointing at the board.
|
|
10
|
+
const STRIP_TASKS = 4;
|
|
11
|
+
const PRIORITY_TONE = { P0: "text-destructive", P1: "text-primary" } satisfies Record<string, string>;
|
|
12
|
+
|
|
13
|
+
export function TasksStrip({ tasks, openTask, openBoard }: { tasks: Task[]; openTask: (id: string) => void; openBoard: () => void }) {
|
|
14
|
+
const open = sortTasks(tasks.filter(task => task.status !== "done"));
|
|
15
|
+
if (!open.length) return null;
|
|
16
|
+
return <section aria-label="Open tasks" className="mx-2 mb-2 flex flex-col gap-0.5 rounded-2xl bg-card p-1.5 shadow-surface">
|
|
17
|
+
<button type="button" onClick={openBoard} className="flex min-h-8 items-center gap-2 rounded-lg px-2 text-left text-xs font-medium text-muted-foreground hover:bg-accent hover:text-foreground max-md:min-h-11">
|
|
18
|
+
<ListTodo aria-hidden className="size-3.5"/><span className="flex-1">Tasks</span>
|
|
19
|
+
<span className="tabular-nums" aria-label={open.length + (open.length === 1 ? " open task" : " open tasks")}>{open.length} open</span>
|
|
20
|
+
</button>
|
|
21
|
+
<ul className="flex flex-col">
|
|
22
|
+
{open.slice(0, STRIP_TASKS).map(task => {
|
|
23
|
+
const priority = priorityOf(task);
|
|
24
|
+
const asks = Boolean(task.question && !task.question.answer);
|
|
25
|
+
return <li key={task.id}>
|
|
26
|
+
<button type="button" data-task={task.id} onClick={() => openTask(task.id)} title={task.title || task.id}
|
|
27
|
+
className="flex w-full min-w-0 items-center gap-2 rounded-lg px-2 py-1 text-left text-sm hover:bg-accent max-md:py-2">
|
|
28
|
+
<span className={cn("w-5 shrink-0 font-mono text-xs", priority in PRIORITY_TONE ? PRIORITY_TONE[priority as keyof typeof PRIORITY_TONE] : "text-muted-foreground")}>{priority}</span>
|
|
29
|
+
<span className="min-w-0 flex-1 truncate">{task.title || task.id}</span>
|
|
30
|
+
<span className={cn("shrink-0 text-xs", asks ? "font-medium text-primary" : "text-muted-foreground")}>{asks ? "decide" : statusLabel(task.status)}</span>
|
|
31
|
+
</button>
|
|
32
|
+
</li>;
|
|
33
|
+
})}
|
|
34
|
+
</ul>
|
|
35
|
+
</section>;
|
|
36
|
+
}
|
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { OutcomeCards } from "./outcomes";
|
|
3
|
+
import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
4
|
+
import { Badge } from "@/components/ui/badge";
|
|
5
|
+
import { Button } from "@/components/ui/button";
|
|
6
|
+
import { ageOf, boardClock, columnsOf, countsOf, COLUMNS, FILTERS, statusLabel } from "@/lib/task-board";
|
|
7
|
+
import { priorityOf, sortTasks } from "../../lib/task-order.mjs";
|
|
8
|
+
import { cn } from "@/lib/utils";
|
|
9
|
+
import { views } from "@/lib/view-memory";
|
|
10
|
+
import { TaskGraph } from "./task-graph";
|
|
11
|
+
|
|
12
|
+
const DOT = { open: "bg-muted-foreground", decided: "bg-sky-500", building: "bg-primary", review: "bg-primary", blocked: "bg-destructive", done: "bg-emerald-500" };
|
|
13
|
+
const PRIORITY_BADGE = {
|
|
14
|
+
P0: "border-destructive/40 bg-destructive/10 text-destructive",
|
|
15
|
+
P1: "border-primary/40 bg-primary/10 text-primary",
|
|
16
|
+
P2: "border-border bg-muted text-muted-foreground",
|
|
17
|
+
P3: "border-border bg-transparent text-muted-foreground",
|
|
18
|
+
};
|
|
19
|
+
const VIEWS = [["board", "Board"], ["graph", "Graph"]];
|
|
20
|
+
const CARD = "flex w-full min-w-0 flex-col gap-1.5 rounded-xl bg-card shadow-surface p-3 text-left text-sm";
|
|
21
|
+
const LAZY = "[content-visibility:auto] [contain-intrinsic-size:auto_7rem]";
|
|
22
|
+
|
|
23
|
+
const plural = (count, word) => `${count} ${word}${count === 1 ? "" : "s"}`;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* A review card's one-line packet: the submitted commit, how much it changed, and whether the branch has moved.
|
|
27
|
+
* The detail view (ReviewTask) is where the verdict is given.
|
|
28
|
+
*/
|
|
29
|
+
function ReviewLine({ review }) {
|
|
30
|
+
const decision = review.decision;
|
|
31
|
+
const changed = [review.insertions ? `+${review.insertions}` : "", review.deletions ? `−${review.deletions}` : ""].filter(Boolean).join(" ");
|
|
32
|
+
return <p className="flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-muted-foreground">
|
|
33
|
+
<span className="font-mono">{String(review.commit).slice(0, 7)}</span>
|
|
34
|
+
{changed && <span className="font-mono">{changed}</span>}
|
|
35
|
+
<span>{plural(review.files?.length ?? 0, "file")}{review.more > 0 && ` +${review.more}`}</span>
|
|
36
|
+
{review.check?.code !== 0 && <span className="text-destructive">check failed</span>}
|
|
37
|
+
{decision ? <span>{decision.action === "accept" ? "accepted" : "returned"}</span>
|
|
38
|
+
: review.stale ? <span className="text-primary">branch moved</span>
|
|
39
|
+
: <span className="text-primary">waiting for you</span>}
|
|
40
|
+
</p>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The verdict on a completed build, shown for a task in review: what it was asked to do, the host check, the diff
|
|
45
|
+
* link and the two decisions. Return needs a one-line note so the next build knows what to change.
|
|
46
|
+
*/
|
|
47
|
+
function ReviewTask({ task, review, decide }) {
|
|
48
|
+
const [note, setNote] = useState("");
|
|
49
|
+
const [busy, setBusy] = useState(false);
|
|
50
|
+
const decided = review.decision;
|
|
51
|
+
const send = async (decision, text) => {
|
|
52
|
+
if (busy) return;
|
|
53
|
+
setBusy(true);
|
|
54
|
+
try { if (await decide(task.id, decision, text, { commit: review.commit, submission: review.submission })) setNote(""); }
|
|
55
|
+
finally { setBusy(false); }
|
|
56
|
+
};
|
|
57
|
+
return <li className="flex min-w-0 flex-col gap-2 rounded-xl border border-primary/50 bg-primary/5 p-3 text-sm">
|
|
58
|
+
<TaskMetadata task={task} fullId/>
|
|
59
|
+
<p className="font-medium leading-snug wrap-break-word">{task.title}</p>
|
|
60
|
+
{review.criteria && <p className="text-xs text-muted-foreground break-words">Asked for: {review.criteria}</p>}
|
|
61
|
+
<ReviewLine review={review}/>
|
|
62
|
+
<p className="text-xs text-muted-foreground">
|
|
63
|
+
<span className="font-mono">{String(review.commit).slice(0, 12)}</span> on <span className="font-mono">{review.branch}</span>
|
|
64
|
+
{" · "}<a className="underline" href={review.diff} target="_blank" rel="noreferrer">View the diff</a>
|
|
65
|
+
</p>
|
|
66
|
+
{review.check?.text && <p className="rounded border bg-background/60 p-2 font-mono text-xs break-words">{review.check.text}</p>}
|
|
67
|
+
{decided ? <p className="text-xs">
|
|
68
|
+
<span className="text-muted-foreground">{decided.action === "accept" ? "Accepted" : "Returned"} by </span>
|
|
69
|
+
<span className="font-mono">{decided.by}</span>
|
|
70
|
+
{decided.note && <span className="text-muted-foreground"> ({decided.note})</span>}
|
|
71
|
+
</p> : review.stale ? <p className="text-xs text-primary">
|
|
72
|
+
The branch moved past this commit, so this packet can no longer be decided. Queue the task for a fresh build.
|
|
73
|
+
</p> : <>
|
|
74
|
+
<form className="flex gap-2" onSubmit={event => { event.preventDefault(); send("return", note); }}>
|
|
75
|
+
<input value={note} onChange={event => setNote(event.target.value)} maxLength={500} aria-label={`Return note for ${task.title}`}
|
|
76
|
+
placeholder="What should change?" enterKeyHint="send" disabled={busy}
|
|
77
|
+
className="h-9 min-w-0 flex-1 rounded-lg border bg-background px-3 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring"/>
|
|
78
|
+
<Button type="submit" size="sm" variant="outline" className="h-9" disabled={busy || !note.trim()}>Return</Button>
|
|
79
|
+
</form>
|
|
80
|
+
<Button type="button" size="sm" className="h-9 self-start" disabled={busy} onClick={() => send("accept")}>Accept build</Button>
|
|
81
|
+
</>}
|
|
82
|
+
</li>;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
function TaskMetadata({ task, fullId }) {
|
|
87
|
+
const priority = priorityOf(task);
|
|
88
|
+
return <div className="flex w-full min-w-0 items-start gap-2">
|
|
89
|
+
<Badge variant="outline" aria-label={`priority ${priority}`} className={cn("shrink-0 font-mono text-xs", PRIORITY_BADGE[priority])}>{priority}</Badge>
|
|
90
|
+
<span className={cn("min-w-0 font-mono text-xs text-muted-foreground", fullId ? "wrap-anywhere" : "truncate")}>{task.id}</span>
|
|
91
|
+
</div>;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const Card = memo(function Card({ task, age, compose, open, fullId, continuation, recover }) {
|
|
95
|
+
const body = <>
|
|
96
|
+
<TaskMetadata task={task} fullId={fullId}/>
|
|
97
|
+
<span className="w-full font-medium leading-snug wrap-break-word">{task.title}</span>
|
|
98
|
+
{task.detail && <p className="text-xs text-muted-foreground break-words">{task.detail}</p>}
|
|
99
|
+
<div className="flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground">
|
|
100
|
+
{task.owner ? <span className="flex min-w-0 items-center gap-1.5 font-mono">
|
|
101
|
+
<span aria-hidden className={cn("inline-block size-2 shrink-0 rounded-full", task.ownerOnline ? "bg-emerald-500" : "bg-muted-foreground/40")}/>
|
|
102
|
+
<span className="truncate">{task.owner}</span>
|
|
103
|
+
<span className="sr-only">{task.ownerOnline ? "online" : "offline"}</span>
|
|
104
|
+
</span> : <span>{task.builderUnit || "No owner"}</span>}
|
|
105
|
+
{task.ownerRunningJobs > 0 && <span>{task.ownerRunningJobs} running {task.ownerRunningJobs === 1 ? "job" : "jobs"}</span>}
|
|
106
|
+
{task.run && <Badge variant="outline" className="font-mono">run {task.run}</Badge>}
|
|
107
|
+
{task.blockers?.length > 0 && <span>waits on {task.blockers.join(", ")}</span>}
|
|
108
|
+
</div>
|
|
109
|
+
{task.question?.answer && <p className="break-words text-xs"><span className="text-muted-foreground">{task.question.text} → </span><span className="font-medium">{task.question.answer.text}</span></p>}
|
|
110
|
+
{task.last && <p className="flex min-w-0 gap-2 border-l-2 pl-2 text-xs">
|
|
111
|
+
<span className="min-w-0 flex-1 break-words">{task.last.text}</span>
|
|
112
|
+
<span className="shrink-0 text-muted-foreground">{age} ago</span>
|
|
113
|
+
</p>}
|
|
114
|
+
</>;
|
|
115
|
+
return <li className={LAZY}>
|
|
116
|
+
<button type="button" aria-label={`Message about ${task.title}`} onClick={() => compose(task.id)} className={cn(CARD, "transition-colors hover:bg-accent")}>{body}</button>
|
|
117
|
+
{task.recovery && recover && <BuilderRecovery task={task} recover={recover}/>}
|
|
118
|
+
{task.owner && !task.recovery && <Button type="button" size="sm" variant="ghost" onClick={() => open(task.owner)}>Open owner session</Button>}
|
|
119
|
+
{task.previousHarness && continuation && !task.recovery && <ContinueBuilder task={task} {...continuation}/>}
|
|
120
|
+
</li>;
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
function CompactCard({ task, age, inspect, move, dragStart }) {
|
|
124
|
+
return <li className="min-w-0 rounded-xl bg-card shadow-surface p-2">
|
|
125
|
+
<button type="button" className="flex w-full min-w-0 flex-col gap-1 text-left hover:underline" onClick={() => inspect(task.id)}>
|
|
126
|
+
<TaskMetadata task={task}/>
|
|
127
|
+
<span className="line-clamp-2 text-sm font-medium wrap-anywhere">{task.title}</span>
|
|
128
|
+
{task.review && <ReviewLine review={task.review}/>}
|
|
129
|
+
</button>
|
|
130
|
+
<div className="mt-1 flex items-center gap-2 text-xs text-muted-foreground">
|
|
131
|
+
<span className="min-w-0 flex-1 truncate">{task.owner || task.builderUnit || "No owner"}{age && ` · ${age} ago`}</span>
|
|
132
|
+
<select aria-label={`Move ${task.title}`} className="max-w-24 rounded border bg-background p-1 capitalize"
|
|
133
|
+
value={task.status} onChange={event => move(task, event.target.value)}>
|
|
134
|
+
{COLUMNS.map(status => <option key={status} value={status}>{statusLabel(status)}</option>)}
|
|
135
|
+
</select>
|
|
136
|
+
{dragStart && <span aria-hidden className="cursor-grab touch-none select-none px-2 py-1 text-base"
|
|
137
|
+
onPointerDown={event => dragStart(event, task)}>⠿</span>}
|
|
138
|
+
</div>
|
|
139
|
+
</li>;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function ContinueBuilder({ task, harnesses, launch }) {
|
|
143
|
+
const choices = harnesses.filter(harness => harness !== task.previousHarness);
|
|
144
|
+
const [selected, select] = useState("");
|
|
145
|
+
const [pending, setPending] = useState(false);
|
|
146
|
+
const harness = choices.includes(selected) ? selected : choices[0];
|
|
147
|
+
if (!harness) return null;
|
|
148
|
+
return <form className="flex flex-wrap items-center gap-2 px-2 pb-2" onSubmit={async event => {
|
|
149
|
+
event.preventDefault();
|
|
150
|
+
setPending(true);
|
|
151
|
+
try { await launch(task.id, harness); } finally { setPending(false); }
|
|
152
|
+
}}>
|
|
153
|
+
<select aria-label="Replacement harness" value={harness} disabled={pending} onChange={event => select(event.target.value)}>
|
|
154
|
+
{choices.map(choice => <option key={choice} value={choice}>{choice}</option>)}
|
|
155
|
+
</select>
|
|
156
|
+
<Button type="submit" size="sm" variant="outline" disabled={pending}>
|
|
157
|
+
{pending ? "Starting…" : "Continue with another agent"}
|
|
158
|
+
</Button>
|
|
159
|
+
<span className="text-xs text-muted-foreground">Runs locally in the existing worktree</span>
|
|
160
|
+
</form>;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function BuilderRecovery({ task, recover }) {
|
|
164
|
+
const [replacement, setReplacement] = useState("");
|
|
165
|
+
const [busy, setBusy] = useState(false);
|
|
166
|
+
const { worktree, branch, commits, backup, harness, choices } = task.recovery;
|
|
167
|
+
async function launch(nextHarness) {
|
|
168
|
+
if (busy) return;
|
|
169
|
+
setBusy(true);
|
|
170
|
+
try { await recover(task.id, nextHarness); }
|
|
171
|
+
finally { setBusy(false); }
|
|
172
|
+
}
|
|
173
|
+
return <section aria-label="Builder recovery" className="flex flex-col gap-2 rounded-xl border border-primary/50 p-3 text-xs">
|
|
174
|
+
<p className="font-medium">Builder needs recovery</p>
|
|
175
|
+
{!task.last && <p>No progress update recorded</p>}
|
|
176
|
+
<p className="wrap-anywhere">Worktree {worktree}</p>
|
|
177
|
+
<p className="wrap-anywhere">Branch {branch} · {commits} recorded {commits === 1 ? "commit" : "commits"}</p>
|
|
178
|
+
{backup && <p className="wrap-anywhere">Saved workspace {backup}</p>}
|
|
179
|
+
{task.recovery.sandboxWorkspace && <p>Workspace available to retrieve from the previous sandbox</p>}
|
|
180
|
+
<Button type="button" variant="outline" disabled={busy} onClick={() => launch()}>Restart {harness}</Button>
|
|
181
|
+
<select aria-label="Replacement builder" className="min-h-9 rounded-md border bg-background px-2"
|
|
182
|
+
value={replacement} disabled={busy} onChange={event => setReplacement(event.target.value)}>
|
|
183
|
+
<option value="">Choose a replacement</option>
|
|
184
|
+
{choices.map(choice => <option key={choice} value={choice}>{choice}</option>)}
|
|
185
|
+
</select>
|
|
186
|
+
<Button type="button" disabled={busy || !replacement} onClick={() => launch(replacement)}>Reassign builder</Button>
|
|
187
|
+
</section>;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function Decision({ task, decide, skip, compose, fullId }) {
|
|
191
|
+
const [text, setText] = useState("");
|
|
192
|
+
const [busy, setBusy] = useState(false);
|
|
193
|
+
const send = async answer => {
|
|
194
|
+
const value = String(answer).trim();
|
|
195
|
+
if (!value || busy) return;
|
|
196
|
+
setBusy(true);
|
|
197
|
+
const ok = await decide(task.id, value);
|
|
198
|
+
setBusy(false);
|
|
199
|
+
if (ok) setText("");
|
|
200
|
+
};
|
|
201
|
+
const q = task.question;
|
|
202
|
+
return <li className="flex min-w-0 flex-col gap-2 rounded-xl border border-primary/50 bg-primary/5 p-3 text-sm">
|
|
203
|
+
<TaskMetadata task={task} fullId={fullId}/>
|
|
204
|
+
<button type="button" onClick={() => compose(task.id)} className="w-full text-left font-medium leading-snug wrap-break-word hover:underline">{task.title}</button>
|
|
205
|
+
<p className="wrap-anywhere">{q.text}</p>
|
|
206
|
+
<p className="text-xs text-muted-foreground">asked by <span className="font-mono">{q.by}</span></p>
|
|
207
|
+
{q.options?.length > 0 && <div role="group" aria-label="Choices" className="grid gap-2">
|
|
208
|
+
{q.options.map(option => <Button key={option} type="button" size="sm" variant="outline" disabled={busy}
|
|
209
|
+
className="h-auto min-h-11 min-w-0 justify-start rounded-lg py-2 text-left text-sm whitespace-normal" onClick={() => send(option)}>
|
|
210
|
+
<span className="min-w-0 wrap-anywhere">{option}</span>
|
|
211
|
+
</Button>)}
|
|
212
|
+
</div>}
|
|
213
|
+
<form className="flex gap-2" onSubmit={event => { event.preventDefault(); send(text); }}>
|
|
214
|
+
<input value={text} onChange={event => setText(event.target.value)} maxLength={500} aria-label={`Answer for ${task.title}`}
|
|
215
|
+
placeholder={q.options?.length ? "Or type your own answer" : "Your decision"} enterKeyHint="send"
|
|
216
|
+
className="h-9 min-w-0 flex-1 rounded-lg border bg-background px-3 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring"/>
|
|
217
|
+
<Button type="submit" size="sm" className="h-9" disabled={busy || !text.trim()}>Decide</Button>
|
|
218
|
+
{skip && <Button type="button" size="sm" variant="ghost" className="h-9 text-muted-foreground" disabled={busy}
|
|
219
|
+
onClick={async () => { setBusy(true); await skip(task.id); setBusy(false); }}>Skip</Button>}
|
|
220
|
+
</form>
|
|
221
|
+
</li>;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
const Column = memo(function Column({ status, list, now, compose, open, fullId, continuation, recover, inspect, move, dragStart, collapsed, toggle, target }) {
|
|
225
|
+
const heading = <>
|
|
226
|
+
<span aria-hidden className={cn("inline-block size-2 rounded-full", DOT[status])}/>{statusLabel(status)} · {list.length}
|
|
227
|
+
</>;
|
|
228
|
+
return <section aria-label={status} data-task-column={status} className={cn("flex min-w-0 flex-col gap-2",
|
|
229
|
+
!fullId && "min-h-0 snap-start rounded-xl border bg-muted/30 p-2", target && "ring-2 ring-inset ring-primary")}>
|
|
230
|
+
<h2 className="flex shrink-0 items-center gap-2 text-xs font-medium text-muted-foreground">
|
|
231
|
+
{toggle ? <button type="button" aria-expanded={!collapsed} onClick={toggle}
|
|
232
|
+
className="flex w-full items-center gap-2 py-1">
|
|
233
|
+
{heading}<span aria-hidden className="ml-auto">{collapsed ? "+" : "−"}</span>
|
|
234
|
+
</button> : heading}
|
|
235
|
+
</h2>
|
|
236
|
+
{!collapsed && (list.length ? <ul className={cn("flex flex-col gap-2", !fullId && "min-h-0 overflow-y-auto overscroll-y-contain")}>{list.map(task => {
|
|
237
|
+
const age = task.last ? ageOf(task.last.at, now) : "";
|
|
238
|
+
return fullId
|
|
239
|
+
? <Card key={task.id} task={task} age={age} compose={compose} open={open} fullId continuation={continuation} recover={recover}/>
|
|
240
|
+
: <CompactCard key={task.id} task={task} age={age} inspect={inspect} move={move} dragStart={dragStart}/>;
|
|
241
|
+
})}</ul> : <p className="text-xs text-muted-foreground">No {statusLabel(status)} tasks.</p>)}
|
|
242
|
+
</section>;
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
export function TaskBoard({ project, board, now, open, compose, decide, skip, review: decideReview, taskId, back, continuation, recover, inspect, move, landControl, outcomeControls }) {
|
|
246
|
+
const filterKey = "task filter " + project;
|
|
247
|
+
const [filter, setFilter] = useState(() => views.get(filterKey, "all"));
|
|
248
|
+
const [view, setView] = useState("board");
|
|
249
|
+
const [doneOpen, setDoneOpen] = useState(false);
|
|
250
|
+
const [target, setTarget] = useState(null);
|
|
251
|
+
const lane = useRef(null);
|
|
252
|
+
const stopDrag = useRef(null);
|
|
253
|
+
const moving = useRef(new Set());
|
|
254
|
+
useEffect(() => () => stopDrag.current?.(), [filter, taskId, view]);
|
|
255
|
+
|
|
256
|
+
const moveRef = useRef(move);
|
|
257
|
+
const inspectRef = useRef(inspect);
|
|
258
|
+
useEffect(() => { moveRef.current = move; inspectRef.current = inspect; });
|
|
259
|
+
const inspectTask = useCallback(id => inspectRef.current(id), []);
|
|
260
|
+
const toggleDone = useCallback(() => setDoneOpen(value => !value), []);
|
|
261
|
+
|
|
262
|
+
const moveCard = useCallback(async (task, status) => {
|
|
263
|
+
if (status === task.status || moving.current.has(task.id)) return;
|
|
264
|
+
moving.current.add(task.id);
|
|
265
|
+
try { await moveRef.current(task.id, status); }
|
|
266
|
+
finally { moving.current.delete(task.id); }
|
|
267
|
+
}, []);
|
|
268
|
+
|
|
269
|
+
const dragStart = useCallback((event, task) => {
|
|
270
|
+
if (!event.isPrimary || event.button !== 0 || stopDrag.current) return;
|
|
271
|
+
const rail = lane.current;
|
|
272
|
+
const handle = event.currentTarget;
|
|
273
|
+
const pointer = event.pointerId;
|
|
274
|
+
let { clientX: x, clientY: y } = event;
|
|
275
|
+
const columnAt = () => {
|
|
276
|
+
const column = document.elementFromPoint(x, y)?.closest("[data-task-column]");
|
|
277
|
+
return rail.contains(column) ? column.dataset.taskColumn : null;
|
|
278
|
+
};
|
|
279
|
+
const track = next => {
|
|
280
|
+
x = next.clientX;
|
|
281
|
+
y = next.clientY;
|
|
282
|
+
setTarget(columnAt());
|
|
283
|
+
};
|
|
284
|
+
const timer = window.setInterval(() => {
|
|
285
|
+
const bounds = rail.getBoundingClientRect();
|
|
286
|
+
if (y < bounds.top || y > bounds.bottom) return;
|
|
287
|
+
if (x >= bounds.left && x < bounds.left + 32) rail.scrollLeft -= 14;
|
|
288
|
+
else if (x <= bounds.right && x > bounds.right - 32) rail.scrollLeft += 14;
|
|
289
|
+
setTarget(columnAt());
|
|
290
|
+
}, 30);
|
|
291
|
+
const stop = () => {
|
|
292
|
+
window.clearInterval(timer);
|
|
293
|
+
handle.removeEventListener("pointermove", track);
|
|
294
|
+
handle.removeEventListener("pointerup", drop);
|
|
295
|
+
handle.removeEventListener("lostpointercapture", stop);
|
|
296
|
+
if (handle.hasPointerCapture(pointer)) handle.releasePointerCapture(pointer);
|
|
297
|
+
delete rail.dataset.dragging;
|
|
298
|
+
stopDrag.current = null;
|
|
299
|
+
setTarget(null);
|
|
300
|
+
};
|
|
301
|
+
const drop = next => {
|
|
302
|
+
track(next);
|
|
303
|
+
const status = columnAt();
|
|
304
|
+
stop();
|
|
305
|
+
if (status) moveCard(task, status);
|
|
306
|
+
};
|
|
307
|
+
stopDrag.current = stop;
|
|
308
|
+
rail.dataset.dragging = "true";
|
|
309
|
+
handle.setPointerCapture(pointer);
|
|
310
|
+
handle.addEventListener("pointermove", track);
|
|
311
|
+
handle.addEventListener("pointerup", drop);
|
|
312
|
+
handle.addEventListener("lostpointercapture", stop);
|
|
313
|
+
}, [moveCard]);
|
|
314
|
+
|
|
315
|
+
const tasks = board?.tasks || [];
|
|
316
|
+
const columns = useMemo(() => columnsOf(tasks, filter), [tasks, filter]);
|
|
317
|
+
const counts = useMemo(() => countsOf(tasks), [tasks]);
|
|
318
|
+
const clock = useMemo(() => boardClock(tasks, now), [tasks, now]);
|
|
319
|
+
const composeRef = useRef(compose);
|
|
320
|
+
const openRef = useRef(open);
|
|
321
|
+
const recoverRef = useRef(recover);
|
|
322
|
+
useEffect(() => { composeRef.current = compose; openRef.current = open; recoverRef.current = recover; });
|
|
323
|
+
const openOwner = useCallback(address => openRef.current(address), []);
|
|
324
|
+
const message = useCallback(id => composeRef.current(id), []);
|
|
325
|
+
const recoverTask = useCallback((id, harness) => recoverRef.current?.(id, harness), []);
|
|
326
|
+
const task = taskId && tasks.find(item => item.id === taskId);
|
|
327
|
+
const waiting = useMemo(() => sortTasks(tasks.filter(item => item.question && !item.question.answer)), [tasks]);
|
|
328
|
+
return <section aria-label="Task board" className={cn("mx-auto flex min-h-0 w-full flex-1 flex-col gap-4 px-3 py-4",
|
|
329
|
+
taskId ? "max-w-6xl overflow-y-auto overscroll-contain" : "overflow-hidden")}>
|
|
330
|
+
{board?.error && <p role="alert" className="rounded-xl border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm">Task store is invalid: {board.error}</p>}
|
|
331
|
+
{taskId ? <>
|
|
332
|
+
<Button type="button" size="sm" variant="outline" className="self-start" onClick={back}>Back to board</Button>
|
|
333
|
+
{task?.question && !task.question.answer && decide && <ul><Decision task={task} decide={decide} skip={skip} compose={message} fullId/></ul>}
|
|
334
|
+
{task?.review && decideReview && <ul><ReviewTask task={task} review={task.review} decide={decideReview}/></ul>}
|
|
335
|
+
{task ? <Column status={task.status} list={[task]} fullId now={clock} compose={message} open={openOwner} continuation={continuation} recover={recover && recoverTask}/>
|
|
336
|
+
: board && !board.error && <p role="status">Task #{taskId} was not found.</p>}
|
|
337
|
+
</> : <>
|
|
338
|
+
<div className="flex max-h-[30dvh] shrink-0 flex-col gap-4 overflow-y-auto overscroll-y-contain empty:hidden">
|
|
339
|
+
{landControl}
|
|
340
|
+
{outcomeControls && <OutcomeCards outcomes={board?.outcomes} tasks={tasks} inspect={inspect} controls={outcomeControls}/>}
|
|
341
|
+
{waiting.length > 0 && decide && <section aria-label="Needs your decision" className="flex flex-col gap-2">
|
|
342
|
+
<h2 className="flex items-center gap-2 text-xs font-medium text-primary">
|
|
343
|
+
<span aria-hidden className="inline-block size-2 rounded-full bg-primary"/>Needs you · {waiting.length}
|
|
344
|
+
</h2>
|
|
345
|
+
<ul className="flex flex-col gap-2 md:grid md:grid-cols-2">{waiting.map(item => <Decision key={item.id} task={item} decide={decide} skip={skip} compose={message}/>)}</ul>
|
|
346
|
+
</section>}
|
|
347
|
+
</div>
|
|
348
|
+
<div role="group" aria-label="View" className="flex shrink-0 gap-2">
|
|
349
|
+
{VIEWS.map(([id, name]) => <Button key={id} type="button" size="sm" variant={view === id ? "default" : "outline"}
|
|
350
|
+
aria-pressed={view === id} className="h-8 rounded-md" onClick={() => setView(id)}>{name}</Button>)}
|
|
351
|
+
</div>
|
|
352
|
+
{view === "graph" ? <TaskGraph tasks={tasks} open={open}/> : <>
|
|
353
|
+
<div role="group" aria-label="Filter by status" className="flex shrink-0 flex-wrap gap-2">
|
|
354
|
+
{FILTERS.map(status => <Button key={status} type="button" size="sm" variant={filter === status ? "default" : "outline"}
|
|
355
|
+
aria-pressed={filter === status} className="h-8 rounded-md capitalize" onClick={() => {
|
|
356
|
+
views.set(filterKey, status === "all" ? "" : status);
|
|
357
|
+
stopDrag.current?.();
|
|
358
|
+
setFilter(status);
|
|
359
|
+
if (lane.current) lane.current.scrollLeft = 0;
|
|
360
|
+
}}>
|
|
361
|
+
{status === "all" ? "All" : statusLabel(status)} · {status === "all" ? tasks.length : counts[status]}
|
|
362
|
+
</Button>)}
|
|
363
|
+
</div>
|
|
364
|
+
<div ref={lane} aria-label="Status columns" tabIndex={filter === "all" ? 0 : undefined}
|
|
365
|
+
className={cn("grid min-h-0 flex-1 grid-rows-[minmax(0,1fr)] items-stretch gap-3 pb-2", filter === "all" &&
|
|
366
|
+
"auto-cols-[85%] grid-flow-col snap-x snap-mandatory overflow-x-auto overscroll-x-contain data-[dragging=true]:snap-none sm:auto-cols-[minmax(13rem,1fr)]")}>
|
|
367
|
+
{columns.map(([status, list]) => <Column key={status} status={status} list={list} now={clock}
|
|
368
|
+
inspect={inspectTask} move={moveCard} dragStart={filter === "all" ? dragStart : null} target={target === status}
|
|
369
|
+
collapsed={status === "done" && filter === "all" && !doneOpen}
|
|
370
|
+
toggle={status === "done" && filter === "all" ? toggleDone : undefined}/>)}
|
|
371
|
+
</div>
|
|
372
|
+
</>}
|
|
373
|
+
</>}
|
|
374
|
+
</section>;
|
|
375
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
|
+
import { Button } from "@/components/ui/button";
|
|
3
|
+
import { toGraph } from "@/lib/pattern-graph";
|
|
4
|
+
import { initialChoice, modelsOf } from "@/lib/start-default";
|
|
5
|
+
import { ConfirmButton, RoleGraph } from "./pattern-graph";
|
|
6
|
+
import { renameTeam, sourceLine } from "@/lib/team-editor";
|
|
7
|
+
|
|
8
|
+
// The operator describes a team in words; a writing agent drafts team.dot; the operator confirms the name and saves.
|
|
9
|
+
// With `pattern` set it edits that team: the current DOT goes into the brief, and saving replaces it after a confirm.
|
|
10
|
+
// The DOT editor stays the escape hatch: "Open in DOT editor" carries the name there.
|
|
11
|
+
export function TeamAuthor({ templates, pattern = null, project, call, go, disabled, startable = [], models = {}, authorDefault = { harness: "cursor", model: "deepseek-v41-flash-1017-high" } }) {
|
|
12
|
+
const editing = Boolean(pattern);
|
|
13
|
+
const [request, setRequest] = useState("");
|
|
14
|
+
const [name, setName] = useState(pattern?.name ?? "");
|
|
15
|
+
const [scope, setScope] = useState(pattern?.source === "global" ? "global" : "project");
|
|
16
|
+
const [history, setHistory] = useState([]);
|
|
17
|
+
const [busy, setBusy] = useState("");
|
|
18
|
+
const [notice, setNotice] = useState("");
|
|
19
|
+
const [draft, setDraft] = useState(null);
|
|
20
|
+
const [writer, setWriter] = useState(() => initialChoice({ startable, models, setting: authorDefault }));
|
|
21
|
+
const pickedWriter = useRef(false);
|
|
22
|
+
// Set when a save was refused because the name is taken; the save becomes an explicit Replace.
|
|
23
|
+
const [replaceAsk, setReplaceAsk] = useState(false);
|
|
24
|
+
|
|
25
|
+
const canAsk = !disabled && !busy && request.trim().length > 0;
|
|
26
|
+
const checked = draft?.ok === true;
|
|
27
|
+
// The name to save under: what the operator typed, else the team being refined, else the digraph the agent wrote.
|
|
28
|
+
const target = name || pattern?.name || draft?.name || draft?.suggested || "";
|
|
29
|
+
// The draft says which entry already uses the name it was checked under; that only applies while that is still the
|
|
30
|
+
// name being saved. A name typed afterwards is checked by the save, which offers Replace when it is taken.
|
|
31
|
+
const replaces = checked && draft.exists && draft.exists !== "built-in" && draft.exists !== "team" && target === draft.name;
|
|
32
|
+
const harnesses = startable.length ? startable : (writer.harness ? [writer.harness] : []);
|
|
33
|
+
const listedModels = modelsOf(models, writer.harness);
|
|
34
|
+
const modelChoices = listedModels.includes(writer.model) || !writer.model ? listedModels : [writer.model, ...listedModels];
|
|
35
|
+
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (pickedWriter.current) return;
|
|
38
|
+
setWriter(initialChoice({ startable, models, setting: authorDefault }));
|
|
39
|
+
}, [startable, models, authorDefault]);
|
|
40
|
+
|
|
41
|
+
async function ask() {
|
|
42
|
+
setBusy("draft"); setNotice("");
|
|
43
|
+
// Editing: the team as it is now is the base; once a valid draft exists, the newest draft takes its place.
|
|
44
|
+
const current = draft?.ok ? draft.dot : editing ? pattern.dot ?? "" : "";
|
|
45
|
+
// The operator's words carry the conversation; a valid draft is already in `current`, so its answer is not repeated.
|
|
46
|
+
// When the last answer did not check, it is carried as a turn instead, so the writer can see what it wrote wrong.
|
|
47
|
+
const said = history.filter(turn => turn.from === "operator" || !current);
|
|
48
|
+
const result = await call({
|
|
49
|
+
project, authorRequest: request, team: name || pattern?.name || "", authorScope: scope, authorTurns: said, authorCurrent: current,
|
|
50
|
+
...(writer.harness ? { authorHarness: writer.harness, authorModel: writer.model } : {}),
|
|
51
|
+
});
|
|
52
|
+
setBusy("");
|
|
53
|
+
if (result?.error) { setNotice(result.error); return; }
|
|
54
|
+
setHistory(turns => [...turns, { from: "operator", text: request }, ...(result.reply ? [{ from: "agent", text: result.reply }] : [])]);
|
|
55
|
+
if (result.status === "failed") { setNotice(result.detail || "The writing agent failed."); return; }
|
|
56
|
+
setDraft(result);
|
|
57
|
+
setReplaceAsk(false);
|
|
58
|
+
if (!result.ok) setNotice(result.error);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const graph = checked ? toGraph(draft.pattern) : null;
|
|
62
|
+
// The name the DOT declares; a name typed after the draft renames the digraph, exactly as the DOT editor does.
|
|
63
|
+
const declared = draft?.suggested || draft?.name || "";
|
|
64
|
+
const dotText = checked && declared && target && declared !== target ? renameTeam(draft.dot, target) : draft?.dot ?? "";
|
|
65
|
+
|
|
66
|
+
async function save() {
|
|
67
|
+
if (!target) { setNotice("Give the team a name to save it."); return; }
|
|
68
|
+
setBusy("save"); setNotice("");
|
|
69
|
+
const result = await call({ project, team: target, authorScope: scope, authorDot: dotText, authorReplace: replaces || replaceAsk ? target : "" });
|
|
70
|
+
setBusy("");
|
|
71
|
+
if (result?.error) {
|
|
72
|
+
// A name typed after the draft can already be in use; that is the operator's call to replace, so offer it rather than fail.
|
|
73
|
+
if (replaces || replaceAsk || !/already exists/.test(result.error)) { setNotice(result.error); return; }
|
|
74
|
+
setReplaceAsk(true); setNotice(result.error); return;
|
|
75
|
+
}
|
|
76
|
+
go({ pattern: result.name });
|
|
77
|
+
}
|
|
78
|
+
return <div className="mx-auto flex w-full max-w-3xl flex-col gap-4 px-3 py-4 text-sm">
|
|
79
|
+
<div className="flex flex-col gap-1">
|
|
80
|
+
<h2 className="font-semibold">{editing ? `Refine ${pattern.name}` : "Describe a team"}</h2>
|
|
81
|
+
<p className="text-xs text-muted-foreground">{editing
|
|
82
|
+
? "Say what should change. The agent sees the team as it is now, drafts the whole file, and nothing is saved until you approve."
|
|
83
|
+
: "Say what the team should do, in your own words. Pick the agent and model that draft team.dot, confirm, and it is saved. No DOT unless you want it."}</p>
|
|
84
|
+
</div>
|
|
85
|
+
|
|
86
|
+
<section className="flex flex-col gap-2">
|
|
87
|
+
<label className="text-xs font-medium" htmlFor="author-request">{editing ? "What should change?" : "What should the team do?"}</label>
|
|
88
|
+
<textarea id="author-request" rows={4} value={request} disabled={disabled || Boolean(busy)} onChange={event => setRequest(event.target.value)}
|
|
89
|
+
placeholder={editing ? "Add a reviewer after the tests pass, and let it send the work back twice." : "One agent scopes a small change, a second implements it with tests, a third reviews and can send it back twice."}
|
|
90
|
+
className="min-h-24 w-full rounded-xl border bg-background p-3 text-sm leading-relaxed"/>
|
|
91
|
+
<div className="flex flex-wrap gap-2">
|
|
92
|
+
{editing
|
|
93
|
+
? <span className="rounded border bg-muted/40 px-2 py-1 font-mono text-xs">{pattern.name} · {scope}</span>
|
|
94
|
+
: <input aria-label="Team name" placeholder="team-name (optional; the agent can propose one)" maxLength={24} value={name} disabled={disabled || Boolean(busy)}
|
|
95
|
+
onChange={event => { setName(event.target.value); setReplaceAsk(false); }} className="min-w-0 flex-1 rounded border bg-background px-2 py-1 font-mono text-xs"/>}
|
|
96
|
+
{!editing && <select aria-label="Scope" className="rounded border bg-background px-2 py-1 text-xs" value={scope} disabled={disabled || Boolean(busy)} onChange={event => setScope(event.target.value)}>
|
|
97
|
+
<option value="project">project</option>
|
|
98
|
+
<option value="global">global</option>
|
|
99
|
+
</select>}
|
|
100
|
+
{harnesses.length > 0 && <select aria-label="Writing agent" className="rounded border bg-background px-2 py-1 text-xs" value={writer.harness} disabled={disabled || Boolean(busy)} onChange={event => {
|
|
101
|
+
const harness = event.target.value;
|
|
102
|
+
pickedWriter.current = true;
|
|
103
|
+
setWriter({ harness, model: modelsOf(models, harness)[0] || "" });
|
|
104
|
+
}}>
|
|
105
|
+
{harnesses.map(harness => <option key={harness} value={harness}>{harness}</option>)}
|
|
106
|
+
</select>}
|
|
107
|
+
{modelChoices.length > 0 && <select aria-label="Writing model" className="max-w-full rounded border bg-background px-2 py-1 font-mono text-xs" value={writer.model} disabled={disabled || Boolean(busy)} onChange={event => { pickedWriter.current = true; setWriter(current => ({ ...current, model: event.target.value })); }}>
|
|
108
|
+
{modelChoices.map(model => <option key={model} value={model}>{model}</option>)}
|
|
109
|
+
</select>}
|
|
110
|
+
<Button type="button" size="sm" disabled={!canAsk} onClick={ask}>{busy === "draft" ? "Drafting…" : history.length ? "Ask again" : "Draft with agent"}</Button>
|
|
111
|
+
</div>
|
|
112
|
+
{history.length > 0 && <p className="text-xs text-muted-foreground">{history.length} message{history.length === 1 ? "" : "s"} so far; the agent sees them, so you can refine in words.</p>}
|
|
113
|
+
</section>
|
|
114
|
+
|
|
115
|
+
{notice && <p role="alert" className="rounded-lg border border-destructive/40 bg-destructive/10 px-2 py-1.5 text-xs text-destructive">
|
|
116
|
+
{notice}
|
|
117
|
+
{draft?.line && <code className="mt-1 block overflow-x-auto font-mono">{sourceLine(draft.dot ?? "", draft.line)}</code>}
|
|
118
|
+
</p>}
|
|
119
|
+
|
|
120
|
+
{checked && <section className="flex flex-col gap-2">
|
|
121
|
+
<h3 className="text-xs font-medium text-muted-foreground">Draft</h3>
|
|
122
|
+
<div className="rounded-xl bg-card shadow-surface p-2"><RoleGraph graph={graph} label={`Draft graph of ${draft.pattern.name}`}/></div>
|
|
123
|
+
<ul className="flex flex-col gap-1 text-xs">
|
|
124
|
+
{draft.pattern.roles.map(role => <li key={role.id} className="flex flex-wrap gap-2 rounded-lg border px-2 py-1.5">
|
|
125
|
+
<span className="font-mono font-semibold">{role.id}</span>
|
|
126
|
+
<span className="font-mono text-muted-foreground">{[role.harness, role.model].filter(Boolean).join(" · ")}</span>
|
|
127
|
+
<span className="text-muted-foreground">{role.responsibility}</span>
|
|
128
|
+
</li>)}
|
|
129
|
+
</ul>
|
|
130
|
+
<pre className="overflow-x-auto rounded-xl border bg-muted/40 p-3 font-mono text-xs leading-relaxed">{dotText}</pre>
|
|
131
|
+
{draft.warnings?.length > 0 && <p className="text-xs text-muted-foreground">Ignored: {draft.warnings.map(item => `${item.message}`).join("; ")}</p>}
|
|
132
|
+
<p className="text-xs text-muted-foreground">Saves <span className="font-mono">{target}/team.dot</span>{scope === "global" ? " in the global teams folder" : " in this project"}{replaces ? ". This name is in use, so saving replaces it." : "."}</p>
|
|
133
|
+
<div className="flex flex-wrap gap-2">
|
|
134
|
+
{replaces || replaceAsk
|
|
135
|
+
? <ConfirmButton label="Replace and save" question={`Replace the existing team ${target}?`} confirmLabel="Replace" disabled={disabled || Boolean(busy)} onConfirm={save}/>
|
|
136
|
+
: <Button type="button" size="sm" disabled={disabled || Boolean(busy) || !target} onClick={save}>{busy === "save" ? "Saving…" : "Save team"}</Button>}
|
|
137
|
+
<Button type="button" size="sm" variant="outline" disabled={disabled || Boolean(busy)} onClick={() => go({ edit: editing ? "1" : "new", ...(editing ? { pattern: pattern.name } : { authorName: target }) })}>Open in DOT editor</Button>
|
|
138
|
+
<Button type="button" size="sm" variant="ghost" disabled={Boolean(busy)} onClick={() => { setDraft(null); setNotice(""); }}>Discard draft</Button>
|
|
139
|
+
</div>
|
|
140
|
+
{!name && !editing && draft?.suggested && <p className="text-xs text-muted-foreground">The agent named it <span className="font-mono">{draft.suggested}</span>; type another name above to save it elsewhere.</p>}
|
|
141
|
+
</section>}
|
|
142
|
+
|
|
143
|
+
{!editing && templates.length > 0 && <p className="text-xs text-muted-foreground">Prefer a starting point? <button type="button" className="underline underline-offset-2" onClick={() => go({ edit: "new" })}>Start from a template</button>.</p>}
|
|
144
|
+
</div>;
|
|
145
|
+
}
|