@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,60 @@
|
|
|
1
|
+
import { type Target } from './api/call.ts';
|
|
2
|
+
/** What a run or a turn may do on its own: the permission mode. */
|
|
3
|
+
export type Mode = 'auto' | 'manual' | 'plan';
|
|
4
|
+
/**
|
|
5
|
+
* The modes, one line each. Chat offers Auto and Manual; Dev adds Plan. Manual
|
|
6
|
+
* is a real pause: before a plugin runs for a message (a search, a site read, a
|
|
7
|
+
* deck), the person allows it once, always in this conversation, or not, and a
|
|
8
|
+
* Dev run is asked for before it starts. Written in English and marked
|
|
9
|
+
* (`phrase`): the composer draws each word through `t`.
|
|
10
|
+
*/
|
|
11
|
+
export declare const MODES: readonly {
|
|
12
|
+
id: Mode;
|
|
13
|
+
label: string;
|
|
14
|
+
note: string;
|
|
15
|
+
}[];
|
|
16
|
+
/** The modes each surface offers. */
|
|
17
|
+
export declare const CHAT_MODES: readonly Mode[];
|
|
18
|
+
export declare const DEV_MODES: readonly Mode[];
|
|
19
|
+
export interface Gear {
|
|
20
|
+
/** Skill names (`/v1/tool/skills`). */
|
|
21
|
+
skills: string[];
|
|
22
|
+
/** Connector ids (`/v1/tool/mcp/servers`). */
|
|
23
|
+
connectors: string[];
|
|
24
|
+
/** Plugin ids. */
|
|
25
|
+
plugins: string[];
|
|
26
|
+
/** A design system's id, or ''. */
|
|
27
|
+
design: string;
|
|
28
|
+
/** A machine's id, or '' for none (Chat) or the sandbox (Dev). */
|
|
29
|
+
device: string;
|
|
30
|
+
research: boolean;
|
|
31
|
+
memory: boolean;
|
|
32
|
+
mode: Mode;
|
|
33
|
+
/** In Manual, the plugins allowed for the rest of this conversation. */
|
|
34
|
+
allowed: string[];
|
|
35
|
+
}
|
|
36
|
+
export declare const BARE: Gear;
|
|
37
|
+
/** How many conversations keep a choice of their own: the document holds 16 KiB in all. */
|
|
38
|
+
export declare const KEEP = 30;
|
|
39
|
+
/** A stored value as a Gear, a field the reader does not know read as unset. */
|
|
40
|
+
export declare function gearOf(raw: unknown, base?: Gear): Gear;
|
|
41
|
+
/** `gears` with `key`'s entry first, cut to `KEEP`. */
|
|
42
|
+
export declare function shelve(gears: Record<string, Gear>, key: string, g: Gear): Record<string, Gear>;
|
|
43
|
+
export interface GearState {
|
|
44
|
+
gear: Gear;
|
|
45
|
+
/** Change this conversation's choice. */
|
|
46
|
+
set: (patch: Partial<Gear>) => void;
|
|
47
|
+
/** Add or take out one id of a list. */
|
|
48
|
+
toggle: (field: 'skills' | 'connectors' | 'plugins', id: string) => void;
|
|
49
|
+
/** Make this conversation's choice the person's default. */
|
|
50
|
+
keep: () => void;
|
|
51
|
+
/** Whether a save was refused, in the platform's words. */
|
|
52
|
+
error: string | null;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The gear of the conversation `key` names (`''` for one not begun: it reads and
|
|
56
|
+
* writes the default until it has an id). Signed out, it lives for the page.
|
|
57
|
+
*/
|
|
58
|
+
export declare function useGear(t: Target, key?: string): GearState;
|
|
59
|
+
/** The dictation language the person keeps, null for Auto, and how to change it. */
|
|
60
|
+
export declare function useLanguage(t: Target): readonly [string | null, (id: string | null) => void];
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a conversation carries beside its words: the skills, connectors and
|
|
3
|
+
* plugins picked from the composer's `+`, the design system, the device, the
|
|
4
|
+
* Research and Memory switches and the mode. Chat and Dev keep it the same way.
|
|
5
|
+
*
|
|
6
|
+
* GET /v1/pref {prefs: {gear, gears}}
|
|
7
|
+
* PATCH /v1/pref {gear} — the person's default, what a new conversation opens with
|
|
8
|
+
* {gears: {<key>: Gear}} — each conversation's own, newest first, at most `KEEP`
|
|
9
|
+
*
|
|
10
|
+
* Both live in the account, so a choice follows the person to every device. A
|
|
11
|
+
* conversation that has none of its own reads the default; changing one writes
|
|
12
|
+
* that conversation's. A conversation not begun holds its choice on the page
|
|
13
|
+
* (`draft`) and hands it to the conversation once it has an id. What carries
|
|
14
|
+
* over to the next new conversation is only the switches (`STICKY`: Research,
|
|
15
|
+
* Memory, the mode); a skill or a plugin is picked for the conversation it was
|
|
16
|
+
* picked in.
|
|
17
|
+
*/
|
|
18
|
+
import { phrase } from '@hanzo/i18n';
|
|
19
|
+
import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react';
|
|
20
|
+
import { call } from './api/call.js';
|
|
21
|
+
/**
|
|
22
|
+
* The modes, one line each. Chat offers Auto and Manual; Dev adds Plan. Manual
|
|
23
|
+
* is a real pause: before a plugin runs for a message (a search, a site read, a
|
|
24
|
+
* deck), the person allows it once, always in this conversation, or not, and a
|
|
25
|
+
* Dev run is asked for before it starts. Written in English and marked
|
|
26
|
+
* (`phrase`): the composer draws each word through `t`.
|
|
27
|
+
*/
|
|
28
|
+
export const MODES = [
|
|
29
|
+
{ id: 'auto', label: phrase('Auto'), note: phrase('Runs tools on its own; pauses only for anything risky.') },
|
|
30
|
+
{ id: 'manual', label: phrase('Manual'), note: phrase('Asks before each tool, connector or site it opens.') },
|
|
31
|
+
{ id: 'plan', label: phrase('Plan'), note: phrase('Writes the plan and waits for your go before changing anything.') },
|
|
32
|
+
];
|
|
33
|
+
/** The modes each surface offers. */
|
|
34
|
+
export const CHAT_MODES = ['auto', 'manual'];
|
|
35
|
+
export const DEV_MODES = ['auto', 'manual', 'plan'];
|
|
36
|
+
export const BARE = {
|
|
37
|
+
skills: [],
|
|
38
|
+
connectors: [],
|
|
39
|
+
plugins: [],
|
|
40
|
+
design: '',
|
|
41
|
+
device: '',
|
|
42
|
+
research: false,
|
|
43
|
+
memory: true,
|
|
44
|
+
mode: 'auto',
|
|
45
|
+
allowed: [],
|
|
46
|
+
};
|
|
47
|
+
/** What a new conversation carries over from the last: the switches, never a pick. */
|
|
48
|
+
const STICKY = ['research', 'memory', 'mode'];
|
|
49
|
+
const pick = (g) => ({ research: g.research, memory: g.memory, mode: g.mode });
|
|
50
|
+
/** How many conversations keep a choice of their own: the document holds 16 KiB in all. */
|
|
51
|
+
export const KEEP = 30;
|
|
52
|
+
const list = (v) => (Array.isArray(v) ? v.filter((x) => typeof x === 'string' && x !== '') : []);
|
|
53
|
+
const text = (v) => (typeof v === 'string' ? v : '');
|
|
54
|
+
/** A stored value as a Gear, a field the reader does not know read as unset. */
|
|
55
|
+
export function gearOf(raw, base = BARE) {
|
|
56
|
+
const o = raw && typeof raw === 'object' && !Array.isArray(raw) ? raw : {};
|
|
57
|
+
return {
|
|
58
|
+
skills: 'skills' in o ? list(o.skills) : base.skills,
|
|
59
|
+
connectors: 'connectors' in o ? list(o.connectors) : base.connectors,
|
|
60
|
+
plugins: 'plugins' in o ? list(o.plugins) : base.plugins,
|
|
61
|
+
design: 'design' in o ? text(o.design) : base.design,
|
|
62
|
+
device: 'device' in o ? text(o.device) : base.device,
|
|
63
|
+
research: typeof o.research === 'boolean' ? o.research : base.research,
|
|
64
|
+
memory: typeof o.memory === 'boolean' ? o.memory : base.memory,
|
|
65
|
+
mode: MODES.some((m) => m.id === o.mode) ? o.mode : base.mode,
|
|
66
|
+
allowed: 'allowed' in o ? list(o.allowed) : base.allowed,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/** `gears` with `key`'s entry first, cut to `KEEP`. */
|
|
70
|
+
export function shelve(gears, key, g) {
|
|
71
|
+
const out = { [key]: g };
|
|
72
|
+
for (const [k, v] of Object.entries(gears)) {
|
|
73
|
+
if (k === key)
|
|
74
|
+
continue;
|
|
75
|
+
if (Object.keys(out).length >= KEEP)
|
|
76
|
+
break;
|
|
77
|
+
out[k] = v;
|
|
78
|
+
}
|
|
79
|
+
return out;
|
|
80
|
+
}
|
|
81
|
+
let doc = { gear: BARE, gears: {}, draft: null, language: null };
|
|
82
|
+
let loaded = null;
|
|
83
|
+
const listeners = new Set();
|
|
84
|
+
const emit = () => listeners.forEach((f) => f());
|
|
85
|
+
const subscribe = (f) => {
|
|
86
|
+
listeners.add(f);
|
|
87
|
+
return () => listeners.delete(f);
|
|
88
|
+
};
|
|
89
|
+
function load(t) {
|
|
90
|
+
const id = `${t.api}|${t.org ?? ''}|${t.token() ? 1 : 0}`;
|
|
91
|
+
if (loaded === id || !t.token())
|
|
92
|
+
return;
|
|
93
|
+
loaded = id;
|
|
94
|
+
void call(t, 'GET', '/v1/pref')
|
|
95
|
+
.then((r) => {
|
|
96
|
+
const raw = r?.prefs ?? {};
|
|
97
|
+
const gear = gearOf(raw.gear);
|
|
98
|
+
const all = raw.gears && typeof raw.gears === 'object' ? raw.gears : {};
|
|
99
|
+
const language = typeof raw.language === 'string' && raw.language ? raw.language : null;
|
|
100
|
+
doc = { gear, gears: Object.fromEntries(Object.entries(all).map(([k, v]) => [k, gearOf(v, gear)])), draft: doc.draft, language };
|
|
101
|
+
emit();
|
|
102
|
+
})
|
|
103
|
+
.catch(() => {
|
|
104
|
+
loaded = null;
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* The gear of the conversation `key` names (`''` for one not begun: it reads and
|
|
109
|
+
* writes the default until it has an id). Signed out, it lives for the page.
|
|
110
|
+
*/
|
|
111
|
+
export function useGear(t, key = '') {
|
|
112
|
+
useEffect(() => load(t), [t]);
|
|
113
|
+
const now = useSyncExternalStore(subscribe, () => doc, () => doc);
|
|
114
|
+
const [error, setError] = useState(null);
|
|
115
|
+
// A conversation with no choice of its own starts from the switches alone.
|
|
116
|
+
const fresh = useMemo(() => ({ ...BARE, ...pick(now.gear) }), [now.gear]);
|
|
117
|
+
const gear = key ? (now.gears[key] ?? fresh) : (now.draft ?? fresh);
|
|
118
|
+
const save = useCallback((patch) => {
|
|
119
|
+
if (!t.token())
|
|
120
|
+
return;
|
|
121
|
+
call(t, 'PATCH', '/v1/pref', patch).then(() => setError(null), (e) => setError(e instanceof Error ? e.message : 'Your choice was not saved.'));
|
|
122
|
+
}, [t]);
|
|
123
|
+
// The conversation just begun takes what was picked before it had an id.
|
|
124
|
+
const was = useRef(key);
|
|
125
|
+
useEffect(() => {
|
|
126
|
+
const from = was.current;
|
|
127
|
+
was.current = key;
|
|
128
|
+
if (from || !key || !doc.draft || doc.gears[key])
|
|
129
|
+
return;
|
|
130
|
+
doc = { ...doc, gears: shelve(doc.gears, key, doc.draft), draft: null };
|
|
131
|
+
emit();
|
|
132
|
+
save({ gears: doc.gears });
|
|
133
|
+
}, [key, save]);
|
|
134
|
+
const write = useCallback((g) => {
|
|
135
|
+
if (key) {
|
|
136
|
+
doc = { ...doc, gears: shelve(doc.gears, key, g) };
|
|
137
|
+
emit();
|
|
138
|
+
return save({ gears: doc.gears });
|
|
139
|
+
}
|
|
140
|
+
// Not begun: the page holds it; the switches become the default too.
|
|
141
|
+
const sticky = { ...doc.gear, ...pick(g) };
|
|
142
|
+
const moved = STICKY.some((k) => sticky[k] !== doc.gear[k]);
|
|
143
|
+
doc = { ...doc, draft: g, ...(moved ? { gear: sticky } : null) };
|
|
144
|
+
emit();
|
|
145
|
+
if (moved)
|
|
146
|
+
save({ gear: sticky });
|
|
147
|
+
}, [key, save]);
|
|
148
|
+
return useMemo(() => ({
|
|
149
|
+
gear,
|
|
150
|
+
error,
|
|
151
|
+
set: (patch) => write({ ...gear, ...patch }),
|
|
152
|
+
toggle: (field, id) => {
|
|
153
|
+
const has = gear[field].includes(id);
|
|
154
|
+
write({ ...gear, [field]: has ? gear[field].filter((x) => x !== id) : [...gear[field], id] });
|
|
155
|
+
},
|
|
156
|
+
keep: () => {
|
|
157
|
+
doc = { ...doc, gear };
|
|
158
|
+
emit();
|
|
159
|
+
if (t.token())
|
|
160
|
+
call(t, 'PATCH', '/v1/pref', { gear }).catch((e) => setError(e instanceof Error ? e.message : 'Not saved.'));
|
|
161
|
+
},
|
|
162
|
+
}), [gear, error, write, t]);
|
|
163
|
+
}
|
|
164
|
+
/** The dictation language the person keeps, null for Auto, and how to change it. */
|
|
165
|
+
export function useLanguage(t) {
|
|
166
|
+
useEffect(() => load(t), [t]);
|
|
167
|
+
const now = useSyncExternalStore(subscribe, () => doc, () => doc);
|
|
168
|
+
const set = useCallback((id) => {
|
|
169
|
+
const was = doc.language;
|
|
170
|
+
doc = { ...doc, language: id };
|
|
171
|
+
emit();
|
|
172
|
+
// A refused save takes the choice back, so what is shown is what is kept.
|
|
173
|
+
if (t.token())
|
|
174
|
+
call(t, 'PATCH', '/v1/pref', { language: id }).catch(() => {
|
|
175
|
+
doc = { ...doc, language: was };
|
|
176
|
+
emit();
|
|
177
|
+
});
|
|
178
|
+
}, [t]);
|
|
179
|
+
return [now.language, set];
|
|
180
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare function Git({ session, title, live }: {
|
|
2
|
+
session: string;
|
|
3
|
+
title: string;
|
|
4
|
+
live: boolean;
|
|
5
|
+
}): import("react").JSX.Element;
|
|
6
|
+
/**
|
|
7
|
+
* Merge for a run's pull request, shown while it is open: `POST …/merge` lands
|
|
8
|
+
* the run's branch in its base at the commit the forge holds now. One press is
|
|
9
|
+
* one merge — pressed again while it is out, nothing more is sent — and a
|
|
10
|
+
* refusal says the forge's reason. `onMerged` reads the run again, which is
|
|
11
|
+
* what closes the button: the pull request reads merged.
|
|
12
|
+
*/
|
|
13
|
+
export declare function Merge({ session, open, onMerged }: {
|
|
14
|
+
session: string;
|
|
15
|
+
open: boolean;
|
|
16
|
+
onMerged: () => void;
|
|
17
|
+
}): import("react").JSX.Element | null;
|
|
18
|
+
/** A unified diff's lines, coloured by what each does: the Git tab's, and a transcript's edit card's. */
|
|
19
|
+
export declare function Patch({ text }: {
|
|
20
|
+
text: string;
|
|
21
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* A run's Git tab: what it pushed, read from the forge. Diff is the net change
|
|
4
|
+
* from its base, Review is the pull request it opened and what reviewers said,
|
|
5
|
+
* with Merge while it is open, Commits is its branch's history since the base.
|
|
6
|
+
* While the run works it is read again every little while, because a run
|
|
7
|
+
* pushes when it finishes a step.
|
|
8
|
+
*
|
|
9
|
+
* Its words are the reader's language (@hanzo/i18n `t`); branches, paths,
|
|
10
|
+
* commit messages, a pull request's title and its reviews are drawn as given.
|
|
11
|
+
*/
|
|
12
|
+
import { SizableText, XStack, YStack } from '@hanzo/gui';
|
|
13
|
+
import { phrase } from '@hanzo/i18n';
|
|
14
|
+
import { useI18n } from '@hanzo/i18n/react';
|
|
15
|
+
import { ChevronDown, ChevronRight } from '@hanzogui/lucide-icons-2';
|
|
16
|
+
import { Button } from '@hanzo/ui';
|
|
17
|
+
import { useEffect, useState } from 'react';
|
|
18
|
+
import { merge, read } from './api/changes.js';
|
|
19
|
+
import { useRead } from './data.js';
|
|
20
|
+
import { useHost, useTarget } from './host.js';
|
|
21
|
+
import { Out } from './out.js';
|
|
22
|
+
const NONE = { repo: '', base: '', head: '', commits: [], files: [], pull: null };
|
|
23
|
+
const AGAIN = 15_000;
|
|
24
|
+
const mono = { fontFamily: 'var(--f-mono, ui-monospace, monospace)', whiteSpace: 'pre' };
|
|
25
|
+
export function Git({ session, title, live }) {
|
|
26
|
+
const host = useHost();
|
|
27
|
+
const target = useTarget();
|
|
28
|
+
const { t } = useI18n();
|
|
29
|
+
const signed = Boolean(host.person);
|
|
30
|
+
const [view, setView] = useState('diff');
|
|
31
|
+
const got = useRead(signed ? () => read(target, session) : null, NONE, [target, session, signed, live]);
|
|
32
|
+
const { reload } = got;
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (!live)
|
|
35
|
+
return;
|
|
36
|
+
const every = setInterval(reload, AGAIN);
|
|
37
|
+
return () => clearInterval(every);
|
|
38
|
+
}, [live, reload]);
|
|
39
|
+
const c = got.value;
|
|
40
|
+
const added = c.files.reduce((n, f) => n + f.additions, 0);
|
|
41
|
+
const removed = c.files.reduce((n, f) => n + f.deletions, 0);
|
|
42
|
+
return (_jsxs(YStack, { gap: "$3", children: [_jsxs(YStack, { gap: "$1", children: [_jsx(SizableText, { size: "$3", color: "$ink", numberOfLines: 1, children: title }), c.head ? (_jsxs(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, children: [`${c.head} → ${c.base}`, c.files.length ? ` · ${c.files.length === 1 ? t('1 file') : t('{n} files', { n: c.files.length })} +${added} −${removed}` : ''] })) : null] }), _jsx(XStack, { gap: "$1", children: ['diff', 'review', 'commits'].map((v) => (_jsx(XStack, { render: "button", "aria-label": t(label(v)), onPress: () => setView(v), px: "$2.5", py: "$1", rounded: "$2", bg: view === v ? '$hover' : 'transparent', children: _jsx(SizableText, { size: "$2", color: view === v ? '$ink' : '$soft', children: t(label(v)) }) }, v))) }), !signed ? (_jsx(Soft, { children: t('Sign in to see what this run pushed.') })) : got.error ? (_jsx(Soft, { children: got.error.message })) : got.loading && !c.head ? (_jsx(Soft, { children: t('Reading the branch…') })) : view === 'diff' ? (c.files.length ? (_jsx(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: "$3", overflow: "hidden", children: c.files.map((f, i) => (_jsx(File, { change: f, first: i === 0 }, f.path))) })) : (_jsx(Soft, { children: t('No pushed changes') }))) : view === 'review' ? (c.pull ? (_jsxs(YStack, { gap: "$3", children: [_jsxs(YStack, { gap: "$1.5", p: "$3", borderWidth: 1, borderColor: "$borderColor", rounded: "$3", children: [_jsx(SizableText, { size: "$2", color: "$ink", children: `#${c.pull.number} ${c.pull.title}` }), _jsx(SizableText, { size: "$1", color: "$soft", children: c.pull.state === 'open'
|
|
43
|
+
? c.pull.mergeable === false
|
|
44
|
+
? t('Open · conflicts with its base')
|
|
45
|
+
: c.pull.mergeable
|
|
46
|
+
? t('Open · ready to merge')
|
|
47
|
+
: t('Open')
|
|
48
|
+
: c.pull.state === 'merged'
|
|
49
|
+
? t('Merged')
|
|
50
|
+
: t('Closed') }), c.pull.url.startsWith('https://') ? (_jsx(Out, { href: c.pull.url, label: t('Open pull request {pr}', { pr: `#${c.pull.number}` }), children: _jsx(SizableText, { size: "$1", color: "$ink", textDecorationLine: "underline", children: t('Open on the forge') }) })) : null, _jsx(Merge, { session: session, open: c.pull.state === 'open', onMerged: reload })] }), c.pull.reviews.length ? (c.pull.reviews.map((r, i) => (_jsxs(YStack, { gap: "$1", pb: "$2", borderBottomWidth: 1, borderColor: "$borderColor", children: [_jsx(SizableText, { size: "$1", color: "$soft", children: [r.author || t('Someone'), verdict(r.state, t), when(r.at)].filter(Boolean).join(' · ') }), r.body ? (_jsx(SizableText, { size: "$2", color: "$ink", children: r.body })) : null] }, i)))) : (_jsx(Soft, { children: t('No reviews yet') }))] })) : (_jsx(Soft, { children: t('No pull request yet. The run opens one when it pushes its changes.') }))) : c.commits.length ? (_jsx(YStack, { children: c.commits.map((k) => (_jsxs(XStack, { gap: "$3", py: "$2", borderBottomWidth: 1, borderColor: "$borderColor", items: "baseline", children: [_jsx(SizableText, { size: "$1", color: "$soft", style: mono, children: k.sha.slice(0, 7) }), _jsxs(YStack, { flex: 1, minW: 0, gap: "$0.5", children: [_jsx(SizableText, { size: "$2", color: "$ink", numberOfLines: 2, children: k.message }), _jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, children: [k.author, when(k.date)].filter(Boolean).join(' · ') })] })] }, k.sha))) })) : (_jsx(Soft, { children: t('No pushed commits') }))] }));
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Merge for a run's pull request, shown while it is open: `POST …/merge` lands
|
|
54
|
+
* the run's branch in its base at the commit the forge holds now. One press is
|
|
55
|
+
* one merge — pressed again while it is out, nothing more is sent — and a
|
|
56
|
+
* refusal says the forge's reason. `onMerged` reads the run again, which is
|
|
57
|
+
* what closes the button: the pull request reads merged.
|
|
58
|
+
*/
|
|
59
|
+
export function Merge({ session, open, onMerged }) {
|
|
60
|
+
const target = useTarget();
|
|
61
|
+
const { t } = useI18n();
|
|
62
|
+
const [busy, setBusy] = useState(false);
|
|
63
|
+
const [note, setNote] = useState('');
|
|
64
|
+
const press = async () => {
|
|
65
|
+
if (busy)
|
|
66
|
+
return;
|
|
67
|
+
setBusy(true);
|
|
68
|
+
setNote('');
|
|
69
|
+
try {
|
|
70
|
+
const done = await merge(target, session);
|
|
71
|
+
setNote(done.base ? t('Merged into {branch}', { branch: done.base }) : t('Merged'));
|
|
72
|
+
onMerged();
|
|
73
|
+
}
|
|
74
|
+
catch (e) {
|
|
75
|
+
setNote(e.message);
|
|
76
|
+
}
|
|
77
|
+
finally {
|
|
78
|
+
setBusy(false);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
if (!open && !note)
|
|
82
|
+
return null;
|
|
83
|
+
return (_jsxs(XStack, { items: "center", gap: "$2", flexWrap: "wrap", children: [open ? (_jsx(Button, { size: "sm", variant: "outline", "aria-busy": busy, onPress: () => void press(), children: busy ? t('Merging…') : t('Merge') })) : null, note ? (_jsx(SizableText, { size: "$1", color: "$soft", role: "status", children: note })) : null] }));
|
|
84
|
+
}
|
|
85
|
+
function File({ change: f, first }) {
|
|
86
|
+
const { t } = useI18n();
|
|
87
|
+
const [open, setOpen] = useState(false);
|
|
88
|
+
const lines = f.patch ? f.patch.split('\n') : [];
|
|
89
|
+
return (_jsxs(YStack, { borderTopWidth: first ? 0 : 1, borderColor: "$borderColor", children: [_jsxs(XStack, { render: "button", "aria-label": open ? t('Hide {path}', { path: f.path }) : t('Show {path}', { path: f.path }), onPress: () => setOpen(!open), items: "center", gap: "$2", px: "$3", py: "$2", hoverStyle: { bg: '$hover' }, children: [open ? _jsx(ChevronDown, { size: 14 }) : _jsx(ChevronRight, { size: 14, 'data-i18n-mirror': '' }), _jsx(SizableText, { size: "$1", color: "$soft", width: 12, children: f.status[0].toUpperCase() }), _jsx(SizableText, { flex: 1, minW: 0, size: "$2", color: "$ink", numberOfLines: 1, text: "start", children: f.from ? `${f.from} → ${f.path}` : f.path }), _jsx(SizableText, { size: "$1", color: "$green10", children: `+${f.additions}` }), _jsx(SizableText, { size: "$1", color: "$red10", children: `−${f.deletions}` })] }), open ? (_jsxs(YStack, { px: "$3", pb: "$2", overflow: "scroll", children: [lines.length ? (_jsx(Patch, { text: f.patch })) : (_jsx(SizableText, { size: "$1", color: "$soft", children: f.truncated ? t('Too large to show here.') : t('Binary file') })), lines.length && f.truncated ? (_jsx(SizableText, { size: "$1", color: "$soft", children: t('The rest of this file’s change is too large to show here.') })) : null] })) : null] }));
|
|
90
|
+
}
|
|
91
|
+
/** A unified diff's lines, coloured by what each does: the Git tab's, and a transcript's edit card's. */
|
|
92
|
+
export function Patch({ text }) {
|
|
93
|
+
return (_jsx(_Fragment, { children: text.split('\n').map((l, i) => (_jsx(SizableText, { size: "$1", style: mono, color: l.startsWith('@@') ? '$soft' : l.startsWith('+') ? '$green10' : l.startsWith('-') ? '$red10' : '$ink', children: l || ' ' }, i))) }));
|
|
94
|
+
}
|
|
95
|
+
/** A view's name, marked (`phrase`): drawn through `t`. */
|
|
96
|
+
function label(v) {
|
|
97
|
+
return v === 'diff' ? phrase('Diff') : v === 'review' ? phrase('Review') : phrase('Commits');
|
|
98
|
+
}
|
|
99
|
+
/** What a reviewer did, in the reader's language; a state the forge names that is not one of these is drawn as given. */
|
|
100
|
+
function verdict(state, t) {
|
|
101
|
+
switch (state.toUpperCase()) {
|
|
102
|
+
case 'APPROVED':
|
|
103
|
+
return t('approved');
|
|
104
|
+
case 'REQUEST_CHANGES':
|
|
105
|
+
return t('asked for changes');
|
|
106
|
+
case 'COMMENT':
|
|
107
|
+
return t('commented');
|
|
108
|
+
default:
|
|
109
|
+
return state.toLowerCase() || t('reviewed');
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function when(iso) {
|
|
113
|
+
const d = new Date(iso);
|
|
114
|
+
return Number.isNaN(d.getTime()) ? '' : d.toLocaleString();
|
|
115
|
+
}
|
|
116
|
+
function Soft({ children }) {
|
|
117
|
+
return (_jsx(YStack, { py: "$6", items: "center", children: _jsx(SizableText, { size: "$2", color: "$soft", style: { textAlign: 'center' }, children: children }) }));
|
|
118
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { type CreatedRepo, type GitHubRepoBadgeInfo } from './api/github.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Crisp monochrome GitHub badge/link (`owner/repo ↗`) with optional sync status.
|
|
4
|
+
*/
|
|
5
|
+
export declare function GitHubBadge({ fullName, htmlUrl, syncedLabel, compact, }: {
|
|
6
|
+
fullName: string;
|
|
7
|
+
htmlUrl: string;
|
|
8
|
+
syncedLabel?: string;
|
|
9
|
+
compact?: boolean;
|
|
10
|
+
}): import("react").JSX.Element;
|
|
11
|
+
/**
|
|
12
|
+
* 1-click user OAuth fallback callout shown when creating/forking under a
|
|
13
|
+
* personal GitHub account returns HTTP 412 or 409.
|
|
14
|
+
*/
|
|
15
|
+
export declare function GitHubOAuthCallout({ message, label, }: {
|
|
16
|
+
message?: string;
|
|
17
|
+
label?: string;
|
|
18
|
+
}): import("react").JSX.Element;
|
|
19
|
+
/**
|
|
20
|
+
* Form to create a new GitHub repository (`POST /v1/provider/github/repos`).
|
|
21
|
+
* Handles 412/409 personal account OAuth requirement with a 1-click CTA.
|
|
22
|
+
*/
|
|
23
|
+
export declare function CreateGitHubRepoForm({ defaultName, defaultDescription, linkRepo, orgs, submitLabel, oauthLabel, onCreated, onCancel, }: {
|
|
24
|
+
defaultName?: string;
|
|
25
|
+
defaultDescription?: string;
|
|
26
|
+
/** Hanzo Git repo slug to link and push immediately after creation. */
|
|
27
|
+
linkRepo?: string;
|
|
28
|
+
orgs?: string[];
|
|
29
|
+
submitLabel?: string;
|
|
30
|
+
oauthLabel?: string;
|
|
31
|
+
onCreated: (repo: CreatedRepo) => void | Promise<void>;
|
|
32
|
+
onCancel?: () => void;
|
|
33
|
+
}): import("react").JSX.Element;
|
|
34
|
+
/**
|
|
35
|
+
* Form to fork a GitHub repository (`POST /v1/provider/github/fork`).
|
|
36
|
+
* Supports `owner/repo`, GitHub URLs, and bare repository names.
|
|
37
|
+
*/
|
|
38
|
+
export declare function ForkGitHubRepoForm({ orgs, submitLabel, onForked, onCancel, }: {
|
|
39
|
+
orgs?: string[];
|
|
40
|
+
submitLabel?: string;
|
|
41
|
+
onForked: (repo: CreatedRepo) => void | Promise<void>;
|
|
42
|
+
onCancel?: () => void;
|
|
43
|
+
}): import("react").JSX.Element;
|
|
44
|
+
/**
|
|
45
|
+
* Dialog to sync a Hanzo Git project to GitHub:
|
|
46
|
+
* - Create & sync a new GitHub repository (`POST /v1/provider/github/repos` with `linkRepo`), OR
|
|
47
|
+
* - Link an existing GitHub repository URL (`POST /v1/git/repos/:name/targets`).
|
|
48
|
+
*/
|
|
49
|
+
export declare function SyncToGitHubDialog({ open, onOpenChange, repoName, defaultName, defaultDescription, onSynced, }: {
|
|
50
|
+
open: boolean;
|
|
51
|
+
onOpenChange: (open: boolean) => void;
|
|
52
|
+
repoName: string;
|
|
53
|
+
defaultName?: string;
|
|
54
|
+
defaultDescription?: string;
|
|
55
|
+
onSynced: (info: GitHubRepoBadgeInfo) => void;
|
|
56
|
+
}): import("react").JSX.Element;
|
|
57
|
+
/**
|
|
58
|
+
* Modal/drawer experience for "Link a GitHub repo" / "Sync repositories" on `/dev/projects`:
|
|
59
|
+
* - When connected with 0 repositories, presents first-class "Create a new GitHub repository"
|
|
60
|
+
* and "Fork a GitHub repository" actions instead of a dead-end empty state.
|
|
61
|
+
* - When repositories are listed, provides instant search, 1-click "Import & edit in /dev",
|
|
62
|
+
* and clean access to "Create new repo" and "Fork repo".
|
|
63
|
+
* - Responsive from 390px mobile to 1440px desktop with zero overlap.
|
|
64
|
+
*/
|
|
65
|
+
export declare function GitHubReposModal({ open, onOpenChange, initialTab, onChanged, }: {
|
|
66
|
+
open: boolean;
|
|
67
|
+
onOpenChange: (open: boolean) => void;
|
|
68
|
+
initialTab?: 'browse' | 'create' | 'fork';
|
|
69
|
+
onChanged?: () => void;
|
|
70
|
+
}): import("react").JSX.Element;
|