@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,604 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* A project's workspace, in the same window: the chat on the left, what it
|
|
4
|
+
* built on the right.
|
|
5
|
+
*
|
|
6
|
+
* A project is a repository on the forge, addressed `<org>/<repo>`; the site it
|
|
7
|
+
* publishes to, when it has one, is the org's project row on that repository
|
|
8
|
+
* (or of the same name). A deployed site with no repository on the forge is
|
|
9
|
+
* opened by its slug (Artifacts), and works the same way.
|
|
10
|
+
*
|
|
11
|
+
* bar mark · project · history · chat toggle | Preview Files Code Layers |
|
|
12
|
+
* Share · Publish; on a phone the views (with Chat) are a row under it
|
|
13
|
+
* left the project's runs as a conversation, suggestions, and the ask
|
|
14
|
+
* right the deployed page, framed under its own bar (reload · page · device
|
|
15
|
+
* · open), and kept loaded while another view is open; the repository
|
|
16
|
+
* at the run's branch as a tree and as read-only code; the element a
|
|
17
|
+
* person picked
|
|
18
|
+
* dock the run's console — its steps and its log, as they stream
|
|
19
|
+
*
|
|
20
|
+
* The edge between left and right is dragged, or moved with the arrow keys, to
|
|
21
|
+
* size the chat, and the width is kept per browser; the right side keeps room
|
|
22
|
+
* for a page whatever the chat asked for.
|
|
23
|
+
*
|
|
24
|
+
* A chat turn IS a coding run: `POST /v1/agent/coding` with the project, the
|
|
25
|
+
* mode, and the previous run as `after`, so the next ask builds on the branch
|
|
26
|
+
* the last one pushed. Files and Code read native git at that branch. The
|
|
27
|
+
* preview is the project's own deployed address; a run's sandbox serves no
|
|
28
|
+
* address the platform publishes, and nothing here invents one.
|
|
29
|
+
*
|
|
30
|
+
* A project in a workspace the platform made is published by the platform: a
|
|
31
|
+
* template taken there reads `building` until its copy is `live` or failed, and
|
|
32
|
+
* is read again until then; a run that publishes what it pushed says so on its
|
|
33
|
+
* final status, which reads the project again and loads the preview again. Its
|
|
34
|
+
* pull request is merged from beside its link. A build that failed, or that has
|
|
35
|
+
* run past STALL, says so in the preview with the platform's reason and offers
|
|
36
|
+
* Publish again, which builds the project's repository at its branch.
|
|
37
|
+
*
|
|
38
|
+
* Derived from the Hanzo App v2 editor (github.com/hanzoai/build-v2), itself
|
|
39
|
+
* derived from OSW Studio and DeepSite (MIT). See NOTICE.
|
|
40
|
+
*
|
|
41
|
+
* Its words are the reader's language (@hanzo/i18n `t`, the target is
|
|
42
|
+
* `target`); a project's and a run's names, branches, paths and the
|
|
43
|
+
* platform's reasons are drawn as given.
|
|
44
|
+
*/
|
|
45
|
+
import { SizableText, useMedia, XStack, YStack } from '@hanzo/gui';
|
|
46
|
+
import { useI18n } from '@hanzo/i18n/react';
|
|
47
|
+
import { AlertCircle, Check, Clock, ExternalLink, Github, Globe, MousePointerClick, PanelLeft, RefreshCcw, Search, Share2, Square, Upload, } from '@hanzogui/lucide-icons-2';
|
|
48
|
+
import { Attachments, CHAT, Console, DEVICES, Feedback, FileTabs, FileTree, PageSelect, PreviewFrame, ProjectChip, VIEWS, Views, Workspace, fold, } from '@hanzo/ui/agents';
|
|
49
|
+
import { Composer, Message } from '@hanzo/ui/chat';
|
|
50
|
+
import { Button, Dialog, DialogContent, DialogTitle, Input, Skeleton, toast } from '@hanzo/ui';
|
|
51
|
+
import { HanzoMark } from '@hanzo/ui/product';
|
|
52
|
+
import { useLimits } from '@hanzo/ui/product/useLimits';
|
|
53
|
+
import { useDictation, useVoice } from '@hanzo/voice';
|
|
54
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
55
|
+
import { copy as toClipboard } from './clipboard.js';
|
|
56
|
+
import { RING } from './pane.js';
|
|
57
|
+
import { read as pushed } from './api/changes.js';
|
|
58
|
+
import { codebases, one } from './api/codebases.js';
|
|
59
|
+
import { start, steer as steerCoding } from './api/coding.js';
|
|
60
|
+
import { blob, listGitTargets, tree } from './api/git.js';
|
|
61
|
+
import { githubRepoFrom } from './api/github.js';
|
|
62
|
+
import { limits as readLimits } from './api/models.js';
|
|
63
|
+
import { declare } from './api/platform.js';
|
|
64
|
+
import { address, deployments, name as repoName, ours, templates } from './api/projects.js';
|
|
65
|
+
import { ports as listening, preview as sandboxPreview, stay } from './api/sandbox.js';
|
|
66
|
+
import { list, message, stop } from './api/sessions.js';
|
|
67
|
+
import { decode, followed, outcome, pull, said, scrub, who } from './api/turn.js';
|
|
68
|
+
import { verdict as record } from './api/verdict.js';
|
|
69
|
+
import { useKept, useProjects, useRead, useRun } from './data.js';
|
|
70
|
+
import { Merge } from './git.js';
|
|
71
|
+
import { GitHubBadge, SyncToGitHubDialog } from './github-sync.js';
|
|
72
|
+
import { Gutter } from './gutter.js';
|
|
73
|
+
import { useHost, useTarget } from './host.js';
|
|
74
|
+
import { cacheBustUrl, previewRevision, resolvePreviewSource } from './preview-url.js';
|
|
75
|
+
import { republish } from './question.js';
|
|
76
|
+
import { useSpend } from './spend.js';
|
|
77
|
+
import { MODES } from './gear.js';
|
|
78
|
+
import { level, pacing, useMind } from './mind.js';
|
|
79
|
+
import { Out } from './out.js';
|
|
80
|
+
import { useEar, useSpoken } from './voice.js';
|
|
81
|
+
import { Publish } from './publish.js';
|
|
82
|
+
import { path } from './route.js';
|
|
83
|
+
import { cleanErrorText, isAlreadyRunningError, isSessionActive, isSessionLive, linkThread, resolveSessionState } from './thread.js';
|
|
84
|
+
import { carrying, compose, pick } from './tools.js';
|
|
85
|
+
/** How often a project being published is read again, ms. */
|
|
86
|
+
const AGAIN = 5000;
|
|
87
|
+
/** How long a build may run before the builder offers to publish again, s. A template's build takes a few minutes. */
|
|
88
|
+
const STALL = 10 * 60;
|
|
89
|
+
/** The chat's width beside the work, px: its default, and the two it is kept between. */
|
|
90
|
+
const CHAT_WIDTH = 360;
|
|
91
|
+
const CHAT_FLOOR = 300;
|
|
92
|
+
const CHAT_CEIL = 640;
|
|
93
|
+
/** The Workspace's gutter between the chat and the work, and its margin right of the work, px ($3). */
|
|
94
|
+
const GUTTER = 12;
|
|
95
|
+
/** What the work keeps beside the chat however wide the chat was asked to be, px. */
|
|
96
|
+
const WORK = 400 + 2 * GUTTER;
|
|
97
|
+
/** Whether the site `p` is the repository `r`'s: built from it, or named as it is. */
|
|
98
|
+
export function siteOf(p, r) {
|
|
99
|
+
const want = `${r.org}/${r.name}`.toLowerCase();
|
|
100
|
+
return (p.repo !== '' && address(p.repo).toLowerCase() === want) || p.slug === r.name.toLowerCase();
|
|
101
|
+
}
|
|
102
|
+
/** A site's slug for a repository's name: lowercase letters, digits and hyphens, at most 40. */
|
|
103
|
+
export function slugOf(name) {
|
|
104
|
+
return name
|
|
105
|
+
.toLowerCase()
|
|
106
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
107
|
+
.replace(/^-+|-+$/g, '')
|
|
108
|
+
.slice(0, 40)
|
|
109
|
+
.replace(/-+$/, '');
|
|
110
|
+
}
|
|
111
|
+
/** One run in the conversation: what was asked, and what it came to. */
|
|
112
|
+
function Turn({ run, open, onOpen, project }) {
|
|
113
|
+
const target = useTarget();
|
|
114
|
+
const { t } = useI18n();
|
|
115
|
+
const [v, setV] = useState(null);
|
|
116
|
+
const [note, setNote] = useState('');
|
|
117
|
+
return (_jsxs(YStack, { gap: "$2", children: [_jsx(Message, { role: "user", children: _jsx(SizableText, { size: "$2", color: "$ink", children: run.title || t('Untitled session') }) }), _jsx(Message, { role: "assistant", busy: isSessionActive(run.status), actions: _jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Feedback, { text: run.title, verdict: v, onVerdict: (next) => {
|
|
118
|
+
setV(next);
|
|
119
|
+
record(target, run.id, project, next).catch((e) => {
|
|
120
|
+
setV(null);
|
|
121
|
+
setNote(e.message);
|
|
122
|
+
});
|
|
123
|
+
} }), note ? (_jsx(SizableText, { size: "$1", color: "$soft", children: note })) : null, !open ? (_jsx(XStack, { render: "button", onPress: onOpen, px: "$1.5", py: "$1", minH: 28, items: "center", focusVisibleStyle: RING, children: _jsx(SizableText, { size: "$1", color: "$soft", textDecorationLine: "underline", children: t('Show steps') }) })) : null] }), children: _jsx(SizableText, { size: "$2", color: "$ink", children: run.status === 'done' || run.status === 'completed'
|
|
124
|
+
? t('Done.')
|
|
125
|
+
: run.status === 'error'
|
|
126
|
+
? t('This session hit an error.')
|
|
127
|
+
: run.status === 'stopped'
|
|
128
|
+
? t('Stopped.')
|
|
129
|
+
: t('Working…') }) })] }));
|
|
130
|
+
}
|
|
131
|
+
export function Project({ at }) {
|
|
132
|
+
const host = useHost();
|
|
133
|
+
const target = useTarget();
|
|
134
|
+
const { t } = useI18n();
|
|
135
|
+
const spend = useSpend();
|
|
136
|
+
const signed = Boolean(host.person);
|
|
137
|
+
const all = useProjects(target, signed);
|
|
138
|
+
// The repository the address names, and the forge's record of it.
|
|
139
|
+
const named = 'slug' in at ? null : at;
|
|
140
|
+
const forge = useRead(named && signed ? () => one(target, named.name) : null, null, [target, signed, named?.name]);
|
|
141
|
+
const project = all.value.find((p) => (named ? siteOf(p, named) : 'slug' in at && p.slug === at.slug)) ?? null;
|
|
142
|
+
// The site this workspace publishes to: the project's, or the repository's name as one.
|
|
143
|
+
const slug = project?.slug ?? ('slug' in at ? at.slug : slugOf(named?.name ?? ''));
|
|
144
|
+
const title = project?.name ?? named?.name ?? slug;
|
|
145
|
+
// A project that has never served reads `building` while it is published, and
|
|
146
|
+
// is read again until it is live or its build failed.
|
|
147
|
+
const building = project?.status === 'building';
|
|
148
|
+
const failed = project?.status === 'error';
|
|
149
|
+
const { reload: again } = all;
|
|
150
|
+
// The clock a build is measured against, moved each time the project is read again.
|
|
151
|
+
const [now, setNow] = useState(() => Date.now());
|
|
152
|
+
useEffect(() => {
|
|
153
|
+
if (!building)
|
|
154
|
+
return;
|
|
155
|
+
const every = setInterval(() => {
|
|
156
|
+
again();
|
|
157
|
+
setNow(Date.now());
|
|
158
|
+
}, AGAIN);
|
|
159
|
+
return () => clearInterval(every);
|
|
160
|
+
}, [building, again]);
|
|
161
|
+
// When the build began, and why it failed, are its latest deployment's to say.
|
|
162
|
+
const failure = useRead(building || failed ? () => deployments(target, slug) : null, [], [target, slug, building, failed, project?.updated]);
|
|
163
|
+
const latest = failure.value[0];
|
|
164
|
+
const began = latest?.status === 'building' ? latest.created : 0;
|
|
165
|
+
const ran = began ? Math.max(0, Math.floor(now / 1000) - began) : 0;
|
|
166
|
+
const stalled = building && ran > STALL;
|
|
167
|
+
// Publish again: the project's repository, built at its branch, the way Publish builds it.
|
|
168
|
+
const [redo, setRedo] = useState({ busy: false, error: '' });
|
|
169
|
+
// The repository's clone address: the forge's for a repository, the site's own otherwise.
|
|
170
|
+
const clone = named ? (forge.value?.clone ?? '') : (project?.repo ?? '');
|
|
171
|
+
const home = named ? (forge.value?.branch ?? 'main') : project?.branch || 'main';
|
|
172
|
+
const retry = async () => {
|
|
173
|
+
if (!clone || redo.busy)
|
|
174
|
+
return;
|
|
175
|
+
// Built again in a cloud sandbox: asked first.
|
|
176
|
+
if (!(await spend.ask(republish(title, t))))
|
|
177
|
+
return;
|
|
178
|
+
setRedo({ busy: true, error: '' });
|
|
179
|
+
try {
|
|
180
|
+
await declare(target, { repo: clone, ref: home, name: slug, project: slug, mode: 'branch' });
|
|
181
|
+
setNow(Date.now());
|
|
182
|
+
again();
|
|
183
|
+
setRedo({ busy: false, error: '' });
|
|
184
|
+
toast.success(t('Publish queued for {name}', { name: title }));
|
|
185
|
+
}
|
|
186
|
+
catch (e) {
|
|
187
|
+
setRedo({ busy: false, error: e.message });
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
// The site's runs, or the org's when the repository has no site yet.
|
|
191
|
+
const sited = !named || Boolean(project);
|
|
192
|
+
const listed = useRead(signed ? () => list(target, sited ? { kind: 'coding', project: slug, limit: 50 } : { kind: 'coding', limit: 50 }) : null, [], [target, signed, slug, sited]);
|
|
193
|
+
// Only the runs on this project's own repository: a record can be moved into
|
|
194
|
+
// any project, and a run's branch is what Files, Code and Publish read.
|
|
195
|
+
const mine = (r) => (named ? ours(r.repo, `${named.org}/${named.name}`) && Boolean(r.repo) : ours(r.repo, project?.repo ?? ''));
|
|
196
|
+
const runs = { ...listed, value: listed.value.filter(mine) };
|
|
197
|
+
const ordered = useMemo(() => [...runs.value].reverse(), [listed.value, project?.repo, named?.org, named?.name]);
|
|
198
|
+
const [chosen, setChosen] = useState(null);
|
|
199
|
+
const current = chosen ?? runs.value[0]?.id ?? null;
|
|
200
|
+
const run = useRun(target, current);
|
|
201
|
+
const end = outcome(run.events);
|
|
202
|
+
const nextSession = useMemo(() => followed(run.events), [run.events]);
|
|
203
|
+
const pr = pull(run.record?.pr ?? '', run.record?.repo ?? '');
|
|
204
|
+
const runState = resolveSessionState(run.status, end.status);
|
|
205
|
+
const running = Boolean(current) && isSessionLive(runState);
|
|
206
|
+
const active = Boolean(current) && isSessionActive(runState);
|
|
207
|
+
const sandboxId = run.record?.sandbox ?? '';
|
|
208
|
+
// Follow a steered turn seamlessly into its continuation session.
|
|
209
|
+
useEffect(() => {
|
|
210
|
+
if (!current || !nextSession || nextSession === current)
|
|
211
|
+
return;
|
|
212
|
+
linkThread(current, nextSession);
|
|
213
|
+
setChosen(nextSession);
|
|
214
|
+
runs.reload();
|
|
215
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
216
|
+
}, [current, nextSession]);
|
|
217
|
+
const [view, setView] = useKept(`hanzo.build.view.${slug}`, 'preview');
|
|
218
|
+
const [device, setDevice] = useState('desktop');
|
|
219
|
+
const [collapsed, setCollapsed] = useKept('hanzo.build.chat', false);
|
|
220
|
+
const [split, setSplit] = useKept('hanzo.build.split', CHAT_WIDTH);
|
|
221
|
+
// The workspace's width, which bounds the chat so the work keeps its room.
|
|
222
|
+
const [room, setRoom] = useState(0);
|
|
223
|
+
const most = room ? Math.max(CHAT_FLOOR, Math.min(CHAT_CEIL, room - WORK)) : CHAT_CEIL;
|
|
224
|
+
const across = Math.min(most, Math.max(CHAT_FLOOR, split));
|
|
225
|
+
// Below md the chat and the work take turns, and Chat is one more view to switch back to.
|
|
226
|
+
const [pane, setPane] = useState('chat');
|
|
227
|
+
const wide = useMedia().md;
|
|
228
|
+
// A workspace too narrow for the chat at its floor and the work at its room
|
|
229
|
+
// (a tablet beside the host's column) shows the work, and the chat when asked:
|
|
230
|
+
// never both cut. Asked here is for this visit; the kept choice is the wide one's.
|
|
231
|
+
const cramped = wide && room > 0 && room < CHAT_FLOOR + WORK;
|
|
232
|
+
const [asked, setAsked] = useState(false);
|
|
233
|
+
const shut = cramped ? !asked : collapsed;
|
|
234
|
+
const [dock, setDock] = useKept('hanzo.build.dock', 36);
|
|
235
|
+
const [mode, setMode] = useKept('hanzo.build.mode', 'build');
|
|
236
|
+
const [page, setPage] = useState('/');
|
|
237
|
+
const [draft, setDraft] = useState('');
|
|
238
|
+
const [busy, setBusy] = useState(false);
|
|
239
|
+
const [note, setNote] = useState('');
|
|
240
|
+
const [picked, setPicked] = useState([]);
|
|
241
|
+
const [attached, setAttached] = useState([]);
|
|
242
|
+
// The model and effort Chat and New share, and dictation into the ask.
|
|
243
|
+
const { limits } = useLimits(signed ? (signal) => readLimits(target, signal) : null, target);
|
|
244
|
+
const mind = useMind(target, limits?.plan, host.topUp);
|
|
245
|
+
const voice = useVoice({ speech: useEar(target), language: useSpoken(), ...useDictation(draft, setDraft) });
|
|
246
|
+
const [bridge, setBridge] = useState(false);
|
|
247
|
+
const [editing, setEditing] = useState(false);
|
|
248
|
+
const [pageLines, setPageLines] = useState([]);
|
|
249
|
+
const [history, setHistory] = useState(false);
|
|
250
|
+
const [publish, setPublish] = useState(null);
|
|
251
|
+
const [switcher, setSwitcher] = useState(false);
|
|
252
|
+
const [switchQ, setSwitchQ] = useState('');
|
|
253
|
+
const repos = useRead(switcher && signed ? () => codebases(target) : null, [], [target, switcher, signed]);
|
|
254
|
+
const filteredRepos = useMemo(() => {
|
|
255
|
+
const needle = switchQ.trim().toLowerCase();
|
|
256
|
+
return needle ? repos.value.filter((c) => `${c.org}/${c.name}`.toLowerCase().includes(needle)) : repos.value;
|
|
257
|
+
}, [repos.value, switchQ]);
|
|
258
|
+
const frame = useRef(null);
|
|
259
|
+
const [previewRev, setPreviewRev] = useState(0);
|
|
260
|
+
const [preferLive, setPreferLive] = useState(false);
|
|
261
|
+
const [sandboxPort, setSandboxPort] = useState(0);
|
|
262
|
+
const [sandboxUrl, setSandboxUrl] = useState('');
|
|
263
|
+
// What was published or edited may be new files at the same address: re-read the
|
|
264
|
+
// project, re-poll sandbox ports, and cache-bust reload the preview frame.
|
|
265
|
+
const fresh = () => {
|
|
266
|
+
again();
|
|
267
|
+
setPreviewRev((n) => n + 1);
|
|
268
|
+
frame.current?.reload();
|
|
269
|
+
};
|
|
270
|
+
// Poll the active session's sandbox for a live dev-server port so Preview prefers
|
|
271
|
+
// live edits in the sandbox over the pre-edit deployed site.
|
|
272
|
+
useEffect(() => {
|
|
273
|
+
if (!signed || !sandboxId) {
|
|
274
|
+
setSandboxPort(0);
|
|
275
|
+
setSandboxUrl('');
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
let gone = false;
|
|
279
|
+
const poll = () => listening(target, sandboxId).then((ps) => {
|
|
280
|
+
if (gone)
|
|
281
|
+
return;
|
|
282
|
+
setSandboxPort((p) => (ps.some((x) => x.port === p) ? p : (ps[0]?.port ?? 0)));
|
|
283
|
+
}, () => undefined);
|
|
284
|
+
void poll();
|
|
285
|
+
const every = setInterval(poll, 5000);
|
|
286
|
+
return () => {
|
|
287
|
+
gone = true;
|
|
288
|
+
clearInterval(every);
|
|
289
|
+
};
|
|
290
|
+
}, [target, signed, sandboxId, previewRev]);
|
|
291
|
+
useEffect(() => {
|
|
292
|
+
setSandboxUrl('');
|
|
293
|
+
if (!signed || !sandboxId || !sandboxPort)
|
|
294
|
+
return;
|
|
295
|
+
let gone = false;
|
|
296
|
+
sandboxPreview(target, sandboxId, sandboxPort, stay).then((u) => !gone && setSandboxUrl(u), () => undefined);
|
|
297
|
+
return () => {
|
|
298
|
+
gone = true;
|
|
299
|
+
};
|
|
300
|
+
}, [target, signed, sandboxId, sandboxPort, previewRev]);
|
|
301
|
+
// Auto-refresh Preview whenever a turn finishes, edits/pushes land, or a publish completes.
|
|
302
|
+
const revKey = useMemo(() => previewRevision(run.events, runState, end.published), [run.events, runState, end.published]);
|
|
303
|
+
const lastRev = useRef({ run: null, key: '', wasActive: false });
|
|
304
|
+
useEffect(() => {
|
|
305
|
+
if (!run.record)
|
|
306
|
+
return;
|
|
307
|
+
if (lastRev.current.run !== current) {
|
|
308
|
+
lastRev.current = { run: current, key: revKey, wasActive: active };
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
const finishedTurn = lastRev.current.wasActive && !active;
|
|
312
|
+
const advanced = lastRev.current.key !== revKey;
|
|
313
|
+
lastRev.current = { run: current, key: revKey, wasActive: active };
|
|
314
|
+
if (advanced || finishedTurn)
|
|
315
|
+
fresh();
|
|
316
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
317
|
+
}, [current, run.record, revKey, active]);
|
|
318
|
+
// Where the open run's pull request stands on the forge: Merge is offered while it is open.
|
|
319
|
+
const proposal = useRead(signed && current && pr.href ? () => pushed(target, current).then((c) => ({ run: current, pull: c.pull })) : null, null, [target, signed, current, pr.href]);
|
|
320
|
+
const proposing = proposal.value?.run === current && proposal.value.pull?.state === 'open';
|
|
321
|
+
// Files is drawn again after a merge, from what the forge holds now.
|
|
322
|
+
const [round, setRound] = useState(0);
|
|
323
|
+
// Files and Code: native git, at the branch the open run pushed (or the project's own).
|
|
324
|
+
const repo = named ? named.name : project?.repo ? repoName(project.repo) : '';
|
|
325
|
+
const ref = run.record?.branch || home;
|
|
326
|
+
// Outbound GitHub mirror targets: shows a GitHub badge when synced, or "Sync to GitHub" when Hanzo Git only.
|
|
327
|
+
const gitTargets = useRead(signed && repo ? () => listGitTargets(target, repo).catch(() => []) : null, [], [target, signed, repo]);
|
|
328
|
+
const [syncDialogOpen, setSyncDialogOpen] = useState(false);
|
|
329
|
+
const [syncedGitHub, setSyncedGitHub] = useState(null);
|
|
330
|
+
useEffect(() => {
|
|
331
|
+
setSyncedGitHub(null);
|
|
332
|
+
}, [repo]);
|
|
333
|
+
const githubInfo = useMemo(() => syncedGitHub ?? githubRepoFrom(project?.repo || clone || '', gitTargets.value), [syncedGitHub, project?.repo, clone, gitTargets.value]);
|
|
334
|
+
const [files, setFiles] = useState([]);
|
|
335
|
+
const [file, setFile] = useState(null);
|
|
336
|
+
useEffect(() => {
|
|
337
|
+
setFiles([]);
|
|
338
|
+
setFile(null);
|
|
339
|
+
}, [repo, ref]);
|
|
340
|
+
const openFile = async (path) => {
|
|
341
|
+
setFile(path);
|
|
342
|
+
setView('code');
|
|
343
|
+
if (files.some((f) => f.path === path))
|
|
344
|
+
return;
|
|
345
|
+
setFiles((was) => [...was, { path, readOnly: true }]);
|
|
346
|
+
try {
|
|
347
|
+
const b = await blob(target, repo, ref, path);
|
|
348
|
+
const content = b.binary ? '' : b.truncated ? '' : b.text;
|
|
349
|
+
const error = b.binary ? t('A binary file — nothing to show as text.') : b.truncated ? t('Past the 1 MiB view cap — clone the repository to read it.') : undefined;
|
|
350
|
+
setFiles((was) => was.map((f) => (f.path === path ? { ...f, content, error } : f)));
|
|
351
|
+
}
|
|
352
|
+
catch (e) {
|
|
353
|
+
setFiles((was) => was.map((f) => (f.path === path ? { ...f, error: e.message } : f)));
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
// Pages: the HTML files at the repository's root, as the page picker's list.
|
|
357
|
+
const root = useRead(repo ? () => tree(target, repo, ref, '') : null, [], [target, repo, ref]);
|
|
358
|
+
const pages = useMemo(() => [
|
|
359
|
+
{ id: '/', label: t('Homepage') },
|
|
360
|
+
...root.value
|
|
361
|
+
.filter((e) => !e.dir && /\.html?$/i.test(e.name) && !/^index\.html?$/i.test(e.name))
|
|
362
|
+
.map((e) => ({ id: `/${e.path}`, label: e.name.replace(/\.html?$/i, '') })),
|
|
363
|
+
], [root.value, t]);
|
|
364
|
+
// Prefer the live sandbox preview when available; fall back to deployed live site or starter demo.
|
|
365
|
+
const forked = project && !project.live && !building && !failed ? project.forked : '';
|
|
366
|
+
const starters = useRead(forked ? () => templates(target) : null, [], [target.api, forked]);
|
|
367
|
+
const starter = forked ? starters.value.find((s) => s.slug === forked && s.demo) : undefined;
|
|
368
|
+
const resolvedPreview = resolvePreviewSource({
|
|
369
|
+
sandboxUrl,
|
|
370
|
+
liveUrl: project?.live,
|
|
371
|
+
starterUrl: starter?.demo,
|
|
372
|
+
preferLive,
|
|
373
|
+
});
|
|
374
|
+
const rawSrc = resolvedPreview.url
|
|
375
|
+
? resolvedPreview.kind === 'sandbox'
|
|
376
|
+
? resolvedPreview.url
|
|
377
|
+
: new URL(page, resolvedPreview.url).toString()
|
|
378
|
+
: null;
|
|
379
|
+
const src = rawSrc ? cacheBustUrl(rawSrc, previewRev) : null;
|
|
380
|
+
const why = failure.value[0]?.message || failure.error?.message || (failure.loading ? '' : t('Its build ended without saying why.'));
|
|
381
|
+
const merged = () => {
|
|
382
|
+
proposal.reload();
|
|
383
|
+
root.reload();
|
|
384
|
+
setRound((n) => n + 1);
|
|
385
|
+
};
|
|
386
|
+
const lines = useMemo(() => [
|
|
387
|
+
...run.events
|
|
388
|
+
.filter((e) => e.kind === 'log' || e.kind === 'tool-call' || e.kind === 'status')
|
|
389
|
+
.map((e) => {
|
|
390
|
+
// The console is where a run's error is read whole; the chat says it in one plain line.
|
|
391
|
+
const body = decode(e.payload);
|
|
392
|
+
const error = e.kind === 'status' && body && typeof body === 'object' && typeof body.error === 'string' ? scrub(body.error, t) : '';
|
|
393
|
+
return {
|
|
394
|
+
id: `r${e.seq || e.id}`,
|
|
395
|
+
level: error || (e.kind === 'status' && /error/.test(said(e, run.record?.mode).toLowerCase())) ? 'error' : e.kind === 'tool-call' ? 'info' : 'log',
|
|
396
|
+
text: error || said(e, run.record?.mode, t),
|
|
397
|
+
source: e.kind === 'status' ? 'run' : who(e.actor),
|
|
398
|
+
};
|
|
399
|
+
})
|
|
400
|
+
.filter((l) => l.text),
|
|
401
|
+
...pageLines,
|
|
402
|
+
], [run.events, run.record?.mode, pageLines]);
|
|
403
|
+
const onBridge = (e) => {
|
|
404
|
+
if (e.type === 'preview:ready') {
|
|
405
|
+
setBridge(true);
|
|
406
|
+
// A new document starts closed to picking; open it again if the person had.
|
|
407
|
+
if (editing)
|
|
408
|
+
frame.current?.post({ type: 'preview:editable', active: true });
|
|
409
|
+
}
|
|
410
|
+
else if (e.type === 'preview:select')
|
|
411
|
+
// The whole selector, as it will ride the next ask — never a shortened name
|
|
412
|
+
// that hides what the page sent.
|
|
413
|
+
setPicked([{ id: e.info.selector, kind: 'element', label: e.info.selector }]);
|
|
414
|
+
else if (e.type === 'preview:navigate') {
|
|
415
|
+
// The bridge admits only a path on the framed site's own origin; kept as its path and query.
|
|
416
|
+
const to = new URL(e.path, window.location.origin);
|
|
417
|
+
setPage(`${to.pathname}${to.search}`);
|
|
418
|
+
}
|
|
419
|
+
else if (e.type === 'preview:console')
|
|
420
|
+
setPageLines((was) => [...was.slice(-400), { id: `p${was.length}-${Date.now()}`, level: e.level, text: e.text, source: 'page' }]);
|
|
421
|
+
};
|
|
422
|
+
// Steer an active session: sandbox sessions use POST /v1/agent/coding/{id}/steer, machines use /message.
|
|
423
|
+
const steer = async (id, wordsOverride) => {
|
|
424
|
+
const words = (wordsOverride ?? draft).trim();
|
|
425
|
+
if (!words)
|
|
426
|
+
return;
|
|
427
|
+
const isSandbox = (run.record?.environment || 'sandbox') === 'sandbox';
|
|
428
|
+
try {
|
|
429
|
+
if (isSandbox) {
|
|
430
|
+
await steerCoding(target, id, words);
|
|
431
|
+
setDraft('');
|
|
432
|
+
setPicked([]);
|
|
433
|
+
setAttached([]);
|
|
434
|
+
setNote(t('Redirecting session — keeping current work and continuing here'));
|
|
435
|
+
}
|
|
436
|
+
else {
|
|
437
|
+
await message(target, id, words);
|
|
438
|
+
setDraft('');
|
|
439
|
+
setPicked([]);
|
|
440
|
+
setAttached([]);
|
|
441
|
+
setNote(t('Sent — recorded on this session'));
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
catch (e) {
|
|
445
|
+
setNote(cleanErrorText(e.message));
|
|
446
|
+
}
|
|
447
|
+
};
|
|
448
|
+
// A suggestion sends its own words; the composer, a draft with words in it.
|
|
449
|
+
const send = async (text) => {
|
|
450
|
+
const ask = (text ?? draft).trim();
|
|
451
|
+
if (busy || !ask)
|
|
452
|
+
return;
|
|
453
|
+
setBusy(true);
|
|
454
|
+
setNote('');
|
|
455
|
+
try {
|
|
456
|
+
// The page's own strings ride as quoted data, never as prose, and the page
|
|
457
|
+
// is named only when the person chose it from the picker.
|
|
458
|
+
const where = pages.find((p) => p.id === page)?.label;
|
|
459
|
+
const context = picked.length
|
|
460
|
+
? `\n\nThe person picked an element in the preview${where ? ` of the ${where} page` : ''}. Its CSS selector, as data: ${JSON.stringify(picked[0].id)}`
|
|
461
|
+
: '';
|
|
462
|
+
const prompt = compose(`${ask}${context}`, attached);
|
|
463
|
+
// A project with no repository yet sends neither, and its first session makes one.
|
|
464
|
+
let next;
|
|
465
|
+
try {
|
|
466
|
+
next = await start(target, {
|
|
467
|
+
prompt,
|
|
468
|
+
// A repository with no site yet runs on the repository alone.
|
|
469
|
+
project: project?.slug,
|
|
470
|
+
repo,
|
|
471
|
+
base: named ? forge.value?.branch : project?.branch,
|
|
472
|
+
after: current ?? undefined,
|
|
473
|
+
mode,
|
|
474
|
+
// Enso named as itself: a turn that names none takes the person's saved coding default.
|
|
475
|
+
model: mind.model,
|
|
476
|
+
effort: level(mind.effort),
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
catch (e) {
|
|
480
|
+
if (current && isAlreadyRunningError(e)) {
|
|
481
|
+
await steer(current, prompt);
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
throw e;
|
|
485
|
+
}
|
|
486
|
+
if (current)
|
|
487
|
+
linkThread(current, next.session);
|
|
488
|
+
setDraft('');
|
|
489
|
+
setPicked([]);
|
|
490
|
+
setAttached([]);
|
|
491
|
+
setChosen(next.session);
|
|
492
|
+
runs.reload();
|
|
493
|
+
}
|
|
494
|
+
catch (e) {
|
|
495
|
+
setNote(cleanErrorText(e.message));
|
|
496
|
+
}
|
|
497
|
+
finally {
|
|
498
|
+
setBusy(false);
|
|
499
|
+
}
|
|
500
|
+
};
|
|
501
|
+
const share = async () => {
|
|
502
|
+
const link = project?.live || `${window.location.origin}${window.location.pathname}`;
|
|
503
|
+
setNote((await toClipboard(link)) ? t('Copied {link}', { link }) : link);
|
|
504
|
+
};
|
|
505
|
+
if (!signed) {
|
|
506
|
+
return (_jsx(YStack, { flex: 1, items: "center", justify: "center", px: "$4", children: _jsxs(YStack, { borderWidth: 1, borderColor: "var(--border-strong)", rounded: "$4", bg: "$panel", px: "$6", py: "$8", gap: "$3", items: "center", width: "100%", maxW: 440, children: [_jsx(SizableText, { size: "$4", fontWeight: "500", color: "$ink", text: "center", children: t('Sign in to open this project.') }), _jsx(Button, { size: "sm", variant: "primary", onPress: () => host.signIn?.(), children: t('Sign in') })] }) }));
|
|
507
|
+
}
|
|
508
|
+
// A repository of another organization is opened in that one.
|
|
509
|
+
if (named && host.org && named.org.toLowerCase() !== host.org.toLowerCase()) {
|
|
510
|
+
const member = host.memberships?.some((m) => m.toLowerCase() === named.org.toLowerCase()) && host.chooseOrg;
|
|
511
|
+
return (_jsx(YStack, { flex: 1, items: "center", justify: "center", px: "$4", children: _jsxs(YStack, { borderWidth: 1, borderColor: "var(--border-strong)", rounded: "$4", bg: "$panel", px: "$6", py: "$8", gap: "$3", items: "center", width: "100%", maxW: 480, children: [_jsx(SizableText, { size: "$4", fontWeight: "500", color: "$ink", text: "center", children: t('{repo} is in {org}, and you are working in {current}.', { repo: `${named.org}/${named.name}`, org: named.org, current: host.org }) }), member ? (_jsx(Button, { size: "sm", variant: "outline", borderColor: "var(--border-strong)", onPress: () => host.chooseOrg?.(named.org), children: t('Switch to {org}', { org: named.org }) })) : (_jsx(Button, { size: "sm", variant: "outline", borderColor: "var(--border-strong)", onPress: () => host.go(path({ kind: 'screen', screen: 'projects' })), children: t('See this organization’s projects') }))] }) }));
|
|
512
|
+
}
|
|
513
|
+
if (named ? !forge.loading && !forge.value : !all.loading && !project && !all.error) {
|
|
514
|
+
return (_jsx(YStack, { flex: 1, items: "center", justify: "center", px: "$4", children: _jsxs(YStack, { borderWidth: 1, borderColor: "var(--border-strong)", rounded: "$4", bg: "$panel", px: "$6", py: "$8", gap: "$3", items: "center", width: "100%", maxW: 480, children: [_jsx(SizableText, { size: "$4", fontWeight: "500", color: "$ink", text: "center", children: named
|
|
515
|
+
? forge.error && !/not found|404/i.test(forge.error.message)
|
|
516
|
+
? forge.error.message
|
|
517
|
+
: t('{org} has no repository named {name}.', { org: named.org, name: named.name })
|
|
518
|
+
: host.org
|
|
519
|
+
? t('{org} has no project named {name}.', { org: host.org, name: slug })
|
|
520
|
+
: t('There is no project named {name}.', { name: slug }) }), _jsx(Button, { size: "sm", variant: "outline", borderColor: "var(--border-strong)", onPress: () => host.go(path({ kind: 'screen', screen: named ? 'projects' : 'artifacts' })), children: named ? t('See this organization’s projects') : t('See what this organization has built') })] }) }));
|
|
521
|
+
}
|
|
522
|
+
const chat = (_jsxs(YStack, { "data-slot": "project-chat", flex: 1, minH: 0, position: "relative", children: [_jsx(YStack, { flex: 1, minH: 0, overflow: "scroll", px: "$3", pt: "$2", pb: "$4", gap: "$4", $md: { pr: 0 }, children: ordered.length === 0 ? (runs.loading ? (_jsxs(YStack, { gap: "$3", "aria-busy": true, children: [_jsx(SizableText, { size: "$2", color: "$soft", children: t('Reading this project’s sessions…') }), _jsx(Skeleton, { layout: "block", width: "84%", height: 14, rounded: "$2" }), _jsx(Skeleton, { layout: "block", width: "66%", height: 14, rounded: "$2" }), _jsx(Skeleton, { layout: "block", width: "92%", height: 56, rounded: "$3" })] })) : (_jsx(SizableText, { size: "$2", color: "$ink", children: project?.live
|
|
523
|
+
? t('{name} is loaded — it is in the preview, and every run on it is under the clock above. Say what to change and it gets built.', { name: project.name })
|
|
524
|
+
: stalled
|
|
525
|
+
? t('{name} has been publishing for {minutes} minutes without finishing. Publish it again from the preview, or say what to change and it gets built.', { name: project?.name ?? '', minutes: Math.floor(ran / 60) })
|
|
526
|
+
: failed
|
|
527
|
+
? t('{name} could not be published. Publish it again from the preview, or say what to change and it gets built.', { name: project?.name ?? '' })
|
|
528
|
+
: building
|
|
529
|
+
? t('{name} is being published — it appears in the preview when its build finishes. Say what to change and it gets built.', { name: project?.name ?? '' })
|
|
530
|
+
: starter
|
|
531
|
+
? t('{name} is loaded — the preview shows the {starter} starter until your copy is published. Say what to change and it gets built.', { name: project?.name ?? '', starter: starter.title })
|
|
532
|
+
: project
|
|
533
|
+
? t('{name} is loaded and nothing is published yet. Say what to change and it gets built.', { name: project.name })
|
|
534
|
+
: named
|
|
535
|
+
? t('{repo} is open on {branch}. Say what to change and it gets built there.', { repo: `${named.org}/${named.name}`, branch: home })
|
|
536
|
+
: t('{name} is loaded. Say what to change and it gets built.', { name: slug }) }))) : (ordered.map((r) => (_jsxs(YStack, { gap: "$2", children: [_jsx(Turn, { run: r, open: r.id === current, onOpen: () => setChosen(r.id), project: slug }), r.id === current ? (_jsxs(YStack, { gap: "$1", paddingInlineStart: "$2", borderInlineStartWidth: 1, borderColor: "$borderColor", children: [fold(run.events.map((e) => ({ kind: e.kind, actor: who(e.actor), seq: e.seq, id: e.id, text: said(e, run.record?.mode, t) })).filter((b) => b.text)).map((b) => (_jsx(SizableText, { size: "$1", color: "$soft", children: b.text }, b.key))), pr.href ? (_jsxs(XStack, { items: "center", gap: "$2", flexWrap: "wrap", children: [_jsxs(Out, { href: pr.href, label: t('Open pull request {pr}', { pr: pr.label }), children: [_jsx(SizableText, { size: "$1", color: "$ink", textDecorationLine: "underline", children: t('Pull request {pr}', { pr: pr.label }) }), _jsx(ExternalLink, { size: 11 })] }), _jsx(Merge, { session: r.id, open: proposing, onMerged: merged })] })) : null] })) : null] }, r.id)))) }), _jsxs(YStack, { "data-slot": "project-ask", px: "$3", pb: "$3", gap: "$2", minW: 0, $md: { pr: 0 }, children: [note ? (_jsx(SizableText, { size: "$1", color: "$soft", role: "status", children: note })) : null, picked.length ? _jsx(Attachments, { items: picked, onRemove: () => setPicked([]) }) : null, _jsx(Composer, { column: true, value: draft, onChange: setDraft, onSend: () => void (current && running ? steer(current) : send()), onStop: current && active
|
|
537
|
+
? () => void stop(target, current).then(() => setNote(t('Stop requested — the session keeps its work on its branch')), (e) => setNote(cleanErrorText(e.message)))
|
|
538
|
+
: undefined, busy: busy || (active && !draft.trim()), placeholder: running ? t('Steer or redirect this session…') : t('Ask Hanzo for edits'), label: t('Ask Hanzo for edits'), plus: { upload: () => pick(attached, setAttached, setNote, t) }, carried: carrying(attached, setAttached), mode: running ? null : { value: mode === 'plan' ? 'plan' : 'auto', set: (m) => setMode(m === 'plan' ? 'plan' : 'build'), items: MODES.filter((m) => m.id !== 'manual') }, mind: running ? null : mind, effort: running ? null : pacing(mind), voice: voice, children: current && active && draft.trim() ? (_jsxs(XStack, { render: "button", "data-slot": "composer-stop", "aria-label": t('Stop session'), ...{ title: t('Stop session') }, onPress: () => void stop(target, current).then(() => setNote(t('Stop requested — the session keeps its work on its branch')), (e) => setNote(cleanErrorText(e.message))), items: "center", gap: "$1.5", px: "$2.5", height: 30, "$max-md": { minH: 40 }, rounded: 999, borderWidth: 1, borderColor: "var(--border-strong)", bg: "$panel", cursor: "pointer", hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING, children: [_jsx(Square, { size: 10, fill: "currentColor" }), _jsx(SizableText, { size: "$1", fontWeight: "500", color: "$ink", children: t('Stop') })] })) : null })] }), wide && !shut ? (_jsx(Gutter, { side: "left", span: across, floor: CHAT_FLOOR, ceil: most, reset: CHAT_WIDTH, onSpan: setSplit, label: t('Resize the chat'), gap: GUTTER })) : null] }));
|
|
539
|
+
// The preview stays loaded while another view is open, so coming back to it
|
|
540
|
+
// is the page as it was left.
|
|
541
|
+
const preview = (_jsxs(YStack, { "data-slot": "preview", flex: 1, minH: 0, minW: 0, gap: "$2", display: view === 'preview' ? 'flex' : 'none', children: [_jsxs(XStack, { "data-slot": "preview-bar", items: "center", gap: "$1.5", minW: 0, shrink: 0, "$max-md": { px: '$2' }, children: [_jsx(XStack, { render: "button", "aria-label": t('Reload the preview'), ...{ title: t('Reload the preview') }, onPress: fresh, p: "$1.5", "$max-md": { minW: 40, minH: 40, items: 'center', justify: 'center' }, rounded: "$3", shrink: 0, hoverStyle: { bg: '$hover' }, children: _jsx(RefreshCcw, { size: 16 }) }), resolvedPreview.kind === 'sandbox' || resolvedPreview.kind === 'live' ? (_jsxs(XStack, { render: sandboxUrl && project?.live ? 'button' : undefined, onPress: sandboxUrl && project?.live ? () => setPreferLive((v) => !v) : undefined, "data-slot": "preview-mode", "data-kind": resolvedPreview.kind, items: "center", gap: "$1", px: "$2", py: "$0.5", rounded: 999, bg: "$edge", borderWidth: 1, borderColor: "$borderColor", shrink: 0, hoverStyle: sandboxUrl && project?.live ? { bg: '$hover' } : undefined, children: [resolvedPreview.kind === 'sandbox' ? _jsx(YStack, { width: 6, height: 6, rounded: 99, bg: "var(--state-online)", shrink: 0 }) : _jsx(Globe, { size: 11, opacity: 0.75 }), _jsx(SizableText, { size: "$1", color: "$ink", numberOfLines: 1, children: resolvedPreview.kind === 'sandbox' ? t('Sandbox preview') : t('Live site') })] })) : null, _jsx(PageSelect, { pages: pages, value: page, onChange: setPage, shrink: 1 }), _jsx(XStack, { flex: 1 }), _jsx(Views, { views: DEVICES, value: device, onChange: (d) => setDevice(d), label: t('Device'), labels: "none" }), rawSrc ? (_jsx(Out, { href: rawSrc, label: t('Open in a new tab'), children: _jsxs(XStack, { items: "center", gap: "$1.5", px: "$2", py: "$1", rounded: "$3", hoverStyle: { bg: '$hover' }, children: [_jsx(SizableText, { size: "$1", color: "$soft", "$max-md": { display: 'none' }, children: t('Preview') }), _jsx(ExternalLink, { size: 15 })] }) })) : null] }), _jsx(PreviewFrame, { ref: frame, src: src, title: t('{title} preview', { title }), device: device, onBridge: onBridge, empty: _jsx(YStack, { items: "center", justify: "center", p: "$6", width: "100%", children: _jsxs(YStack, { items: "center", gap: "$2.5", px: "$5", py: "$6", rounded: "$4", borderWidth: 1, borderColor: "var(--border-strong)", bg: "$panel", width: "100%", maxW: 420, children: [_jsx(YStack, { width: 36, height: 36, rounded: "$3", bg: "$raised", items: "center", justify: "center", "aria-hidden": true, children: stalled || failed ? _jsx(AlertCircle, { size: 18, color: "var(--state-error)" }) : _jsx(Globe, { size: 18, color: "$soft" }) }), _jsx(SizableText, { size: "$3", fontWeight: "500", color: "$ink", text: "center", children: stalled
|
|
542
|
+
? t('Publishing is taking too long')
|
|
543
|
+
: building
|
|
544
|
+
? project?.forked
|
|
545
|
+
? t('Publishing your copy…')
|
|
546
|
+
: t('Publishing…')
|
|
547
|
+
: failed
|
|
548
|
+
? t('Publishing failed')
|
|
549
|
+
: t('Nothing deployed yet') }), _jsx(SizableText, { size: "$2", color: "$soft", text: "center", children: stalled
|
|
550
|
+
? t('Its build started {minutes} minutes ago and has not finished.', { minutes: Math.floor(ran / 60) })
|
|
551
|
+
: building
|
|
552
|
+
? t('Its page appears here when the build finishes.')
|
|
553
|
+
: failed
|
|
554
|
+
? why
|
|
555
|
+
: t('Publish this project and its page appears here.') }), spend.dialog, (stalled || failed) && clone ? (_jsx(Button, { size: "sm", variant: "outline", borderColor: "var(--border-strong)", disabled: redo.busy, onPress: () => void retry(), children: redo.busy ? t('Publishing…') : t('Publish again') })) : null, redo.error ? (_jsx(SizableText, { size: "$2", color: "var(--state-error)", text: "center", role: "alert", children: redo.error })) : null] }) }), toolbar: bridge ? (_jsx(XStack, { render: "button", "aria-pressed": editing, "aria-label": editing ? t('Stop picking elements') : t('Pick an element to edit'), ...{ title: editing ? t('Stop picking elements') : t('Pick an element to edit') }, onPress: () => {
|
|
556
|
+
const next = !editing;
|
|
557
|
+
setEditing(next);
|
|
558
|
+
frame.current?.post({ type: 'preview:editable', active: next });
|
|
559
|
+
}, minW: 36, minH: 36, items: "center", justify: "center", rounded: "$10", focusVisibleStyle: RING, children: _jsx(MousePointerClick, { size: 16 }) })) : undefined })] }));
|
|
560
|
+
const body = view === 'preview' ? null : view === 'files' ? (repo && root.error ? (_jsx(YStack, { p: "$4", children: _jsx(SizableText, { size: "$2", color: "var(--state-error)", role: "status", children: t('Nothing to show for {repo} at {ref}: the forge answered “{reason}”.', { repo, ref, reason: root.error.message }) }) })) : repo ? (_jsx(FileTree, { load: async (dir) => (await tree(target, repo, ref, dir)).map((e) => ({ path: e.path, kind: e.dir ? 'dir' : 'file' })), value: file, onSelect: (p) => void openFile(p), label: t('{repo} at {ref}', { repo, ref }) }, round)) : (_jsx(SizableText, { size: "$2", color: "$soft", p: "$4", children: t('This project has no repository yet. Its first run creates one.') }))) : view === 'code' ? (_jsx(FileTabs, { files: files, value: file, onSelect: setFile, onClose: (p) => {
|
|
561
|
+
setFiles((was) => was.filter((f) => f.path !== p));
|
|
562
|
+
if (file === p)
|
|
563
|
+
setFile(null);
|
|
564
|
+
}, empty: _jsx(SizableText, { size: "$2", color: "$soft", p: "$4", children: t('Open a file from Files. Code here is read at {ref}; ask in the chat to change it.', { ref }) }) })) : (_jsx(YStack, { p: "$4", gap: "$2", children: picked.length ? (picked.map((p) => (_jsxs(XStack, { items: "center", gap: "$2.5", px: "$3", py: "$2.5", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", bg: "$panel", children: [_jsx(MousePointerClick, { size: 14, color: "$soft" }), _jsxs(SizableText, { size: "$2", color: "$ink", fontFamily: "$mono", flex: 1, minW: 0, children: [p.label, " \u2014 ", p.id] })] }, p.id)))) : (_jsx(YStack, { p: "$5", rounded: "$4", borderWidth: 1, borderColor: "$borderColor", bg: "$panel", items: "center", gap: "$2", children: _jsx(SizableText, { size: "$2", color: "$soft", text: "center", children: bridge
|
|
565
|
+
? t('Pick an element in the preview to see it here and attach it to your next ask.')
|
|
566
|
+
: t('Layers are read through the preview bridge, and this page does not run it. Its elements cannot be listed from here.') }) })) }));
|
|
567
|
+
const views = (_jsx(Views, { views: [CHAT, ...VIEWS], value: pane === 'chat' && !wide ? 'chat' : view, onChange: (v) => {
|
|
568
|
+
if (v === 'chat')
|
|
569
|
+
return setPane('chat');
|
|
570
|
+
setView(v);
|
|
571
|
+
setPane('view');
|
|
572
|
+
}, label: t('View') }));
|
|
573
|
+
// On a phone the bar has no room for the views beside the project: there
|
|
574
|
+
// they were a scroller of the bar's leftovers, 49px at 375 beside a project
|
|
575
|
+
// named "Instrument", showing part of Chat and none of Code (hanzo-inc/app#305).
|
|
576
|
+
// So below md they take a row of their own under the bar, in whichever pane
|
|
577
|
+
// shows (one pane at a time there, so one row).
|
|
578
|
+
const row = wide ? null : (_jsx(XStack, { "data-slot": "views-row", justify: "center", px: "$3", pb: "$2", shrink: 0, minW: 0, overflowX: "auto", "$platform-web": { scrollbarWidth: 'none' }, children: views }));
|
|
579
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Workspace, { start: _jsxs(XStack, { items: "center", gap: "$2", minW: 0, shrink: 1, children: [_jsx(XStack, { render: "button", "aria-label": t('All sessions'), ...{ title: t('All sessions') }, onPress: () => host.go(''), p: "$1", "$max-md": { minW: 40, minH: 40, items: 'center', justify: 'center' }, shrink: 0, children: _jsx(HanzoMark, { size: 20 }) }), _jsx(ProjectChip, { name: title, onPress: () => setSwitcher(true) }), _jsx(XStack, { render: "button", "aria-label": t('History'), ...{ title: t('History') }, onPress: () => setHistory(true), p: "$1.5", "$max-md": { minW: 40, minH: 40, items: 'center', justify: 'center' }, rounded: "$3", shrink: 0, hoverStyle: { bg: '$hover' }, children: _jsx(Clock, { size: 16 }) }), _jsx(XStack, { render: "button", "aria-label": shut ? t('Show the chat') : t('Hide the chat'), ...{ title: shut ? t('Show the chat') : t('Hide the chat') }, "aria-pressed": !shut, onClick: () => (cramped ? setAsked(!asked) : setCollapsed(!collapsed)), minW: 32, minH: 32, items: "center", justify: "center", rounded: "$3", shrink: 0, hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING, "$max-md": { display: 'none' }, children: _jsx(PanelLeft, { size: 16 }) })] }), middle: wide ? views : undefined, end: _jsxs(XStack, { "data-slot": "project-header-actions", items: "center", gap: "$2", shrink: 0, style: { paddingInlineEnd: 'var(--hanzo-shell-top-right-inset, 0px)' }, children: [githubInfo ? (_jsx(GitHubBadge, { fullName: githubInfo.fullName, htmlUrl: githubInfo.htmlUrl, syncedLabel: t('Synced'), compact: true })) : repo ? (_jsxs(Button, { variant: "outline", size: "sm", "data-slot": "project-sync-github", "aria-label": t('Sync to GitHub'), ...{ title: t('Sync to GitHub') }, onPress: () => setSyncDialogOpen(true), shrink: 0, children: [_jsx(Github, { size: 14 }), _jsx(SizableText, { size: "$2", color: "inherit", "$max-md": { display: 'none' }, children: t('Sync to GitHub') })] })) : null, _jsx(XStack, { display: "none", $md: { display: 'flex' }, shrink: 0, children: _jsxs(Button, { variant: "outline", size: "sm", onPress: () => void share(), children: [_jsx(Share2, { size: 14 }), " ", t('Share')] }) }), _jsxs(Button, { size: "sm", variant: "primary", "aria-label": t('Publish'), disabled: !clone || !slug, onPress: () => setPublish({ repo: clone, title, ref, name: slug, project: slug, preview: project?.live || undefined }), shrink: 0, children: [_jsx(Upload, { size: 14 }), _jsx(SizableText, { size: "$2", color: "inherit", "$max-md": { display: 'none' }, children: t('Publish') })] })] }), chat: _jsxs(_Fragment, { children: [row, chat] }), dock: _jsx(Console, { lines: lines, height: dock, onHeight: setDock, onClear: () => setPageLines([]), status: run.status || end.status || undefined, label: t('Console') }), collapsed: shut, pane: pane, width: across, onLayout: (e) => setRoom(e.nativeEvent.layout.width), children: [row, preview, body] }), _jsx(Dialog, { open: history, onOpenChange: setHistory, children: _jsxs(DialogContent, { maxW: 480, children: [_jsx(DialogTitle, { children: t('Sessions on {title}', { title }) }), _jsx(YStack, { gap: "$1", children: runs.value.length === 0 ? (_jsx(SizableText, { size: "$2", color: "$soft", children: t('No sessions yet.') })) : (runs.value.map((r) => {
|
|
580
|
+
const active = r.id === current;
|
|
581
|
+
return (_jsxs(XStack, { render: "button", "aria-current": active ? 'true' : undefined, onPress: () => {
|
|
582
|
+
setChosen(r.id);
|
|
583
|
+
setHistory(false);
|
|
584
|
+
}, justify: "space-between", items: "center", gap: "$2", px: "$2.5", py: "$2", minH: 40, "$platform-web": { textAlign: 'start' }, focusVisibleStyle: RING, children: [_jsx(SizableText, { size: "$2", color: "$ink", fontWeight: active ? '500' : '400', numberOfLines: 1, flex: 1, children: r.title || t('Untitled session') }), _jsx(SizableText, { size: "$1", color: "$soft", shrink: 0, children: r.status })] }, r.id));
|
|
585
|
+
})) })] }) }), _jsx(Dialog, { open: switcher, onOpenChange: (o) => {
|
|
586
|
+
setSwitcher(o);
|
|
587
|
+
if (!o)
|
|
588
|
+
setSwitchQ('');
|
|
589
|
+
}, children: _jsxs(DialogContent, { maxW: 420, gap: "$3", children: [_jsx(DialogTitle, { children: t('Projects') }), repos.value.length > 6 ? (_jsx(Input, { value: switchQ, onChangeText: setSwitchQ, placeholder: t('Find a project…'), "aria-label": t('Find a project'), startAdornment: _jsx(Search, { size: 14, color: "$soft" }) })) : null, _jsx(YStack, { gap: "$1", maxH: 420, overflow: "scroll", children: repos.error ? (_jsx(SizableText, { size: "$2", color: "$soft", children: repos.error.message })) : repos.loading && repos.value.length === 0 ? (_jsxs(YStack, { gap: "$2", children: [_jsx(SizableText, { size: "$2", color: "$soft", children: t('Reading the forge…') }), _jsx(Skeleton, { layout: "block", height: 36, rounded: "$3" }), _jsx(Skeleton, { layout: "block", height: 36, rounded: "$3" }), _jsx(Skeleton, { layout: "block", height: 36, rounded: "$3" })] })) : filteredRepos.length === 0 ? (_jsx(SizableText, { size: "$2", color: "$soft", py: "$2", children: t('Nothing matches.') })) : (filteredRepos.map((c) => {
|
|
590
|
+
const here = Boolean(named) && c.name === named?.name;
|
|
591
|
+
return (_jsxs(XStack, { render: "button", "aria-label": t('Open {repo}', { repo: `${c.org}/${c.name}` }), "aria-current": here ? 'page' : undefined, onPress: () => {
|
|
592
|
+
setSwitcher(false);
|
|
593
|
+
setSwitchQ('');
|
|
594
|
+
host.go(path({ kind: 'repo', org: c.org || host.org || '', name: c.name }));
|
|
595
|
+
}, px: "$2.5", py: "$2", minH: 40, items: "center", justify: "space-between", gap: "$2", rounded: "$3", hoverStyle: { bg: '$hover' }, "$platform-web": { textAlign: 'start' }, focusVisibleStyle: RING, children: [_jsx(SizableText, { size: "$2", color: "$ink", numberOfLines: 1, children: c.name }), here ? _jsx(Check, { size: 14, color: "$ink" }) : null] }, `${c.org}/${c.name}`));
|
|
596
|
+
})) }), _jsx(Button, { variant: "outline", size: "sm", onPress: () => {
|
|
597
|
+
setSwitcher(false);
|
|
598
|
+
setSwitchQ('');
|
|
599
|
+
host.go(path({ kind: 'screen', screen: 'projects' }));
|
|
600
|
+
}, children: t('All projects') })] }) }), _jsx(Publish, { source: publish, onClose: () => setPublish(null), onLive: fresh }), repo ? (_jsx(SyncToGitHubDialog, { open: syncDialogOpen, onOpenChange: setSyncDialogOpen, repoName: repo, defaultName: slug || repo, defaultDescription: forge.value?.description || '', onSynced: (info) => {
|
|
601
|
+
setSyncedGitHub(info);
|
|
602
|
+
gitTargets.reload();
|
|
603
|
+
} })) : null] }));
|
|
604
|
+
}
|