@hanzo/dev 4.0.1 → 4.2.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/LICENSE +21 -0
- package/dist/{BinaryViewer-qn8xfPZp.js → BinaryViewer-CmFUK4zZ.js} +2 -2
- package/dist/{ChatMarkdown-Cyujn3JJ.js → ChatMarkdown-nvEI7iCv.js} +4 -4
- package/dist/{DiffCommentAnnotation-BZu1TP6E.js → DiffCommentAnnotation-BPTN_2a6.js} +1 -1
- package/dist/{DiffFileTree-CcJ91zOM.js → DiffFileTree-B_br90vY.js} +2 -2
- package/dist/{DiffPanel-BXC88NMs.js → DiffPanel-V5R5TPuK.js} +5 -5
- package/dist/{ExpandedImageDialog-BZnGRBJR.js → ExpandedImageDialog-CAorLacL.js} +1 -1
- package/dist/{FileExplorerPane-vBJS6V75.js → FileExplorerPane-CeHulcPz.js} +1 -1
- package/dist/{FilePreviewPanel-jJHWsMzm.js → FilePreviewPanel-BVNLvWOc.js} +8 -8
- package/dist/{MermaidDiagram-paNwQY33.js → MermaidDiagram-CTolIzQD.js} +1 -1
- package/dist/{MermaidFilePreview-B9KxfnIN.js → MermaidFilePreview-CP2zP4FU.js} +1 -1
- package/dist/{MermaidViewer-CAEGpLyD.js → MermaidViewer-BDfYkS9E.js} +2 -2
- package/dist/{NotebookPreview-D01mMCpR.js → NotebookPreview-Cybs5uM0.js} +1 -1
- package/dist/{OfficeFilePreview-DWaRgfQU.js → OfficeFilePreview-7JsmSoKU.js} +1 -1
- package/dist/{OfficeViewer-BudrZbBA.js → OfficeViewer-CJoojlJK.js} +1 -1
- package/dist/{OpenInPicker-Dd3ifHa1.js → OpenInPicker-BIMWUxBP.js} +7 -7
- package/dist/{OpenXmlOfficeViewer-CXcKdq7k.js → OpenXmlOfficeViewer-C24Kj8DM.js} +1 -1
- package/dist/{PreviewImage-C4Ku4z7v.js → PreviewImage-oY5YnuTr.js} +1 -1
- package/dist/{PreviewImageContent-BwOB9Lyd.js → PreviewImageContent-n6eLzY99.js} +1 -1
- package/dist/{PullRequestCodeTab-BcwyMk7d.js → PullRequestCodeTab-Dv_0kVad.js} +7 -7
- package/dist/{PullRequestReviewAnnotation-BU5t_1fC.js → PullRequestReviewAnnotation-LeuwO-iH.js} +4 -4
- package/dist/builder/activity.d.ts +16 -0
- package/dist/builder/activity.js +51 -0
- package/dist/builder/address.d.ts +11 -0
- package/dist/builder/address.js +50 -0
- package/dist/builder/ago.d.ts +2 -0
- package/dist/builder/ago.js +18 -0
- package/dist/builder/api/agents.d.ts +139 -0
- package/dist/builder/api/agents.js +253 -0
- package/dist/builder/api/auto.d.ts +166 -0
- package/dist/builder/api/auto.js +300 -0
- package/dist/builder/api/billing.d.ts +263 -0
- package/dist/builder/api/billing.js +401 -0
- package/dist/builder/api/call.d.ts +53 -0
- package/dist/builder/api/call.js +123 -0
- package/dist/builder/api/capabilities.d.ts +14 -0
- package/dist/builder/api/capabilities.js +41 -0
- package/dist/builder/api/changes.d.ts +74 -0
- package/dist/builder/api/changes.js +75 -0
- package/dist/builder/api/chat.d.ts +12 -0
- package/dist/builder/api/chat.js +28 -0
- package/dist/builder/api/cli.d.ts +59 -0
- package/dist/builder/api/cli.js +133 -0
- package/dist/builder/api/codebases.d.ts +46 -0
- package/dist/builder/api/codebases.js +100 -0
- package/dist/builder/api/coding.d.ts +117 -0
- package/dist/builder/api/coding.js +222 -0
- package/dist/builder/api/connectors.d.ts +76 -0
- package/dist/builder/api/connectors.js +111 -0
- package/dist/builder/api/consent.d.ts +22 -0
- package/dist/builder/api/consent.js +28 -0
- package/dist/builder/api/conversations.d.ts +20 -0
- package/dist/builder/api/conversations.js +23 -0
- package/dist/builder/api/draft.d.ts +38 -0
- package/dist/builder/api/draft.js +87 -0
- package/dist/builder/api/environment.d.ts +55 -0
- package/dist/builder/api/environment.js +126 -0
- package/dist/builder/api/gallery.d.ts +32 -0
- package/dist/builder/api/gallery.js +85 -0
- package/dist/builder/api/git.d.ts +59 -0
- package/dist/builder/api/git.js +117 -0
- package/dist/builder/api/github.d.ts +230 -0
- package/dist/builder/api/github.js +373 -0
- package/dist/builder/api/keys.d.ts +35 -0
- package/dist/builder/api/keys.js +72 -0
- package/dist/builder/api/library.d.ts +116 -0
- package/dist/builder/api/library.js +214 -0
- package/dist/builder/api/limits.d.ts +69 -0
- package/dist/builder/api/limits.js +86 -0
- package/dist/builder/api/links.d.ts +51 -0
- package/dist/builder/api/links.js +75 -0
- package/dist/builder/api/machines.d.ts +122 -0
- package/dist/builder/api/machines.js +238 -0
- package/dist/builder/api/mcp.d.ts +10 -0
- package/dist/builder/api/mcp.js +47 -0
- package/dist/builder/api/members.d.ts +35 -0
- package/dist/builder/api/members.js +95 -0
- package/dist/builder/api/memory.d.ts +14 -0
- package/dist/builder/api/memory.js +35 -0
- package/dist/builder/api/models.d.ts +17 -0
- package/dist/builder/api/models.js +20 -0
- package/dist/builder/api/places.d.ts +32 -0
- package/dist/builder/api/places.js +29 -0
- package/dist/builder/api/platform.d.ts +68 -0
- package/dist/builder/api/platform.js +87 -0
- package/dist/builder/api/plugins.d.ts +42 -0
- package/dist/builder/api/plugins.js +175 -0
- package/dist/builder/api/pref.d.ts +77 -0
- package/dist/builder/api/pref.js +93 -0
- package/dist/builder/api/profile.d.ts +11 -0
- package/dist/builder/api/profile.js +41 -0
- package/dist/builder/api/projects.d.ts +99 -0
- package/dist/builder/api/projects.js +166 -0
- package/dist/builder/api/provider.d.ts +49 -0
- package/dist/builder/api/provider.js +96 -0
- package/dist/builder/api/sandbox.d.ts +90 -0
- package/dist/builder/api/sandbox.js +223 -0
- package/dist/builder/api/sessions.d.ts +123 -0
- package/dist/builder/api/sessions.js +255 -0
- package/dist/builder/api/skills.d.ts +82 -0
- package/dist/builder/api/skills.js +117 -0
- package/dist/builder/api/sse.d.ts +24 -0
- package/dist/builder/api/sse.js +68 -0
- package/dist/builder/api/studio.d.ts +59 -0
- package/dist/builder/api/studio.js +91 -0
- package/dist/builder/api/talk.d.ts +48 -0
- package/dist/builder/api/talk.js +81 -0
- package/dist/builder/api/tools.d.ts +34 -0
- package/dist/builder/api/tools.js +37 -0
- package/dist/builder/api/turn.d.ts +202 -0
- package/dist/builder/api/turn.js +772 -0
- package/dist/builder/api/verdict.d.ts +3 -0
- package/dist/builder/api/verdict.js +21 -0
- package/dist/builder/api/webhooks.d.ts +47 -0
- package/dist/builder/api/webhooks.js +82 -0
- package/dist/builder/api/work.d.ts +110 -0
- package/dist/builder/api/work.js +218 -0
- package/dist/builder/ask.d.ts +51 -0
- package/dist/builder/ask.js +147 -0
- package/dist/builder/automations.d.ts +33 -0
- package/dist/builder/automations.js +453 -0
- package/dist/builder/awake.d.ts +24 -0
- package/dist/builder/awake.js +68 -0
- package/dist/builder/back.d.ts +30 -0
- package/dist/builder/back.js +105 -0
- package/dist/builder/builder.d.ts +12 -0
- package/dist/builder/builder.js +162 -0
- package/dist/builder/carry.d.ts +48 -0
- package/dist/builder/carry.js +278 -0
- package/dist/builder/choice.d.ts +134 -0
- package/dist/builder/choice.js +152 -0
- package/dist/builder/claims.d.ts +13 -0
- package/dist/builder/claims.js +35 -0
- package/dist/builder/clipboard.d.ts +2 -0
- package/dist/builder/clipboard.js +10 -0
- package/dist/builder/customize/agents.d.ts +11 -0
- package/dist/builder/customize/agents.js +513 -0
- package/dist/builder/customize/connectors.d.ts +2 -0
- package/dist/builder/customize/connectors.js +319 -0
- package/dist/builder/customize/drafted.d.ts +4 -0
- package/dist/builder/customize/drafted.js +92 -0
- package/dist/builder/customize/index.d.ts +8 -0
- package/dist/builder/customize/index.js +127 -0
- package/dist/builder/customize/inventory.d.ts +14 -0
- package/dist/builder/customize/inventory.js +127 -0
- package/dist/builder/customize/load.d.ts +9 -0
- package/dist/builder/customize/load.js +22 -0
- package/dist/builder/customize/ocean.d.ts +41 -0
- package/dist/builder/customize/ocean.js +332 -0
- package/dist/builder/customize/plugins.d.ts +2 -0
- package/dist/builder/customize/plugins.js +136 -0
- package/dist/builder/customize/roles.d.ts +4 -0
- package/dist/builder/customize/roles.js +105 -0
- package/dist/builder/customize/say.d.ts +13 -0
- package/dist/builder/customize/say.js +32 -0
- package/dist/builder/customize/skills.d.ts +2 -0
- package/dist/builder/customize/skills.js +208 -0
- package/dist/builder/customize/ui.d.ts +152 -0
- package/dist/builder/customize/ui.js +208 -0
- package/dist/builder/data.d.ts +57 -0
- package/dist/builder/data.js +322 -0
- package/dist/builder/design.d.ts +140 -0
- package/dist/builder/design.js +175 -0
- package/dist/builder/desk.d.ts +48 -0
- package/dist/builder/desk.js +449 -0
- package/dist/builder/dev-mode.d.ts +43 -0
- package/dist/builder/dev-mode.js +120 -0
- package/dist/builder/door.d.ts +11 -0
- package/dist/builder/door.js +126 -0
- package/dist/builder/environment.d.ts +23 -0
- package/dist/builder/environment.js +193 -0
- package/dist/builder/files.d.ts +23 -0
- package/dist/builder/files.js +175 -0
- package/dist/builder/find.d.ts +7 -0
- package/dist/builder/find.js +80 -0
- package/dist/builder/foot.d.ts +30 -0
- package/dist/builder/foot.js +79 -0
- package/dist/builder/forge.d.ts +4 -0
- package/dist/builder/forge.js +639 -0
- package/dist/builder/gear.d.ts +60 -0
- package/dist/builder/gear.js +180 -0
- package/dist/builder/git.d.ts +21 -0
- package/dist/builder/git.js +118 -0
- package/dist/builder/github-sync.d.ts +70 -0
- package/dist/builder/github-sync.js +435 -0
- package/dist/builder/gutter.d.ts +17 -0
- package/dist/builder/gutter.js +25 -0
- package/dist/builder/handoff.d.ts +8 -0
- package/dist/builder/handoff.js +22 -0
- package/dist/builder/host.d.ts +189 -0
- package/dist/builder/host.js +46 -0
- package/dist/builder/index.d.ts +108 -0
- package/dist/builder/index.js +99 -0
- package/dist/builder/landing.d.ts +34 -0
- package/dist/builder/landing.js +725 -0
- package/dist/builder/library.d.ts +21 -0
- package/dist/builder/library.js +526 -0
- package/dist/builder/local.d.ts +80 -0
- package/dist/builder/local.js +124 -0
- package/dist/builder/make.d.ts +10 -0
- package/dist/builder/make.js +120 -0
- package/dist/builder/markdown.d.ts +49 -0
- package/dist/builder/markdown.js +125 -0
- package/dist/builder/marks.d.ts +15 -0
- package/dist/builder/marks.js +18 -0
- package/dist/builder/merge.d.ts +223 -0
- package/dist/builder/merge.js +380 -0
- package/dist/builder/meter.d.ts +31 -0
- package/dist/builder/meter.js +54 -0
- package/dist/builder/mind.d.ts +107 -0
- package/dist/builder/mind.js +335 -0
- package/dist/builder/names.d.ts +40 -0
- package/dist/builder/names.js +189 -0
- package/dist/builder/nav.d.ts +28 -0
- package/dist/builder/nav.js +218 -0
- package/dist/builder/out.d.ts +16 -0
- package/dist/builder/out.js +24 -0
- package/dist/builder/page.d.ts +55 -0
- package/dist/builder/page.js +217 -0
- package/dist/builder/pane.d.ts +30 -0
- package/dist/builder/pane.js +21 -0
- package/dist/builder/panel.d.ts +101 -0
- package/dist/builder/panel.js +408 -0
- package/dist/builder/pdf.d.ts +139 -0
- package/dist/builder/pdf.js +847 -0
- package/dist/builder/pick.d.ts +10 -0
- package/dist/builder/pick.js +38 -0
- package/dist/builder/plain.d.ts +59 -0
- package/dist/builder/plain.js +209 -0
- package/dist/builder/plan.d.ts +63 -0
- package/dist/builder/plan.js +155 -0
- package/dist/builder/plans.d.ts +1 -0
- package/dist/builder/plans.js +157 -0
- package/dist/builder/plugin.d.ts +60 -0
- package/dist/builder/plugin.js +1 -0
- package/dist/builder/plugins/design.d.ts +8 -0
- package/dist/builder/plugins/design.js +71 -0
- package/dist/builder/plugins/index.d.ts +46 -0
- package/dist/builder/plugins/index.js +117 -0
- package/dist/builder/plugins/pdf.d.ts +18 -0
- package/dist/builder/plugins/pdf.js +83 -0
- package/dist/builder/plugins/project.d.ts +5 -0
- package/dist/builder/plugins/project.js +68 -0
- package/dist/builder/plugins/research.d.ts +24 -0
- package/dist/builder/plugins/research.js +147 -0
- package/dist/builder/plugins/sketch.d.ts +9 -0
- package/dist/builder/plugins/sketch.js +101 -0
- package/dist/builder/plugins/slides.d.ts +14 -0
- package/dist/builder/plugins/slides.js +55 -0
- package/dist/builder/plugins/template.d.ts +13 -0
- package/dist/builder/plugins/template.js +95 -0
- package/dist/builder/prefs.d.ts +29 -0
- package/dist/builder/prefs.js +91 -0
- package/dist/builder/preview-url.d.ts +47 -0
- package/dist/builder/preview-url.js +107 -0
- package/dist/builder/project.d.ts +18 -0
- package/dist/builder/project.js +604 -0
- package/dist/builder/prose.d.ts +4 -0
- package/dist/builder/prose.js +57 -0
- package/dist/builder/publish.d.ts +18 -0
- package/dist/builder/publish.js +141 -0
- package/dist/builder/question.d.ts +33 -0
- package/dist/builder/question.js +64 -0
- package/dist/builder/redesign.d.ts +32 -0
- package/dist/builder/redesign.js +117 -0
- package/dist/builder/removal.d.ts +71 -0
- package/dist/builder/removal.js +73 -0
- package/dist/builder/reply.d.ts +50 -0
- package/dist/builder/reply.js +196 -0
- package/dist/builder/roles.d.ts +10 -0
- package/dist/builder/roles.js +28 -0
- package/dist/builder/route.d.ts +85 -0
- package/dist/builder/route.js +126 -0
- package/dist/builder/run.d.ts +4 -0
- package/dist/builder/run.js +804 -0
- package/dist/builder/runmeta.d.ts +16 -0
- package/dist/builder/runmeta.js +69 -0
- package/dist/builder/say.d.ts +2 -0
- package/dist/builder/say.js +7 -0
- package/dist/builder/scheduled.d.ts +3 -0
- package/dist/builder/scheduled.js +328 -0
- package/dist/builder/section.d.ts +27 -0
- package/dist/builder/section.js +60 -0
- package/dist/builder/settings/account.d.ts +1 -0
- package/dist/builder/settings/account.js +111 -0
- package/dist/builder/settings/billing.d.ts +1 -0
- package/dist/builder/settings/billing.js +210 -0
- package/dist/builder/settings/capabilities.d.ts +1 -0
- package/dist/builder/settings/capabilities.js +66 -0
- package/dist/builder/settings/card.d.ts +31 -0
- package/dist/builder/settings/card.js +140 -0
- package/dist/builder/settings/code.d.ts +1 -0
- package/dist/builder/settings/code.js +70 -0
- package/dist/builder/settings/credits.d.ts +10 -0
- package/dist/builder/settings/credits.js +123 -0
- package/dist/builder/settings/environments.d.ts +1 -0
- package/dist/builder/settings/environments.js +60 -0
- package/dist/builder/settings/general.d.ts +1 -0
- package/dist/builder/settings/general.js +58 -0
- package/dist/builder/settings/index.d.ts +4 -0
- package/dist/builder/settings/index.js +25 -0
- package/dist/builder/settings/integrations.d.ts +8 -0
- package/dist/builder/settings/integrations.js +138 -0
- package/dist/builder/settings/keys.d.ts +1 -0
- package/dist/builder/settings/keys.js +114 -0
- package/dist/builder/settings/list.d.ts +10 -0
- package/dist/builder/settings/list.js +28 -0
- package/dist/builder/settings/machines.d.ts +4 -0
- package/dist/builder/settings/machines.js +243 -0
- package/dist/builder/settings/members.d.ts +1 -0
- package/dist/builder/settings/members.js +77 -0
- package/dist/builder/settings/memory.d.ts +1 -0
- package/dist/builder/settings/memory.js +62 -0
- package/dist/builder/settings/notifications.d.ts +1 -0
- package/dist/builder/settings/notifications.js +111 -0
- package/dist/builder/settings/plan.d.ts +17 -0
- package/dist/builder/settings/plan.js +131 -0
- package/dist/builder/settings/privacy.d.ts +1 -0
- package/dist/builder/settings/privacy.js +76 -0
- package/dist/builder/settings/sections.d.ts +16 -0
- package/dist/builder/settings/sections.js +34 -0
- package/dist/builder/settings/shared.d.ts +6 -0
- package/dist/builder/settings/shared.js +58 -0
- package/dist/builder/settings/ui.d.ts +50 -0
- package/dist/builder/settings/ui.js +53 -0
- package/dist/builder/settings/usage.d.ts +1 -0
- package/dist/builder/settings/usage.js +24 -0
- package/dist/builder/shared.d.ts +26 -0
- package/dist/builder/shared.js +15 -0
- package/dist/builder/shelf.d.ts +16 -0
- package/dist/builder/shelf.js +219 -0
- package/dist/builder/side.d.ts +40 -0
- package/dist/builder/side.js +208 -0
- package/dist/builder/site.d.ts +75 -0
- package/dist/builder/site.js +138 -0
- package/dist/builder/spend.d.ts +21 -0
- package/dist/builder/spend.js +80 -0
- package/dist/builder/standing.d.ts +36 -0
- package/dist/builder/standing.js +66 -0
- package/dist/builder/suggest.d.ts +238 -0
- package/dist/builder/suggest.js +463 -0
- package/dist/builder/suggestions.d.ts +49 -0
- package/dist/builder/suggestions.js +260 -0
- package/dist/builder/summary.d.ts +60 -0
- package/dist/builder/summary.js +81 -0
- package/dist/builder/sync.d.ts +1 -0
- package/dist/builder/sync.js +187 -0
- package/dist/builder/tabs.d.ts +85 -0
- package/dist/builder/tabs.js +288 -0
- package/dist/builder/talk.d.ts +5 -0
- package/dist/builder/talk.js +108 -0
- package/dist/builder/thread.d.ts +60 -0
- package/dist/builder/thread.js +302 -0
- package/dist/builder/tools.d.ts +22 -0
- package/dist/builder/tools.js +52 -0
- package/dist/builder/transcript.d.ts +47 -0
- package/dist/builder/transcript.js +108 -0
- package/dist/builder/voice.d.ts +8 -0
- package/dist/builder/voice.js +24 -0
- package/dist/{changedFileKind-DqgCCDUs.js → changedFileKind-D6QYvIez.js} +1 -1
- package/dist/core.js +1 -0
- package/dist/{decodeImagePreview-CesVZYP4.js → decodeImagePreview-DnfFEjhw.js} +1 -1
- package/dist/{embed-DYP-OUlb.js → embed-c030vUqM.js} +11 -11
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -1
- package/dist/{micromark-util-decode-string-NQjVkmZH.js → micromark-util-decode-string-C-5AXkOV.js} +5 -3
- package/dist/{readBinaryPreview-D2X4Uahu.js → readBinaryPreview-BAQ4fFjm.js} +1 -1
- package/dist/{useTextFieldSpeech-CyOZZPrV.js → useTextFieldSpeech-COa9XcRx.js} +1 -1
- package/package.json +101 -11
- /package/{index.d.ts → dist/core.d.ts} +0 -0
- /package/{keymap.d.ts → dist/keymap.d.ts} +0 -0
|
@@ -0,0 +1,725 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* New: the empty state. A heading at the top of the column, and at the foot of
|
|
4
|
+
* the pane the composer — where the run goes (Cloud: the sandbox with the
|
|
5
|
+
* codebase's environment; or one of the org's machines, under remote control),
|
|
6
|
+
* which repository and branch it starts from, and the ask itself — the one
|
|
7
|
+
* composer Chat draws too (@hanzo/ui/chat): Dev hands it the three pills, the
|
|
8
|
+
* chips that go to its repositories, issues and templates, and its commands.
|
|
9
|
+
*
|
|
10
|
+
* Sending opens a conversation (api/talk.ts) and goes to it: the agent answers,
|
|
11
|
+
* and decides for itself when the ask needs a sandbox or a coding run — on the
|
|
12
|
+
* repository, branch and machine chosen here, and only planning when Plan is on.
|
|
13
|
+
* A repository is never a gate: a run with none works in a new folder, in the
|
|
14
|
+
* sandbox or on one of the org's machines (hanzo-inc/cloud issue 779), and
|
|
15
|
+
* GitHub can be connected later. On a host that has the computer (Hanzo
|
|
16
|
+
* Desktop, `host.local`), New also offers This computer: the run works in a
|
|
17
|
+
* folder there, Auto picking the folder used last (local.ts), and needs no
|
|
18
|
+
* repository at all (hanzo-inc/app issues 309 and 310). On a machine whose owner lets the web use some of its
|
|
19
|
+
* folders, the run can work in one of those instead of a repository (shared.ts): Auto is the folder the machine's
|
|
20
|
+
* linked shell is open in, when it is one of them. The choices a person made here are kept in this
|
|
21
|
+
* browser, per org, so the next New starts where the last one did — and a kept
|
|
22
|
+
* repository New can no longer offer is let go, so the next run is not sent
|
|
23
|
+
* back to it. A repository can also be given by its address (Use a git URL).
|
|
24
|
+
*
|
|
25
|
+
* Its words are the reader's language (@hanzo/i18n `t`, the target is
|
|
26
|
+
* `target`); a codebase's, a machine's and a branch's names are drawn as given.
|
|
27
|
+
*/
|
|
28
|
+
import { SizableText, useMedia, XStack, YStack } from '@hanzo/gui';
|
|
29
|
+
import { phrase } from '@hanzo/i18n';
|
|
30
|
+
import { useI18n } from '@hanzo/i18n/react';
|
|
31
|
+
import { CircleDot, Cloud, Code, FolderGit2, FolderOpen, GitBranch, Globe, Laptop, LayoutTemplate, Link2, Monitor, Play } from '@hanzogui/lucide-icons-2';
|
|
32
|
+
import { Button, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@hanzo/ui';
|
|
33
|
+
import { Composer, MEASURE } from '@hanzo/ui/chat';
|
|
34
|
+
import { BranchSelect, ChipSelect, FooterLink, RepoSelect } from '@hanzo/ui/product';
|
|
35
|
+
import { useLimits } from '@hanzo/ui/product/useLimits';
|
|
36
|
+
import { useDictation, useTalk, useVoice } from '@hanzo/voice';
|
|
37
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
38
|
+
import { Refusal, told } from './api/call.js';
|
|
39
|
+
import { start, unhonoured } from './api/coding.js';
|
|
40
|
+
import { list as running } from './api/sessions.js';
|
|
41
|
+
import { say } from './api/talk.js';
|
|
42
|
+
import { asRepo, chosen, codebases, one } from './api/codebases.js';
|
|
43
|
+
import { heard, repos as githubRepos } from './api/github.js';
|
|
44
|
+
import { plain, read, SETUP, unset } from './api/environment.js';
|
|
45
|
+
import { homes as readHomes } from './api/work.js';
|
|
46
|
+
import { SetupDialog } from './environment.js';
|
|
47
|
+
import { limits as readLimits } from './api/models.js';
|
|
48
|
+
import { displayPlace, ready, SANDBOX } from './api/places.js';
|
|
49
|
+
import { useDeviceNames } from './names.js';
|
|
50
|
+
import { Address } from './ask.js';
|
|
51
|
+
import { asHub, gone, isForge, isHub, settle } from './choice.js';
|
|
52
|
+
import { useCached, useKept, usePlaces, useRead } from './data.js';
|
|
53
|
+
import { useDevMode } from './dev-mode.js';
|
|
54
|
+
import { takeHandoff } from './handoff.js';
|
|
55
|
+
import { useHost, useLocal, useSite, useTarget } from './host.js';
|
|
56
|
+
import { failed, HERE, named, recent, where } from './local.js';
|
|
57
|
+
import { aim, NOT_GRANTED, shell } from './shared.js';
|
|
58
|
+
import { plainAnswer } from './plain.js';
|
|
59
|
+
import { useRedesign } from './redesign.js';
|
|
60
|
+
import { urlOf } from './site.js';
|
|
61
|
+
import { level, pacing, useMind } from './mind.js';
|
|
62
|
+
import { usePrefs } from './prefs.js';
|
|
63
|
+
import { Publish } from './publish.js';
|
|
64
|
+
import { path } from './route.js';
|
|
65
|
+
import { useCarry } from './carry.js';
|
|
66
|
+
import { DEV_MODES } from './gear.js';
|
|
67
|
+
import { Panel, PanelToggle } from './panel.js';
|
|
68
|
+
import { PAGE, useDeck, useKey } from './tabs.js';
|
|
69
|
+
import { taken } from './suggestions.js';
|
|
70
|
+
import { carrying, compose, pick, read as readFiles } from './tools.js';
|
|
71
|
+
import { about, asked as critiqued, attach as asFile, critique, local as onThisComputer, named as pagesIn, read as readPage, shown as shownPage } from './page.js';
|
|
72
|
+
import { useEar, useSpoken } from './voice.js';
|
|
73
|
+
/** One vocabulary for the mode, on New and in a workspace: English, marked (`phrase`), drawn through `t`. */
|
|
74
|
+
export const MODES = [
|
|
75
|
+
{ id: 'build', label: phrase('Build'), hint: phrase('Edits, commits and pushes a branch') },
|
|
76
|
+
{ id: 'plan', label: phrase('Plan'), hint: phrase('Plans the change and writes nothing') },
|
|
77
|
+
];
|
|
78
|
+
/** The org's repositories before they have been read: no answer, so nothing is judged from it. */
|
|
79
|
+
const NOHOMES = { homes: [], whole: false };
|
|
80
|
+
const FIRST = { repo: null, branch: '', place: '', folder: '', mode: 'build', ask: '', issue: 0 };
|
|
81
|
+
/** No folders: a place that shares none. */
|
|
82
|
+
const NONE = [];
|
|
83
|
+
/** This computer, as a place: always there on a host that has it. */
|
|
84
|
+
const HERE_PLACE = { id: HERE, label: 'This computer', kind: 'here', status: 'online', capacity: '' };
|
|
85
|
+
const UNSENT = 'hanzo.build.unsent';
|
|
86
|
+
let held = { draft: '', files: [] };
|
|
87
|
+
function unsent() {
|
|
88
|
+
try {
|
|
89
|
+
const v = JSON.parse(window.sessionStorage.getItem(UNSENT) ?? 'null');
|
|
90
|
+
if (v && typeof v.draft === 'string' && Array.isArray(v.files))
|
|
91
|
+
return v;
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
/* a browser that refuses storage, or a value that is not ours */
|
|
95
|
+
}
|
|
96
|
+
return held;
|
|
97
|
+
}
|
|
98
|
+
/** Hold what New has unsent, or forget it once there is nothing. */
|
|
99
|
+
export function hold(u) {
|
|
100
|
+
held = u;
|
|
101
|
+
try {
|
|
102
|
+
if (!u.draft && !u.files.length)
|
|
103
|
+
window.sessionStorage.removeItem(UNSENT);
|
|
104
|
+
else
|
|
105
|
+
window.sessionStorage.setItem(UNSENT, JSON.stringify(u));
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
/* kept for the life of the page */
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* A run on this computer: where it works, and once it ends, what the agent said, in words (`plainAnswer`). What it did
|
|
113
|
+
* on the way (its commands and what they printed) is drawn only in Developer mode; the first run waits while the host
|
|
114
|
+
* fetches the agent, and says so.
|
|
115
|
+
*/
|
|
116
|
+
function RanHere({ ran, setup, devMode, onCancel }) {
|
|
117
|
+
const { t } = useI18n();
|
|
118
|
+
const fetching = ran.going && setup !== null && setup < 100;
|
|
119
|
+
const head = ran.going
|
|
120
|
+
? t('Working in {name}…', { name: ran.folder.name })
|
|
121
|
+
: ran.ok
|
|
122
|
+
? t('Done in {name}', { name: ran.folder.name })
|
|
123
|
+
: t('Stopped in {name}', { name: ran.folder.name });
|
|
124
|
+
const said = ran.output ? plainAnswer(ran.output, ran.folder, t) : '';
|
|
125
|
+
return (_jsxs(YStack, { "data-slot": "ran-here", role: "status", "aria-live": "polite", gap: "$1.5", mx: "$3", px: "$3", py: "$2.5", rounded: "$4", borderWidth: 1, borderColor: "$borderColor", bg: "$background", minW: 0, children: [_jsxs(XStack, { items: "center", gap: "$2", minW: 0, children: [_jsx(FolderOpen, { size: 13, color: "$soft" }), _jsx(SizableText, { size: "$2", color: "$ink", fontWeight: "500", numberOfLines: 1, flex: 1, minW: 0, children: head })] }), fetching ? (_jsxs(XStack, { items: "center", gap: "$2", minW: 0, children: [_jsx(SizableText, { "data-slot": "ran-setup", size: "$1", color: "$soft", flex: 1, minW: 0, children: t('Setting up Hanzo Dev on this computer… {percent}%', { percent: setup }) }), onCancel ? (_jsx(Button, { size: "xs", variant: "ghost", "data-slot": "ran-setup-cancel", onPress: onCancel, children: t('Cancel') })) : null] })) : null, said ? (_jsx(YStack, { maxH: 320, overflowY: "auto", minW: 0, children: _jsx(SizableText, { "data-slot": "ran-answer", size: "$2", color: "$ink", whiteSpace: "pre-wrap", wordWrap: "break-word", children: said }) })) : !ran.going && !ran.ok ? (_jsx(SizableText, { "data-slot": "ran-answer", size: "$2", color: "$ink", children: t('Hanzo Dev stopped before it finished. Try again.') })) : null, devMode && ran.process ? (_jsxs(YStack, { "data-slot": "ran-process", gap: "$1", minW: 0, children: [_jsx(SizableText, { size: "$1", color: "$soft", fontWeight: "500", children: t('What Hanzo ran') }), _jsx(SizableText, { size: "$1", color: "$soft", fontFamily: "$mono", whiteSpace: "pre-wrap", wordWrap: "break-word", maxH: 240, overflowY: "auto", "data-i18n-ltr": "", children: ran.process })] })) : null] }));
|
|
126
|
+
}
|
|
127
|
+
export function Landing({ onStarted }) {
|
|
128
|
+
const host = useHost();
|
|
129
|
+
const target = useTarget();
|
|
130
|
+
const { t } = useI18n();
|
|
131
|
+
const media = useMedia();
|
|
132
|
+
const wide = Boolean(media.md);
|
|
133
|
+
const signed = Boolean(host.person);
|
|
134
|
+
const [devMode] = useDevMode();
|
|
135
|
+
const { prefs, save: savePrefs } = usePrefs();
|
|
136
|
+
const local = useLocal();
|
|
137
|
+
const site = useSite();
|
|
138
|
+
const [stored, keep] = useKept(`hanzo.build.new.${host.org ?? 'none'}`, null);
|
|
139
|
+
// What was chosen here, over the person's coding defaults (Settings → Code), over
|
|
140
|
+
// the first run's. Field by field: a codebase or an issue handed over from its own
|
|
141
|
+
// screen keeps only the codebase and the words, and the rest still has a value.
|
|
142
|
+
// On a host that has the computer, the first run's place is This computer.
|
|
143
|
+
const kept = settle(local ? { ...FIRST, place: HERE } : FIRST, prefs.code, stored);
|
|
144
|
+
const set = (patch) => keep({ ...kept, ...patch });
|
|
145
|
+
const [was] = useState(unsent);
|
|
146
|
+
const [draft, setDraft] = useState(kept.ask || was.draft);
|
|
147
|
+
// The issue handed over with the words, while the run is still on its repository.
|
|
148
|
+
const [issue, setIssue] = useState(kept.ask ? kept.issue : 0);
|
|
149
|
+
const [files, setFiles] = useState(was.files);
|
|
150
|
+
useEffect(() => hold({ draft, files }), [draft, files]);
|
|
151
|
+
const [busy, setBusy] = useState(false);
|
|
152
|
+
const [note, setNote] = useState('');
|
|
153
|
+
const [adding, setAdding] = useState(null);
|
|
154
|
+
const [offering, setOffering] = useState(false);
|
|
155
|
+
const [desk, setDesk] = useState(false);
|
|
156
|
+
const deck = useDeck('dev-new', { tabs: [{ id: 'tab-1', kind: PAGE, title: '' }], at: 'tab-1' });
|
|
157
|
+
useKey(() => setDesk((d) => !d));
|
|
158
|
+
// Asking for a repository's address, for one the lists do not show.
|
|
159
|
+
const [giving, setGiving] = useState(false);
|
|
160
|
+
// The repository and branch lists are read again each time they open.
|
|
161
|
+
const [picking, setPicking] = useState(false);
|
|
162
|
+
const [branching, setBranching] = useState(false);
|
|
163
|
+
// A codebase or an issue hands its words over once. Left in the kept choice,
|
|
164
|
+
// every later visit to New would put them back.
|
|
165
|
+
useEffect(() => {
|
|
166
|
+
if (kept.ask || kept.issue)
|
|
167
|
+
set({ ask: '', issue: 0 });
|
|
168
|
+
// Chat's "Open in Dev" leaves its prompt and code here (handoff.ts).
|
|
169
|
+
const handed = takeHandoff(window.sessionStorage);
|
|
170
|
+
if (handed) {
|
|
171
|
+
setDraft(handed);
|
|
172
|
+
setNote(t('Imported from Chat — ready to run in Dev.'));
|
|
173
|
+
}
|
|
174
|
+
// The handover is read on this mount only.
|
|
175
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
176
|
+
}, []);
|
|
177
|
+
const places = usePlaces(target, signed);
|
|
178
|
+
const names = useDeviceNames(signed ? target : null);
|
|
179
|
+
// The model and effort Chat shares, and dictation into the ask.
|
|
180
|
+
const { limits } = useLimits(signed ? (signal) => readLimits(target, signal) : null, target);
|
|
181
|
+
const mind = useMind(target, limits?.plan, host.topUp);
|
|
182
|
+
const voice = useVoice({ speech: useEar(target), language: useSpoken(), ...useDictation(draft, setDraft) });
|
|
183
|
+
const talk = useTalk({ baseUrl: target.api, token: () => target.token(), ...(target.org ? { org: target.org } : {}) });
|
|
184
|
+
// What the run carries beside the ask: skills, memory and the mode, as Chat's turns do.
|
|
185
|
+
const carry = useCarry(target, '', (tab) => host.go(path({ kind: 'customize', tab })), {
|
|
186
|
+
draft,
|
|
187
|
+
setDraft,
|
|
188
|
+
// A run reads text: a file that is one rides the ask, a picture goes with a chat.
|
|
189
|
+
attach: (list) => {
|
|
190
|
+
const text = list.filter((f) => !f.type.startsWith('image/'));
|
|
191
|
+
if (text.length < list.length)
|
|
192
|
+
setNote(t('A run reads text files; send a picture in Chat.'));
|
|
193
|
+
if (text.length) {
|
|
194
|
+
const dt = new DataTransfer();
|
|
195
|
+
for (const f of text)
|
|
196
|
+
dt.items.add(f);
|
|
197
|
+
void readFiles(files, dt.files).then(({ files: next, note: why }) => {
|
|
198
|
+
setFiles(next);
|
|
199
|
+
if (why)
|
|
200
|
+
setNote(why);
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
go: (href) => (href.startsWith('http') ? host.open(href) : host.go(href)),
|
|
205
|
+
}, DEV_MODES);
|
|
206
|
+
const mode = carry.mode.value === 'plan' ? 'plan' : 'build';
|
|
207
|
+
// The chosen codebase's environment, so New can say when it has none yet.
|
|
208
|
+
const codebase = isForge(kept.repo) ? kept.repo.name : '';
|
|
209
|
+
// The org's repositories on the forge: what a run and an environment can name.
|
|
210
|
+
const homes = useCached(signed ? `${host.org}:homes` : null, (signal) => readHomes(target, signal), NOHOMES);
|
|
211
|
+
// A kept codebase the org's whole list does not hold — a board's key once handed over as one — is not offered as one.
|
|
212
|
+
const stranger = codebase !== '' && homes.value.whole && !homes.value.homes.some((h) => h.name.toLowerCase() === codebase.toLowerCase());
|
|
213
|
+
// Read once the list has answered (or failed), so a name that is not the org's is never asked for.
|
|
214
|
+
const settled = homes.value !== NOHOMES || homes.error !== null;
|
|
215
|
+
const found = useRead(signed && codebase && settled && !stranger ? () => read(target, codebase) : null, null, [target, signed, codebase, settled, stranger]);
|
|
216
|
+
// A read kept from the codebase before is not this one's.
|
|
217
|
+
const env = { ...found, value: found.value && found.value.repo === codebase && !stranger ? found.value : null };
|
|
218
|
+
// This computer, where the host has it: the run goes to a folder here and never to the platform.
|
|
219
|
+
const here = local !== null && kept.place === HERE;
|
|
220
|
+
const place = here ? SANDBOX : (places.value.find((p) => p.id === kept.place) ?? SANDBOX);
|
|
221
|
+
// The folders this computer opened, most recent first, and the one a run here goes to: the one chosen, else Auto's.
|
|
222
|
+
const folders = local ? recent(local.folders()) : [];
|
|
223
|
+
// The folder Auto picks is the one the words typed so far are about (local.ts `route`), so the pill says where Send goes.
|
|
224
|
+
const folderAt = where(folders, kept.folder, draft);
|
|
225
|
+
// On a machine: the folders its owner lets the web use, the one its linked shell is open in, and the one a run goes to.
|
|
226
|
+
const granted = here ? NONE : (place.folders ?? NONE);
|
|
227
|
+
const shells = useRead(granted.length ? () => running(target, { status: 'running', limit: 100 }) : null, [], [target, place.id, granted.length > 0]);
|
|
228
|
+
const aimed = aim(granted, kept.folder, shell(shells.value, place));
|
|
229
|
+
// The machine a run was refused on for a folder it does not share: there, the folders it does are offered.
|
|
230
|
+
const [offered, setOffered] = useState('');
|
|
231
|
+
const [ran, setRan] = useState(null);
|
|
232
|
+
// How far the agent's first-run setup has got, while the host fetches it.
|
|
233
|
+
const [fetched, setFetched] = useState(null);
|
|
234
|
+
// The folders found on the computer arrive after the first read.
|
|
235
|
+
const [, folded] = useState(0);
|
|
236
|
+
useEffect(() => local?.changed?.(() => folded((n) => n + 1)), [local]);
|
|
237
|
+
// An address pasted here is offered as a redesign of that site (redesign.tsx): the folder the person chose is built in, Auto makes a new one.
|
|
238
|
+
const redesign = useRedesign({
|
|
239
|
+
local,
|
|
240
|
+
site,
|
|
241
|
+
here,
|
|
242
|
+
draft,
|
|
243
|
+
chosen: folderAt.auto ? null : folderAt.folder,
|
|
244
|
+
carried: carry.text,
|
|
245
|
+
devMode,
|
|
246
|
+
started: () => {
|
|
247
|
+
setDraft('');
|
|
248
|
+
setFiles([]);
|
|
249
|
+
setNote('');
|
|
250
|
+
},
|
|
251
|
+
});
|
|
252
|
+
// Why this mode cannot run where it is sent: a plan is the sandbox's, on a machine and on this computer alike.
|
|
253
|
+
const refused = here ? (mode === 'plan' ? t('A plan runs in the cloud workspace. On this computer, switch to Build.') : '') : unhonoured(mode, place.id, t);
|
|
254
|
+
// The kept repository is checked against what New can offer now (choice.ts
|
|
255
|
+
// `gone`): on arrival, and again each time the GitHub connection changes
|
|
256
|
+
// anywhere on the page (api/github.ts `heard`). One that is gone is let go with
|
|
257
|
+
// its branch and the issue it would close, so the composer holds none and Send
|
|
258
|
+
// opens the picker — a repository let go on GitHub, or a GitHub disconnected,
|
|
259
|
+
// is not where the next run goes.
|
|
260
|
+
const address = isHub(kept.repo) ? kept.repo.full_name : '';
|
|
261
|
+
const given = kept.repo?.given === true;
|
|
262
|
+
// The choice as it is when an answer lands, so nothing chosen while it was read is written back over.
|
|
263
|
+
const latest = useRef(kept);
|
|
264
|
+
latest.current = kept;
|
|
265
|
+
const drop = useCallback(() => {
|
|
266
|
+
setIssue(0);
|
|
267
|
+
keep({ ...latest.current, repo: null, branch: '' });
|
|
268
|
+
}, [keep]);
|
|
269
|
+
const [looks, look] = useState(0);
|
|
270
|
+
const { reload: readHomesAgain } = homes;
|
|
271
|
+
useEffect(() => heard(() => {
|
|
272
|
+
look((n) => n + 1);
|
|
273
|
+
readHomesAgain();
|
|
274
|
+
}), [readHomesAgain]);
|
|
275
|
+
// A codebase is judged by the org's list above. That list is drawn at once from
|
|
276
|
+
// what this page read before, so only its own answer on this visit judges: read
|
|
277
|
+
// to the end, neither refused nor let go as slow, and from both of its sources.
|
|
278
|
+
const fresh = !homes.loading && homes.error === null && homes.value !== NOHOMES && homes.value.whole;
|
|
279
|
+
const forgeNames = useMemo(() => (fresh ? homes.value.homes.map((h) => h.name) : null), [fresh, homes.value]);
|
|
280
|
+
useEffect(() => {
|
|
281
|
+
if ((codebase && gone(latest.current.repo, { forge: forgeNames, github: null })) || stranger)
|
|
282
|
+
drop();
|
|
283
|
+
}, [codebase, forgeNames, stranger, drop]);
|
|
284
|
+
// A GitHub repository, by GitHub's listing narrowed to its own address, so one
|
|
285
|
+
// page is the whole answer for it however many the connection grants. A read
|
|
286
|
+
// refused is no list; one this page has moved on from is not heard.
|
|
287
|
+
useEffect(() => {
|
|
288
|
+
if (!signed || !address || given)
|
|
289
|
+
return;
|
|
290
|
+
const ctl = new AbortController();
|
|
291
|
+
void githubRepos(target, { q: address.slice('github.com/'.length), limit: 100 }, ctl.signal)
|
|
292
|
+
.catch(() => null)
|
|
293
|
+
.then((github) => {
|
|
294
|
+
if (!ctl.signal.aborted && gone(latest.current.repo, { forge: null, github }))
|
|
295
|
+
drop();
|
|
296
|
+
});
|
|
297
|
+
return () => ctl.abort();
|
|
298
|
+
}, [signed, target, address, given, looks, drop]);
|
|
299
|
+
const known = useRef(new Map());
|
|
300
|
+
const hubs = useRef(new Map());
|
|
301
|
+
// The forge's codebases, then the repositories the org's GitHub installation
|
|
302
|
+
// grants. A GitHub row is chosen as GitHub's address, so a run on it clones,
|
|
303
|
+
// pushes and proposes on GitHub, where its people work. A GitHub read that
|
|
304
|
+
// fails leaves the forge's list standing.
|
|
305
|
+
const loadRepos = useCallback(async (q) => {
|
|
306
|
+
const [page, hub] = await Promise.all([codebases(target, q), githubRepos(target, { q }).catch(() => null)]);
|
|
307
|
+
const repos = page.map(asRepo);
|
|
308
|
+
for (const r of repos)
|
|
309
|
+
known.current.set(r.name, r);
|
|
310
|
+
const github = (hub?.repos ?? []).map(asHub);
|
|
311
|
+
for (const r of github)
|
|
312
|
+
hubs.current.set(r.full_name.toLowerCase(), r);
|
|
313
|
+
return { repos: [...repos.map((r) => ({ ...r, source: 'forge' })), ...github.map((r) => ({ ...r, source: 'github' }))], next: null };
|
|
314
|
+
}, [target]);
|
|
315
|
+
// Drawn only once a forge codebase is chosen; one the forge no longer lists offers its default branch.
|
|
316
|
+
const home = kept.repo?.default_branch || 'main';
|
|
317
|
+
const loadBranches = useCallback(async (q) => {
|
|
318
|
+
const got = await one(target, codebase);
|
|
319
|
+
const needle = q.trim().toLowerCase();
|
|
320
|
+
const names = (got?.branches ?? [home]).filter((b) => !needle || b.toLowerCase().includes(needle));
|
|
321
|
+
return { branches: names.map((name) => ({ name })), next: null };
|
|
322
|
+
}, [target, codebase, home]);
|
|
323
|
+
const hostOf = (u) => {
|
|
324
|
+
try {
|
|
325
|
+
return new URL(u).hostname;
|
|
326
|
+
}
|
|
327
|
+
catch {
|
|
328
|
+
return '';
|
|
329
|
+
}
|
|
330
|
+
};
|
|
331
|
+
/**
|
|
332
|
+
* The web pages an ask names, read and ready to ride it as files (page.ts). `only` narrows which addresses are
|
|
333
|
+
* read; the rest go to the run as words. Strict (a run on the platform): a page that could not be read is said
|
|
334
|
+
* and the answer is null, so no run starts on a page it could not read. Not strict (a run on this computer, which
|
|
335
|
+
* may be about anything): what was read rides the ask, and `missed` says what was not.
|
|
336
|
+
*/
|
|
337
|
+
const pagesFor = async (said, only = () => true, strict = true) => {
|
|
338
|
+
const want = pagesIn(said).filter(only);
|
|
339
|
+
if (!want.length)
|
|
340
|
+
return { files: [], missed: '' };
|
|
341
|
+
setNote(t('Reading {page}…', { page: want.map(shownPage).join(', ') }));
|
|
342
|
+
const read = await Promise.allSettled(want.map((u) => readPage(target, u)));
|
|
343
|
+
const files = read.flatMap((r) => (r.status === 'fulfilled' ? [asFile(r.value)] : []));
|
|
344
|
+
const failed = read.find((r) => r.status === 'rejected');
|
|
345
|
+
const missed = failed ? told(failed.reason, t) : '';
|
|
346
|
+
if (missed && strict) {
|
|
347
|
+
setNote(missed);
|
|
348
|
+
return null;
|
|
349
|
+
}
|
|
350
|
+
setNote('');
|
|
351
|
+
return { files, missed };
|
|
352
|
+
};
|
|
353
|
+
// The composer sends only a draft with words in it, and not while a send is out.
|
|
354
|
+
const send = async (said = draft) => {
|
|
355
|
+
// A site's address, alone or asked to be redesigned, starts a redesign (redesign.tsx); any other ask is a run.
|
|
356
|
+
const asked = redesign.can ? urlOf(said) : null;
|
|
357
|
+
if (asked)
|
|
358
|
+
return void (await redesign.start(asked));
|
|
359
|
+
// This computer needs no sign-in to the platform and no repository: the agent runs in the folder, here.
|
|
360
|
+
if (here && local)
|
|
361
|
+
return void (await sendHere(said));
|
|
362
|
+
if (!signed) {
|
|
363
|
+
hold({ draft: said, files, sent: true });
|
|
364
|
+
host.signIn?.();
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
const repo = isForge(kept.repo) ? kept.repo : null;
|
|
368
|
+
const hub = isHub(kept.repo) ? kept.repo : null;
|
|
369
|
+
// No repository is no gate: a machine run with none works in a new folder there (cloud issue 779).
|
|
370
|
+
// A plan or a setup routed to a machine is refused here, in its own words, before it leaves the page.
|
|
371
|
+
const why = unhonoured(mode, place.id, t);
|
|
372
|
+
if (why) {
|
|
373
|
+
setNote(why);
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
setBusy(true);
|
|
377
|
+
setNote('');
|
|
378
|
+
setOffered('');
|
|
379
|
+
try {
|
|
380
|
+
// A page the ask names is read first, and rides it: a run never starts on a page that could not be read.
|
|
381
|
+
// Only an ask about its pages reads them (page.ts `about`); any other link is words for the agent.
|
|
382
|
+
const pages = about(said) ? await pagesFor(said) : { files: [], missed: '' };
|
|
383
|
+
if (!pages)
|
|
384
|
+
return;
|
|
385
|
+
// What the plugins that are on add: words for the run, or an answer of their own.
|
|
386
|
+
const prepped = carry.preparing ? await carry.prep({ text: said.trim(), files: [], thread: '' }, new AbortController().signal) : {};
|
|
387
|
+
// An answer of a plugin's own (a deck) is the answer: no run is started for it.
|
|
388
|
+
if (prepped.reply) {
|
|
389
|
+
// Its words, without the page it drew (Chat shows that in the side panel).
|
|
390
|
+
setNote(prepped.reply.split('```')[0].trim());
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
// The first thing said opens a conversation (api/talk.ts) and starts nothing:
|
|
394
|
+
// the agent answers, and leases a sandbox or starts a coding run only when the
|
|
395
|
+
// ask needs one — on the repository, branch, machine and Plan chosen here.
|
|
396
|
+
// Skills, memories and plugin system prompts travel out-of-band as
|
|
397
|
+
// developerInstructions so the user prompt stays clean and cacheable.
|
|
398
|
+
const developerInstructions = [carry.text, prepped.system ?? ''].filter(Boolean).join('\n\n');
|
|
399
|
+
const input = compose(said.trim(), [...files, ...pages.files]);
|
|
400
|
+
// A folder on the machine is a coding run there, in that folder: a conversation names no folder.
|
|
401
|
+
const sent = aimed.dir
|
|
402
|
+
? await start(target, {
|
|
403
|
+
prompt: input,
|
|
404
|
+
targetId: place.id,
|
|
405
|
+
dir: aimed.dir,
|
|
406
|
+
mode,
|
|
407
|
+
model: mind.model,
|
|
408
|
+
effort: level(mind.effort),
|
|
409
|
+
...(developerInstructions ? { developerInstructions } : {}),
|
|
410
|
+
})
|
|
411
|
+
: await say(target, {
|
|
412
|
+
input,
|
|
413
|
+
...(developerInstructions ? { developerInstructions } : {}),
|
|
414
|
+
// The name alone. The org rides the request, and a slash is not a repo name.
|
|
415
|
+
// An empty base or place is not sent: the default branch, and the sandbox.
|
|
416
|
+
repo: repo?.name ?? hub?.full_name,
|
|
417
|
+
base: repo ? kept.branch : hub ? kept.branch || hub.default_branch : undefined,
|
|
418
|
+
target: place.id,
|
|
419
|
+
// The mode the composer shows: Auto starts a build, Manual asks first, Plan only plans.
|
|
420
|
+
mode: carry.mode.value === 'manual' ? 'manual' : mode === 'plan' ? 'plan' : 'auto',
|
|
421
|
+
model: mind.model,
|
|
422
|
+
effort: level(mind.effort),
|
|
423
|
+
issue,
|
|
424
|
+
});
|
|
425
|
+
setDraft('');
|
|
426
|
+
setFiles([]);
|
|
427
|
+
setIssue(0);
|
|
428
|
+
onStarted(sent.session);
|
|
429
|
+
}
|
|
430
|
+
catch (e) {
|
|
431
|
+
// The owner stopped sharing the folder, or never did: say how to share it, and offer the ones shared now.
|
|
432
|
+
if (e instanceof Refusal && e.code === NOT_GRANTED) {
|
|
433
|
+
setNote(t('That folder is not shared with the web. Share it from Hanzo Desktop or `hanzo link grant {folder}`', { folder: aimed.dir }));
|
|
434
|
+
setOffered(place.id);
|
|
435
|
+
places.reload();
|
|
436
|
+
shells.reload();
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
setNote(plain(e, aimed.dir ? named(aimed.dir) : (repo?.name ?? hub?.full_name ?? (place.id ? activePlaceDisplay.title : t('a new project'))), 'run', t));
|
|
440
|
+
}
|
|
441
|
+
finally {
|
|
442
|
+
setBusy(false);
|
|
443
|
+
}
|
|
444
|
+
};
|
|
445
|
+
/**
|
|
446
|
+
* A run on this computer: in the folder chosen, else Auto's (the one the ask is about, else the one used last), else one
|
|
447
|
+
* the person picks now, once. The agent reads, edits and runs there and nowhere else; what it said is shown under the
|
|
448
|
+
* composer when it ends, and what it did only in Developer mode.
|
|
449
|
+
*/
|
|
450
|
+
const sendHere = async (said) => {
|
|
451
|
+
if (!local || busy || redesign.busy)
|
|
452
|
+
return;
|
|
453
|
+
if (refused) {
|
|
454
|
+
setNote(refused);
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
let folder = where(folders, kept.folder, said).folder;
|
|
458
|
+
if (!folder) {
|
|
459
|
+
setNote(t('Choose a folder for this run'));
|
|
460
|
+
folder = await local.pick().catch(() => null);
|
|
461
|
+
if (!folder)
|
|
462
|
+
return;
|
|
463
|
+
set({ place: HERE, folder: '' });
|
|
464
|
+
}
|
|
465
|
+
local.use(folder.path);
|
|
466
|
+
const ask = said.trim();
|
|
467
|
+
// A public page is read for the run while someone is signed in; an address on this computer (a localhost
|
|
468
|
+
// server) is the agent's own to open, and a signed-out run reads nothing from the platform.
|
|
469
|
+
setBusy(true);
|
|
470
|
+
const pages = (signed && about(ask) ? await pagesFor(ask, (u) => !onThisComputer(hostOf(u)), false) : null) ?? { files: [], missed: '' };
|
|
471
|
+
const prompt = [carry.text, compose(ask, [...files, ...pages.files])].filter(Boolean).join('\n\n');
|
|
472
|
+
setBusy(true);
|
|
473
|
+
setNote(pages.missed ? t('{why} The run goes on without that page.', { why: pages.missed }) : '');
|
|
474
|
+
setRan({ folder, ask, going: true, ok: true, output: '', process: '' });
|
|
475
|
+
setFetched(null);
|
|
476
|
+
try {
|
|
477
|
+
const done = await local.run(folder.path, prompt, setFetched);
|
|
478
|
+
setRan({ folder, ask, going: false, ok: done.ok, output: done.output.trim(), process: (done.process ?? '').trim() });
|
|
479
|
+
setDraft('');
|
|
480
|
+
setFiles([]);
|
|
481
|
+
}
|
|
482
|
+
catch (e) {
|
|
483
|
+
setRan(null);
|
|
484
|
+
setNote(failed(e, t));
|
|
485
|
+
}
|
|
486
|
+
finally {
|
|
487
|
+
setFetched(null);
|
|
488
|
+
setBusy(false);
|
|
489
|
+
}
|
|
490
|
+
};
|
|
491
|
+
// A draft sent while signed out goes once its person is in, and only once.
|
|
492
|
+
const owed = useRef(was.sent === true);
|
|
493
|
+
useEffect(() => {
|
|
494
|
+
if (!signed || !owed.current || !draft.trim())
|
|
495
|
+
return;
|
|
496
|
+
owed.current = false;
|
|
497
|
+
void send();
|
|
498
|
+
// Sent once, on the sign-in that it waited for.
|
|
499
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
500
|
+
}, [signed]);
|
|
501
|
+
// A run a suggestion in Chat left for Dev starts on arrival, once its person is known.
|
|
502
|
+
const [handed] = useState(() => ({ prompt: taken('task') }));
|
|
503
|
+
useEffect(() => {
|
|
504
|
+
if (!signed || !handed.prompt)
|
|
505
|
+
return;
|
|
506
|
+
const p = handed.prompt;
|
|
507
|
+
handed.prompt = '';
|
|
508
|
+
setDraft(p);
|
|
509
|
+
void send(p);
|
|
510
|
+
// Started once, on the sign-in that it waited for.
|
|
511
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
512
|
+
}, [signed]);
|
|
513
|
+
/** Start the agent that finds a codebase's environment, and open it: its run is the progress. A refusal is the dialog's to say. */
|
|
514
|
+
const setup = async (repo) => {
|
|
515
|
+
const run = await start(target, { prompt: SETUP, repo, mode: 'setup', model: mind.model, effort: level(mind.effort) });
|
|
516
|
+
onStarted(run.session);
|
|
517
|
+
};
|
|
518
|
+
/** The codebase a dialog chose, chosen here too. */
|
|
519
|
+
const choose = (h) => {
|
|
520
|
+
const row = chosen({ owner: h.label.split('/')[0] ?? '', name: h.name, full_name: h.label, default_branch: h.branch });
|
|
521
|
+
setIssue(0);
|
|
522
|
+
set({ repo: row, branch: row.default_branch });
|
|
523
|
+
};
|
|
524
|
+
/**
|
|
525
|
+
* The repository at an address the person gave, chosen as GitHub's — as a row
|
|
526
|
+
* of the GitHub list is, so the run clones, pushes and proposes there — and
|
|
527
|
+
* kept as given. One the list has shown keeps the branch and privacy it said;
|
|
528
|
+
* any other starts from its default branch.
|
|
529
|
+
*/
|
|
530
|
+
const give = (at) => {
|
|
531
|
+
const listed = hubs.current.get(`github.com/${at.owner}/${at.name}`.toLowerCase());
|
|
532
|
+
const row = {
|
|
533
|
+
...(listed ?? asHub({ owner: at.owner, name: at.name, full_name: `${at.owner}/${at.name}`, private: false, default_branch: '', pushed_at: '', installation_id: 0 })),
|
|
534
|
+
given: true,
|
|
535
|
+
};
|
|
536
|
+
setIssue(0);
|
|
537
|
+
setNote('');
|
|
538
|
+
set({ repo: row, branch: row.default_branch });
|
|
539
|
+
};
|
|
540
|
+
// Cloud is the managed workspace, set up by the chosen project's environment; the rest are the org's machines.
|
|
541
|
+
const placeItems = useMemo(() => [
|
|
542
|
+
// This computer first, where the host has it: a folder here is the nearest place a run can go.
|
|
543
|
+
...(local
|
|
544
|
+
? [
|
|
545
|
+
{
|
|
546
|
+
id: HERE,
|
|
547
|
+
label: t('This computer'),
|
|
548
|
+
hint: folderAt.folder ? folderAt.folder.name : t('A folder on this computer'),
|
|
549
|
+
detail: undefined,
|
|
550
|
+
icon: _jsx(Laptop, { size: 13, color: "$soft" }),
|
|
551
|
+
disabled: false,
|
|
552
|
+
place: HERE_PLACE,
|
|
553
|
+
},
|
|
554
|
+
]
|
|
555
|
+
: []),
|
|
556
|
+
...(places.value.length ? places.value : [SANDBOX]).map((p) => {
|
|
557
|
+
const display = displayPlace(p, { devMode, say: t, names });
|
|
558
|
+
return {
|
|
559
|
+
id: p.id || 'sandbox',
|
|
560
|
+
label: display.title,
|
|
561
|
+
hint: p.id
|
|
562
|
+
? devMode
|
|
563
|
+
? [p.status, p.capacity].filter(Boolean).join(' · ')
|
|
564
|
+
: p.status === 'online'
|
|
565
|
+
? t('Online')
|
|
566
|
+
: p.status
|
|
567
|
+
: devMode
|
|
568
|
+
? ''
|
|
569
|
+
: t('Cloud workspace'),
|
|
570
|
+
detail: display.detail,
|
|
571
|
+
icon: p.id ? _jsx(Monitor, { size: 13, color: "$soft" }) : _jsx(Cloud, { size: 13, color: "$soft" }),
|
|
572
|
+
disabled: !ready(p),
|
|
573
|
+
place: p,
|
|
574
|
+
};
|
|
575
|
+
}),
|
|
576
|
+
], [places.value, devMode, t, names, local, folderAt.folder]);
|
|
577
|
+
const activePlaceDisplay = useMemo(() => displayPlace(place, { devMode, say: t, names }), [place, devMode, t, names]);
|
|
578
|
+
const placeTooltip = here
|
|
579
|
+
? t('Runs on this computer, in the folder you choose. No repository needed.')
|
|
580
|
+
: aimed.dir
|
|
581
|
+
? t('Runs on this machine, in a folder its owner shares with the web. No repository needed.')
|
|
582
|
+
: place.id
|
|
583
|
+
? t('Runs on this machine, in a new folder unless you choose a repository')
|
|
584
|
+
: t('Runs automatically in your Hanzo cloud workspace');
|
|
585
|
+
const placeHardwareHint = place.id && !devMode && !here ? activePlaceDisplay.detail : undefined;
|
|
586
|
+
// The place chosen, as the pill and the `+` menu mark it.
|
|
587
|
+
const placeId = here ? HERE : place.id;
|
|
588
|
+
// The Folder pill's choices: Auto, then on This computer every folder it opened, most recent first, and on a
|
|
589
|
+
// machine the folders its owner shares with the web, and no others.
|
|
590
|
+
const AUTO = '__auto__';
|
|
591
|
+
const folderItems = useMemo(() => {
|
|
592
|
+
const item = (id, label, hint) => ({ id, label, hint, icon: _jsx(FolderOpen, { size: 13, color: "$soft" }) });
|
|
593
|
+
return here
|
|
594
|
+
? [item(AUTO, t('Auto'), t('The folder your ask is about, else the one you used last')), ...folders.map((f) => item(f.path, f.name, f.path))]
|
|
595
|
+
: [item(AUTO, t('Auto'), t('The folder your shell there is open in, when it is shared; else a new folder')), ...granted.map((f) => item(f, named(f), f))];
|
|
596
|
+
}, [here, folders, granted, t]);
|
|
597
|
+
// The folder the run goes to, as the pill says it: Auto's or the one chosen.
|
|
598
|
+
const aimedAt = here
|
|
599
|
+
? { name: folderAt.folder?.name ?? '', id: folderAt.auto ? AUTO : folderAt.folder?.path, auto: folderAt.auto }
|
|
600
|
+
: { name: aimed.dir ? named(aimed.dir) : '', id: aimed.auto ? AUTO : aimed.dir, auto: aimed.auto };
|
|
601
|
+
const chooseFolder = async () => {
|
|
602
|
+
if (!local)
|
|
603
|
+
return;
|
|
604
|
+
const f = await local.pick().catch(() => null);
|
|
605
|
+
if (f)
|
|
606
|
+
set({ place: HERE, folder: f.path });
|
|
607
|
+
};
|
|
608
|
+
const branch = kept.branch || kept.repo?.default_branch || 'main';
|
|
609
|
+
const forge = isForge(kept.repo);
|
|
610
|
+
const hasRepo = Boolean(isForge(kept.repo) || isHub(kept.repo));
|
|
611
|
+
const screen = (to) => () => host.go(path({ kind: 'screen', screen: to }));
|
|
612
|
+
// The composer's pills: where the run goes, which repository, which branch.
|
|
613
|
+
const pills = (_jsxs(_Fragment, { children: [_jsx(TooltipProvider, { delay: 150, children: _jsxs(Tooltip, { placement: "top", offset: 6, children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(XStack, { items: "center", minW: 0, maxW: "100%", children: _jsx(ChipSelect, { name: t('Where the run runs'), icon: here ? _jsx(Laptop, { size: 13, color: "$soft" }) : place.id ? _jsx(Monitor, { size: 13, color: "$soft" }) : _jsx(Cloud, { size: 13, color: "$soft" }), label: here ? t('This computer') : activePlaceDisplay.title, chosen: placeItems.find((i) => i.place.id === placeId), items: placeItems, onChange: (i) => set({ place: i.place.id }), placeholder: devMode ? t('Search machines…') : t('Search devices…'), placement: "top-start", loading: places.loading, error: places.error?.message ?? null, footer: _jsx(FooterLink, { label: t('Manage…'), onPress: () => host.go(path({ kind: 'settings', section: 'machines' })) }) }) }) }), _jsx(TooltipContent, { maxW: 280, px: "$3", py: "$2", z: "var(--z-popover)", children: _jsxs(YStack, { gap: "$0.5", children: [_jsx(SizableText, { fontFamily: "$body", size: "$1", color: "$ink", children: placeTooltip }), placeHardwareHint ? (_jsx(SizableText, { fontFamily: "$body", size: "$1", color: "$soft", children: placeHardwareHint })) : null] }) })] }) }), here || granted.length ? (_jsx(ChipSelect, { name: t('Folder'), icon: _jsx(FolderOpen, { size: 13, color: "$soft" }), label: aimedAt.name ? (aimedAt.auto ? t('Auto · {name}', { name: aimedAt.name }) : aimedAt.name) : here ? t('Choose folder…') : t('Auto'), chosen: folderItems.find((i) => i.id === aimedAt.id), items: folderItems, onChange: (i) => set({ folder: i.id === AUTO ? '' : i.id }), placeholder: t('Search folders…'), placement: "top-start", footer: here ? (_jsx(FooterLink, { label: t('Choose folder…'), onPress: () => void chooseFolder() })) : (_jsx(FooterLink, { label: t('Manage shared folders…'), onPress: () => host.go(path({ kind: 'settings', section: 'machines' })) })) })) : null, here || aimed.dir ? null : (_jsx(RepoSelect, { open: picking, onOpenChange: setPicking, value: isForge(kept.repo) ? { ...kept.repo, source: 'forge' } : isHub(kept.repo) ? { ...kept.repo, source: 'github' } : null, onChange: (r) => {
|
|
614
|
+
const hub = r.github ? hubs.current.get((r.full_name ?? '').toLowerCase()) : undefined;
|
|
615
|
+
setIssue(0);
|
|
616
|
+
if (hub) {
|
|
617
|
+
set({ repo: hub, branch: hub.default_branch });
|
|
618
|
+
return;
|
|
619
|
+
}
|
|
620
|
+
const row = known.current.get(r.name) ?? chosen(r);
|
|
621
|
+
set({ repo: row, branch: row.default_branch });
|
|
622
|
+
}, load: loadRepos, connect: hasRepo ? (_jsx(FooterLink, { label: t('Work without a repository'), onPress: () => {
|
|
623
|
+
drop();
|
|
624
|
+
setPicking(false);
|
|
625
|
+
} })) : undefined, tabs: [
|
|
626
|
+
{ id: 'all', label: t('All') },
|
|
627
|
+
{ id: 'forge', label: t('Organization') },
|
|
628
|
+
{ id: 'github', label: 'GitHub' },
|
|
629
|
+
], troubleshoot: { label: t('Link GitHub project…'), onPress: screen('sync') }, action: {
|
|
630
|
+
label: t('Add to project'),
|
|
631
|
+
onPress: (r) => {
|
|
632
|
+
// A GitHub row is built from GitHub's own address: cloud git's first segment is a Hanzo org, and a GitHub owner is not one.
|
|
633
|
+
const github = r.github === true;
|
|
634
|
+
const row = github ? undefined : known.current.get(r.name);
|
|
635
|
+
setAdding({
|
|
636
|
+
repo: github ? `https://github.com/${r.owner}/${r.name}` : row?.clone || `${target.api}/v1/git/${r.owner}/${r.name}.git`,
|
|
637
|
+
title: row?.full_name || `${r.owner}/${r.name}`,
|
|
638
|
+
ref: r.default_branch || 'main',
|
|
639
|
+
name: r.name,
|
|
640
|
+
});
|
|
641
|
+
},
|
|
642
|
+
}, placeholder: t('Repository'), placement: "top-start", disabled: !signed })), forge && !here && !aimed.dir ? (_jsx(BranchSelect, { open: branching, onOpenChange: setBranching, value: branch, onChange: (b) => set({ branch: b }), load: loadBranches, placement: "top-start" })) : null] }));
|
|
643
|
+
const commands = [
|
|
644
|
+
{ id: 'run', label: t('Run'), keys: 'Ctrl+↵', icon: _jsx(Play, { size: 14, color: "$soft" }), disabled: !draft.trim(), run: () => void send() },
|
|
645
|
+
{ id: 'pick-repo', label: t('Link GitHub project…'), icon: _jsx(FolderGit2, { size: 14, color: "$soft" }), run: () => setPicking(true) },
|
|
646
|
+
{ id: 'issues', label: t('View issues'), icon: _jsx(CircleDot, { size: 14, color: "$soft" }), run: screen('issues') },
|
|
647
|
+
{ id: 'templates', label: t('Browse templates'), icon: _jsx(LayoutTemplate, { size: 14, color: "$soft" }), run: screen('templates') },
|
|
648
|
+
{ id: 'projects', label: t('Open projects'), icon: _jsx(Code, { size: 14, color: "$soft" }), run: screen('projects') },
|
|
649
|
+
{ id: 'sync', label: t('Connect GitHub…'), icon: _jsx(GitBranch, { size: 14, color: "$soft" }), run: screen('sync') },
|
|
650
|
+
{ id: 'address', label: t('Use a git URL'), icon: _jsx(Link2, { size: 14, color: "$soft" }), run: () => setGiving(true) },
|
|
651
|
+
...(redesign.can ? [{ id: 'redesign', label: t('Redesign a site…'), icon: _jsx(Globe, { size: 14, color: "$soft" }), run: redesign.ask }] : []),
|
|
652
|
+
];
|
|
653
|
+
// The `+` menu's Connectors shelf gives power users 1-click access to attach a GitHub project even when the composer bar is kept clean.
|
|
654
|
+
const connectors = {
|
|
655
|
+
rows: homes.value.homes.slice(0, 12).map((h) => ({
|
|
656
|
+
id: h.name,
|
|
657
|
+
label: h.label,
|
|
658
|
+
note: h.branch,
|
|
659
|
+
icon: _jsx(FolderGit2, { size: 16 }),
|
|
660
|
+
on: codebase !== '' && codebase.toLowerCase() === h.name.toLowerCase(),
|
|
661
|
+
})),
|
|
662
|
+
pick: (id) => {
|
|
663
|
+
if (codebase && codebase.toLowerCase() === id.toLowerCase()) {
|
|
664
|
+
drop();
|
|
665
|
+
return;
|
|
666
|
+
}
|
|
667
|
+
const match = homes.value.homes.find((h) => h.name === id);
|
|
668
|
+
if (match)
|
|
669
|
+
choose(match);
|
|
670
|
+
},
|
|
671
|
+
loading: homes.loading,
|
|
672
|
+
empty: t('Start any prompt directly, or link a GitHub project'),
|
|
673
|
+
create: { label: t('Link GitHub project…'), onPress: () => setPicking(true) },
|
|
674
|
+
browse: { label: t('Connect GitHub…'), onPress: screen('sync') },
|
|
675
|
+
manage: { label: t('Open projects'), onPress: screen('projects') },
|
|
676
|
+
};
|
|
677
|
+
// Dev takes text files, so Sketch's image drawings stay off its `+` and `@` shelves.
|
|
678
|
+
const devPlugins = {
|
|
679
|
+
...carry.plugins,
|
|
680
|
+
rows: carry.plugins.rows.filter((r) => r.id !== 'sketch'),
|
|
681
|
+
pick: (id) => {
|
|
682
|
+
if (id !== 'sketch')
|
|
683
|
+
carry.plugins.pick(id);
|
|
684
|
+
},
|
|
685
|
+
};
|
|
686
|
+
// The machines a run can go to, as the `+` menu's Devices: the same choice as the pill's.
|
|
687
|
+
const devices = {
|
|
688
|
+
rows: placeItems.map((i) => ({
|
|
689
|
+
id: i.place.id || 'sandbox',
|
|
690
|
+
label: i.label,
|
|
691
|
+
note: i.hint,
|
|
692
|
+
icon: i.place.id === HERE ? _jsx(Laptop, { size: 16 }) : i.place.id ? _jsx(Monitor, { size: 16 }) : _jsx(Cloud, { size: 16 }),
|
|
693
|
+
on: i.place.id === placeId,
|
|
694
|
+
})),
|
|
695
|
+
pick: (id) => set({ place: id === 'sandbox' ? '' : id }),
|
|
696
|
+
loading: places.loading,
|
|
697
|
+
error: places.error?.message ?? null,
|
|
698
|
+
create: { label: t('Link GitHub project…'), onPress: () => setPicking(true) },
|
|
699
|
+
manage: { label: t('Manage devices…'), onPress: () => host.go(path({ kind: 'settings', section: 'machines' })) },
|
|
700
|
+
};
|
|
701
|
+
return (_jsxs(XStack, { flex: 1, width: "100%", height: "100%", minW: 0, minH: 0, overflow: "hidden", children: [_jsxs(YStack, { flex: 1, minW: 0, minH: 0, height: "100%", overflow: "hidden", children: [_jsxs(XStack, { "data-slot": "conversation-head", shrink: 0, items: "center", justify: "space-between", gap: "$2", px: "$3", height: 36, "$max-md": { display: 'none' }, children: [_jsx(XStack, { items: "center", gap: "$2", minW: 0, flex: 1 }), _jsx(XStack, { "data-slot": "conversation-controls", items: "center", gap: "$1", shrink: 0, children: wide ? _jsx(PanelToggle, { open: desk, onToggle: () => setDesk((d) => !d) }) : null })] }), _jsxs(YStack, { display: "grid",
|
|
702
|
+
// Optical center (~43% down viewport on desktop) instead of geometric 50% + top bar offset.
|
|
703
|
+
gridTemplateRows: wide ? 'minmax(24px, 0.76fr) auto auto minmax(48px, 1.24fr)' : 'minmax(0, 1fr) auto', items: "center", "$platform-web": { justifyItems: 'center' }, width: "100%", flex: 1, minH: 0, overflowX: "hidden", "data-slot": "new", children: [wide ? _jsx(YStack, {}) : null, _jsx(YStack, { display: "grid",
|
|
704
|
+
// One track, its question set at the track's foot, just above the composer: a
|
|
705
|
+
// second `auto` track left the question alone in the first, at the pane's top.
|
|
706
|
+
gridTemplateRows: "minmax(0, 1fr)", items: "flex-end", width: "100%", maxW: MEASURE, height: wide ? undefined : '100%', px: "$4", pb: "$5", overflowY: "auto", children: _jsx(SizableText, { render: "h1", fontFamily: "$heading", fontSize: "$7", lineHeight: "$7", fontWeight: "600", letterSpacing: '-0.025em', color: "$ink", text: "center", children: t('Build what’s next.') }) }), _jsx(YStack, { width: "100%", maxW: MEASURE, gap: "$2", pb: "$3", children: _jsxs(YStack, { gap: "$2", children: [env.value && (env.value.state === 'proposed' || unset(env.value)) && !place.id && !here ? (_jsxs(XStack, { items: "center", justify: "space-between", gap: "$3", rowGap: "$2", mx: "$3", px: "$3", py: "$2", flexWrap: "wrap", children: [_jsx(SizableText, { size: "$2", color: "$ink", flex: 1, minW: 180, children: env.value.state === 'proposed'
|
|
707
|
+
? t('A proposed environment for {repo} is waiting for review.', { repo: codebase })
|
|
708
|
+
: t('{repo} has no environment yet, so every run starts it bare.', { repo: codebase }) }), env.value.state === 'proposed' && env.value.session ? (_jsx(Button, { size: "sm", variant: "outline", borderColor: "var(--border-strong)", onPress: () => host.go(env.value.session), children: t('Review') })) : (_jsx(Button, { size: "sm", variant: "primary", onPress: () => setOffering(true), children: t('Set up environment') }))] })) : null, note || refused || mind.note ? (_jsx(SizableText, { size: "$1", color: "$soft", role: "status", px: "$3", children: note || refused || mind.note })) : null, offered === place.id && granted.length ? (_jsx(XStack, { px: "$3", gap: "$2", flexWrap: "wrap", "data-slot": "shared-folders", children: granted.map((f) => (_jsx(Button, { size: "sm", variant: "outline", borderColor: "var(--border-strong)", "aria-label": t('Use {folder}', { folder: f }), onPress: () => {
|
|
709
|
+
set({ folder: f });
|
|
710
|
+
setOffered('');
|
|
711
|
+
setNote('');
|
|
712
|
+
}, children: _jsxs(XStack, { items: "center", gap: "$1.5", children: [_jsx(FolderOpen, { size: 14 }), _jsx(SizableText, { size: "$2", color: "$ink", children: named(f) })] }) }, f))) })) : null, redesign.view, ran ? _jsx(RanHere, { ran: ran, setup: fetched, devMode: devMode, onCancel: local?.cancel ? () => void local.cancel?.() : undefined }) : null, !redesign.can && pagesIn(draft).length && !critiqued(draft) && !busy ? (_jsx(XStack, { px: "$3", "data-slot": "web-page-offer", children: _jsx(Button, { size: "sm", variant: "outline", borderColor: "var(--border-strong)", onPress: () => setDraft(critique(pagesIn(draft)[0])), children: _jsxs(XStack, { items: "center", gap: "$1.5", children: [_jsx(Globe, { size: 14 }), _jsx(SizableText, { size: "$2", color: "$ink", children: t('Critique and redesign {page}', { page: shownPage(pagesIn(draft)[0]) }) })] }) }) })) : null, _jsx(Composer, { column: true, value: draft, onChange: setDraft, onSend: () => void send(), busy: busy || redesign.busy, placeholder: t('Ask, build, or run anything…'), label: t('Describe a task or ask a question'), plus: {
|
|
713
|
+
upload: () => pick(files, setFiles, setNote, t),
|
|
714
|
+
research: { on: carry.gear.gear.research, set: (on) => carry.gear.set({ research: on }) },
|
|
715
|
+
skills: carry.skills,
|
|
716
|
+
connectors,
|
|
717
|
+
design: carry.design,
|
|
718
|
+
plugins: devPlugins,
|
|
719
|
+
devices,
|
|
720
|
+
memory: { on: carry.gear.gear.memory, set: (on) => carry.gear.set({ memory: on }) },
|
|
721
|
+
}, carried: [...carry.on, ...carrying(files, setFiles)], slash: carry.skills, at: devPlugins, pills: pills, commands: commands, mode: carry.mode, mind: mind, effort: pacing(mind), limits: limits, onUpgrade: () => host.go(path({ kind: 'screen', screen: 'plans' })), voice: voice, language: prefs.language ?? null, onLanguage: (id) => void savePrefs({ language: id }), talk: talk })] }) }), wide ? _jsx(YStack, {}) : null, _jsx(Publish, { source: adding, onClose: () => setAdding(null) }), _jsx(Address, { open: giving, onOpenChange: setGiving, title: t('Use a git URL'), says: t('Runs work on the GitHub repository at this address until you choose another. A private one needs GitHub connected.'), act: t('Use'), address: "", run: async (at) => give(at) }), carry.dialog, codebase ? (_jsx(SetupDialog, { repo: codebase, homes: homes, open: offering, onOpenChange: setOffering, onStart: setup, onRepo: choose, onSaved: () => {
|
|
722
|
+
setOffering(false);
|
|
723
|
+
env.reload();
|
|
724
|
+
} })) : null] })] }), desk && wide ? (_jsx(YStack, { width: 440, "$max-lg": { width: 340 }, maxW: "50%", shrink: 0, height: "100%", borderLeftWidth: 1, borderColor: "$borderColor", bg: "$background", minW: 0, minH: 0, overflow: "hidden", children: _jsx(Panel, { side: deck, kinds: [], onHide: () => setDesk(false), label: t('Tabs') }) })) : null] }));
|
|
725
|
+
}
|