@hanzo/dev 4.1.0 → 4.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/dist/{BinaryViewer-CmFUK4zZ.js → BinaryViewer-BCDMNW2g.js} +19 -19
  2. package/dist/{ChatMarkdown-nvEI7iCv.js → ChatMarkdown-BUidXqSs.js} +2460 -2460
  3. package/dist/{DevicePanel-v5e3sEIf.js → DevicePanel-D-pksK3r.js} +532 -532
  4. package/dist/{DeviceStreamView-CCIfmbxH.js → DeviceStreamView-DsCoOzDV.js} +377 -377
  5. package/dist/{DiffCommentAnnotation-BPTN_2a6.js → DiffCommentAnnotation-2HD5qiyt.js} +227 -227
  6. package/dist/{DiffFileTree-B_br90vY.js → DiffFileTree-CuWvI5hS.js} +13 -13
  7. package/dist/{DiffPanel-V5R5TPuK.js → DiffPanel-Z2QVmBzu.js} +328 -328
  8. package/dist/{DiffWorkerPoolProvider-BwFR-Fc9.js → DiffWorkerPoolProvider-CEfiCIGR.js} +3 -3
  9. package/dist/{DocumentPages-VSn83vty.js → DocumentPages-glImt2JO.js} +3 -3
  10. package/dist/{ExpandedImageDialog-CAorLacL.js → ExpandedImageDialog-iqO3LiIj.js} +404 -404
  11. package/dist/{FileExplorerPane-CeHulcPz.js → FileExplorerPane-GwnRmXEh.js} +4 -4
  12. package/dist/{FilePreviewPanel-BVNLvWOc.js → FilePreviewPanel-CXWpTlfI.js} +1089 -1089
  13. package/dist/{FontFilePreview-Dj8Blcay.js → FontFilePreview-CDydHOXg.js} +2 -2
  14. package/dist/{FontViewer-CLDdwhSr.js → FontViewer-DDt9C5Cb.js} +5 -5
  15. package/dist/{HanzoConnectAccountPages-BEzYfu2l.js → HanzoConnectAccountPages-_sfrtw9j.js} +357 -357
  16. package/dist/{HanzoConnectSidebarSignIn-BhD6-Up5.js → HanzoConnectSidebarSignIn-coFQvyRw.js} +3 -3
  17. package/dist/{Icons-CvSmt8vD.js → Icons-CdegMw5l.js} +1 -1
  18. package/dist/{LargeTextViewer-DfFnYGCw.js → LargeTextViewer-D3RklYQB.js} +8 -8
  19. package/dist/{MermaidDiagram-CTolIzQD.js → MermaidDiagram-sVLnox7j.js} +8 -8
  20. package/dist/{MermaidFilePreview-CP2zP4FU.js → MermaidFilePreview-BmPdNxW5.js} +2 -2
  21. package/dist/{MermaidViewer-BDfYkS9E.js → MermaidViewer-BlKTevTF.js} +3 -3
  22. package/dist/{NotebookPreview-Cybs5uM0.js → NotebookPreview-C0gSEyeO.js} +10 -10
  23. package/dist/{OfficeFilePreview-7JsmSoKU.js → OfficeFilePreview-Ago_DWEt.js} +2 -2
  24. package/dist/{OfficeViewer-CJoojlJK.js → OfficeViewer-DBRqtLet.js} +10 -10
  25. package/dist/{OpenInPicker-BIMWUxBP.js → OpenInPicker-DD_h7VLv.js} +287 -287
  26. package/dist/{OpenXmlOfficeViewer-C24Kj8DM.js → OpenXmlOfficeViewer-B4dxjpba.js} +4 -4
  27. package/dist/{PdfViewer-Cf1iD759.js → PdfViewer-BanXvPmz.js} +16 -16
  28. package/dist/{PreviewFaviconIcon-zFOuzIxe.js → PreviewFaviconIcon-BwYKB-3e.js} +892 -892
  29. package/dist/{PreviewImage-oY5YnuTr.js → PreviewImage-6UU-M6_B.js} +3 -3
  30. package/dist/{PreviewImageContent-n6eLzY99.js → PreviewImageContent-D-00K-A9.js} +3 -3
  31. package/dist/{PreviewPanel-Bo4Lt02m.js → PreviewPanel-CiuHdDv8.js} +489 -489
  32. package/dist/{PreviewPanelShell-DhXLeN5j.js → PreviewPanelShell-Dezxjg0T.js} +71 -71
  33. package/dist/{ProjectIconPickerDialog-D0kFzt8f.js → ProjectIconPickerDialog-LomrzROv.js} +29 -29
  34. package/dist/{ProjectMonogram-D35xrrXQ.js → ProjectMonogram-D21--FQY.js} +1 -1
  35. package/dist/{ProviderAuthTerminal-DfsXnu7A.js → ProviderAuthTerminal-pQXIfodT.js} +3 -3
  36. package/dist/{PullRequestCodeTab-Dv_0kVad.js → PullRequestCodeTab-Cqfh5eN2.js} +476 -476
  37. package/dist/{PullRequestReviewAnnotation-LeuwO-iH.js → PullRequestReviewAnnotation-B4Lp8Ktf.js} +334 -334
  38. package/dist/{ReadOnlySourcePreview-D__IA5g1.js → ReadOnlySourcePreview-7xXUUySV.js} +5 -5
  39. package/dist/{RelativeTime-BMRprQS8.js → RelativeTime-B_yprjav.js} +2 -2
  40. package/dist/{RightPanelResizeHandle-BLbSz-gk.js → RightPanelResizeHandle-PumvYb9P.js} +2 -2
  41. package/dist/{ThemeEditorPanel-CUDdsRsE.js → ThemeEditorPanel-BmXXpaCI.js} +196 -196
  42. package/dist/{ThreadTerminalDrawer-BF3Ix0q_.js → ThreadTerminalDrawer-DCgE3ojz.js} +461 -461
  43. package/dist/{VirtualTablePreview-dajviAfu.js → VirtualTablePreview-mA6DOFwb.js} +1 -1
  44. package/dist/{anchoredCopyToast-DnUtg1n_.js → anchoredCopyToast-BVa_dlBU.js} +2 -2
  45. package/dist/{assetUrls-DkY7vXfM.js → assetUrls-D8lRk7Xd.js} +45 -45
  46. package/dist/{browserLinkTarget-CA46wnQC.js → browserLinkTarget-BbVlDQYx.js} +18 -18
  47. package/dist/builder/api/git.d.ts +32 -4
  48. package/dist/builder/api/git.js +74 -4
  49. package/dist/builder/api/github.d.ts +54 -0
  50. package/dist/builder/api/github.js +103 -1
  51. package/dist/builder/api/models.d.ts +2 -0
  52. package/dist/builder/api/models.js +6 -1
  53. package/dist/builder/api/sandbox.d.ts +2 -0
  54. package/dist/builder/api/sandbox.js +3 -1
  55. package/dist/builder/desk.d.ts +6 -0
  56. package/dist/builder/desk.js +79 -14
  57. package/dist/builder/forge.js +79 -10
  58. package/dist/builder/github-sync.d.ts +70 -0
  59. package/dist/builder/github-sync.js +435 -0
  60. package/dist/builder/mind.d.ts +5 -5
  61. package/dist/builder/mind.js +35 -14
  62. package/dist/builder/pane.d.ts +1 -1
  63. package/dist/builder/pane.js +1 -1
  64. package/dist/builder/panel.js +5 -5
  65. package/dist/builder/preview-fallback.d.ts +47 -0
  66. package/dist/builder/preview-fallback.js +341 -0
  67. package/dist/builder/project.js +17 -4
  68. package/dist/builder/sync.js +27 -4
  69. package/dist/{changedFileKind-D6QYvIez.js → changedFileKind-DrjqPCpz.js} +5 -5
  70. package/dist/{collapsible-DFT41MdC.js → collapsible-CDT6JKbk.js} +1 -1
  71. package/dist/{color-picker-CshqBbpY.js → color-picker-kSVcH92L.js} +16 -16
  72. package/dist/core.js +1 -1
  73. package/dist/{decodeImagePreview-DnfFEjhw.js → decodeImagePreview-ZtWU3urU.js} +2 -2
  74. package/dist/{delimitedPreview-BiEpdYOj.js → delimitedPreview-DbbXcqOT.js} +1 -1
  75. package/dist/{dialog-DhQtWGRa.js → dialog-EmpqFZiK.js} +40 -40
  76. package/dist/{embed-c030vUqM.js → embed-CPWZKyIW.js} +36098 -35677
  77. package/dist/{empty-Bm5EzcG8.js → empty-ChM6gdzn.js} +1 -1
  78. package/dist/{errors-DrFQSJW3.js → errors-D8_Zn8KN.js} +2 -2
  79. package/dist/{fileContextMenu-BBo91omq.js → fileContextMenu-DW94DZj4.js} +54 -54
  80. package/dist/{fileExplorerLabel-AikEChiS.js → fileExplorerLabel-Cfz-3q1U.js} +507 -507
  81. package/dist/{fileSurfaceChrome-Cqkvn8RQ.js → fileSurfaceChrome-BDyKklTq.js} +26 -26
  82. package/dist/{hanzoWebAnalytics-CCxpTzcI.js → hanzoWebAnalytics-B1eETW-7.js} +1 -1
  83. package/dist/index.css +1 -1
  84. package/dist/{input-group-DEJEuwc9.js → input-group-BZ_QN-y7.js} +1 -1
  85. package/dist/{keybindings-C5tK_GAk.js → keybindings-D0pBlT1k.js} +7812 -7806
  86. package/dist/keymap.js +1 -1
  87. package/dist/{lucideIconByName-DUaXKH0V.js → lucideIconByName-CXY44V8P.js} +6835 -6848
  88. package/dist/{mediaReference-Bt_mh-ag.js → mediaReference-3wc4ZfY8.js} +95 -95
  89. package/dist/mediaSource-jW5c7b4r.js +70 -0
  90. package/dist/{modelPickerVisibility-Jue3CLfc.js → modelPickerVisibility-DBTc5r1G.js} +1 -1
  91. package/dist/{network-BbwqRm8c.js → network-wuXD7-is.js} +1 -1
  92. package/dist/{popover-anNQdce7.js → popover-BAyP2Tdr.js} +1 -1
  93. package/dist/{presentation-D9mVPBHm.js → presentation-68y8EAuH.js} +299 -299
  94. package/dist/{previewFailureMessages-BKpsSGX5.js → previewFailureMessages-CFguipaK.js} +3 -3
  95. package/dist/query-BPk2W3QN.js +63 -0
  96. package/dist/{readBinaryPreview-BAQ4fFjm.js → readBinaryPreview-CjZdBNVR.js} +2 -2
  97. package/dist/{refresh-icon-BYx64to1.js → refresh-icon-Vo5ImiQL.js} +1 -1
  98. package/dist/{scroll-area-ChvX8uOh.js → scroll-area-CEoyjC7h.js} +1 -1
  99. package/dist/{select-DumYjny_.js → select-DLFnkZsI.js} +2 -2
  100. package/dist/{session-_kmiSv2A.js → session-Decc4Fo5.js} +1063 -1063
  101. package/dist/{skeleton-CJqwfMSF.js → skeleton-BOKpAZv6.js} +1 -1
  102. package/dist/{switch-COwevwaq.js → switch-DjpPjtQN.js} +2 -2
  103. package/dist/{themePalette-Dl_7omVL.js → themePalette-C-GtwwqV.js} +977 -977
  104. package/dist/{threadSearch-BHyWwcV3.js → threadSearch-CrtCof6n.js} +162 -162
  105. package/dist/{toggle-CEO6qTxB.js → toggle-B4F0EEtI.js} +1 -1
  106. package/dist/{toggle-group-BHovdMDl.js → toggle-group-l8hRPswr.js} +2 -2
  107. package/dist/{use-atom-command-ByoYq_K6.js → use-atom-command-XemtT1Gv.js} +1 -1
  108. package/dist/{useAriaLabelledBy-DPSISlnL.js → useAriaLabelledBy-CibvSz-b.js} +1 -1
  109. package/dist/{useFileMetadata-e7zsixVX.js → useFileMetadata-PesehDX0.js} +33 -33
  110. package/dist/{useFloatingRootContext-CJ9stHca.js → useFloatingRootContext-ppoGvqar.js} +1 -1
  111. package/dist/{useLiveRefresh-BkKJKXhH.js → useLiveRefresh-aHkPuz6N.js} +172 -172
  112. package/dist/{useNextRenderData-CyUmSAgz.js → useNextRenderData-CNhjWfP0.js} +1 -1
  113. package/dist/{useSettings-DYG9Dmro.js → useSettings-B_MtcTyD.js} +139 -139
  114. package/dist/{useTextFieldSpeech-COa9XcRx.js → useTextFieldSpeech-B1wCgLPO.js} +1404 -1404
  115. package/dist/{useTheme-D2ZM1gvV.js → useTheme-WlXpQRKG.js} +4 -4
  116. package/dist/{utils-515nQ17G.js → utils-DtKQl-D3.js} +6184 -6172
  117. package/dist/{wizard-i86ViMRc.js → wizard-DjD4UNew.js} +3 -3
  118. package/dist/{workspaceFocus-BV1_9KiH.js → workspaceFocus-MR1plm6A.js} +144 -144
  119. package/dist/{zap-e0OsRjBR.js → zap-iwsUKtvA.js} +30 -17
  120. package/package.json +1 -1
  121. package/dist/mediaSource-zI7JWid4.js +0 -70
  122. package/dist/query-BxrrBAp6.js +0 -63
@@ -0,0 +1,435 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * GitHub repository creation, public `owner/repo` forking, outbound mirror sync,
4
+ * and repository import modal for `/dev`.
5
+ *
6
+ * Follows the monochrome design system (`@hanzo/gui`, `@hanzo/ui`, `@hanzo/i18n`)
7
+ * and works cleanly from mobile (`390px`) to desktop (`1440px`).
8
+ */
9
+ import { SizableText, XStack, YStack } from '@hanzo/gui';
10
+ import { useI18n } from '@hanzo/i18n/react';
11
+ import { ArrowRight, ArrowUpRight, GitBranch, GitFork, Github, Globe, Link2, Lock, Plus, Search, X, } from '@hanzogui/lucide-icons-2';
12
+ import { Button, Dialog, DialogContent, DialogDescription, DialogTitle, Input, Skeleton, toast } from '@hanzo/ui';
13
+ import { useEffect, useId, useMemo, useState } from 'react';
14
+ import { here } from './back.js';
15
+ import { told } from './api/call.js';
16
+ import { codebases } from './api/codebases.js';
17
+ import { attachGitHubMirror, bring, connect, connection, createGitHubRepo, forkGitHubRepo, installations, isGitHubUserOAuthRequired, parseGitHubRepo, repos as listGitHubRepos, } from './api/github.js';
18
+ import { links } from './api/links.js';
19
+ import { authorize, read as readProvider } from './api/provider.js';
20
+ import { pinHub, readPending, writePending } from './choice.js';
21
+ import { useRead } from './data.js';
22
+ import { useHost, useTarget } from './host.js';
23
+ import { Out } from './out.js';
24
+ import { RING } from './pane.js';
25
+ import { path } from './route.js';
26
+ const EMPTY_REPOS = { repos: [], next: '', total: 0, unread: [], connected: false };
27
+ /**
28
+ * Crisp monochrome GitHub badge/link (`owner/repo ↗`) with optional sync status.
29
+ */
30
+ export function GitHubBadge({ fullName, htmlUrl, syncedLabel, compact = false, }) {
31
+ const { t } = useI18n();
32
+ return (_jsx(XStack, { "data-slot": "github-badge", "data-repo": fullName, items: "center", rounded: 999, borderWidth: 1, borderColor: "$borderColor", bg: "$panel", px: "$2", py: "$0.5", minH: 26, minW: 0, shrink: 1, maxW: compact ? 180 : 240, "$max-md": { maxW: compact ? 132 : 180 }, hoverStyle: { bg: '$hover' }, children: _jsx(Out, { href: htmlUrl, label: t('Open {repo} on GitHub', { repo: fullName }), children: _jsxs(XStack, { items: "center", gap: "$1.5", minW: 0, maxW: "100%", 'data-i18n-ltr': '', children: [_jsx(Github, { size: 12, color: "$ink", "aria-hidden": true }), _jsx(SizableText, { size: "$1", color: "$ink", fontWeight: "500", numberOfLines: 1, minW: 0, shrink: 1, children: fullName }), syncedLabel && !compact ? (_jsx(SizableText, { size: "$1", color: "$soft", shrink: 0, "$max-md": { display: 'none' }, children: `· ${syncedLabel}` })) : null, _jsx(ArrowUpRight, { size: 11, color: "$soft", "aria-hidden": true })] }) }) }));
33
+ }
34
+ /**
35
+ * 1-click user OAuth fallback callout shown when creating/forking under a
36
+ * personal GitHub account returns HTTP 412 or 409.
37
+ */
38
+ export function GitHubOAuthCallout({ message, label, }) {
39
+ const host = useHost();
40
+ const target = useTarget();
41
+ const { t } = useI18n();
42
+ const [busy, setBusy] = useState(false);
43
+ const [err, setErr] = useState('');
44
+ const authorizeUser = async () => {
45
+ setBusy(true);
46
+ setErr('');
47
+ try {
48
+ const url = await connect(target, here());
49
+ host.open(url);
50
+ }
51
+ catch (e) {
52
+ setErr(told(e, t));
53
+ setBusy(false);
54
+ }
55
+ };
56
+ return (_jsxs(YStack, { "data-slot": "github-oauth-fallback", role: "alert", gap: "$2", px: "$3", py: "$2.5", rounded: "$3", borderWidth: 1, borderColor: "var(--border-strong)", bg: "$panel", children: [_jsx(SizableText, { size: "$2", color: "$ink", children: message || t('Authorize your personal GitHub account to create or fork repositories.') }), err ? (_jsx(SizableText, { size: "$1", color: "var(--state-error)", children: err })) : null, _jsx(XStack, { children: _jsxs(Button, { size: "sm", variant: "primary", "data-slot": "github-oauth-cta", "aria-label": label || t('Authorize GitHub account'), disabled: busy, onPress: () => void authorizeUser(), children: [_jsx(Github, { size: 14 }), busy ? t('Opening GitHub…') : label || t('Authorize GitHub account')] }) })] }));
57
+ }
58
+ /**
59
+ * Segmented toggle pill button used for tabs and visibility switches.
60
+ */
61
+ function SegmentButton({ active, label, icon, role, onPress, disabled = false, dataSlot, }) {
62
+ return (_jsxs(XStack, { render: "button", "data-slot": dataSlot, role: role, "aria-selected": role === 'tab' ? active : undefined, "aria-pressed": role !== 'tab' ? active : undefined, "aria-label": label, disabled: disabled, onPress: onPress, items: "center", justify: "center", gap: "$1.5", px: "$3", py: "$1.5", minH: 36, rounded: "$3", borderWidth: 1, borderColor: active ? '$ink' : '$borderColor', bg: active ? '$ink' : '$panel', cursor: disabled ? 'default' : 'pointer', opacity: disabled ? 0.6 : 1, focusVisibleStyle: RING, children: [icon, _jsx(SizableText, { size: "$2", fontWeight: active ? '500' : '400', color: active ? '$background' : '$ink', numberOfLines: 1, children: label })] }));
63
+ }
64
+ /**
65
+ * Form to create a new GitHub repository (`POST /v1/provider/github/repos`).
66
+ * Handles 412/409 personal account OAuth requirement with a 1-click CTA.
67
+ */
68
+ export function CreateGitHubRepoForm({ defaultName = '', defaultDescription = '', linkRepo, orgs = [], submitLabel, oauthLabel, onCreated, onCancel, }) {
69
+ const target = useTarget();
70
+ const { t } = useI18n();
71
+ const id = useId();
72
+ const [name, setName] = useState(defaultName);
73
+ const [description, setDescription] = useState(defaultDescription);
74
+ const [isPrivate, setIsPrivate] = useState(true);
75
+ const [org, setOrg] = useState('');
76
+ const [busy, setBusy] = useState(false);
77
+ const [error, setError] = useState('');
78
+ const [needsOAuth, setNeedsOAuth] = useState(false);
79
+ useEffect(() => {
80
+ setName(defaultName);
81
+ setDescription(defaultDescription);
82
+ setError('');
83
+ setNeedsOAuth(false);
84
+ }, [defaultName, defaultDescription, linkRepo]);
85
+ const submit = async () => {
86
+ const trimmed = name.trim();
87
+ if (!trimmed) {
88
+ setError(t('Enter a repository name.'));
89
+ return;
90
+ }
91
+ setBusy(true);
92
+ setError('');
93
+ setNeedsOAuth(false);
94
+ try {
95
+ const created = await createGitHubRepo(target, {
96
+ name: trimmed,
97
+ description: description.trim() || undefined,
98
+ private: isPrivate,
99
+ org: org || undefined,
100
+ linkRepo,
101
+ });
102
+ await onCreated(created);
103
+ }
104
+ catch (e) {
105
+ if (isGitHubUserOAuthRequired(e)) {
106
+ setNeedsOAuth(true);
107
+ setError(told(e, t));
108
+ }
109
+ else {
110
+ setError(told(e, t));
111
+ }
112
+ }
113
+ finally {
114
+ setBusy(false);
115
+ }
116
+ };
117
+ return (_jsxs(YStack, { "data-slot": "create-github-repo-form", gap: "$3", children: [_jsxs(YStack, { gap: "$1.5", children: [_jsx(SizableText, { render: "label", size: "$2", color: "$soft", htmlFor: `${id}-name`, children: t('Repository name') }), _jsx(Input, { id: `${id}-name`, value: name, onChangeText: setName, placeholder: "my-project", "aria-label": t('Repository name'), disabled: busy, onKeyDown: (e) => {
118
+ if (e.key === 'Enter')
119
+ void submit();
120
+ } })] }), _jsxs(YStack, { gap: "$1.5", children: [_jsx(SizableText, { render: "label", size: "$2", color: "$soft", htmlFor: `${id}-desc`, children: t('Description') }), _jsx(Input, { id: `${id}-desc`, value: description, onChangeText: setDescription, placeholder: t('Short description (optional)'), "aria-label": t('Description'), disabled: busy, onKeyDown: (e) => {
121
+ if (e.key === 'Enter')
122
+ void submit();
123
+ } })] }), _jsxs(YStack, { gap: "$1.5", children: [_jsx(SizableText, { size: "$2", color: "$soft", children: t('Visibility') }), _jsxs(XStack, { gap: "$2", flexWrap: "wrap", role: "group", "aria-label": t('Visibility'), children: [_jsx(SegmentButton, { dataSlot: "visibility-private", active: isPrivate, label: t('Private'), icon: _jsx(Lock, { size: 13, color: isPrivate ? '$background' : '$ink' }), disabled: busy, onPress: () => setIsPrivate(true) }), _jsx(SegmentButton, { dataSlot: "visibility-public", active: !isPrivate, label: t('Public'), icon: _jsx(Globe, { size: 13, color: !isPrivate ? '$background' : '$ink' }), disabled: busy, onPress: () => setIsPrivate(false) })] })] }), orgs.length > 0 ? (_jsxs(YStack, { gap: "$1.5", children: [_jsx(SizableText, { size: "$2", color: "$soft", children: t('Owner') }), _jsxs(XStack, { gap: "$1.5", flexWrap: "wrap", role: "group", "aria-label": t('Owner'), children: [_jsx(SegmentButton, { active: org === '', label: t('Personal account'), disabled: busy, onPress: () => setOrg('') }), orgs.map((o) => (_jsx(SegmentButton, { active: org === o, label: o, disabled: busy, onPress: () => setOrg(o) }, o)))] })] })) : null, needsOAuth ? (_jsx(GitHubOAuthCallout, { message: error || t('Your personal GitHub account needs authorization before creating repositories.'), label: oauthLabel })) : error ? (_jsx(SizableText, { size: "$2", color: "var(--state-error)", role: "alert", children: error })) : null, _jsxs(XStack, { gap: "$2", justify: "flex-end", flexWrap: "wrap", children: [onCancel ? (_jsx(Button, { size: "sm", variant: "outline", disabled: busy, onPress: onCancel, children: t('Cancel') })) : null, _jsxs(Button, { size: "sm", variant: "primary", "data-slot": "create-github-repo-submit", disabled: busy || !name.trim(), onPress: () => void submit(), children: [_jsx(Plus, { size: 14 }), busy ? t('Creating…') : submitLabel || t('Create repository')] })] })] }));
124
+ }
125
+ /**
126
+ * Form to fork a GitHub repository (`POST /v1/provider/github/fork`).
127
+ * Supports `owner/repo`, GitHub URLs, and bare repository names.
128
+ */
129
+ export function ForkGitHubRepoForm({ orgs = [], submitLabel, onForked, onCancel, }) {
130
+ const target = useTarget();
131
+ const { t } = useI18n();
132
+ const id = useId();
133
+ const [repo, setRepo] = useState('');
134
+ const [name, setName] = useState('');
135
+ const [org, setOrg] = useState('');
136
+ const [busy, setBusy] = useState(false);
137
+ const [error, setError] = useState('');
138
+ const [needsOAuth, setNeedsOAuth] = useState(false);
139
+ const submit = async () => {
140
+ const trimmed = repo.trim();
141
+ if (!trimmed) {
142
+ setError(t('Enter a repository to fork, such as owner/repo.'));
143
+ return;
144
+ }
145
+ setBusy(true);
146
+ setError('');
147
+ setNeedsOAuth(false);
148
+ try {
149
+ const forked = await forkGitHubRepo(target, {
150
+ repo: trimmed,
151
+ org: org || undefined,
152
+ name: name.trim() || undefined,
153
+ });
154
+ await onForked(forked);
155
+ }
156
+ catch (e) {
157
+ if (isGitHubUserOAuthRequired(e)) {
158
+ setNeedsOAuth(true);
159
+ setError(told(e, t));
160
+ }
161
+ else {
162
+ setError(told(e, t));
163
+ }
164
+ }
165
+ finally {
166
+ setBusy(false);
167
+ }
168
+ };
169
+ return (_jsxs(YStack, { "data-slot": "fork-github-repo-form", gap: "$3", children: [_jsxs(YStack, { gap: "$1.5", children: [_jsx(SizableText, { render: "label", size: "$2", color: "$soft", htmlFor: `${id}-repo`, children: t('Repository to fork') }), _jsx(Input, { id: `${id}-repo`, value: repo, onChangeText: setRepo, placeholder: "owner/repo", "aria-label": t('Repository to fork'), disabled: busy, onKeyDown: (e) => {
170
+ if (e.key === 'Enter')
171
+ void submit();
172
+ } }), _jsx(SizableText, { size: "$1", color: "$soft", children: t('Enter any public GitHub repository (e.g. hanzoai/ui) or paste its URL.') })] }), _jsxs(YStack, { gap: "$1.5", children: [_jsx(SizableText, { render: "label", size: "$2", color: "$soft", htmlFor: `${id}-rename`, children: t('New repository name (optional)') }), _jsx(Input, { id: `${id}-rename`, value: name, onChangeText: setName, placeholder: t('Keep original name'), "aria-label": t('New repository name (optional)'), disabled: busy, onKeyDown: (e) => {
173
+ if (e.key === 'Enter')
174
+ void submit();
175
+ } })] }), orgs.length > 0 ? (_jsxs(YStack, { gap: "$1.5", children: [_jsx(SizableText, { size: "$2", color: "$soft", children: t('Fork into') }), _jsxs(XStack, { gap: "$1.5", flexWrap: "wrap", role: "group", "aria-label": t('Fork into'), children: [_jsx(SegmentButton, { active: org === '', label: t('Personal account'), disabled: busy, onPress: () => setOrg('') }), orgs.map((o) => (_jsx(SegmentButton, { active: org === o, label: o, disabled: busy, onPress: () => setOrg(o) }, o)))] })] })) : null, needsOAuth ? (_jsx(GitHubOAuthCallout, { message: error || t('Authorize your personal GitHub account to fork repositories into it.') })) : error ? (_jsx(SizableText, { size: "$2", color: "var(--state-error)", role: "alert", children: error })) : null, _jsxs(XStack, { gap: "$2", justify: "flex-end", flexWrap: "wrap", children: [onCancel ? (_jsx(Button, { size: "sm", variant: "outline", disabled: busy, onPress: onCancel, children: t('Cancel') })) : null, _jsxs(Button, { size: "sm", variant: "primary", "data-slot": "fork-github-repo-submit", disabled: busy || !repo.trim(), onPress: () => void submit(), children: [_jsx(GitFork, { size: 14 }), busy ? t('Forking…') : submitLabel || t('Fork & edit in /dev')] })] })] }));
176
+ }
177
+ /**
178
+ * Dialog to sync a Hanzo Git project to GitHub:
179
+ * - Create & sync a new GitHub repository (`POST /v1/provider/github/repos` with `linkRepo`), OR
180
+ * - Link an existing GitHub repository URL (`POST /v1/git/repos/:name/targets`).
181
+ */
182
+ export function SyncToGitHubDialog({ open, onOpenChange, repoName, defaultName, defaultDescription = '', onSynced, }) {
183
+ const target = useTarget();
184
+ const { t } = useI18n();
185
+ const id = useId();
186
+ const [mode, setMode] = useState('create');
187
+ const [existingUrl, setExistingUrl] = useState('');
188
+ const [busy, setBusy] = useState(false);
189
+ const [error, setError] = useState('');
190
+ const [needsOAuth, setNeedsOAuth] = useState(false);
191
+ const installed = useRead(open ? () => installations(target).catch(() => []) : null, [], [target, open]);
192
+ const orgLogins = useMemo(() => installed.value.filter((i) => i.connected && i.type.toLowerCase() === 'organization').map((i) => i.login), [installed.value]);
193
+ useEffect(() => {
194
+ if (!open)
195
+ return;
196
+ setMode('create');
197
+ setExistingUrl('');
198
+ setError('');
199
+ setNeedsOAuth(false);
200
+ }, [open, repoName]);
201
+ const attachExisting = async () => {
202
+ const at = parseGitHubRepo(existingUrl);
203
+ if (!at) {
204
+ setError(t('Enter a GitHub repository URL or owner/repo (e.g. https://github.com/owner/repo).'));
205
+ return;
206
+ }
207
+ setBusy(true);
208
+ setError('');
209
+ setNeedsOAuth(false);
210
+ try {
211
+ await attachGitHubMirror(target, repoName, existingUrl);
212
+ const fullName = `${at.owner}/${at.name}`;
213
+ const htmlUrl = `https://github.com/${fullName}`;
214
+ toast.success(t('Syncing {repo} to GitHub ({target})', { repo: repoName, target: fullName }));
215
+ onSynced({ owner: at.owner, name: at.name, fullName, htmlUrl, source: 'target' });
216
+ onOpenChange(false);
217
+ }
218
+ catch (e) {
219
+ if (isGitHubUserOAuthRequired(e)) {
220
+ setNeedsOAuth(true);
221
+ setError(told(e, t));
222
+ }
223
+ else {
224
+ setError(told(e, t));
225
+ }
226
+ }
227
+ finally {
228
+ setBusy(false);
229
+ }
230
+ };
231
+ return (_jsx(Dialog, { open: open, onOpenChange: (o) => !busy && onOpenChange(o), children: _jsxs(DialogContent, { "data-slot": "sync-to-github-dialog", width: "100%", maxW: 480, maxH: "85vh", overflow: "scroll", gap: "$3", children: [_jsx(DialogTitle, { children: t('Sync to GitHub') }), _jsx(DialogDescription, { children: t('Push {repo} to a new or existing GitHub repository and keep commits synced.', { repo: repoName }) }), _jsxs(XStack, { role: "tablist", "aria-label": t('Sync method'), gap: "$2", flexWrap: "wrap", children: [_jsx(SegmentButton, { role: "tab", dataSlot: "sync-tab-create", active: mode === 'create', label: t('Create new repo'), icon: _jsx(Plus, { size: 13, color: mode === 'create' ? '$background' : '$ink' }), disabled: busy, onPress: () => {
232
+ setMode('create');
233
+ setError('');
234
+ setNeedsOAuth(false);
235
+ } }), _jsx(SegmentButton, { role: "tab", dataSlot: "sync-tab-link", active: mode === 'link', label: t('Link existing repo'), icon: _jsx(Link2, { size: 13, color: mode === 'link' ? '$background' : '$ink' }), disabled: busy, onPress: () => {
236
+ setMode('link');
237
+ setError('');
238
+ setNeedsOAuth(false);
239
+ } })] }), mode === 'create' ? (_jsx(CreateGitHubRepoForm, { defaultName: defaultName || repoName, defaultDescription: defaultDescription, linkRepo: repoName, orgs: orgLogins, submitLabel: t('Create & sync to GitHub'), oauthLabel: t('Authorize GitHub to create repos'), onCancel: () => onOpenChange(false), onCreated: (created) => {
240
+ const parts = created.full_name.split('/');
241
+ const owner = parts[0] ?? '';
242
+ const name = parts[1] ?? created.full_name;
243
+ toast.success(t('Synced to {repo} on GitHub', { repo: created.full_name }));
244
+ onSynced({
245
+ owner,
246
+ name,
247
+ fullName: created.full_name,
248
+ htmlUrl: created.html_url || `https://github.com/${created.full_name}`,
249
+ source: 'target',
250
+ });
251
+ onOpenChange(false);
252
+ } })) : (_jsxs(YStack, { "data-slot": "link-existing-github-form", gap: "$3", children: [_jsxs(YStack, { gap: "$1.5", children: [_jsx(SizableText, { render: "label", size: "$2", color: "$soft", htmlFor: `${id}-url`, children: t('GitHub repository') }), _jsx(Input, { id: `${id}-url`, value: existingUrl, onChangeText: setExistingUrl, placeholder: "https://github.com/owner/repo", "aria-label": t('GitHub repository URL'), disabled: busy, onKeyDown: (e) => {
253
+ if (e.key === 'Enter')
254
+ void attachExisting();
255
+ } }), _jsx(SizableText, { size: "$1", color: "$soft", children: t('Attaches an outbound mirror target and triggers an initial sync push.') })] }), needsOAuth ? (_jsx(GitHubOAuthCallout, { message: error || t('Authorize your GitHub account to push to this repository.') })) : error ? (_jsx(SizableText, { size: "$2", color: "var(--state-error)", role: "alert", children: error })) : null, _jsxs(XStack, { gap: "$2", justify: "flex-end", flexWrap: "wrap", children: [_jsx(Button, { size: "sm", variant: "outline", disabled: busy, onPress: () => onOpenChange(false), children: t('Cancel') }), _jsxs(Button, { size: "sm", variant: "primary", "data-slot": "link-existing-github-submit", disabled: busy || !existingUrl.trim(), onPress: () => void attachExisting(), children: [_jsx(Link2, { size: 14 }), busy ? t('Syncing…') : t('Link & sync to GitHub')] })] })] }))] }) }));
256
+ }
257
+ /**
258
+ * Modal/drawer experience for "Link a GitHub repo" / "Sync repositories" on `/dev/projects`:
259
+ * - When connected with 0 repositories, presents first-class "Create a new GitHub repository"
260
+ * and "Fork a GitHub repository" actions instead of a dead-end empty state.
261
+ * - When repositories are listed, provides instant search, 1-click "Import & edit in /dev",
262
+ * and clean access to "Create new repo" and "Fork repo".
263
+ * - Responsive from 390px mobile to 1440px desktop with zero overlap.
264
+ */
265
+ export function GitHubReposModal({ open, onOpenChange, initialTab = 'browse', onChanged, }) {
266
+ const host = useHost();
267
+ const target = useTarget();
268
+ const { t } = useI18n();
269
+ const signed = Boolean(host.person);
270
+ const [tab, setTab] = useState(initialTab);
271
+ const [q, setQ] = useState('');
272
+ const [importing, setImporting] = useState('');
273
+ const [connecting, setConnecting] = useState(false);
274
+ const [error, setError] = useState('');
275
+ const [needsOAuth, setNeedsOAuth] = useState(false);
276
+ useEffect(() => {
277
+ if (!open)
278
+ return;
279
+ setTab(initialTab);
280
+ setQ('');
281
+ setError('');
282
+ setNeedsOAuth(false);
283
+ setImporting('');
284
+ }, [open, initialTab]);
285
+ const me = useRead(open && signed ? () => connection(target).catch(() => null) : null, null, [target, open, signed]);
286
+ const providerConn = useRead(open && signed ? () => readProvider(target, 'github').catch(() => null) : null, null, [target, open, signed]);
287
+ const installed = useRead(open && signed ? () => installations(target).catch(() => []) : null, [], [target, open, signed]);
288
+ const repoPage = useRead(open && signed ? () => listGitHubRepos(target, { limit: 100 }) : null, EMPTY_REPOS, [target, open, signed]);
289
+ const held = useRead(open && signed ? () => codebases(target).catch(() => []) : null, [], [target, open, signed]);
290
+ const syncedLinks = useRead(open && signed ? () => links(target).catch(() => []) : null, [], [target, open, signed]);
291
+ const isConnected = Boolean(me.value?.connected ||
292
+ providerConn.value?.connected ||
293
+ repoPage.value.connected ||
294
+ installed.value.some((i) => i.connected));
295
+ const login = me.value?.login ||
296
+ providerConn.value?.account ||
297
+ installed.value.find((i) => i.connected)?.login ||
298
+ '';
299
+ const orgLogins = useMemo(() => installed.value.filter((i) => i.connected && i.type.toLowerCase() === 'organization').map((i) => i.login), [installed.value]);
300
+ const loading = me.loading || repoPage.loading;
301
+ const heldNames = useMemo(() => new Set(held.value.map((c) => c.name.toLowerCase())), [held.value]);
302
+ const linkedMap = useMemo(() => new Map(syncedLinks.value.map((l) => [`${l.owner}/${l.name}`.toLowerCase(), l])), [syncedLinks.value]);
303
+ const needle = q.trim().toLowerCase();
304
+ const filteredRepos = useMemo(() => repoPage.value.repos.filter((r) => !needle || r.full_name.toLowerCase().includes(needle) || r.name.toLowerCase().includes(needle) || r.owner.toLowerCase().includes(needle)), [repoPage.value.repos, needle]);
305
+ const startConnect = async () => {
306
+ setConnecting(true);
307
+ setError('');
308
+ try {
309
+ host.open(await connect(target, here()));
310
+ }
311
+ catch (e) {
312
+ setError(told(e, t));
313
+ setConnecting(false);
314
+ }
315
+ };
316
+ const installApp = async () => {
317
+ setConnecting(true);
318
+ setError('');
319
+ try {
320
+ host.open(await authorize(target, 'github', here()));
321
+ }
322
+ catch (e) {
323
+ setError(told(e, t));
324
+ setConnecting(false);
325
+ }
326
+ };
327
+ const openCreatedOrForked = async (created, verb) => {
328
+ const [owner = '', name = created.full_name] = created.full_name.split('/');
329
+ try {
330
+ const queued = await bring(target, [created.full_name]);
331
+ const codebaseName = queued.codebases[created.full_name.toLowerCase()] || name;
332
+ const nextPending = [
333
+ ...readPending(host.org).filter((p) => p.fullName.toLowerCase() !== created.full_name.toLowerCase()),
334
+ { fullName: created.full_name, name: codebaseName },
335
+ ];
336
+ writePending(host.org, nextPending);
337
+ }
338
+ catch {
339
+ // Personal OAuth repos can still be edited directly via github.com/owner/repo even without an org mirror.
340
+ }
341
+ pinHub(host.org, {
342
+ owner,
343
+ name,
344
+ private: created.private,
345
+ branch: created.default_branch || 'main',
346
+ });
347
+ toast.success(verb === 'created'
348
+ ? t('Created {repo} on GitHub — opening in Dev', { repo: created.full_name })
349
+ : t('Forked {repo} to GitHub — opening in Dev', { repo: created.full_name }));
350
+ onChanged?.();
351
+ onOpenChange(false);
352
+ host.go('');
353
+ };
354
+ const importAndEdit = async (r) => {
355
+ const existingLink = linkedMap.get(r.full_name.toLowerCase());
356
+ const forgeName = existingLink?.forge || r.codebase || r.name;
357
+ if (heldNames.has(forgeName.toLowerCase())) {
358
+ onOpenChange(false);
359
+ host.go(path({ kind: 'repo', org: host.org || '', name: forgeName }));
360
+ return;
361
+ }
362
+ setImporting(r.full_name);
363
+ setError('');
364
+ setNeedsOAuth(false);
365
+ try {
366
+ const queued = await bring(target, [r.full_name]);
367
+ const codebaseName = queued.codebases[r.full_name.toLowerCase()] || r.codebase || r.name;
368
+ const nextPending = [
369
+ ...readPending(host.org).filter((p) => p.fullName.toLowerCase() !== r.full_name.toLowerCase()),
370
+ { fullName: r.full_name, name: codebaseName },
371
+ ];
372
+ writePending(host.org, nextPending);
373
+ pinHub(host.org, {
374
+ owner: r.owner,
375
+ name: r.name,
376
+ private: r.private,
377
+ branch: r.default_branch || 'main',
378
+ });
379
+ toast.success(t('Importing {repo} — opening in Dev', { repo: r.full_name }));
380
+ onChanged?.();
381
+ onOpenChange(false);
382
+ host.go('');
383
+ }
384
+ catch (e) {
385
+ if (isGitHubUserOAuthRequired(e)) {
386
+ // When user has personal GitHub connected, they can still work directly on github.com/owner/repo.
387
+ if (me.value?.connected) {
388
+ pinHub(host.org, {
389
+ owner: r.owner,
390
+ name: r.name,
391
+ private: r.private,
392
+ branch: r.default_branch || 'main',
393
+ });
394
+ toast.success(t('Opened {repo} in Dev', { repo: r.full_name }));
395
+ onOpenChange(false);
396
+ host.go('');
397
+ return;
398
+ }
399
+ setNeedsOAuth(true);
400
+ setError(told(e, t));
401
+ }
402
+ else {
403
+ setError(told(e, t));
404
+ }
405
+ }
406
+ finally {
407
+ setImporting('');
408
+ }
409
+ };
410
+ return (_jsx(Dialog, { open: open, onOpenChange: (o) => !importing && onOpenChange(o), children: _jsxs(DialogContent, { "data-slot": "github-repos-modal", width: "100%", maxW: 540, maxH: "85vh", overflow: "scroll", gap: "$3", children: [_jsx(XStack, { items: "center", justify: "space-between", gap: "$2", flexWrap: "wrap", children: _jsxs(YStack, { gap: "$0.5", flex: 1, minW: 0, children: [_jsx(DialogTitle, { children: t('GitHub repositories') }), isConnected && login ? (_jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, children: t('Connected as @{login}', { login }) })) : null] }) }), !signed ? (_jsxs(YStack, { gap: "$3", items: "center", py: "$4", children: [_jsx(SizableText, { size: "$2", color: "$soft", text: "center", children: t('Sign in to connect GitHub and work on repositories in Dev.') }), _jsx(Button, { size: "sm", variant: "primary", onPress: () => host.signIn?.(), children: t('Sign in') })] })) : !isConnected && !loading ? (_jsxs(YStack, { "data-slot": "github-not-connected", gap: "$3", py: "$2", children: [_jsx(SizableText, { size: "$2", color: "$soft", children: t('Connect your GitHub account to import, create, or fork repositories right from Dev.') }), error ? (_jsx(SizableText, { size: "$2", color: "var(--state-error)", role: "alert", children: error })) : null, _jsxs(XStack, { gap: "$2", flexWrap: "wrap", children: [_jsxs(Button, { size: "sm", variant: "primary", disabled: connecting, onPress: () => void startConnect(), children: [_jsx(Github, { size: 14 }), connecting ? t('Opening GitHub…') : t('Connect GitHub')] }), host.admin ? (_jsx(Button, { size: "sm", variant: "outline", disabled: connecting, onPress: () => void installApp(), children: t('Install on organization') })) : null] })] })) : (_jsxs(_Fragment, { children: [_jsxs(XStack, { role: "tablist", "aria-label": t('GitHub actions'), gap: "$2", flexWrap: "wrap", children: [_jsx(SegmentButton, { role: "tab", dataSlot: "github-tab-browse", active: tab === 'browse', label: repoPage.value.repos.length > 0
411
+ ? t('Repositories ({n})', { n: repoPage.value.total || repoPage.value.repos.length })
412
+ : t('Repositories'), icon: _jsx(Github, { size: 13, color: tab === 'browse' ? '$background' : '$ink' }), onPress: () => {
413
+ setTab('browse');
414
+ setError('');
415
+ setNeedsOAuth(false);
416
+ } }), _jsx(SegmentButton, { role: "tab", dataSlot: "github-tab-create", active: tab === 'create', label: t('Create new repo'), icon: _jsx(Plus, { size: 13, color: tab === 'create' ? '$background' : '$ink' }), onPress: () => {
417
+ setTab('create');
418
+ setError('');
419
+ setNeedsOAuth(false);
420
+ } }), _jsx(SegmentButton, { role: "tab", dataSlot: "github-tab-fork", active: tab === 'fork', label: t('Fork repo'), icon: _jsx(GitFork, { size: 13, color: tab === 'fork' ? '$background' : '$ink' }), onPress: () => {
421
+ setTab('fork');
422
+ setError('');
423
+ setNeedsOAuth(false);
424
+ } })] }), tab === 'browse' ? (loading && repoPage.value.repos.length === 0 ? (_jsxs(YStack, { gap: "$2", "aria-busy": true, py: "$2", children: [_jsx(SizableText, { size: "$2", color: "$soft", children: t('Reading your GitHub repositories…') }), _jsx(Skeleton, { layout: "block", height: 40, rounded: "$3" }), _jsx(Skeleton, { layout: "block", height: 40, rounded: "$3" }), _jsx(Skeleton, { layout: "block", height: 40, rounded: "$3" })] })) : repoPage.error && repoPage.value.repos.length === 0 ? (_jsxs(YStack, { gap: "$3", py: "$2", children: [_jsx(SizableText, { size: "$2", color: "var(--state-error)", role: "alert", children: told(repoPage.error, t) }), _jsxs(XStack, { gap: "$2", flexWrap: "wrap", children: [_jsx(Button, { size: "sm", variant: "outline", onPress: repoPage.reload, children: t('Try again') }), _jsxs(Button, { size: "sm", variant: "primary", onPress: () => setTab('create'), children: [_jsx(Plus, { size: 14 }), t('Create a new GitHub repository')] }), _jsxs(Button, { size: "sm", variant: "outline", onPress: () => setTab('fork'), children: [_jsx(GitFork, { size: 14 }), t('Fork a GitHub repository')] })] })] })) : repoPage.value.repos.length === 0 ? (_jsxs(YStack, { "data-slot": "github-empty-state", gap: "$3", py: "$2", children: [_jsxs(YStack, { gap: "$1", children: [_jsx(SizableText, { size: "$3", fontWeight: "500", color: "$ink", children: t('No repositories on GitHub yet') }), _jsx(SizableText, { size: "$2", color: "$soft", children: login
425
+ ? t('Your GitHub account (@{login}) has 0 repositories right now. Create a new repository or fork any public owner/repo to start editing in Dev.', { login })
426
+ : t('Your connected GitHub account has 0 repositories right now. Create a new repository or fork any public owner/repo to start editing in Dev.') })] }), _jsxs(XStack, { gap: "$2.5", flexWrap: "wrap", children: [_jsxs(YStack, { render: "button", "data-slot": "empty-create-github-repo", "aria-label": t('Create a new GitHub repository'), onPress: () => setTab('create'), flex: 1, flexBasis: 200, minW: 0, gap: "$1.5", p: "$3.5", rounded: "$4", borderWidth: 1, borderColor: "$borderColor", bg: "$panel", items: "flex-start", hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING, "$platform-web": { textAlign: 'start' }, children: [_jsx(Plus, { size: 18, color: "$ink" }), _jsx(SizableText, { size: "$3", fontWeight: "500", color: "$ink", children: t('Create a new GitHub repository') }), _jsx(SizableText, { size: "$1", color: "$soft", children: t('Name, description, and visibility — created on GitHub and opened in Dev.') })] }), _jsxs(YStack, { render: "button", "data-slot": "empty-fork-github-repo", "aria-label": t('Fork a GitHub repository'), onPress: () => setTab('fork'), flex: 1, flexBasis: 200, minW: 0, gap: "$1.5", p: "$3.5", rounded: "$4", borderWidth: 1, borderColor: "$borderColor", bg: "$panel", items: "flex-start", hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING, "$platform-web": { textAlign: 'start' }, children: [_jsx(GitFork, { size: 18, color: "$ink" }), _jsx(SizableText, { size: "$3", fontWeight: "500", color: "$ink", children: t('Fork a GitHub repository') }), _jsx(SizableText, { size: "$1", color: "$soft", children: t('Fork any public owner/repo to your GitHub and edit it in Dev.') })] })] }), host.admin ? (_jsx(XStack, { children: _jsx(Button, { size: "sm", variant: "ghost", disabled: connecting, onPress: () => void installApp(), children: t('Grant access to more repositories on GitHub') }) })) : null] })) : (_jsxs(YStack, { "data-slot": "github-repo-list", gap: "$2.5", children: [_jsx(Input, { value: q, onChangeText: setQ, placeholder: t('Search repositories…'), "aria-label": t('Search repositories'), startAdornment: _jsx(Search, { size: 14, color: "$soft", "aria-hidden": true }), endAdornment: q ? (_jsx(XStack, { render: "button", "aria-label": t('Clear search'), onPress: () => setQ(''), minW: 24, minH: 24, items: "center", justify: "center", focusVisibleStyle: RING, children: _jsx(X, { size: 13, color: "$soft" }) })) : undefined }), needsOAuth ? (_jsx(GitHubOAuthCallout, { message: error })) : error ? (_jsx(SizableText, { size: "$2", color: "var(--state-error)", role: "alert", children: error })) : null, _jsx(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: "$3", maxH: 320, overflow: "scroll", children: filteredRepos.length === 0 ? (_jsxs(YStack, { p: "$4", gap: "$2", items: "center", children: [_jsx(SizableText, { size: "$2", color: "$soft", children: t('Nothing matches.') }), _jsx(Button, { size: "sm", variant: "outline", onPress: () => setQ(''), children: t('Clear search') })] })) : (filteredRepos.map((r, i) => {
427
+ const existingLink = linkedMap.get(r.full_name.toLowerCase());
428
+ const forgeName = existingLink?.forge || r.codebase || r.name;
429
+ const onForge = heldNames.has(forgeName.toLowerCase());
430
+ const isBusy = importing === r.full_name;
431
+ return (_jsxs(XStack, { items: "center", gap: "$2.5", px: "$3", py: "$2.5", minH: 48, borderTopWidth: i ? 1 : 0, borderColor: "$borderColor", hoverStyle: { bg: '$hover' }, flexWrap: "wrap", children: [_jsxs(XStack, { items: "center", gap: "$2", flex: 1, minW: 160, children: [r.private ? _jsx(Lock, { size: 14, color: "$soft", "aria-hidden": true }) : _jsx(Globe, { size: 14, color: "$soft", "aria-hidden": true }), _jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(SizableText, { size: "$2", color: "$ink", fontWeight: "500", numberOfLines: 1, 'data-i18n-ltr': '', children: r.full_name }), r.default_branch ? (_jsxs(XStack, { items: "center", gap: "$1", children: [_jsx(GitBranch, { size: 10, color: "$soft", "aria-hidden": true }), _jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, children: r.default_branch })] })) : null] })] }), _jsxs(Button, { size: "sm", variant: onForge ? 'outline' : 'primary', "data-slot": "import-edit-repo", "aria-label": onForge
432
+ ? t('Open {repo} in /dev', { repo: r.full_name })
433
+ : t('Import & edit {repo} in /dev', { repo: r.full_name }), disabled: Boolean(importing), onPress: () => void importAndEdit(r), shrink: 0, children: [isBusy ? t('Importing…') : onForge ? t('Open in /dev') : t('Import & edit in /dev'), !isBusy ? _jsx(ArrowRight, { size: 13 }) : null] })] }, r.full_name));
434
+ })) })] }))) : tab === 'create' ? (_jsx(CreateGitHubRepoForm, { orgs: orgLogins, submitLabel: t('Create & edit in /dev'), onCreated: (r) => openCreatedOrForked(r, 'created'), onCancel: () => setTab('browse') })) : (_jsx(ForkGitHubRepoForm, { orgs: orgLogins, submitLabel: t('Fork & edit in /dev'), onForked: (r) => openCreatedOrForked(r, 'forked'), onCancel: () => setTab('browse') }))] }))] }) }));
435
+ }
@@ -1,14 +1,14 @@
1
1
  import type { Modes } from '@hanzo/ui/chat';
2
2
  import { type Target } from './api/call.ts';
3
3
  import { type Model } from './api/models.ts';
4
- export type Effort = 'auto' | 'low' | 'high' | 'max';
5
- /** The efforts a Dev run offers, in order: Auto (medium), Fast (low), High, and Max. Marked English, drawn through `t`. */
4
+ export type Effort = 'auto' | 'off' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max';
5
+ /** The efforts a Dev run offers, matching every reasoning level tracked across models. Marked English, drawn through `t`. */
6
6
  export declare const EFFORTS: {
7
- id: "auto" | "high" | "low" | "max";
7
+ id: Effort;
8
8
  label: string;
9
9
  note: string;
10
10
  }[];
11
- /** The effort a coding run names (apps/coding takes low, medium or high): low for Fast, medium for Auto, high for High/Max. */
11
+ /** The effort a coding run names (apps/coding takes low, medium or high). */
12
12
  export declare const level: (effort: Effort) => 'low' | 'medium' | 'high';
13
13
  /** What a person chose: the model (Enso routes) and the effort. */
14
14
  export interface Choice {
@@ -54,7 +54,7 @@ export interface Catalog {
54
54
  * the reason in the chooser — never the platform's own words.
55
55
  */
56
56
  export declare function useCatalog(t: Target): Catalog;
57
- /** Whether `model` is one this plan may send: on Free, Enso Auto alone (commerce's `allowedModels`). */
57
+ /** Whether `model` is one this plan may send: on Free, Enso Auto and Enso Flash only (never Enso Free or other paid models). */
58
58
  export declare function grants(free: boolean, model: string): boolean;
59
59
  /**
60
60
  * Whether the plan and the prepaid balance (cents, null where unknown) let `id` be
@@ -26,19 +26,31 @@ import { parseModels, thirdParty } from '@hanzo/ui/models/catalog';
26
26
  import { useEffect, useState, useSyncExternalStore } from 'react';
27
27
  import { prepaid as readPrepaid } from './api/billing.js';
28
28
  import { Refusal } from './api/call.js';
29
- import { ENSO, models as read } from './api/models.js';
29
+ import { ENSO, isRemovedEnsoFree, models as read } from './api/models.js';
30
30
  import { usePick } from './pick.js';
31
+ const EFFORT_ORDER = ['auto', 'off', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max'];
31
32
  const EFFORT_LABELS = {
32
- low: phrase('Fast'),
33
+ auto: phrase('Auto'),
34
+ off: phrase('Off'),
35
+ minimal: phrase('Minimal'),
36
+ low: phrase('Low'),
37
+ medium: phrase('Medium'),
38
+ high: phrase('High'),
39
+ xhigh: phrase('Extra High'),
40
+ max: phrase('Max'),
33
41
  };
34
42
  const EFFORT_NOTES = {
35
43
  auto: phrase('Matches thinking depth to the complexity of each prompt.'),
36
- low: phrase('Fastest edits and replies for straightforward coding tasks.'),
44
+ off: phrase('Direct replies without extended reasoning.'),
45
+ minimal: phrase('Lightest reasoning pass for quick checks and small edits.'),
46
+ low: phrase('Fast edits and replies for straightforward coding tasks.'),
47
+ medium: phrase('Balanced reasoning depth for everyday engineering work.'),
37
48
  high: phrase('Spends extra time reasoning through multi-step tasks and code.'),
49
+ xhigh: phrase('Extended reasoning for hard debugging and multi-file changes.'),
38
50
  max: phrase('Deepest reasoning and verification for complex architecture.'),
39
51
  };
40
- /** The efforts a Dev run offers, in order: Auto (medium), Fast (low), High, and Max. Marked English, drawn through `t`. */
41
- export const EFFORTS = ['auto', 'low', 'high', 'max'].map((id) => {
52
+ /** The efforts a Dev run offers, matching every reasoning level tracked across models. Marked English, drawn through `t`. */
53
+ export const EFFORTS = EFFORT_ORDER.map((id) => {
42
54
  const base = EVERY.find((e) => e.id === id);
43
55
  return {
44
56
  id,
@@ -46,8 +58,12 @@ export const EFFORTS = ['auto', 'low', 'high', 'max'].map((id) => {
46
58
  note: EFFORT_NOTES[id] ?? base?.note ?? '',
47
59
  };
48
60
  });
49
- /** The effort a coding run names (apps/coding takes low, medium or high): low for Fast, medium for Auto, high for High/Max. */
50
- export const level = (effort) => effort === 'low' ? 'low' : effort === 'auto' ? 'medium' : 'high';
61
+ /** The effort a coding run names (apps/coding takes low, medium or high). */
62
+ export const level = (effort) => effort === 'off' || effort === 'minimal' || effort === 'low'
63
+ ? 'low'
64
+ : effort === 'auto' || effort === 'medium'
65
+ ? 'medium'
66
+ : 'high';
51
67
  export const FIRST = { model: ENSO, effort: 'auto' };
52
68
  /** Whether a plan grants only Enso Auto. An unknown plan is not taken for Free. */
53
69
  export const isFree = (plan) => plan === 'free';
@@ -78,8 +94,8 @@ function useAllowThirdPartyModels() {
78
94
  }, []);
79
95
  return allowed;
80
96
  }
81
- /** An effort kept, read back: one the ladder still offers, XHigh (which Max replaced) as Max, else Auto. */
82
- const effortOf = (v) => (v === 'xhigh' ? 'max' : EFFORTS.some((e) => e.id === v) ? v : FIRST.effort);
97
+ /** An effort kept, read back: one the ladder still offers, else Auto. */
98
+ const effortOf = (v) => (EFFORTS.some((e) => e.id === v) ? v : FIRST.effort);
83
99
  /** The store, or null where the browser gives none (a server render, blocked site data). */
84
100
  function store() {
85
101
  try {
@@ -171,7 +187,7 @@ const ROUTER = parseModels([{ id: ENSO, name: 'Enso Auto', family: 'enso', class
171
187
  /** The last list this browser read, or none. */
172
188
  function last() {
173
189
  try {
174
- return parseModels(JSON.parse(store()?.getItem(LAST) ?? 'null'));
190
+ return parseModels(JSON.parse(store()?.getItem(LAST) ?? 'null')).filter((m) => !isRemovedEnsoFree(m));
175
191
  }
176
192
  catch {
177
193
  return [];
@@ -220,8 +236,10 @@ export function useCatalog(t) {
220
236
  // eslint-disable-next-line react-hooks/exhaustive-deps
221
237
  }, [at]);
222
238
  const now = state?.at === at ? state : settled.has(at) ? { at, models: settled.get(at), error: null } : null;
223
- if (!now?.error)
224
- return { models: now?.models ?? [], list: now?.models ?? [], loading: !now, error: null, note: '' };
239
+ if (!now?.error) {
240
+ const clean = (now?.models ?? []).filter((m) => !isRemovedEnsoFree(m));
241
+ return { models: clean, list: clean, loading: !now, error: null, note: '' };
242
+ }
225
243
  const kept = last();
226
244
  if (kept.length)
227
245
  return { models: kept, list: kept, loading: false, error: null, note: 'The model list could not be refreshed; these are the models as last read.' };
@@ -234,9 +252,12 @@ export function useCatalog(t) {
234
252
  note: '',
235
253
  };
236
254
  }
237
- /** Whether `model` is one this plan may send: on Free, Enso Auto alone (commerce's `allowedModels`). */
255
+ const FREE_ALLOWED_MODELS = new Set([ENSO, 'enso-auto', 'hanzo/enso-auto', 'enso-flash', 'hanzo/enso-flash']);
256
+ /** Whether `model` is one this plan may send: on Free, Enso Auto and Enso Flash only (never Enso Free or other paid models). */
238
257
  export function grants(free, model) {
239
- return !free || model === ENSO;
258
+ if (!free)
259
+ return true;
260
+ return FREE_ALLOWED_MODELS.has(model.trim().toLowerCase());
240
261
  }
241
262
  /** Whole cents as dollars. */
242
263
  const dollars = (cents) => `$${(cents / 100).toFixed(2)}`;
@@ -10,7 +10,7 @@ export declare const pane: {
10
10
  readonly bg: 'var(--pane-fill, var(--sheet-1))';
11
11
  readonly rounded: 'var(--pane-round, var(--radius-xl))';
12
12
  readonly borderWidth: 1;
13
- readonly borderColor: 'var(--pane-edge, var(--white-08))';
13
+ readonly borderColor: 'var(--pane-edge, rgba(255, 255, 255, 0.08))';
14
14
  readonly backdropFilter: 'var(--pane-blur, blur(20px) saturate(1.8))';
15
15
  readonly boxShadow: 'var(--shadow-sheet-2)';
16
16
  };
@@ -10,7 +10,7 @@ export const pane = {
10
10
  bg: 'var(--pane-fill, var(--sheet-1))',
11
11
  rounded: 'var(--pane-round, var(--radius-xl))',
12
12
  borderWidth: 1,
13
- borderColor: 'var(--pane-edge, var(--white-08))',
13
+ borderColor: 'var(--pane-edge, rgba(255, 255, 255, 0.08))',
14
14
  backdropFilter: 'var(--pane-blur, blur(20px) saturate(1.8))',
15
15
  boxShadow: 'var(--shadow-sheet-2)',
16
16
  };