@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,88 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
|
+
import { Button } from "@/components/ui/button";
|
|
3
|
+
import { toGraph } from "@/lib/pattern-graph";
|
|
4
|
+
import { renameTeam, sourceLine } from "@/lib/team-editor";
|
|
5
|
+
import { RoleGraph } from "./pattern-graph";
|
|
6
|
+
|
|
7
|
+
export const CHECK_MS = 300;
|
|
8
|
+
|
|
9
|
+
// DOT text with a live graph above it (one column on phones, side by side on desktop). Each edit is checked after CHECK_MS;
|
|
10
|
+
// while the text has an error the graph keeps the last valid one, and the error shows with its source line.
|
|
11
|
+
export function TeamEditor({ pattern, initialName = "", templates, project, call, go, disabled }) {
|
|
12
|
+
const isNew = !pattern;
|
|
13
|
+
const [templateName, setTemplateName] = useState(templates[0]?.name ?? "");
|
|
14
|
+
const [name, setName] = useState(pattern?.name ?? initialName ?? "");
|
|
15
|
+
const [text, setText] = useState(pattern ? pattern.dot ?? "" : renameTeam(templates[0]?.text ?? "", initialName ?? ""));
|
|
16
|
+
const [check, setCheck] = useState(null);
|
|
17
|
+
const [good, setGood] = useState(pattern ?? null);
|
|
18
|
+
const [busy, setBusy] = useState(false);
|
|
19
|
+
const [notice, setNotice] = useState("");
|
|
20
|
+
const latest = useRef(0);
|
|
21
|
+
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
const id = ++latest.current;
|
|
24
|
+
const timer = setTimeout(async () => {
|
|
25
|
+
const result = await call({ project, team: name, checkDot: text });
|
|
26
|
+
if (id !== latest.current) return;
|
|
27
|
+
setCheck(result);
|
|
28
|
+
if (result.ok) setGood(result.pattern);
|
|
29
|
+
}, CHECK_MS);
|
|
30
|
+
return () => clearTimeout(timer);
|
|
31
|
+
}, [text, name, project]);
|
|
32
|
+
|
|
33
|
+
const error = check && !check.ok ? check.error : "";
|
|
34
|
+
const canSave = !disabled && !busy && Boolean(check?.ok) && Boolean(name);
|
|
35
|
+
|
|
36
|
+
function pickTemplate(value) {
|
|
37
|
+
const picked = templates.find(item => item.name === value);
|
|
38
|
+
setTemplateName(value);
|
|
39
|
+
if (picked) setText(renameTeam(picked.text, name));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function rename(value) {
|
|
43
|
+
setName(value);
|
|
44
|
+
setText(current => renameTeam(current, value));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async function save() {
|
|
48
|
+
setBusy(true); setNotice("");
|
|
49
|
+
const result = await call({ project, team: name, teamDot: text, teamNew: isNew });
|
|
50
|
+
setBusy(false);
|
|
51
|
+
if (result?.error) { setNotice(result.error); return; }
|
|
52
|
+
go({ pattern: result.name });
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return <div className="mx-auto flex w-full max-w-5xl flex-col gap-4 px-3 py-4 text-sm lg:flex-row lg:items-start">
|
|
56
|
+
<section className="flex min-w-0 flex-col gap-2 lg:flex-1">
|
|
57
|
+
<h2 className="text-xs font-medium text-muted-foreground">Graph</h2>
|
|
58
|
+
<div className="rounded-xl bg-card shadow-surface p-2">
|
|
59
|
+
{good?.roles?.length ? <RoleGraph graph={toGraph(good)} label={`Graph of ${good.name}`}/>
|
|
60
|
+
: <p className="py-8 text-center text-xs text-muted-foreground">No valid graph yet.</p>}
|
|
61
|
+
</div>
|
|
62
|
+
{error && good && <p className="text-xs text-muted-foreground">Showing the last valid graph.</p>}
|
|
63
|
+
</section>
|
|
64
|
+
|
|
65
|
+
<section className="flex min-w-0 flex-col gap-2 lg:flex-1">
|
|
66
|
+
<h2 className="text-xs font-medium text-muted-foreground">Definition (team.dot)</h2>
|
|
67
|
+
{isNew ? <div className="flex flex-wrap gap-2">
|
|
68
|
+
<input aria-label="Team name" className="min-w-0 flex-1 rounded border bg-background px-2 py-1 font-mono text-xs" placeholder="team-name" maxLength={24} value={name} onChange={e => rename(e.target.value)}/>
|
|
69
|
+
{templates.length > 0 && <select aria-label="Template" className="rounded border bg-background px-2 py-1 text-xs" value={templateName} onChange={e => pickTemplate(e.target.value)}>
|
|
70
|
+
{templates.map(item => <option key={item.name} value={item.name}>{item.name}</option>)}
|
|
71
|
+
</select>}
|
|
72
|
+
</div> : <p className="font-mono text-xs">@{pattern.name} · saved as a project team file</p>}
|
|
73
|
+
{error && <div role="alert" className="flex flex-col gap-1 rounded-lg border border-destructive/40 bg-destructive/10 px-2 py-1.5 text-xs text-destructive">
|
|
74
|
+
<p>{error}</p>
|
|
75
|
+
{check.line && <code className="block overflow-x-auto font-mono">{sourceLine(text, check.line)}</code>}
|
|
76
|
+
</div>}
|
|
77
|
+
{!error && check?.ok && <p className="text-xs text-muted-foreground">Valid. Save writes {name}/team.dot in the project.</p>}
|
|
78
|
+
{!error && check?.warnings?.length > 0 && <p className="text-xs text-muted-foreground">Ignored: {check.warnings.map(item => `line ${item.line}: ${item.message}`).join("; ")}</p>}
|
|
79
|
+
<textarea aria-label="Team definition" spellCheck={false} rows={12} value={text} onChange={e => setText(e.target.value)}
|
|
80
|
+
className="min-h-56 w-full rounded-xl border bg-background p-3 font-mono text-xs leading-relaxed"/>
|
|
81
|
+
{notice && <p role="alert" className="text-xs text-destructive">{notice}</p>}
|
|
82
|
+
<div className="flex flex-wrap gap-2">
|
|
83
|
+
<Button type="button" size="sm" disabled={!canSave} onClick={save}>{busy ? "Saving…" : "Save"}</Button>
|
|
84
|
+
<Button type="button" size="sm" variant="outline" onClick={() => go(isNew ? {} : { pattern: pattern.name })}>Cancel</Button>
|
|
85
|
+
</div>
|
|
86
|
+
</section>
|
|
87
|
+
</div>;
|
|
88
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
// The thread chat's agent strip: one chip per session in the thread, lead first; a chip opens that agent's own chat.
|
|
3
|
+
import { shortName, type Agent, type Thread } from "@/lib/thread-groups";
|
|
4
|
+
import { cn } from "@/lib/utils";
|
|
5
|
+
import { AgentName } from "./agent-mark";
|
|
6
|
+
import { Dot } from "./chat-shared";
|
|
7
|
+
import { sessionLive } from "./thread-sessions";
|
|
8
|
+
|
|
9
|
+
export function ThreadAgents({ thread, agents, now, open }: { thread?: Thread; agents: Agent[]; now: number; open: (session: string) => void }) {
|
|
10
|
+
const byId = new Map(agents.map(agent => [agent.id, agent]));
|
|
11
|
+
const ids = thread?.sessions || [];
|
|
12
|
+
const ordered = thread?.leadSession && ids.includes(thread.leadSession) ? [thread.leadSession, ...ids.filter(id => id !== thread.leadSession)] : ids;
|
|
13
|
+
const shown = ordered.map(id => byId.get(id)).filter((agent): agent is Agent => Boolean(agent));
|
|
14
|
+
if (!shown.length) return null;
|
|
15
|
+
return <nav aria-label="Agents in this thread" className="shrink-0 border-b bg-background">
|
|
16
|
+
<ul className="mx-auto flex w-full max-w-3xl gap-1.5 overflow-x-auto px-3 py-1.5">
|
|
17
|
+
{shown.map(agent => {
|
|
18
|
+
const name = shortName(agent, thread?.title) || agent.id;
|
|
19
|
+
const live = sessionLive(agent, now);
|
|
20
|
+
return <li key={agent.id} className="shrink-0">
|
|
21
|
+
<button type="button" data-thread-agent={agent.id} onClick={() => open(agent.id)}
|
|
22
|
+
aria-label={"Open " + name + (agent.gone ? " (ended)" : live ? " (live)" : "")} title={agent.id}
|
|
23
|
+
className={cn("flex min-h-9 max-w-56 items-center gap-1.5 rounded-full border px-2.5 text-sm hover:bg-accent", agent.gone && "text-muted-foreground")}>
|
|
24
|
+
<Dot online={live}/>
|
|
25
|
+
<AgentName address={agent.id} name={name}/>
|
|
26
|
+
{agent.id === thread?.leadSession && <span className="shrink-0 text-xs text-muted-foreground">lead</span>}
|
|
27
|
+
</button>
|
|
28
|
+
</li>;
|
|
29
|
+
})}
|
|
30
|
+
</ul>
|
|
31
|
+
</nav>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Where a thread runs: "main" or its worktree folder, then its branch.
|
|
2
|
+
import { cn } from "@/lib/utils";
|
|
3
|
+
|
|
4
|
+
export function ThreadPlace({ place, branch, className }: { place?: string; branch?: string; className?: string }) {
|
|
5
|
+
if (!place && !branch) return null;
|
|
6
|
+
return <span className={cn("min-w-0 truncate", className)} title={[place, branch].filter(Boolean).join(" · ")} data-place={place || undefined}>
|
|
7
|
+
{place}{place && branch && " · "}{branch && <span className="font-mono">{branch}</span>}
|
|
8
|
+
</span>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
// A thread's sessions in the sidebar: lead, children and subagent runs, live or finished; gone sessions stay and open their history.
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { Bell, BellOff, ChevronRight, CircleStop } from "lucide-react";
|
|
5
|
+
import { Toggle } from "@ui-sdk/react/toggle";
|
|
6
|
+
import { cn } from "@/lib/utils";
|
|
7
|
+
import { canStop, isLive, sessionState } from "@/lib/session-state";
|
|
8
|
+
import { runState, subagentModel } from "@/lib/activity-rows";
|
|
9
|
+
import { agentDetail } from "@/lib/agent-detail";
|
|
10
|
+
import { shortName, type Agent } from "@/lib/thread-groups";
|
|
11
|
+
import { listens, threadRole } from "../../lib/thread-listening";
|
|
12
|
+
import { HarnessMark } from "./agent-mark";
|
|
13
|
+
import { Dot, ago, short } from "./chat-shared";
|
|
14
|
+
|
|
15
|
+
type Run = { id: string; agent?: string; run?: string; kind?: string; model?: string; description?: string; steps?: number; time?: number; lastTime?: number; done?: boolean; child?: boolean };
|
|
16
|
+
type Selected = { level: string; session?: string; run?: string; subagent?: string };
|
|
17
|
+
export type OpenSession = (session: string, run?: string) => void;
|
|
18
|
+
export type ListenSession = (thread: string, session: string, on: boolean) => void;
|
|
19
|
+
/** The thread a tree belongs to, for the listening toggles: its members and stored settings. */
|
|
20
|
+
export type ListenThread = { id: string; title?: string; sessions?: string[]; listeners?: { session: string; listening: boolean }[] };
|
|
21
|
+
type Listen = { thread: ListenThread; set: ListenSession; disabled?: boolean };
|
|
22
|
+
|
|
23
|
+
const ROW = "flex w-full min-w-0 items-start gap-2 rounded-lg px-2 text-left hover:bg-sidebar-accent";
|
|
24
|
+
|
|
25
|
+
/** A session the thread lists but the server no longer knows: only its address remains. */
|
|
26
|
+
export function missingSession(id: string): Agent {
|
|
27
|
+
return { id, peer: id.split("#")[0], gone: true, missing: true };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** A session the sidebar shows as live: not gone, and either working now or online. */
|
|
31
|
+
export function sessionLive(agent: Agent, now: number): boolean {
|
|
32
|
+
return !agent.gone && (isLive(agent, now) || Boolean(agent.online));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Unfinished runs of one session; child sessions list as sessions of their own. */
|
|
36
|
+
function openRuns(agent: Agent): Run[] {
|
|
37
|
+
return ((agent.subagents || []) as Run[]).filter(run => !run.child && !run.done);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Every agent working under a thread: its live sessions, their live child sessions and their unfinished subagent runs. */
|
|
41
|
+
export function workingCount(sessions: Agent[], all: Agent[], now: number): number {
|
|
42
|
+
const seen = new Set<string>();
|
|
43
|
+
const visit = (agent: Agent, depth: number): number => {
|
|
44
|
+
if (seen.has(agent.id) || depth > 3) return 0;
|
|
45
|
+
seen.add(agent.id);
|
|
46
|
+
const kids = all.filter(kid => kid.parent === agent.id && kid.id !== agent.id);
|
|
47
|
+
return (sessionLive(agent, now) ? 1 : 0) + openRuns(agent).length + kids.reduce((sum, kid) => sum + visit(kid, depth + 1), 0);
|
|
48
|
+
};
|
|
49
|
+
return sessions.reduce((sum, agent) => sum + visit(agent, 0), 0);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** The sessions under a thread, children nested under their parent; every row opens its session. */
|
|
53
|
+
export function SessionTree({ sessions, all, label, title, selected, now, open, listen, stop }: {
|
|
54
|
+
sessions: Agent[]; all: Agent[]; label: string; title?: string; selected: Selected; now: number; open: OpenSession; listen?: Listen; stop?: (session: string) => void;
|
|
55
|
+
}) {
|
|
56
|
+
const listed = new Set(sessions.map(agent => agent.id));
|
|
57
|
+
const roots = sessions.filter(agent => !agent.parent || !listed.has(String(agent.parent)));
|
|
58
|
+
const childrenOf = (id: string) => all.filter(agent => agent.parent === id && agent.id !== id);
|
|
59
|
+
const node = (agent: Agent, depth: number): React.ReactNode => <SessionItem key={agent.id} agent={agent} name={agent.missing ? agent.peer + " session " + agent.id.split("#")[1]?.slice(0, 6) : shortName(agent, title)} selected={selected} now={now} open={open} listen={listen} stop={stop}>
|
|
60
|
+
{depth < 3 && childrenOf(agent.id).map(child => node(child, depth + 1))}
|
|
61
|
+
</SessionItem>;
|
|
62
|
+
return <ul aria-label={label} className="ml-3 flex flex-col gap-px pl-1">{roots.map(agent => node(agent, 0))}</ul>;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** One session: live dot, harness mark, name, its state, "model · where", then its subagent runs and children. */
|
|
66
|
+
function SessionItem({ agent, name, selected, now, open, listen, stop, children }: {
|
|
67
|
+
agent: Agent; name: string; selected: Selected; now: number; open: OpenSession; listen?: Listen; stop?: (session: string) => void; children?: React.ReactNode;
|
|
68
|
+
}) {
|
|
69
|
+
const state = sessionState(agent, now);
|
|
70
|
+
const live = sessionLive(agent, now);
|
|
71
|
+
const current = selected.level === "session" && selected.session === agent.id;
|
|
72
|
+
const detail = agentDetail(agent);
|
|
73
|
+
const runs = openRuns(agent);
|
|
74
|
+
const finished = (agent.finishedSubagents || []) as Run[];
|
|
75
|
+
const kids = Array.isArray(children) ? children.filter(Boolean) : [];
|
|
76
|
+
return <li className="flex min-w-0 flex-col">
|
|
77
|
+
<div className="flex min-w-0 items-start">
|
|
78
|
+
<button type="button" data-session={agent.id} data-gone={agent.gone ? "true" : undefined} aria-current={current ? "page" : undefined} onClick={() => open(agent.id)}
|
|
79
|
+
title={agent.gone ? "Ended: opens its history" : agent.id}
|
|
80
|
+
className={cn(ROW, "py-1 max-md:py-2", current ? "bg-sidebar-accent font-medium text-foreground" : "text-muted-foreground", agent.gone && "opacity-70")}>
|
|
81
|
+
<span className="mt-1.5 flex shrink-0"><Dot online={live}/></span>
|
|
82
|
+
<span className="flex min-w-0 flex-1 flex-col">
|
|
83
|
+
<span className="flex min-w-0 items-center gap-1.5">
|
|
84
|
+
<HarnessMark peer={String(agent.peer || agent.id.split("#")[0])}/>
|
|
85
|
+
<span className={cn("min-w-0 flex-1 truncate", current || live ? "text-foreground" : "")}>{name || short(agent.id)}</span>
|
|
86
|
+
{agent.gone ? <span className="shrink-0 text-xs">ended</span>
|
|
87
|
+
: state === "waiting" || state === "afk" ? <span className="shrink-0 text-xs font-medium text-primary">waiting</span>
|
|
88
|
+
: state === "working" ? <span className="shrink-0 text-xs text-foreground">working</span>
|
|
89
|
+
: !live && agent.lastMessageAt ? <span className="shrink-0 text-xs">{ago(agent.lastMessageAt, now)}</span> : null}
|
|
90
|
+
</span>
|
|
91
|
+
{detail && <span className="min-w-0 truncate text-xs text-muted-foreground" title={detail}>{detail}</span>}
|
|
92
|
+
</span>
|
|
93
|
+
</button>
|
|
94
|
+
{stop && canStop(agent, now) && <button type="button" aria-label={"Stop " + (name || short(agent.id))} title="Stop this agent's turn" onClick={() => stop(agent.id)}
|
|
95
|
+
className="mt-0.5 grid size-7 shrink-0 place-items-center rounded-md text-muted-foreground hover:bg-sidebar-accent hover:text-foreground max-md:mt-0 max-md:size-11">
|
|
96
|
+
<CircleStop aria-hidden className="size-3.5"/>
|
|
97
|
+
</button>}
|
|
98
|
+
{listen && !agent.gone && <ListenToggle agent={agent} name={name || short(agent.id)} listen={listen}/>}
|
|
99
|
+
</div>
|
|
100
|
+
{(runs.length > 0 || finished.length > 0 || kids.length > 0) && <ul aria-label={"Inside " + (name || short(agent.id))} className="ml-3 flex flex-col gap-px pl-1">
|
|
101
|
+
{runs.map(run => <RunItem key={run.id} run={run} parent={agent} now={now} current={current && (selected.subagent || selected.run) === run.run} onOpen={() => open(agent.id, run.run)}/>)}
|
|
102
|
+
{kids}
|
|
103
|
+
{finished.length > 0 && <FinishedRuns runs={finished} parent={agent} now={now} selected={current ? selected.subagent || selected.run : undefined} onOpen={run => open(agent.id, run)}/>}
|
|
104
|
+
</ul>}
|
|
105
|
+
</li>;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** The bell beside a session: on, every thread post reaches it; off, only posts that @mention it (docs/threads.md "Thread channels"). */
|
|
109
|
+
function ListenToggle({ agent, name, listen }: { agent: Agent; name: string; listen: Listen }) {
|
|
110
|
+
const { thread, set, disabled } = listen;
|
|
111
|
+
const setting = thread.listeners?.find(item => item.session === agent.id)?.listening;
|
|
112
|
+
const member = (thread.sessions || []).includes(agent.id);
|
|
113
|
+
const on = listens({ role: threadRole(agent.parent), member, listening: setting ?? null });
|
|
114
|
+
const hint = (on ? "Listening: every post in " : "Muted: only @mentions in ") + (thread.title || "this thread") + (setting === undefined ? " (default)" : "");
|
|
115
|
+
return <Toggle aria-label={"Listen to thread posts: " + name} title={hint} pressed={on} disabled={disabled} data-listen={agent.id}
|
|
116
|
+
onPressedChange={next => set(thread.id, agent.id, next)}
|
|
117
|
+
className="mt-0.5 grid size-7 shrink-0 place-items-center rounded-md text-muted-foreground hover:bg-sidebar-accent hover:text-foreground data-pressed:text-foreground data-disabled:opacity-50 max-md:mt-0 max-md:size-11">
|
|
118
|
+
{on ? <Bell aria-hidden className="size-3.5"/> : <BellOff aria-hidden className="size-3.5"/>}
|
|
119
|
+
</Toggle>;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** Finished runs fold behind one row so a busy session does not push the threads below off screen. */
|
|
123
|
+
function FinishedRuns({ runs, parent, now, selected, onOpen }: { runs: Run[]; parent: Agent; now: number; selected?: string; onOpen: (run?: string) => void }) {
|
|
124
|
+
const [open, setOpen] = useState(runs.some(run => run.run === selected));
|
|
125
|
+
return <li className="flex min-w-0 flex-col">
|
|
126
|
+
<button type="button" aria-expanded={open} onClick={() => setOpen(!open)} className={cn(ROW, "items-center py-0.5 text-xs text-muted-foreground max-md:py-2")}>
|
|
127
|
+
<ChevronRight aria-hidden className={cn("size-3 shrink-0 transition-transform motion-reduce:transition-none", open && "rotate-90")}/>
|
|
128
|
+
{runs.length} finished {runs.length === 1 ? "subagent" : "subagents"}
|
|
129
|
+
</button>
|
|
130
|
+
{open && <ul className="flex flex-col gap-px">
|
|
131
|
+
{runs.map(run => <RunItem key={run.id} run={run} parent={parent} now={now} current={selected === run.run} onOpen={() => onOpen(run.run)}/>)}
|
|
132
|
+
</ul>}
|
|
133
|
+
</li>;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** One subagent run: a live dot until it finishes, its kind and task, and its step count. */
|
|
137
|
+
function RunItem({ run, parent, now, current, onOpen }: { run: Run; parent: Agent; now: number; current: boolean; onOpen: () => void }) {
|
|
138
|
+
const running = !run.done && runState(run, now) === "running";
|
|
139
|
+
const model = subagentModel(run, parent);
|
|
140
|
+
return <li>
|
|
141
|
+
<button type="button" data-run={run.run} data-running={running ? "true" : undefined} aria-current={current ? "page" : undefined} onClick={onOpen} title={run.description || run.kind}
|
|
142
|
+
className={cn(ROW, "items-center py-0.5 text-xs max-md:py-2", current ? "bg-sidebar-accent text-foreground" : "text-muted-foreground")}>
|
|
143
|
+
<Dot online={!run.done}/>
|
|
144
|
+
<HarnessMark peer={String(parent.peer || parent.id.split("#")[0])} className="size-3.5"/>
|
|
145
|
+
<span className="min-w-0 flex-1 truncate"><span className={running ? "text-foreground" : ""}>{run.kind || "agent"}</span>{model && <span data-model> · {model}</span>}{run.description && " · " + run.description}</span>
|
|
146
|
+
{(run.steps || 0) > 0 && <span className="shrink-0 tabular-nums">{run.steps}</span>}
|
|
147
|
+
</button>
|
|
148
|
+
</li>;
|
|
149
|
+
}
|