@temmo/cli 0.0.0 → 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 +112 -1
- 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,251 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { ArrowRightLeft, Bot, ChevronRight, CircleAlert, CirclePlay, CircleStop, Eraser, FileText, Globe, ListTodo, LoaderCircle, Minimize2, Paperclip, Pencil, Plug, Search, SquareArrowOutUpRight, Terminal, TriangleAlert, Wrench } from "lucide-react";
|
|
3
|
+
import { useMemo, useState } from "react";
|
|
4
|
+
import { CodeBlockCode } from "@/components/ui/code-block";
|
|
5
|
+
import { MessageContent } from "@/components/ui/message";
|
|
6
|
+
import { cn } from "@/lib/utils";
|
|
7
|
+
import { groupLabel } from "@/lib/chat-turns";
|
|
8
|
+
import { clearText, compactionText, modelText } from "@/lib/compaction-view";
|
|
9
|
+
import { activeAgents, inputBlocks, readableText, resultLanguage, runState, spawnedSession, subagentLabel, subagentModel, summarize } from "@/lib/activity-rows";
|
|
10
|
+
import { toolDiff } from "@/lib/tool-diff";
|
|
11
|
+
import { elapsed } from "@/lib/thread-groups";
|
|
12
|
+
import { ChoiceCard, askedQuestions } from "./cards";
|
|
13
|
+
import { Counts, ToolDiff } from "./tool-diff";
|
|
14
|
+
import { HarnessMark } from "./agent-mark";
|
|
15
|
+
import { peerOf } from "./chat-shared";
|
|
16
|
+
|
|
17
|
+
const PREVIEW_LINES = 3;
|
|
18
|
+
const TOOL_ICONS = [
|
|
19
|
+
[/spawn_agent$/i, Bot],
|
|
20
|
+
[/^(bash|shell|exec_command|run_terminal_cmd|terminal)/i, Terminal],
|
|
21
|
+
[/^(read|view|cat|read_file)/i, FileText],
|
|
22
|
+
[/(edit|write|patch|apply_patch|multiedit|notebookedit|delete_file)/i, Pencil],
|
|
23
|
+
[/(grep|glob|search|find|ls|list)/i, Search],
|
|
24
|
+
[/^web|fetch|browser/i, Globe],
|
|
25
|
+
[/^mcp/i, Plug],
|
|
26
|
+
[/^(task|agent|spawn_agent)/i, Bot],
|
|
27
|
+
[/todo|plan/i, ListTodo],
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
const CODE = "font-mono [overflow-wrap:anywhere] [&_pre]:whitespace-pre-wrap [&_pre]:font-mono";
|
|
31
|
+
// Subagent runs the operator expanded, kept for the page's lifetime.
|
|
32
|
+
const expandedRuns = new Set();
|
|
33
|
+
const iconOf = tool => TOOL_ICONS.find(([pattern]) => pattern.test(tool || ""))?.[1] || Wrench;
|
|
34
|
+
const sizeOf = bytes => bytes >= 1024 * 1024 ? (bytes / 1024 / 1024).toFixed(1) + " MB" : bytes >= 1024 ? Math.round(bytes / 1024) + " KB" : bytes + " B";
|
|
35
|
+
|
|
36
|
+
// Highlighted code once rendered; language is a fence name or file extension.
|
|
37
|
+
function Code({ code, language, className }) {
|
|
38
|
+
return <CodeBlockCode code={code} language={language} className={cn(CODE, "text-xs [&>pre]:px-2.5 [&>pre]:py-1.5", className)}/>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function Result({ item, input, header, summary }) {
|
|
42
|
+
const [open, setOpen] = useState(false);
|
|
43
|
+
const text = item.output || "";
|
|
44
|
+
const lines = text.split("\n");
|
|
45
|
+
const preview = lines.slice(0, PREVIEW_LINES).join("\n");
|
|
46
|
+
const more = lines.length > PREVIEW_LINES || preview.length > 240;
|
|
47
|
+
const error = item.type === "error";
|
|
48
|
+
const language = error ? "" : resultLanguage(item.tool, input, text);
|
|
49
|
+
return <div className={cn("min-w-0 rounded-lg border bg-muted/40 text-xs", error && "border-destructive/50 bg-destructive/10")}>
|
|
50
|
+
{header && <ToolName tool={item.tool} error={error} summary={summary} className="border-b px-2.5 py-1.5"/>}
|
|
51
|
+
{more ? <details className="group" onToggle={event => setOpen(event.currentTarget.open)}>
|
|
52
|
+
<summary aria-label={error ? "Error details" : "Tool result"} className="flex cursor-pointer list-none items-start gap-1.5 px-2.5 py-1.5 [&::-webkit-details-marker]:hidden">
|
|
53
|
+
<ChevronRight className="mt-0.5 size-3.5 shrink-0 transition-transform group-open:rotate-90"/>
|
|
54
|
+
<pre className="line-clamp-3 min-w-0 flex-1 whitespace-pre-wrap font-mono [overflow-wrap:anywhere] group-open:hidden">{preview}</pre>
|
|
55
|
+
<span className="hidden text-muted-foreground group-open:inline">{error ? "Error" : "Result"} · {lines.length} lines</span>
|
|
56
|
+
</summary>
|
|
57
|
+
{open && <Code code={text} language={language} className="max-h-96 overflow-auto border-t"/>}
|
|
58
|
+
</details> : text ? <Code code={text} language={language}/> : <pre className="px-2.5 py-1.5 font-mono">(no output)</pre>}
|
|
59
|
+
{item.attachment && <a href={"/api/file/" + item.attachment.file} target="_blank" rel="noreferrer"
|
|
60
|
+
className="flex items-center gap-1.5 border-t px-2.5 py-1.5 font-medium text-primary underline-offset-2 hover:underline">
|
|
61
|
+
<Paperclip className="size-3.5"/>Full output ({sizeOf(item.attachment.size)})
|
|
62
|
+
</a>}
|
|
63
|
+
</div>;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// One line: the tool name, then its summary (the command or path) truncated to the row width.
|
|
67
|
+
function ToolName({ tool, error, summary, className }) {
|
|
68
|
+
const Icon = error ? TriangleAlert : iconOf(tool);
|
|
69
|
+
return <div className={cn("flex min-w-0 items-center gap-2 text-sm", className)}>
|
|
70
|
+
<Icon className={cn("size-4 shrink-0", error ? "text-destructive" : "text-muted-foreground")}/>
|
|
71
|
+
<span className="shrink-0 font-medium">{tool}</span>
|
|
72
|
+
{summary && <span className="min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground">{summary}</span>}
|
|
73
|
+
</div>;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function ToolCall({ item }) {
|
|
77
|
+
const [open, setOpen] = useState(false);
|
|
78
|
+
// A file edit shows its diff: the files it changes in the summary, their diffs when open.
|
|
79
|
+
const diff = useMemo(() => toolDiff(item.tool, item.input, item.result?.output), [item.tool, item.input, item.result?.output]);
|
|
80
|
+
// An AskUserQuestion call shows its questions as a read-only card; a pending one is answered from its approval card.
|
|
81
|
+
const questions = askedQuestions(item.tool, item.input);
|
|
82
|
+
if (questions) return <div className="flex min-w-0 flex-col gap-1.5">
|
|
83
|
+
<ChoiceCard questions={questions} title="AskUserQuestion"/>
|
|
84
|
+
{item.result && <Result item={item.result} input={item.input}/>}
|
|
85
|
+
</div>;
|
|
86
|
+
const Icon = iconOf(item.tool);
|
|
87
|
+
const summary = diff ? diff.files.map(file => file.path).join(", ") : summarize(item.input);
|
|
88
|
+
const blocks = open && !diff ? inputBlocks(item.tool, item.input) : [];
|
|
89
|
+
return <div className="flex min-w-0 flex-col gap-1.5">
|
|
90
|
+
<details className="group min-w-0 rounded-lg border bg-card text-sm" onToggle={event => setOpen(event.currentTarget.open)}>
|
|
91
|
+
<summary aria-label={"Tool call " + (item.tool || "")} className="flex cursor-pointer list-none items-center gap-2 px-2.5 py-1.5 [&::-webkit-details-marker]:hidden">
|
|
92
|
+
<Icon className="size-4 shrink-0 text-muted-foreground"/>
|
|
93
|
+
<span className="shrink-0 font-medium">{item.tool || "tool"}</span>
|
|
94
|
+
<span className="min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground">{summary}</span>
|
|
95
|
+
{diff && <Counts added={diff.files.reduce((sum, file) => sum + file.added, 0)} removed={diff.files.reduce((sum, file) => sum + file.removed, 0)} className="text-xs"/>}
|
|
96
|
+
<ChevronRight className="size-3.5 shrink-0 text-muted-foreground transition-transform group-open:rotate-90"/>
|
|
97
|
+
</summary>
|
|
98
|
+
{open && diff && <div className="max-h-96 overflow-auto border-t p-2">
|
|
99
|
+
<ToolDiff files={diff.files} truncated={diff.truncated}/>
|
|
100
|
+
</div>}
|
|
101
|
+
{open && !diff && <div className="max-h-96 overflow-auto border-t">
|
|
102
|
+
{blocks.length ? blocks.map((block, i) => <Code key={i} code={block.code} language={block.language} className={i > 0 && "border-t"}/>)
|
|
103
|
+
: <pre className="px-2.5 py-1.5 font-mono text-xs">(no input)</pre>}
|
|
104
|
+
</div>}
|
|
105
|
+
</details>
|
|
106
|
+
{item.result && <Result item={item.result} input={item.input}/>}
|
|
107
|
+
</div>;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function Body({ item }) {
|
|
111
|
+
switch (item.type) {
|
|
112
|
+
case "prompt":
|
|
113
|
+
return <MessageContent markdown className="bubble ml-auto max-w-[90%] rounded-2xl rounded-tr-md border border-primary/25 bg-primary/10 px-3 py-1.5 text-sm leading-relaxed text-foreground [overflow-wrap:anywhere]">{readableText(item.input).text}</MessageContent>;
|
|
114
|
+
case "text":
|
|
115
|
+
// Lighter than a chat bubble: the agent's own narration, not a message to the operator.
|
|
116
|
+
return <MessageContent markdown className="bubble max-w-full rounded-2xl rounded-tl-md border border-dashed bg-muted/30 px-3 py-1.5 text-sm leading-relaxed text-foreground/90 [overflow-wrap:anywhere]">{readableText(item.output).text}</MessageContent>;
|
|
117
|
+
case "tool_call":
|
|
118
|
+
return <ToolCall item={item}/>;
|
|
119
|
+
case "tool_result":
|
|
120
|
+
case "error":
|
|
121
|
+
// A result without its call names the tool and its command inside its own box.
|
|
122
|
+
return <Result item={item} input={item.input} header={Boolean(item.tool)} summary={summarize(item.input)}/>;
|
|
123
|
+
default: {
|
|
124
|
+
const Icon = { start: CirclePlay, compact: Minimize2, clear: Eraser, model: Bot, limit: CircleAlert, handoff: ArrowRightLeft }[item.type] || CircleStop;
|
|
125
|
+
const label = item.type === "clear" ? clearText(item.clear) : item.type === "model" && item.modelSwitch ? modelText(item.modelSwitch)
|
|
126
|
+
: compactionText(item.compaction) || item.input || item.type;
|
|
127
|
+
return <>
|
|
128
|
+
<p className="flex items-center gap-1.5 text-xs text-muted-foreground"><Icon className="size-3.5"/>{label}</p>
|
|
129
|
+
{item.output && <MessageContent markdown className="bubble max-w-full rounded-2xl rounded-tl-md border border-dashed bg-muted/30 px-3 py-1.5 text-sm leading-relaxed text-foreground/90 [overflow-wrap:anywhere]">{item.output}</MessageContent>}
|
|
130
|
+
</>;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// One collapsed row per subagent run; tapping it shows the run's own rows, indented.
|
|
136
|
+
function SubagentRun({ row, when, now, goRun }) {
|
|
137
|
+
const [open, setOpen] = useState(() => expandedRuns.has(row.id));
|
|
138
|
+
const toggle = () => { if (open) expandedRuns.delete(row.id); else expandedRuns.add(row.id); setOpen(!open); };
|
|
139
|
+
const state = runState(row, now);
|
|
140
|
+
const label = "Subagent · " + subagentLabel(row, now) + (row.description ? " · " + row.description : "");
|
|
141
|
+
return <div className="flex min-w-0 flex-col gap-2" data-run-state={state}>
|
|
142
|
+
<div className="flex min-w-0 items-center gap-1.5">
|
|
143
|
+
<button type="button" aria-expanded={open} onClick={toggle}
|
|
144
|
+
className="flex min-w-0 flex-1 items-center gap-2 rounded-lg border border-dashed bg-card px-2.5 py-1.5 text-left text-sm">
|
|
145
|
+
{state === "running" ? <LoaderCircle className="size-4 shrink-0 animate-spin text-muted-foreground"/> : <Bot className="size-4 shrink-0 text-muted-foreground"/>}
|
|
146
|
+
<span className="min-w-0 flex-1 truncate">{label}</span>
|
|
147
|
+
<ChevronRight className={cn("size-3.5 shrink-0 text-muted-foreground transition-transform", open && "rotate-90")}/>
|
|
148
|
+
</button>
|
|
149
|
+
{goRun && <GoToAgent label={"Go to subagent " + (row.kind || "agent")} onClick={() => goRun(row)}/>}
|
|
150
|
+
</div>
|
|
151
|
+
{open && <div data-subagent={row.run} className="ml-3 flex min-w-0 flex-col gap-3 border-l pl-3">
|
|
152
|
+
{row.rows.map(item => <ActivityRow key={item.id} row={item} when={when}/>)}
|
|
153
|
+
</div>}
|
|
154
|
+
</div>;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// One row per run of tool uses between two messages: "Ran …" when collapsed; the live run stays open until a message follows.
|
|
158
|
+
function ToolGroupRun({ row, when, now, goRun, openSession }) {
|
|
159
|
+
const [manual, setManual] = useState(null);
|
|
160
|
+
const open = manual ?? row.live;
|
|
161
|
+
// Each child session a spawn_agent call in the group started gets its own Go-to button.
|
|
162
|
+
const children = openSession ? [...new Set(row.rows.map(spawnedSession).filter(Boolean))] : [];
|
|
163
|
+
return <div className="flex min-w-0 flex-col gap-2">
|
|
164
|
+
<div className="flex min-w-0 items-center gap-1.5">
|
|
165
|
+
<button type="button" aria-expanded={open} onClick={() => setManual(!open)}
|
|
166
|
+
className="flex min-w-0 flex-1 items-center gap-2 rounded-lg border border-dashed bg-card px-2.5 py-1.5 text-left text-sm">
|
|
167
|
+
{row.live ? <LoaderCircle className="size-4 shrink-0 animate-spin text-muted-foreground"/> : <Wrench className="size-4 shrink-0 text-muted-foreground"/>}
|
|
168
|
+
<span className="min-w-0 flex-1 truncate">{groupLabel(row)}</span>
|
|
169
|
+
<ChevronRight className={cn("size-3.5 shrink-0 text-muted-foreground transition-transform", open && "rotate-90")}/>
|
|
170
|
+
</button>
|
|
171
|
+
{children.map(child => <GoToAgent key={child} label={"Go to spawned agent " + child} onClick={() => openSession(child)}/>)}
|
|
172
|
+
</div>
|
|
173
|
+
{open && <div data-group={row.id} className="ml-3 flex min-w-0 flex-col gap-3 border-l pl-3">
|
|
174
|
+
{row.rows.map(item => <ActivityRow key={item.id} row={item} when={when} now={now} goRun={goRun}/>)}
|
|
175
|
+
</div>}
|
|
176
|
+
</div>;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/** Small "Go to agent" button used wherever an agent or subagent is referenced. */
|
|
180
|
+
export function GoToAgent({ label = "Go to agent", onClick, className }) {
|
|
181
|
+
return <button type="button" aria-label={label} title={label} onClick={event => { event.stopPropagation(); onClick(); }}
|
|
182
|
+
className={cn("inline-flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground", className)}>
|
|
183
|
+
<SquareArrowOutUpRight className="size-3.5"/>
|
|
184
|
+
</button>;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/** One activity row; goRun opens a subagent run, openSession a session spawn_agent started. */
|
|
188
|
+
export function ActivityRow({ row, when, now, goRun, openSession }) {
|
|
189
|
+
if (row.type === "subagent") return <article data-type="subagent" className="flex min-w-0 flex-col gap-1">
|
|
190
|
+
<SubagentRun row={row} when={when} now={now} goRun={goRun}/>
|
|
191
|
+
</article>;
|
|
192
|
+
if (row.type === "group") return <article data-type="group" data-agent={row.agent} className="flex min-w-0 flex-col gap-1"><p className="font-mono text-xs text-muted-foreground">{row.agent}</p><ToolGroupRun row={row} when={when} now={now} goRun={goRun} openSession={openSession}/></article>;
|
|
193
|
+
return <article data-type={row.type} data-agent={row.agent} className={cn("flex min-w-0 flex-col gap-1", row.type === "prompt" && "items-end")}>
|
|
194
|
+
<div className="flex max-w-full items-center gap-1.5 text-xs text-muted-foreground">
|
|
195
|
+
{row.type === "prompt" && <span className="font-medium text-foreground">Prompt</span>}
|
|
196
|
+
{row.type === "text" && <span className="font-medium text-foreground">{readableText(row.output).label || row.tool || "Agent"}</span>}
|
|
197
|
+
{row.type === "text" && row.agent && <span className="font-mono text-xs">{row.agent}</span>}
|
|
198
|
+
{row.time > 0 && <time dateTime={new Date(row.time * 1000).toISOString()}>{when(row.time * 1000)}</time>}
|
|
199
|
+
</div>
|
|
200
|
+
<Body item={row}/>
|
|
201
|
+
</article>;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/** "Working now" with each agent running: the session with an open tool call, and its running subagents. */
|
|
205
|
+
export function Working({ rows, now, agents = [] }) {
|
|
206
|
+
const busy = activeAgents(rows, now);
|
|
207
|
+
const [open, setOpen] = useState(false);
|
|
208
|
+
if (!busy.length) return null;
|
|
209
|
+
const sessions = busy.filter(item => !item.kind);
|
|
210
|
+
const runs = rows.filter(row => row.type === "subagent" && runState(row, now) === "running");
|
|
211
|
+
return <div role="status" className="flex min-w-0 flex-col gap-2 text-sm text-muted-foreground">
|
|
212
|
+
{sessions.length > 0 && <p className="flex flex-wrap items-center gap-x-2 gap-y-1">
|
|
213
|
+
<LoaderCircle className="size-4 animate-spin motion-reduce:animate-none"/>Working now
|
|
214
|
+
{sessions.map(item => <span key={item.key} data-agent={item.agent} className="inline-flex items-center gap-1 font-mono text-xs text-foreground"><HarnessMark peer={peerOf(item.agent)} className="size-3.5"/>{item.agent}</span>)}
|
|
215
|
+
</p>}
|
|
216
|
+
{runs.length > 0 && <div className="flex min-w-0 flex-col gap-2">
|
|
217
|
+
<button type="button" aria-expanded={open} onClick={() => setOpen(!open)}
|
|
218
|
+
className="flex min-w-0 items-center gap-2 rounded-xl bg-card px-2.5 py-1.5 text-left text-sm text-foreground shadow-surface">
|
|
219
|
+
<LoaderCircle className="size-4 shrink-0 animate-spin text-live motion-reduce:animate-none"/>
|
|
220
|
+
<span className="min-w-0 flex-1 truncate">{runs.length === 1 ? "1 subagent working" : runs.length + " subagents working"}{" · " + [...new Set(runs.map(run => run.kind || "agent"))].join(", ")}</span>
|
|
221
|
+
<ChevronRight className={cn("size-3.5 shrink-0 text-muted-foreground transition-transform motion-reduce:transition-none", open && "rotate-90")}/>
|
|
222
|
+
</button>
|
|
223
|
+
{open && <ul aria-label="Working subagents" className="ml-3 flex min-w-0 flex-col gap-2 border-l pl-3">
|
|
224
|
+
{runs.map(run => <li key={run.id}><WorkingRun run={run} parent={agents.find(agent => agent.id === run.agent)} now={now}/></li>)}
|
|
225
|
+
</ul>}
|
|
226
|
+
</div>}
|
|
227
|
+
</div>;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/** One running subagent; it expands to its task, status, running time and newest step. */
|
|
231
|
+
function WorkingRun({ run, parent, now }) {
|
|
232
|
+
const [open, setOpen] = useState(false);
|
|
233
|
+
const model = subagentModel(run, parent);
|
|
234
|
+
const took = elapsed(now - (run.time || 0) * 1000);
|
|
235
|
+
return <div className="flex min-w-0 flex-col gap-1" data-run={run.run}>
|
|
236
|
+
<button type="button" aria-expanded={open} onClick={() => setOpen(!open)} className="flex min-w-0 items-center gap-2 rounded-lg px-1 py-1 text-left text-sm hover:bg-accent">
|
|
237
|
+
<ChevronRight className={cn("size-3.5 shrink-0 transition-transform motion-reduce:transition-none", open && "rotate-90")}/>
|
|
238
|
+
<HarnessMark peer={String(parent?.peer || peerOf(run.agent || ""))} className="size-3.5"/>
|
|
239
|
+
<span className="min-w-0 flex-1 truncate"><span className="text-foreground">{run.kind || "agent"}</span>{model && <span data-model> · {model}</span>}{run.description && " · " + run.description}</span>
|
|
240
|
+
<span className="shrink-0 text-xs tabular-nums">{took}</span>
|
|
241
|
+
</button>
|
|
242
|
+
{open && <dl className="ml-6 grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-xs">
|
|
243
|
+
<dt>Task</dt><dd className="min-w-0 text-foreground [overflow-wrap:anywhere]">{run.description || "No task summary"}</dd>
|
|
244
|
+
<dt>Status</dt><dd className="text-foreground">running · {run.steps === 1 ? "1 step" : (run.steps || 0) + " steps"}</dd>
|
|
245
|
+
<dt>Running for</dt><dd className="text-foreground">{took}</dd>
|
|
246
|
+
{model && <><dt>Model</dt><dd className="text-foreground">{model}</dd></>}
|
|
247
|
+
<dt>In</dt><dd className="min-w-0 truncate font-mono text-foreground">{run.agent}</dd>
|
|
248
|
+
{run.last && <><dt>Last step</dt><dd className="min-w-0 truncate font-mono text-foreground">{run.last.tool} {run.last.summary}</dd></>}
|
|
249
|
+
</dl>}
|
|
250
|
+
</div>;
|
|
251
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
// Agent identity: a harness glyph in its harness tint and a short name; the raw address shows on hover or a long press.
|
|
3
|
+
import { useRef, useState, type ReactNode } from "react";
|
|
4
|
+
import { HarnessLogo, hasLogo } from "./logos";
|
|
5
|
+
import { HARNESS_NAMES, harnessTint, peerOf, short } from "./chat-shared";
|
|
6
|
+
import { cn } from "@/lib/utils";
|
|
7
|
+
|
|
8
|
+
const LONG_PRESS_MS = 450;
|
|
9
|
+
const REVEAL_MS = 2500;
|
|
10
|
+
|
|
11
|
+
/** The harness glyph, tinted per harness, in a small square; a peer without a logo shows its first letter. */
|
|
12
|
+
export function HarnessMark({ peer, className }: { peer: string; className?: string }) {
|
|
13
|
+
const name = (HARNESS_NAMES as Record<string, string>)[peer] || peer;
|
|
14
|
+
return <span data-harness={peer} title={name} className={cn("inline-grid size-4 shrink-0 place-items-center", harnessTint(peer) || "text-agent", className)}>
|
|
15
|
+
{hasLogo(peer) ? <HarnessLogo peer={peer} className="size-3.5"/> : <span aria-label={name} className="font-mono text-xs leading-none">{peer.slice(0, 1).toUpperCase()}</span>}
|
|
16
|
+
</span>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A session as glyph plus name. The raw address is the title on hover; a long press on touch swaps the name for it
|
|
21
|
+
* for a moment, since a phone has no hover.
|
|
22
|
+
*/
|
|
23
|
+
export function AgentName({ address, name, className, children }: { address: string; name?: string; className?: string; children?: ReactNode }) {
|
|
24
|
+
const [reveal, setReveal] = useState(false);
|
|
25
|
+
const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);
|
|
26
|
+
const raw = short(address) || address;
|
|
27
|
+
const shown = name || raw;
|
|
28
|
+
function press(event: React.PointerEvent) {
|
|
29
|
+
if (event.pointerType !== "touch") return;
|
|
30
|
+
clearTimeout(timer.current);
|
|
31
|
+
timer.current = setTimeout(() => {
|
|
32
|
+
setReveal(true);
|
|
33
|
+
timer.current = setTimeout(() => setReveal(false), REVEAL_MS);
|
|
34
|
+
}, LONG_PRESS_MS);
|
|
35
|
+
}
|
|
36
|
+
const cancel = () => { if (!reveal) clearTimeout(timer.current); };
|
|
37
|
+
return <span data-agent={address} title={address} onPointerDown={press} onPointerUp={cancel} onPointerCancel={cancel} onPointerLeave={cancel}
|
|
38
|
+
className={cn("inline-flex min-w-0 items-center gap-1.5", className)}>
|
|
39
|
+
<HarnessMark peer={peerOf(address)}/>
|
|
40
|
+
<span className={cn("min-w-0 truncate", reveal && "font-mono text-xs")}>{reveal ? raw : shown}</span>
|
|
41
|
+
{children}
|
|
42
|
+
</span>;
|
|
43
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator } from "@/components/ui/dropdown-menu";
|
|
2
|
+
import { ALERT_LEVELS } from "@/lib/alert-level";
|
|
3
|
+
|
|
4
|
+
// Which notifications buzz the phone; every message still reaches the chat. The levels and their ids live in web/lib.
|
|
5
|
+
export { ALERT_LEVELS };
|
|
6
|
+
|
|
7
|
+
/** The phone alert level as radio items inside the Notifications menu (server-side, honoured by hooks and the UI). */
|
|
8
|
+
export function AlertLevelItems({ level, set }) {
|
|
9
|
+
return <>
|
|
10
|
+
<DropdownMenuSeparator/>
|
|
11
|
+
<DropdownMenuLabel>Phone alerts</DropdownMenuLabel>
|
|
12
|
+
<DropdownMenuRadioGroup value={level} onValueChange={set}>
|
|
13
|
+
{ALERT_LEVELS.map(([id, text]) => <DropdownMenuRadioItem key={id} value={id}>{text}</DropdownMenuRadioItem>)}
|
|
14
|
+
</DropdownMenuRadioGroup>
|
|
15
|
+
</>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ui } from "../../../../server/instance.js";
|
|
2
|
+
|
|
3
|
+
export const runtime = "nodejs";
|
|
4
|
+
export const dynamic = "force-dynamic";
|
|
5
|
+
|
|
6
|
+
export async function GET(request, { params }) {
|
|
7
|
+
return (await ui()).auth(request, (await params).step);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export async function POST(request, { params }) {
|
|
11
|
+
return (await ui()).auth(request, (await params).step);
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ui } from "../../../server/instance.js";
|
|
2
|
+
|
|
3
|
+
export const runtime = "nodejs";
|
|
4
|
+
export const dynamic = "force-dynamic";
|
|
5
|
+
|
|
6
|
+
export async function GET(request) {
|
|
7
|
+
return (await ui()).land(request);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export async function POST(request) {
|
|
11
|
+
return (await ui()).handle(request, "land");
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ui } from "../../../../server/instance.js";
|
|
2
|
+
|
|
3
|
+
export const runtime = "nodejs";
|
|
4
|
+
export const dynamic = "force-dynamic";
|
|
5
|
+
|
|
6
|
+
export async function POST(request) {
|
|
7
|
+
return (await ui()).push(request, "subscribe");
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export async function DELETE(request) {
|
|
11
|
+
return (await ui()).push(request, "subscribe");
|
|
12
|
+
}
|