makersclaw 0.8.0 → 0.8.1
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/README.md +9 -3
- package/package.json +1 -1
- package/r/activity-log.json +52 -0
- package/r/agent-changes.json +51 -0
- package/r/agent-chat.json +53 -0
- package/r/agent-column.json +85 -0
- package/r/agent-dock.json +57 -0
- package/r/agent-kit.json +49 -0
- package/r/agent-marks.json +49 -0
- package/r/agent-pane.json +93 -0
- package/r/ai-action.json +56 -0
- package/r/annotate.json +3 -3
- package/r/approval-request.json +2 -2
- package/r/approval.json +54 -0
- package/r/ask-bar.json +50 -0
- package/r/audio-player.json +2 -2
- package/r/auth-form.json +2 -2
- package/r/automation-editor.json +66 -0
- package/r/automation-list.json +57 -0
- package/r/automation-model.json +118 -0
- package/r/automations-screen.json +71 -0
- package/r/board.json +2 -2
- package/r/calendar-view.json +3 -3
- package/r/cart.json +2 -2
- package/r/chart.json +2 -2
- package/r/chat-pane.json +84 -0
- package/r/chat.json +2 -2
- package/r/code-editor.json +2 -2
- package/r/comment-box.json +3 -3
- package/r/connect-card.json +51 -0
- package/r/contact-section.json +2 -2
- package/r/core.json +13 -7
- package/r/cost.json +51 -0
- package/r/csv-import.json +3 -3
- package/r/data-picker.json +60 -0
- package/r/data-table.json +2 -2
- package/r/diagram.json +2 -2
- package/r/doc-editor.json +2 -2
- package/r/doc-page.json +3 -3
- package/r/email-render.json +2 -2
- package/r/faq.json +2 -2
- package/r/file-upload.json +2 -2
- package/r/first-run.json +63 -0
- package/r/fix-note.json +57 -0
- package/r/flow-canvas.json +2 -2
- package/r/flow-editor.json +79 -0
- package/r/footer.json +2 -2
- package/r/gantt.json +3 -3
- package/r/job-panel.json +2 -2
- package/r/json-editor.json +3 -3
- package/r/library-shelf.json +56 -0
- package/r/map.json +2 -2
- package/r/margin-notes.json +67 -0
- package/r/menubar.json +2 -2
- package/r/mind-map.json +3 -3
- package/r/navigation-menu.json +2 -2
- package/r/needs-you.json +55 -0
- package/r/order-detail.json +2 -2
- package/r/org-chart.json +3 -3
- package/r/pace-bar.json +69 -0
- package/r/page-builder.json +2 -2
- package/r/payment-methods.json +2 -2
- package/r/pdf-document.json +2 -2
- package/r/pdf-viewer.json +2 -2
- package/r/product-detail.json +2 -2
- package/r/product-grid.json +3 -3
- package/r/record-form.json +2 -2
- package/r/record-grid.json +52 -0
- package/r/record-notes.json +4 -4
- package/r/registry.json +4086 -1512
- package/r/run-history.json +52 -0
- package/r/run-view.json +80 -0
- package/r/schedule-card.json +54 -0
- package/r/schedule-engine.json +79 -0
- package/r/schedule-gantt.json +83 -0
- package/r/schedule-ruler.json +64 -0
- package/r/search-dialog.json +2 -2
- package/r/settings-list.json +2 -2
- package/r/setup-checklist.json +2 -2
- package/r/share-dialog.json +2 -2
- package/r/sidebar.json +2 -2
- package/r/signature-pad.json +2 -2
- package/r/sketch-canvas.json +2 -2
- package/r/source-receipt.json +52 -0
- package/r/spreadsheet.json +3 -3
- package/r/stat-cards.json +3 -3
- package/r/step-picker.json +53 -0
- package/r/step-settings.json +72 -0
- package/r/suggestion.json +58 -0
- package/r/sum-bar.json +64 -0
- package/r/task-list.json +3 -3
- package/r/task-model.json +2 -2
- package/r/testimonials.json +2 -2
- package/r/tier-map.json +67 -0
- package/r/time-grid.json +73 -0
- package/r/time-strip.json +64 -0
- package/r/top-bar.json +66 -0
- package/r/transaction-list.json +2 -2
- package/r/trigger-picker.json +61 -0
- package/r/whiteboard.json +3 -3
- package/r/workflow-view.json +55 -0
- package/registry/blocks/activity-log/README.md +112 -0
- package/registry/blocks/activity-log/activity-log.jsx +351 -0
- package/registry/blocks/activity-log/block.json +33 -0
- package/registry/blocks/activity-log/demo.jsx +48 -0
- package/registry/blocks/activity-log/index.js +4 -0
- package/registry/blocks/agent-changes/README.md +94 -0
- package/registry/blocks/agent-changes/agent-changes.jsx +118 -0
- package/registry/blocks/agent-changes/block.json +28 -0
- package/registry/blocks/agent-changes/demo.jsx +39 -0
- package/registry/blocks/agent-changes/index.js +3 -0
- package/registry/blocks/agent-chat/README.md +145 -0
- package/registry/blocks/agent-chat/agent-chat.jsx +415 -0
- package/registry/blocks/agent-chat/block.json +30 -0
- package/registry/blocks/agent-chat/demo.jsx +165 -0
- package/registry/blocks/agent-chat/index.js +3 -0
- package/registry/blocks/agent-column/README.md +197 -0
- package/registry/blocks/agent-column/agent-column.jsx +492 -0
- package/registry/blocks/agent-column/block.json +67 -0
- package/registry/blocks/agent-column/column-picker.jsx +163 -0
- package/registry/blocks/agent-column/demo.jsx +50 -0
- package/registry/blocks/agent-column/index.js +7 -0
- package/registry/blocks/agent-column/model.js +164 -0
- package/registry/blocks/agent-column/receipt.jsx +483 -0
- package/registry/blocks/agent-column/spreadsheet-type.jsx +24 -0
- package/registry/blocks/agent-dock/README.md +210 -0
- package/registry/blocks/agent-dock/agent-dock.jsx +356 -0
- package/registry/blocks/agent-dock/block.json +47 -0
- package/registry/blocks/agent-dock/demo.jsx +153 -0
- package/registry/blocks/agent-dock/dock-model.js +118 -0
- package/registry/blocks/agent-dock/index.js +5 -0
- package/registry/blocks/agent-kit/README.md +73 -0
- package/registry/blocks/agent-kit/agent-kit.jsx +86 -0
- package/registry/blocks/agent-kit/block.json +10 -0
- package/registry/blocks/agent-kit/demo.jsx +35 -0
- package/registry/blocks/agent-kit/index.js +3 -0
- package/registry/blocks/agent-marks/README.md +80 -0
- package/registry/blocks/agent-marks/agent-marks.jsx +133 -0
- package/registry/blocks/agent-marks/block.json +27 -0
- package/registry/blocks/agent-marks/demo.jsx +49 -0
- package/registry/blocks/agent-marks/index.js +3 -0
- package/registry/blocks/agent-pane/README.md +225 -0
- package/registry/blocks/agent-pane/agent-pane.jsx +244 -0
- package/registry/blocks/agent-pane/block.json +41 -0
- package/registry/blocks/agent-pane/composer.jsx +6 -0
- package/registry/blocks/agent-pane/demo.jsx +233 -0
- package/registry/blocks/agent-pane/dock-context.js +10 -0
- package/registry/blocks/agent-pane/index.js +4 -0
- package/registry/blocks/agent-pane/prose.jsx +84 -0
- package/registry/blocks/agent-pane/questions.jsx +134 -0
- package/registry/blocks/agent-pane/transcript.jsx +268 -0
- package/registry/blocks/agent-pane/work.jsx +368 -0
- package/registry/blocks/ai-action/README.md +94 -0
- package/registry/blocks/ai-action/ai-action.jsx +188 -0
- package/registry/blocks/ai-action/block.json +34 -0
- package/registry/blocks/ai-action/demo.jsx +93 -0
- package/registry/blocks/ai-action/index.js +3 -0
- package/registry/blocks/approval/README.md +145 -0
- package/registry/blocks/approval/approval.jsx +163 -0
- package/registry/blocks/approval/block.json +31 -0
- package/registry/blocks/approval/demo.jsx +121 -0
- package/registry/blocks/approval/index.js +3 -0
- package/registry/blocks/ask-bar/README.md +105 -0
- package/registry/blocks/ask-bar/ask-bar.jsx +166 -0
- package/registry/blocks/ask-bar/block.json +26 -0
- package/registry/blocks/ask-bar/demo.jsx +78 -0
- package/registry/blocks/ask-bar/index.js +3 -0
- package/registry/blocks/automation-editor/README.md +291 -0
- package/registry/blocks/automation-editor/automation-editor.jsx +656 -0
- package/registry/blocks/automation-editor/block.json +39 -0
- package/registry/blocks/automation-editor/demo.jsx +284 -0
- package/registry/blocks/automation-editor/index.js +4 -0
- package/registry/blocks/automation-editor/run-inputs.jsx +82 -0
- package/registry/blocks/automation-list/README.md +129 -0
- package/registry/blocks/automation-list/automation-list.jsx +476 -0
- package/registry/blocks/automation-list/block.json +35 -0
- package/registry/blocks/automation-list/demo.jsx +67 -0
- package/registry/blocks/automation-list/index.js +3 -0
- package/registry/blocks/automation-model/README.md +109 -0
- package/registry/blocks/automation-model/block.json +135 -0
- package/registry/blocks/automation-model/catalog.js +256 -0
- package/registry/blocks/automation-model/check.js +161 -0
- package/registry/blocks/automation-model/demo.jsx +42 -0
- package/registry/blocks/automation-model/edit.js +262 -0
- package/registry/blocks/automation-model/fixes.js +287 -0
- package/registry/blocks/automation-model/glyph.jsx +13 -0
- package/registry/blocks/automation-model/graph.js +410 -0
- package/registry/blocks/automation-model/index.js +33 -0
- package/registry/blocks/automation-model/overlay.js +175 -0
- package/registry/blocks/automation-model/parts.jsx +94 -0
- package/registry/blocks/automation-model/schedule.js +53 -0
- package/registry/blocks/automation-model/templates.js +128 -0
- package/registry/blocks/automation-model/values.js +29 -0
- package/registry/blocks/automation-model/words.js +439 -0
- package/registry/blocks/automations-screen/README.md +207 -0
- package/registry/blocks/automations-screen/automations-screen.jsx +452 -0
- package/registry/blocks/automations-screen/block.json +47 -0
- package/registry/blocks/automations-screen/demo.jsx +364 -0
- package/registry/blocks/automations-screen/index.js +4 -0
- package/registry/blocks/automations-screen/screen-model.js +129 -0
- package/registry/blocks/chat-pane/README.md +143 -0
- package/registry/blocks/chat-pane/block.json +48 -0
- package/registry/blocks/chat-pane/chat-attach.js +166 -0
- package/registry/blocks/chat-pane/chat-composer.jsx +195 -0
- package/registry/blocks/chat-pane/chat-context.js +17 -0
- package/registry/blocks/chat-pane/chat-model.js +43 -0
- package/registry/blocks/chat-pane/chat-pane.jsx +398 -0
- package/registry/blocks/chat-pane/chats-list.jsx +52 -0
- package/registry/blocks/chat-pane/demo.jsx +103 -0
- package/registry/blocks/chat-pane/index.js +9 -0
- package/registry/blocks/connect-card/README.md +99 -0
- package/registry/blocks/connect-card/block.json +10 -0
- package/registry/blocks/connect-card/connect-card.jsx +103 -0
- package/registry/blocks/connect-card/demo.jsx +49 -0
- package/registry/blocks/connect-card/index.js +3 -0
- package/registry/blocks/cost/README.md +115 -0
- package/registry/blocks/cost/block.json +10 -0
- package/registry/blocks/cost/cost.jsx +176 -0
- package/registry/blocks/cost/demo.jsx +66 -0
- package/registry/blocks/cost/index.js +3 -0
- package/registry/blocks/data-picker/README.md +81 -0
- package/registry/blocks/data-picker/block.json +38 -0
- package/registry/blocks/data-picker/data-picker.jsx +210 -0
- package/registry/blocks/data-picker/demo.jsx +34 -0
- package/registry/blocks/data-picker/fields.js +89 -0
- package/registry/blocks/data-picker/index.js +4 -0
- package/registry/blocks/data-table/demo.jsx +1 -1
- package/registry/blocks/first-run/README.md +118 -0
- package/registry/blocks/first-run/block.json +11 -0
- package/registry/blocks/first-run/demo.jsx +88 -0
- package/registry/blocks/first-run/first-run-model.js +51 -0
- package/registry/blocks/first-run/first-run.jsx +156 -0
- package/registry/blocks/first-run/index.js +5 -0
- package/registry/blocks/first-run/probe-rules.js +26 -0
- package/registry/blocks/fix-note/README.md +79 -0
- package/registry/blocks/fix-note/block.json +35 -0
- package/registry/blocks/fix-note/demo.jsx +30 -0
- package/registry/blocks/fix-note/fix-note.jsx +235 -0
- package/registry/blocks/fix-note/index.js +3 -0
- package/registry/blocks/flow-editor/README.md +108 -0
- package/registry/blocks/flow-editor/block.json +44 -0
- package/registry/blocks/flow-editor/demo.jsx +115 -0
- package/registry/blocks/flow-editor/flow-canvas.jsx +568 -0
- package/registry/blocks/flow-editor/flow-editor.jsx +154 -0
- package/registry/blocks/flow-editor/index.js +6 -0
- package/registry/blocks/flow-editor/minimap.jsx +78 -0
- package/registry/blocks/flow-editor/outline.jsx +134 -0
- package/registry/blocks/library-shelf/README.md +117 -0
- package/registry/blocks/library-shelf/block.json +28 -0
- package/registry/blocks/library-shelf/demo.jsx +68 -0
- package/registry/blocks/library-shelf/index.js +3 -0
- package/registry/blocks/library-shelf/library-shelf.jsx +211 -0
- package/registry/blocks/library-shelf/probe-rules.js +15 -0
- package/registry/blocks/margin-notes/README.md +222 -0
- package/registry/blocks/margin-notes/block.json +10 -0
- package/registry/blocks/margin-notes/demo.jsx +144 -0
- package/registry/blocks/margin-notes/index.js +20 -0
- package/registry/blocks/margin-notes/margin-model.js +224 -0
- package/registry/blocks/margin-notes/margin-notes.jsx +465 -0
- package/registry/blocks/needs-you/README.md +177 -0
- package/registry/blocks/needs-you/block.json +34 -0
- package/registry/blocks/needs-you/demo.jsx +143 -0
- package/registry/blocks/needs-you/index.js +3 -0
- package/registry/blocks/needs-you/needs-you.jsx +441 -0
- package/registry/blocks/pace-bar/README.md +230 -0
- package/registry/blocks/pace-bar/block.json +10 -0
- package/registry/blocks/pace-bar/demo.jsx +255 -0
- package/registry/blocks/pace-bar/index.js +22 -0
- package/registry/blocks/pace-bar/pace-bar.jsx +461 -0
- package/registry/blocks/pace-bar/pace-model.js +288 -0
- package/registry/blocks/record-grid/README.md +100 -0
- package/registry/blocks/record-grid/block.json +28 -0
- package/registry/blocks/record-grid/demo.jsx +43 -0
- package/registry/blocks/record-grid/index.js +3 -0
- package/registry/blocks/record-grid/record-grid.jsx +251 -0
- package/registry/blocks/run-history/README.md +138 -0
- package/registry/blocks/run-history/block.json +10 -0
- package/registry/blocks/run-history/demo.jsx +74 -0
- package/registry/blocks/run-history/index.js +3 -0
- package/registry/blocks/run-history/run-history.jsx +218 -0
- package/registry/blocks/run-view/README.md +174 -0
- package/registry/blocks/run-view/block.json +50 -0
- package/registry/blocks/run-view/demo.jsx +286 -0
- package/registry/blocks/run-view/index.js +5 -0
- package/registry/blocks/run-view/run-controls.jsx +266 -0
- package/registry/blocks/run-view/run-view.jsx +236 -0
- package/registry/blocks/run-view/runs-list.jsx +99 -0
- package/registry/blocks/schedule-card/README.md +121 -0
- package/registry/blocks/schedule-card/block.json +10 -0
- package/registry/blocks/schedule-card/demo.jsx +82 -0
- package/registry/blocks/schedule-card/index.js +3 -0
- package/registry/blocks/schedule-card/schedule-card.jsx +136 -0
- package/registry/blocks/schedule-engine/README.md +137 -0
- package/registry/blocks/schedule-engine/block.json +10 -0
- package/registry/blocks/schedule-engine/demo.jsx +82 -0
- package/registry/blocks/schedule-engine/engine.js +769 -0
- package/registry/blocks/schedule-engine/index.js +9 -0
- package/registry/blocks/schedule-engine/ops.js +71 -0
- package/registry/blocks/schedule-engine/place.js +294 -0
- package/registry/blocks/schedule-engine/tree.js +79 -0
- package/registry/blocks/schedule-engine/waits.js +80 -0
- package/registry/blocks/schedule-gantt/README.md +159 -0
- package/registry/blocks/schedule-gantt/block.json +10 -0
- package/registry/blocks/schedule-gantt/demo.jsx +223 -0
- package/registry/blocks/schedule-gantt/gantt-model.js +219 -0
- package/registry/blocks/schedule-gantt/geometry.js +176 -0
- package/registry/blocks/schedule-gantt/index.js +26 -0
- package/registry/blocks/schedule-gantt/schedule-gantt.jsx +882 -0
- package/registry/blocks/schedule-gantt/sheet.jsx +372 -0
- package/registry/blocks/schedule-gantt/track.jsx +190 -0
- package/registry/blocks/schedule-ruler/README.md +148 -0
- package/registry/blocks/schedule-ruler/block.json +10 -0
- package/registry/blocks/schedule-ruler/demo.jsx +181 -0
- package/registry/blocks/schedule-ruler/index.js +21 -0
- package/registry/blocks/schedule-ruler/ruler-model.js +239 -0
- package/registry/blocks/schedule-ruler/schedule-ruler.jsx +548 -0
- package/registry/blocks/source-receipt/README.md +97 -0
- package/registry/blocks/source-receipt/block.json +30 -0
- package/registry/blocks/source-receipt/demo.jsx +71 -0
- package/registry/blocks/source-receipt/index.js +3 -0
- package/registry/blocks/source-receipt/source-receipt.jsx +107 -0
- package/registry/blocks/spreadsheet/spreadsheet.jsx +15 -1
- package/registry/blocks/step-picker/README.md +78 -0
- package/registry/blocks/step-picker/block.json +31 -0
- package/registry/blocks/step-picker/demo.jsx +23 -0
- package/registry/blocks/step-picker/index.js +3 -0
- package/registry/blocks/step-picker/step-picker.jsx +144 -0
- package/registry/blocks/step-settings/README.md +100 -0
- package/registry/blocks/step-settings/block.json +44 -0
- package/registry/blocks/step-settings/demo.jsx +93 -0
- package/registry/blocks/step-settings/fields.jsx +58 -0
- package/registry/blocks/step-settings/flow-settings.jsx +115 -0
- package/registry/blocks/step-settings/index.js +5 -0
- package/registry/blocks/step-settings/step-settings.jsx +290 -0
- package/registry/blocks/suggestion/README.md +171 -0
- package/registry/blocks/suggestion/block.json +40 -0
- package/registry/blocks/suggestion/demo.jsx +91 -0
- package/registry/blocks/suggestion/index.js +3 -0
- package/registry/blocks/suggestion/suggestion.jsx +436 -0
- package/registry/blocks/sum-bar/README.md +122 -0
- package/registry/blocks/sum-bar/block.json +10 -0
- package/registry/blocks/sum-bar/demo.jsx +110 -0
- package/registry/blocks/sum-bar/index.js +5 -0
- package/registry/blocks/sum-bar/sum-bar.jsx +209 -0
- package/registry/blocks/sum-bar/sum-model.js +126 -0
- package/registry/blocks/tier-map/README.md +217 -0
- package/registry/blocks/tier-map/block.json +10 -0
- package/registry/blocks/tier-map/demo.jsx +222 -0
- package/registry/blocks/tier-map/index.js +24 -0
- package/registry/blocks/tier-map/tier-map.jsx +574 -0
- package/registry/blocks/tier-map/tier-model.js +318 -0
- package/registry/blocks/time-grid/README.md +305 -0
- package/registry/blocks/time-grid/block.json +10 -0
- package/registry/blocks/time-grid/demo.jsx +279 -0
- package/registry/blocks/time-grid/grid-model.js +322 -0
- package/registry/blocks/time-grid/index.js +25 -0
- package/registry/blocks/time-grid/time-grid.jsx +1325 -0
- package/registry/blocks/time-strip/README.md +141 -0
- package/registry/blocks/time-strip/block.json +10 -0
- package/registry/blocks/time-strip/demo.jsx +129 -0
- package/registry/blocks/time-strip/index.js +19 -0
- package/registry/blocks/time-strip/strip-model.js +178 -0
- package/registry/blocks/time-strip/time-strip.jsx +260 -0
- package/registry/blocks/top-bar/README.md +149 -0
- package/registry/blocks/top-bar/block.json +35 -0
- package/registry/blocks/top-bar/demo.jsx +78 -0
- package/registry/blocks/top-bar/index.js +5 -0
- package/registry/blocks/top-bar/probe-rules.js +74 -0
- package/registry/blocks/top-bar/top-bar-model.js +152 -0
- package/registry/blocks/top-bar/top-bar.jsx +244 -0
- package/registry/blocks/trigger-picker/README.md +98 -0
- package/registry/blocks/trigger-picker/block.json +38 -0
- package/registry/blocks/trigger-picker/demo.jsx +59 -0
- package/registry/blocks/trigger-picker/index.js +3 -0
- package/registry/blocks/trigger-picker/trigger-picker.jsx +374 -0
- package/registry/blocks/workflow-view/README.md +123 -0
- package/registry/blocks/workflow-view/block.json +10 -0
- package/registry/blocks/workflow-view/demo.jsx +90 -0
- package/registry/blocks/workflow-view/index.js +3 -0
- package/registry/blocks/workflow-view/workflow-view.jsx +203 -0
- package/src/install.mjs +77 -16
- package/src/registry.mjs +3 -0
- package/templates/next/browser/lib/data.js +6 -1
- package/templates/next/files/README.md +627 -24
- package/templates/next/files/check/automation-format.ts +2103 -0
- package/templates/next/files/check/automation-package.ts +142 -0
- package/templates/next/files/check/run.mjs +968 -9
- package/templates/next/files/components/ui/field.jsx +17 -4
- package/templates/next/files/components/ui/icon.jsx +13 -0
- package/templates/next/files/components/ui/index.js +2 -1
- package/templates/next/files/components/ui/layout.jsx +77 -2
- package/templates/next/files/components/ui/notice.jsx +70 -0
- package/templates/next/files/components/ui/page.jsx +124 -0
- package/templates/next/files/components/ui/stat.jsx +22 -7
- package/templates/next/files/components/ui/toast.jsx +6 -3
- package/templates/next/files/lib/automations.js +660 -0
- package/templates/next/files/lib/claw.js +241 -5
- package/templates/next/files/lib/door.js +92 -0
- package/templates/next/files/lib/hooks.js +1627 -8
- package/templates/next/files/lib/platform.js +529 -21
- package/templates/next/template.json +13 -3
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { Button, Icon, Input, cx } from "../../ui";
|
|
5
|
+
|
|
6
|
+
// The agent's questions, as the desk's sidebar asks them (D27): every
|
|
7
|
+
// question waiting is one form — its words, its options as chips, a box
|
|
8
|
+
// for the member's own words where it welcomes them — and one submit
|
|
9
|
+
// answers them all in a single resume, so an eight-question setup is one
|
|
10
|
+
// form fill, not eight round trips. A lone question with options keeps the
|
|
11
|
+
// old immediacy: a press on an option answers it.
|
|
12
|
+
//
|
|
13
|
+
// Fed by useAgentPane(): `questions` is chat.view.questions, `onSubmit` is
|
|
14
|
+
// chat.answer({ answers }) → { ok } | { ok: false, error }. The door checks
|
|
15
|
+
// each answer against the question as the session holds it.
|
|
16
|
+
|
|
17
|
+
export function QuestionForm({ questions, onSubmit, className }) {
|
|
18
|
+
const [answers, setAnswers] = useState({});
|
|
19
|
+
const [busy, setBusy] = useState(false);
|
|
20
|
+
const [error, setError] = useState(null);
|
|
21
|
+
const [sent, setSent] = useState(false);
|
|
22
|
+
if (!onSubmit || !questions?.length) return null;
|
|
23
|
+
const single = questions.length === 1;
|
|
24
|
+
|
|
25
|
+
const answered = (q) => {
|
|
26
|
+
const a = answers[q.id];
|
|
27
|
+
return Boolean(a?.optionId || a?.text?.trim());
|
|
28
|
+
};
|
|
29
|
+
const complete = questions.every(answered);
|
|
30
|
+
// A lone question that takes its options only is answered by a press on
|
|
31
|
+
// one; every other form has its submit.
|
|
32
|
+
const showSend = !single || questions[0].free !== false || !(questions[0].options?.length ?? 0);
|
|
33
|
+
|
|
34
|
+
async function send(list) {
|
|
35
|
+
if (busy || sent) return;
|
|
36
|
+
setBusy(true);
|
|
37
|
+
setError(null);
|
|
38
|
+
let r;
|
|
39
|
+
try {
|
|
40
|
+
r = await onSubmit(list);
|
|
41
|
+
} catch (e) {
|
|
42
|
+
r = { ok: false, error: e?.message ?? String(e) };
|
|
43
|
+
}
|
|
44
|
+
setBusy(false);
|
|
45
|
+
if (r && r.ok === false) setError(r.error || "That did not go through. Try again.");
|
|
46
|
+
else setSent(true);
|
|
47
|
+
}
|
|
48
|
+
const submit = () => {
|
|
49
|
+
if (!complete) return;
|
|
50
|
+
send(
|
|
51
|
+
questions.map((q) => {
|
|
52
|
+
const a = answers[q.id];
|
|
53
|
+
return a?.optionId ? { requestId: q.id, optionId: a.optionId } : { requestId: q.id, text: a?.text?.trim() ?? "" };
|
|
54
|
+
}),
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
if (sent)
|
|
59
|
+
return (
|
|
60
|
+
<p role="status" className={cx("flex items-center gap-2 text-sm text-success", className)}>
|
|
61
|
+
<Icon name="check" size={14} className="shrink-0" /> Sent. The agent is on it.
|
|
62
|
+
</p>
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<form
|
|
67
|
+
aria-label={single ? "A question for you" : `${questions.length} questions for you`}
|
|
68
|
+
className={cx("grid min-w-0 gap-3", className)}
|
|
69
|
+
onSubmit={(e) => {
|
|
70
|
+
e.preventDefault();
|
|
71
|
+
submit();
|
|
72
|
+
}}
|
|
73
|
+
>
|
|
74
|
+
{questions.map((q, index) => {
|
|
75
|
+
const a = answers[q.id];
|
|
76
|
+
const hasOptions = (q.options?.length ?? 0) > 0;
|
|
77
|
+
const free = q.free !== false || !hasOptions;
|
|
78
|
+
return (
|
|
79
|
+
<div key={q.id} className="grid min-w-0 gap-1.5">
|
|
80
|
+
<p className="flex min-w-0 items-start gap-2 text-sm font-medium">
|
|
81
|
+
{single ? null : (
|
|
82
|
+
<span className="mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-full bg-muted text-[11px] tabular-nums text-muted-foreground">{index + 1}</span>
|
|
83
|
+
)}
|
|
84
|
+
<span className="min-w-0 break-words">{q.prompt}</span>
|
|
85
|
+
</p>
|
|
86
|
+
{hasOptions ? (
|
|
87
|
+
<div className="flex min-w-0 flex-wrap gap-1.5">
|
|
88
|
+
{q.options.map((o) => (
|
|
89
|
+
<Button
|
|
90
|
+
key={o.id}
|
|
91
|
+
size="sm"
|
|
92
|
+
variant={a?.optionId === o.id ? "primary" : "secondary"}
|
|
93
|
+
aria-pressed={a?.optionId === o.id}
|
|
94
|
+
disabled={busy}
|
|
95
|
+
onClick={() => {
|
|
96
|
+
// A lone question with options answers on the spot.
|
|
97
|
+
if (single) {
|
|
98
|
+
send([{ requestId: q.id, optionId: o.id }]);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
setAnswers((prev) => ({ ...prev, [q.id]: prev[q.id]?.optionId === o.id ? {} : { optionId: o.id } }));
|
|
102
|
+
}}
|
|
103
|
+
>
|
|
104
|
+
{o.label}
|
|
105
|
+
</Button>
|
|
106
|
+
))}
|
|
107
|
+
</div>
|
|
108
|
+
) : null}
|
|
109
|
+
{free ? (
|
|
110
|
+
<Input
|
|
111
|
+
aria-label={hasOptions ? `Or answer “${q.prompt}” in your own words` : `Answer “${q.prompt}”`}
|
|
112
|
+
placeholder={hasOptions ? "Or answer in your own words…" : "Your answer…"}
|
|
113
|
+
value={a?.text ?? ""}
|
|
114
|
+
disabled={busy}
|
|
115
|
+
onChange={(e) => setAnswers((prev) => ({ ...prev, [q.id]: e.target.value ? { text: e.target.value } : {} }))}
|
|
116
|
+
className="min-w-0"
|
|
117
|
+
/>
|
|
118
|
+
) : null}
|
|
119
|
+
</div>
|
|
120
|
+
);
|
|
121
|
+
})}
|
|
122
|
+
{showSend ? (
|
|
123
|
+
<Button size="sm" variant="primary" type="submit" loading={busy} disabled={!complete || busy} className="justify-self-start">
|
|
124
|
+
{single ? "Send answer" : "Send answers"}
|
|
125
|
+
</Button>
|
|
126
|
+
) : null}
|
|
127
|
+
{error ? (
|
|
128
|
+
<p role="alert" className="text-xs text-destructive">
|
|
129
|
+
{error}
|
|
130
|
+
</p>
|
|
131
|
+
) : null}
|
|
132
|
+
</form>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Button, Icon, Spinner, cx } from "../../ui";
|
|
4
|
+
import { Prose } from "./prose";
|
|
5
|
+
import { WorkBlock } from "./work";
|
|
6
|
+
|
|
7
|
+
// The cards of a turn, as the desk's sidebar draws them (D27): the plan
|
|
8
|
+
// checklist, the one-line receipt an answered card shrinks to, the
|
|
9
|
+
// "Needs your OK" note, an app it made, everything it made, a sign-in it
|
|
10
|
+
// asks for. What each holds is decided by the platform (the rules the
|
|
11
|
+
// sidebar runs) and arrives as data; these draw it.
|
|
12
|
+
|
|
13
|
+
/* ---- the plan -------------------------------------------------------- */
|
|
14
|
+
|
|
15
|
+
const PLAN_LABEL = { done: "Done", active: "Working on it", waiting: "Waiting for you", pending: "Not started", cancelled: "Dropped" };
|
|
16
|
+
|
|
17
|
+
function PlanMark({ state }) {
|
|
18
|
+
const label = PLAN_LABEL[state] ?? "";
|
|
19
|
+
if (state === "done") return <Icon name="circle-check" size={14} className="shrink-0 text-success" label={label} />;
|
|
20
|
+
if (state === "active") return <Spinner size="sm" label={label} className="shrink-0 text-primary" />;
|
|
21
|
+
if (state === "waiting") return <Icon name="warning" size={14} className="shrink-0 text-warning" label={label} />;
|
|
22
|
+
if (state === "cancelled") return <Icon name="circle-x" size={14} className="shrink-0 text-muted-foreground" label={label} />;
|
|
23
|
+
return <Icon name="circle" size={14} className="shrink-0 text-muted-foreground" label={label} />;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function PlanCard({ items }) {
|
|
27
|
+
return (
|
|
28
|
+
<ol aria-label="The plan" className="grid min-w-0 divide-y divide-border overflow-hidden rounded-lg border border-border bg-card">
|
|
29
|
+
{items.map((item, i) => (
|
|
30
|
+
<li
|
|
31
|
+
key={`${i}-${item.text}`}
|
|
32
|
+
data-state={item.state}
|
|
33
|
+
className={cx("flex min-w-0 items-start gap-2 px-2.5 py-1.5 text-xs", item.state === "done" || item.state === "cancelled" ? "text-muted-foreground" : "text-foreground")}
|
|
34
|
+
>
|
|
35
|
+
<span className="mt-px">
|
|
36
|
+
<PlanMark state={item.state} />
|
|
37
|
+
</span>
|
|
38
|
+
<span className={cx("min-w-0 flex-1 break-words", item.state === "cancelled" && "line-through")}>{item.text}</span>
|
|
39
|
+
{item.state === "waiting" ? <span className="shrink-0 text-warning">Waiting for you</span> : null}
|
|
40
|
+
</li>
|
|
41
|
+
))}
|
|
42
|
+
</ol>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* ---- decided cards, one line ------------------------------------------ */
|
|
47
|
+
|
|
48
|
+
function Receipt({ block }) {
|
|
49
|
+
const clip = (s) => (s.length > 60 ? `${s.slice(0, 59)}…` : s);
|
|
50
|
+
const line =
|
|
51
|
+
block.decision === "approved"
|
|
52
|
+
? `You approved · ${block.text}`
|
|
53
|
+
: block.decision === "declined"
|
|
54
|
+
? `Not now · ${block.text}`
|
|
55
|
+
: block.prompt
|
|
56
|
+
? `You answered “${clip(block.prompt)}” · ${block.text}`
|
|
57
|
+
: `You answered · ${block.text}`;
|
|
58
|
+
return (
|
|
59
|
+
<div role="status" data-decision={block.decision} className="flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground">
|
|
60
|
+
<Icon name={block.decision === "declined" ? "x" : "check"} size={12} className="shrink-0" />
|
|
61
|
+
<span className="min-w-0 truncate" title={line}>
|
|
62
|
+
{line}
|
|
63
|
+
</span>
|
|
64
|
+
</div>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Parked tool approvals and the one ask, listed. Pressing happens in the
|
|
69
|
+
* bar under the thread (the `approval` block) or on the desk. */
|
|
70
|
+
function ApprovalNote({ block }) {
|
|
71
|
+
return (
|
|
72
|
+
<div role="group" aria-label="Needs your OK" className="grid min-w-0 gap-1 rounded-lg border border-warning/50 bg-card px-2.5 py-2 text-xs">
|
|
73
|
+
<span className="font-medium text-warning">Needs your OK</span>
|
|
74
|
+
<ul className="grid gap-0.5">
|
|
75
|
+
{block.items.map((item) => (
|
|
76
|
+
<li key={item.id} className="min-w-0 break-words">
|
|
77
|
+
{item.ask}
|
|
78
|
+
{item.grant ? <span className="block text-muted-foreground">{item.grant}</span> : null}
|
|
79
|
+
</li>
|
|
80
|
+
))}
|
|
81
|
+
</ul>
|
|
82
|
+
</div>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function RaisedNote({ block }) {
|
|
87
|
+
return (
|
|
88
|
+
<div className="flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground">
|
|
89
|
+
<Icon name="warning" size={12} className="shrink-0 text-warning" />
|
|
90
|
+
<span className="min-w-0 truncate">{block.text} It waits on the desk.</span>
|
|
91
|
+
</div>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function Authorization({ block }) {
|
|
96
|
+
if (block.state === "completed") {
|
|
97
|
+
return (
|
|
98
|
+
<div role="status" className="flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground">
|
|
99
|
+
<Icon name={block.outcome === "authorized" ? "check" : "x"} size={12} className="shrink-0" />
|
|
100
|
+
<span className="min-w-0 truncate">{block.outcome === "authorized" ? `Signed in to ${block.name}` : `The sign-in to ${block.name} didn’t finish`}</span>
|
|
101
|
+
</div>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
return (
|
|
105
|
+
<div role="group" aria-label="Needs your OK" className="grid min-w-0 gap-2 rounded-lg border border-warning/50 bg-card px-2.5 py-2 text-xs">
|
|
106
|
+
<span className="font-medium text-warning">Needs you</span>
|
|
107
|
+
<span>Sign in to {block.name} so the agent can carry on.</span>
|
|
108
|
+
{block.url ? (
|
|
109
|
+
<a
|
|
110
|
+
href={block.url}
|
|
111
|
+
target="_blank"
|
|
112
|
+
rel="noopener noreferrer"
|
|
113
|
+
className="inline-flex w-fit items-center gap-1 rounded-md bg-primary px-2.5 py-1 text-primary-foreground hover:opacity-90"
|
|
114
|
+
>
|
|
115
|
+
{block.instructions ?? "Sign in"}
|
|
116
|
+
{block.userCode ? ` (code: ${block.userCode})` : ""}
|
|
117
|
+
</a>
|
|
118
|
+
) : null}
|
|
119
|
+
</div>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/* ---- what it made ------------------------------------------------------ */
|
|
124
|
+
|
|
125
|
+
const APP_WORD = { building: "Being built", running: "Running", live: "Live", updated: "Updated", installed: "Installed" };
|
|
126
|
+
|
|
127
|
+
function AppCard({ app, onOpen }) {
|
|
128
|
+
return (
|
|
129
|
+
<div data-app={app.key} className="flex min-w-0 items-center gap-2.5 rounded-lg border border-border bg-card px-3 py-2">
|
|
130
|
+
<Icon name="layers" size={18} className="shrink-0 text-muted-foreground" />
|
|
131
|
+
<div className="grid min-w-0 flex-1">
|
|
132
|
+
<b className="truncate text-sm">{app.name}</b>
|
|
133
|
+
<span className="text-xs text-muted-foreground">{APP_WORD[app.state] ?? app.state}</span>
|
|
134
|
+
</div>
|
|
135
|
+
{onOpen && app.id ? (
|
|
136
|
+
<Button size="sm" variant="secondary" onClick={() => onOpen({ kind: "app", id: app.id })}>
|
|
137
|
+
Open
|
|
138
|
+
</Button>
|
|
139
|
+
) : null}
|
|
140
|
+
</div>
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function FileRow({ file, onOpen }) {
|
|
145
|
+
const body = (
|
|
146
|
+
<>
|
|
147
|
+
<span className="shrink-0 rounded-sm bg-muted px-1.5 py-0.5 font-mono text-[10px] font-medium text-muted-foreground">{file.kind}</span>
|
|
148
|
+
<span className="min-w-0 flex-1 truncate" title={file.url ?? file.path}>
|
|
149
|
+
{file.name}
|
|
150
|
+
</span>
|
|
151
|
+
{file.meta ? <span className="shrink-0 text-muted-foreground">{file.meta}</span> : null}
|
|
152
|
+
</>
|
|
153
|
+
);
|
|
154
|
+
const cls = "flex w-full min-w-0 items-center gap-2 px-2.5 py-1.5 text-left text-xs";
|
|
155
|
+
// An address opens in a tab; only http(s) is one.
|
|
156
|
+
if (file.where === "web" && file.url && /^https?:\/\//i.test(file.url))
|
|
157
|
+
return (
|
|
158
|
+
<a className={cx(cls, "hover:bg-muted")} href={file.url} target="_blank" rel="noopener noreferrer">
|
|
159
|
+
{body}
|
|
160
|
+
</a>
|
|
161
|
+
);
|
|
162
|
+
if (onOpen && (file.where === "workspace" || (file.where === "app" && file.appRef)))
|
|
163
|
+
return (
|
|
164
|
+
<button type="button" className={cx(cls, "hover:bg-muted")} onClick={() => onOpen({ kind: "file", path: file.path, where: file.where, appRef: file.appRef })}>
|
|
165
|
+
{body}
|
|
166
|
+
</button>
|
|
167
|
+
);
|
|
168
|
+
return <div className={cls}>{body}</div>;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function MadeList({ block, onOpen }) {
|
|
172
|
+
return (
|
|
173
|
+
<div className="grid min-w-0 gap-1.5">
|
|
174
|
+
<p className="text-sm">Here’s everything I made:</p>
|
|
175
|
+
<ul aria-label="Everything I made" className="grid min-w-0 divide-y divide-border overflow-hidden rounded-lg border border-border bg-card">
|
|
176
|
+
{block.apps.map((app) => (
|
|
177
|
+
<li key={`app-${app.key}`}>
|
|
178
|
+
<div className="flex min-w-0 items-center gap-2 px-2.5 py-1.5 text-xs">
|
|
179
|
+
<span className="shrink-0 rounded-sm bg-muted px-1.5 py-0.5 font-mono text-[10px] font-medium text-muted-foreground">APP</span>
|
|
180
|
+
<span className="min-w-0 flex-1 truncate">{app.name}</span>
|
|
181
|
+
<span className="shrink-0 text-muted-foreground">{APP_WORD[app.state] ?? app.state}</span>
|
|
182
|
+
{onOpen && app.id ? (
|
|
183
|
+
<Button size="sm" variant="quiet" onClick={() => onOpen({ kind: "app", id: app.id })}>
|
|
184
|
+
Open
|
|
185
|
+
</Button>
|
|
186
|
+
) : null}
|
|
187
|
+
</div>
|
|
188
|
+
</li>
|
|
189
|
+
))}
|
|
190
|
+
{block.files.map((file) => (
|
|
191
|
+
<li key={file.url ?? file.path}>
|
|
192
|
+
<FileRow file={file} onOpen={onOpen} />
|
|
193
|
+
</li>
|
|
194
|
+
))}
|
|
195
|
+
</ul>
|
|
196
|
+
</div>
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function AttachedFile({ block }) {
|
|
201
|
+
return (
|
|
202
|
+
<span className="inline-flex w-fit max-w-full min-w-0 items-center gap-1.5 rounded-md border border-border px-2 py-1 text-xs">
|
|
203
|
+
<Icon name="paperclip" size={12} className="shrink-0 text-muted-foreground" />
|
|
204
|
+
<span className="min-w-0 truncate">{block.name}</span>
|
|
205
|
+
</span>
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/* ---- the member's words ------------------------------------------------ */
|
|
210
|
+
|
|
211
|
+
export function MemberWords({ children, files = [] }) {
|
|
212
|
+
return (
|
|
213
|
+
<div className="ml-auto grid max-w-[85%] min-w-0 gap-1.5 justify-items-end">
|
|
214
|
+
{files.map((f, i) => (
|
|
215
|
+
<span key={`${f.name}-${i}`} className="inline-flex max-w-full min-w-0 items-center gap-1.5 rounded-md border border-border px-2 py-1 text-xs">
|
|
216
|
+
<Icon name="paperclip" size={12} className="shrink-0 text-muted-foreground" />
|
|
217
|
+
<span className="min-w-0 truncate">{f.name}</span>
|
|
218
|
+
</span>
|
|
219
|
+
))}
|
|
220
|
+
{children ? <div className="min-w-0 whitespace-pre-wrap break-words rounded-[var(--radius)] bg-muted px-2.5 py-1.5">{children}</div> : null}
|
|
221
|
+
</div>
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/* ---- a message ---------------------------------------------------------- */
|
|
226
|
+
|
|
227
|
+
function Block({ block, live, load, onOpen, onOpenRequest }) {
|
|
228
|
+
switch (block.kind) {
|
|
229
|
+
case "text":
|
|
230
|
+
return <Prose text={block.streaming ? `${block.text}▍` : block.text} />;
|
|
231
|
+
case "plan":
|
|
232
|
+
return <PlanCard items={block.items} />;
|
|
233
|
+
case "work":
|
|
234
|
+
return <WorkBlock runs={block.runs} live={live} load={load} onOpenRequest={onOpenRequest} />;
|
|
235
|
+
case "approval":
|
|
236
|
+
return <ApprovalNote block={block} />;
|
|
237
|
+
case "receipt":
|
|
238
|
+
return <Receipt block={block} />;
|
|
239
|
+
case "raised":
|
|
240
|
+
return <RaisedNote block={block} />;
|
|
241
|
+
case "app":
|
|
242
|
+
// A card for an app only once it can be used; a building one waits.
|
|
243
|
+
return block.app.state === "building" ? null : <AppCard app={block.app} onOpen={onOpen} />;
|
|
244
|
+
case "made":
|
|
245
|
+
return <MadeList block={block} onOpen={onOpen} />;
|
|
246
|
+
case "file":
|
|
247
|
+
return <AttachedFile block={block} />;
|
|
248
|
+
case "authorization":
|
|
249
|
+
return <Authorization block={block} />;
|
|
250
|
+
default:
|
|
251
|
+
return null;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/** One message of the thread: the member's bubble, or the agent's blocks in order. */
|
|
256
|
+
export function Message({ message, load, onOpen, onOpenRequest, mark }) {
|
|
257
|
+
if (message.role === "user") return <MemberWords files={message.files}>{message.text}</MemberWords>;
|
|
258
|
+
return (
|
|
259
|
+
<div data-role="assistant" className="flex min-w-0 items-start gap-2">
|
|
260
|
+
{mark ? <span className="mt-0.5 shrink-0">{mark}</span> : null}
|
|
261
|
+
<div className="grid min-w-0 flex-1 gap-2">
|
|
262
|
+
{message.blocks.map((block) => (
|
|
263
|
+
<Block key={block.key} block={block} live={message.live} load={load} onOpen={onOpen} onOpenRequest={onOpenRequest} />
|
|
264
|
+
))}
|
|
265
|
+
</div>
|
|
266
|
+
</div>
|
|
267
|
+
);
|
|
268
|
+
}
|