@hanzo/dev 4.2.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.
- package/dist/{BinaryViewer-CmFUK4zZ.js → BinaryViewer-BCDMNW2g.js} +19 -19
- package/dist/{ChatMarkdown-nvEI7iCv.js → ChatMarkdown-BUidXqSs.js} +2460 -2460
- package/dist/{DevicePanel-v5e3sEIf.js → DevicePanel-D-pksK3r.js} +532 -532
- package/dist/{DeviceStreamView-CCIfmbxH.js → DeviceStreamView-DsCoOzDV.js} +377 -377
- package/dist/{DiffCommentAnnotation-BPTN_2a6.js → DiffCommentAnnotation-2HD5qiyt.js} +227 -227
- package/dist/{DiffFileTree-B_br90vY.js → DiffFileTree-CuWvI5hS.js} +13 -13
- package/dist/{DiffPanel-V5R5TPuK.js → DiffPanel-Z2QVmBzu.js} +328 -328
- package/dist/{DiffWorkerPoolProvider-BwFR-Fc9.js → DiffWorkerPoolProvider-CEfiCIGR.js} +3 -3
- package/dist/{DocumentPages-VSn83vty.js → DocumentPages-glImt2JO.js} +3 -3
- package/dist/{ExpandedImageDialog-CAorLacL.js → ExpandedImageDialog-iqO3LiIj.js} +404 -404
- package/dist/{FileExplorerPane-CeHulcPz.js → FileExplorerPane-GwnRmXEh.js} +4 -4
- package/dist/{FilePreviewPanel-BVNLvWOc.js → FilePreviewPanel-CXWpTlfI.js} +1089 -1089
- package/dist/{FontFilePreview-Dj8Blcay.js → FontFilePreview-CDydHOXg.js} +2 -2
- package/dist/{FontViewer-CLDdwhSr.js → FontViewer-DDt9C5Cb.js} +5 -5
- package/dist/{HanzoConnectAccountPages-BEzYfu2l.js → HanzoConnectAccountPages-_sfrtw9j.js} +357 -357
- package/dist/{HanzoConnectSidebarSignIn-BhD6-Up5.js → HanzoConnectSidebarSignIn-coFQvyRw.js} +3 -3
- package/dist/{Icons-CvSmt8vD.js → Icons-CdegMw5l.js} +1 -1
- package/dist/{LargeTextViewer-DfFnYGCw.js → LargeTextViewer-D3RklYQB.js} +8 -8
- package/dist/{MermaidDiagram-CTolIzQD.js → MermaidDiagram-sVLnox7j.js} +8 -8
- package/dist/{MermaidFilePreview-CP2zP4FU.js → MermaidFilePreview-BmPdNxW5.js} +2 -2
- package/dist/{MermaidViewer-BDfYkS9E.js → MermaidViewer-BlKTevTF.js} +3 -3
- package/dist/{NotebookPreview-Cybs5uM0.js → NotebookPreview-C0gSEyeO.js} +10 -10
- package/dist/{OfficeFilePreview-7JsmSoKU.js → OfficeFilePreview-Ago_DWEt.js} +2 -2
- package/dist/{OfficeViewer-CJoojlJK.js → OfficeViewer-DBRqtLet.js} +10 -10
- package/dist/{OpenInPicker-BIMWUxBP.js → OpenInPicker-DD_h7VLv.js} +287 -287
- package/dist/{OpenXmlOfficeViewer-C24Kj8DM.js → OpenXmlOfficeViewer-B4dxjpba.js} +4 -4
- package/dist/{PdfViewer-Cf1iD759.js → PdfViewer-BanXvPmz.js} +16 -16
- package/dist/{PreviewFaviconIcon-zFOuzIxe.js → PreviewFaviconIcon-BwYKB-3e.js} +892 -892
- package/dist/{PreviewImage-oY5YnuTr.js → PreviewImage-6UU-M6_B.js} +3 -3
- package/dist/{PreviewImageContent-n6eLzY99.js → PreviewImageContent-D-00K-A9.js} +3 -3
- package/dist/{PreviewPanel-Bo4Lt02m.js → PreviewPanel-CiuHdDv8.js} +489 -489
- package/dist/{PreviewPanelShell-DhXLeN5j.js → PreviewPanelShell-Dezxjg0T.js} +71 -71
- package/dist/{ProjectIconPickerDialog-D0kFzt8f.js → ProjectIconPickerDialog-LomrzROv.js} +29 -29
- package/dist/{ProjectMonogram-D35xrrXQ.js → ProjectMonogram-D21--FQY.js} +1 -1
- package/dist/{ProviderAuthTerminal-DfsXnu7A.js → ProviderAuthTerminal-pQXIfodT.js} +3 -3
- package/dist/{PullRequestCodeTab-Dv_0kVad.js → PullRequestCodeTab-Cqfh5eN2.js} +476 -476
- package/dist/{PullRequestReviewAnnotation-LeuwO-iH.js → PullRequestReviewAnnotation-B4Lp8Ktf.js} +334 -334
- package/dist/{ReadOnlySourcePreview-D__IA5g1.js → ReadOnlySourcePreview-7xXUUySV.js} +5 -5
- package/dist/{RelativeTime-BMRprQS8.js → RelativeTime-B_yprjav.js} +2 -2
- package/dist/{RightPanelResizeHandle-BLbSz-gk.js → RightPanelResizeHandle-PumvYb9P.js} +2 -2
- package/dist/{ThemeEditorPanel-CUDdsRsE.js → ThemeEditorPanel-BmXXpaCI.js} +196 -196
- package/dist/{ThreadTerminalDrawer-BF3Ix0q_.js → ThreadTerminalDrawer-DCgE3ojz.js} +461 -461
- package/dist/{VirtualTablePreview-dajviAfu.js → VirtualTablePreview-mA6DOFwb.js} +1 -1
- package/dist/{anchoredCopyToast-DnUtg1n_.js → anchoredCopyToast-BVa_dlBU.js} +2 -2
- package/dist/{assetUrls-DkY7vXfM.js → assetUrls-D8lRk7Xd.js} +45 -45
- package/dist/{browserLinkTarget-CA46wnQC.js → browserLinkTarget-BbVlDQYx.js} +18 -18
- package/dist/builder/api/models.d.ts +2 -0
- package/dist/builder/api/models.js +6 -1
- package/dist/builder/api/sandbox.d.ts +2 -0
- package/dist/builder/api/sandbox.js +3 -1
- package/dist/builder/desk.d.ts +6 -0
- package/dist/builder/desk.js +79 -14
- package/dist/builder/mind.d.ts +5 -5
- package/dist/builder/mind.js +35 -14
- package/dist/builder/pane.d.ts +1 -1
- package/dist/builder/pane.js +1 -1
- package/dist/builder/panel.js +5 -5
- package/dist/builder/preview-fallback.d.ts +47 -0
- package/dist/builder/preview-fallback.js +341 -0
- package/dist/{changedFileKind-D6QYvIez.js → changedFileKind-DrjqPCpz.js} +5 -5
- package/dist/{collapsible-DFT41MdC.js → collapsible-CDT6JKbk.js} +1 -1
- package/dist/{color-picker-CshqBbpY.js → color-picker-kSVcH92L.js} +16 -16
- package/dist/core.js +1 -1
- package/dist/{decodeImagePreview-DnfFEjhw.js → decodeImagePreview-ZtWU3urU.js} +2 -2
- package/dist/{delimitedPreview-BiEpdYOj.js → delimitedPreview-DbbXcqOT.js} +1 -1
- package/dist/{dialog-DhQtWGRa.js → dialog-EmpqFZiK.js} +40 -40
- package/dist/{embed-c030vUqM.js → embed-CPWZKyIW.js} +36098 -35677
- package/dist/{empty-Bm5EzcG8.js → empty-ChM6gdzn.js} +1 -1
- package/dist/{errors-DrFQSJW3.js → errors-D8_Zn8KN.js} +2 -2
- package/dist/{fileContextMenu-BBo91omq.js → fileContextMenu-DW94DZj4.js} +54 -54
- package/dist/{fileExplorerLabel-AikEChiS.js → fileExplorerLabel-Cfz-3q1U.js} +507 -507
- package/dist/{fileSurfaceChrome-Cqkvn8RQ.js → fileSurfaceChrome-BDyKklTq.js} +26 -26
- package/dist/{hanzoWebAnalytics-CCxpTzcI.js → hanzoWebAnalytics-B1eETW-7.js} +1 -1
- package/dist/index.css +1 -1
- package/dist/{input-group-DEJEuwc9.js → input-group-BZ_QN-y7.js} +1 -1
- package/dist/{keybindings-C5tK_GAk.js → keybindings-D0pBlT1k.js} +7812 -7806
- package/dist/keymap.js +1 -1
- package/dist/{lucideIconByName-DUaXKH0V.js → lucideIconByName-CXY44V8P.js} +6835 -6848
- package/dist/{mediaReference-Bt_mh-ag.js → mediaReference-3wc4ZfY8.js} +95 -95
- package/dist/mediaSource-jW5c7b4r.js +70 -0
- package/dist/{modelPickerVisibility-Jue3CLfc.js → modelPickerVisibility-DBTc5r1G.js} +1 -1
- package/dist/{network-BbwqRm8c.js → network-wuXD7-is.js} +1 -1
- package/dist/{popover-anNQdce7.js → popover-BAyP2Tdr.js} +1 -1
- package/dist/{presentation-D9mVPBHm.js → presentation-68y8EAuH.js} +299 -299
- package/dist/{previewFailureMessages-BKpsSGX5.js → previewFailureMessages-CFguipaK.js} +3 -3
- package/dist/query-BPk2W3QN.js +63 -0
- package/dist/{readBinaryPreview-BAQ4fFjm.js → readBinaryPreview-CjZdBNVR.js} +2 -2
- package/dist/{refresh-icon-BYx64to1.js → refresh-icon-Vo5ImiQL.js} +1 -1
- package/dist/{scroll-area-ChvX8uOh.js → scroll-area-CEoyjC7h.js} +1 -1
- package/dist/{select-DumYjny_.js → select-DLFnkZsI.js} +2 -2
- package/dist/{session-_kmiSv2A.js → session-Decc4Fo5.js} +1063 -1063
- package/dist/{skeleton-CJqwfMSF.js → skeleton-BOKpAZv6.js} +1 -1
- package/dist/{switch-COwevwaq.js → switch-DjpPjtQN.js} +2 -2
- package/dist/{themePalette-Dl_7omVL.js → themePalette-C-GtwwqV.js} +977 -977
- package/dist/{threadSearch-BHyWwcV3.js → threadSearch-CrtCof6n.js} +162 -162
- package/dist/{toggle-CEO6qTxB.js → toggle-B4F0EEtI.js} +1 -1
- package/dist/{toggle-group-BHovdMDl.js → toggle-group-l8hRPswr.js} +2 -2
- package/dist/{use-atom-command-ByoYq_K6.js → use-atom-command-XemtT1Gv.js} +1 -1
- package/dist/{useAriaLabelledBy-DPSISlnL.js → useAriaLabelledBy-CibvSz-b.js} +1 -1
- package/dist/{useFileMetadata-e7zsixVX.js → useFileMetadata-PesehDX0.js} +33 -33
- package/dist/{useFloatingRootContext-CJ9stHca.js → useFloatingRootContext-ppoGvqar.js} +1 -1
- package/dist/{useLiveRefresh-BkKJKXhH.js → useLiveRefresh-aHkPuz6N.js} +172 -172
- package/dist/{useNextRenderData-CyUmSAgz.js → useNextRenderData-CNhjWfP0.js} +1 -1
- package/dist/{useSettings-DYG9Dmro.js → useSettings-B_MtcTyD.js} +139 -139
- package/dist/{useTextFieldSpeech-COa9XcRx.js → useTextFieldSpeech-B1wCgLPO.js} +1404 -1404
- package/dist/{useTheme-D2ZM1gvV.js → useTheme-WlXpQRKG.js} +4 -4
- package/dist/{utils-515nQ17G.js → utils-DtKQl-D3.js} +6184 -6172
- package/dist/{wizard-i86ViMRc.js → wizard-DjD4UNew.js} +3 -3
- package/dist/{workspaceFocus-BV1_9KiH.js → workspaceFocus-MR1plm6A.js} +144 -144
- package/dist/{zap-e0OsRjBR.js → zap-iwsUKtvA.js} +30 -17
- package/package.json +1 -1
- package/dist/mediaSource-zI7JWid4.js +0 -70
- package/dist/query-BxrrBAp6.js +0 -63
package/dist/builder/mind.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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,
|
|
41
|
-
export const EFFORTS =
|
|
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)
|
|
50
|
-
export const level = (effort) => effort === '
|
|
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,
|
|
82
|
-
const effortOf = (v) => (
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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)}`;
|
package/dist/builder/pane.d.ts
CHANGED
|
@@ -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,
|
|
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
|
};
|
package/dist/builder/pane.js
CHANGED
|
@@ -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,
|
|
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
|
};
|
package/dist/builder/panel.js
CHANGED
|
@@ -43,9 +43,9 @@ const SHORTCUTS = 'Control+Shift+B Meta+Shift+B Control+Period Meta+Period';
|
|
|
43
43
|
const BLANK = phrase('New tab');
|
|
44
44
|
/** On an icon that points along the line (Back, Forward): it turns in a right-to-left page. */
|
|
45
45
|
const MIRROR = { 'data-i18n-mirror': '' };
|
|
46
|
-
/** The row heights, px: the strip (the
|
|
47
|
-
const STRIP =
|
|
48
|
-
const BAR =
|
|
46
|
+
/** The row heights, px: the strip (aligned to the host shell's 40px top-right bar), and a page's bar. */
|
|
47
|
+
const STRIP = 40;
|
|
48
|
+
const BAR = 44;
|
|
49
49
|
/** A round control in a page's bar, px. */
|
|
50
50
|
const PILL = 34;
|
|
51
51
|
/** A press on an icon control of the panel's: quiet until pointed at, lit while its thing is open. */
|
|
@@ -322,7 +322,7 @@ function Leaf({ tab, on, side, index, label, icon }) {
|
|
|
322
322
|
/** The tab itself, as the strip draws it. */
|
|
323
323
|
function Strip({ tab, on, side, index, label, icon, ...rest }) {
|
|
324
324
|
const { t } = useI18n();
|
|
325
|
-
return (_jsxs(XStack, { ...rest, "data-slot": "side-tab", "data-tab": tab.id, items: "center", gap: "$1", pl: "$2.5", pr: on || tab.pinned ? '$1' : '$2.5', minH:
|
|
325
|
+
return (_jsxs(XStack, { ...rest, "data-slot": "side-tab", "data-tab": tab.id, items: "center", gap: "$1", pl: "$2.5", pr: on || tab.pinned ? '$1' : '$2.5', minH: 28, "$max-md": { minH: 36 },
|
|
326
326
|
// Keep every tab label legible at narrow viewports; the tablist scrolls horizontally instead of crushing tabs.
|
|
327
327
|
shrink: 0, maxW: 220, rounded: 8, borderWidth: 1, borderColor: on ? '$borderColor' : 'transparent', bg: on ? '$edge' : 'transparent', hoverStyle: { bg: on ? '$edge' : '$hover' }, style: { flexShrink: 0 }, ...{
|
|
328
328
|
// A middle press shuts any tab, as a browser's does; the chosen one also has its cross.
|
|
@@ -397,7 +397,7 @@ export function Panel({ side, kinds, onHide, sheet = false, bar, menu, label, su
|
|
|
397
397
|
const body = (_jsxs(YStack, { role: "complementary", "aria-label": label ?? say('Side panel'), "data-slot": "side", flex: 1, minW: 0, minH: 0, overflow: "hidden", rounded: "inherit", children: [_jsxs(XStack, { "data-slot": "side-strip", height: STRIP, px: "$2", gap: "$1.5", items: "center", borderBottomWidth: 1, borderColor: "$borderColor", shrink: 0, minW: 0, style: topRightInset ? { paddingInlineEnd: 'calc(8px + var(--hanzo-shell-top-right-inset, 0px))' } : undefined, children: [column?.hidden && !column.full ? (_jsxs(XStack, { render: "button", "data-slot": "side-show", onPress: column.show, minH: 32, px: "$2", gap: "$1.5", ...quiet(), children: [_jsx(PanelLeftOpen, { size: 16 }), _jsx(SizableText, { fontSize: 13, color: "$ink", children: column.main === 'run' ? say('Show session') : column.main === 'chat' ? say('Show chat') : say('Show {main}', { main: column.main }) })] })) : null, _jsx(XStack, { role: "tablist", "aria-label": say('Tabs'), flex: 1, minW: 0, gap: "$1", items: "center", overflowX: "auto", overflowY: "hidden", "$platform-web": { scrollbarWidth: 'none', msOverflowStyle: 'none', WebkitOverflowScrolling: 'touch' }, children: side.tabs.map((t, i) => (_jsx(Leaf, { tab: t, on: t.id === side.at, side: side, index: i, label: title(t), icon: mark(t) }, t.id))) }), closed.length ? (_jsx(DropdownMenu, { trigger: plus, items: [
|
|
398
398
|
...closed.map((k) => ({ key: k.id, label: k.label, onSelect: () => side.open({ kind: k.id, title: k.label }) })),
|
|
399
399
|
{ key: PAGE, label: say('Page'), description: say('An address, framed here'), onSelect: blank },
|
|
400
|
-
] })) : (plus), menu, _jsx(XStack, { render: "button", "aria-label": say('Open this tab in a new window'), ...{ title: say('Open this tab in a new window') }, "aria-disabled": !poppable || undefined, onPress: poppable ? () => popOut(tab) : undefined, width: 28, height: 28, ...quiet(false, !poppable), children: _jsx(ExternalLink, { size: 14 }) }), column ? (_jsx(XStack, { render: "button", "data-slot": "side-full", "aria-label": column.full ? say('Exit full screen') : say('Full screen'), "aria-pressed": column.full, "aria-keyshortcuts": column.full ? 'Escape' : undefined, ...{ title: column.full ? say('Exit full screen ({key})', { key: 'Esc' }) : say('Full screen') }, onPress: () => column.fill(!column.full), width: 28, height: 28, ...quiet(column.full), children: column.full ? _jsx(Minimize2, { size: 14 }) : _jsx(Maximize2, { size: 14 }) })) : null, _jsx(XStack, { render: "button", "data-slot": "side-toggle", "aria-label": say('Hide tabs'), "aria-expanded": true, "aria-keyshortcuts": SHORTCUTS, ...{ title: say('Hide tabs ({keys})', { keys: KEYS }) }, onPress: onHide, width:
|
|
400
|
+
] })) : (plus), menu, _jsx(XStack, { render: "button", "aria-label": say('Open this tab in a new window'), ...{ title: say('Open this tab in a new window') }, "aria-disabled": !poppable || undefined, onPress: poppable ? () => popOut(tab) : undefined, width: 28, height: 28, ...quiet(false, !poppable), children: _jsx(ExternalLink, { size: 14 }) }), column ? (_jsx(XStack, { render: "button", "data-slot": "side-full", "aria-label": column.full ? say('Exit full screen') : say('Full screen'), "aria-pressed": column.full, "aria-keyshortcuts": column.full ? 'Escape' : undefined, ...{ title: column.full ? say('Exit full screen ({key})', { key: 'Esc' }) : say('Full screen') }, onPress: () => column.fill(!column.full), width: 28, height: 28, ...quiet(column.full), children: column.full ? _jsx(Minimize2, { size: 14 }) : _jsx(Maximize2, { size: 14 }) })) : null, _jsx(XStack, { render: "button", "data-slot": "side-toggle", "aria-label": say('Hide tabs'), "aria-expanded": true, "aria-keyshortcuts": SHORTCUTS, ...{ title: say('Hide tabs ({keys})', { keys: KEYS }) }, onPress: onHide, width: 28, height: 28, ...quiet(true), children: _jsx(Columns2, { size: 15 }) })] }), bar, _jsx(YStack, { id: "side-body", role: "tabpanel", "aria-labelledby": tab ? `side-tab-${tab.id}` : undefined,
|
|
401
401
|
// What a tab lays over itself (a door's "Connecting…") stays inside it, under the strip.
|
|
402
402
|
position: "relative", flex: 1, minH: 0, overflowY: bleed ? 'hidden' : 'auto', overflowX: "hidden", px: bleed ? 0 : '$3', py: bleed ? 0 : '$3', children: !tab ? (_jsx(YStack, { flex: 1, items: "center", justify: "center", p: "$5", children: _jsx(SizableText, { fontSize: 13, color: "$soft", children: say('No tabs open.') }) })) : tab.kind === PAGE ? (_jsx(Page, { tab: tab, onGo: (url) => side.go(tab.id, url), onBack: () => side.back(tab.id), onForward: () => side.forward(tab.id), onTitle: (t) => side.rename(tab.id, t), onPin: (on) => (on ? side.pin(tab.id) : side.unpin(tab.id)), suggested: suggested, ...acts }, tab.id)) : kind ? (_jsx(Fragment, { children: kind.render() }, tab.id)) : (_jsx(SizableText, { size: "$2", color: "$soft", children: say('This tab is not offered here.') })) })] }));
|
|
403
403
|
if (!sheet || typeof document === 'undefined')
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fallback preview resolver when no live sandbox preview / published site is serving:
|
|
3
|
+
* session-edited file -> project README.md -> first readable workspace file -> null.
|
|
4
|
+
*/
|
|
5
|
+
import type { Target } from './api/call.ts';
|
|
6
|
+
import type { Event } from './api/sessions.ts';
|
|
7
|
+
export type FallbackPreviewFormat = 'markdown' | 'html' | 'svg' | 'image' | 'code';
|
|
8
|
+
export type FallbackPreviewSource = 'session' | 'readme' | 'repo';
|
|
9
|
+
export interface FallbackPreview {
|
|
10
|
+
path: string;
|
|
11
|
+
format: FallbackPreviewFormat;
|
|
12
|
+
source: FallbackPreviewSource;
|
|
13
|
+
/** UTF-8 file text for markdown, html, svg, and code previews. */
|
|
14
|
+
text: string;
|
|
15
|
+
/** Data URL or direct URL for image previews. */
|
|
16
|
+
imageUrl?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function previewFormatOf(path: string): FallbackPreviewFormat;
|
|
19
|
+
export declare function imageMimeOf(path: string): string;
|
|
20
|
+
/** Minimal sandboxed HTML wrapper for inline `.svg` previews. */
|
|
21
|
+
export declare function svgPreviewDocument(svg: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Extract the paths created or modified during this session in most-recent-first order.
|
|
24
|
+
* Deleted files are removed from the result unless recreated later.
|
|
25
|
+
*/
|
|
26
|
+
export declare function sessionEditedPaths(events: readonly Pick<Event, 'kind' | 'payload' | 'seq'>[]): string[];
|
|
27
|
+
/** Candidate raw GitHub URLs for `path` across the session's ref and default branches. */
|
|
28
|
+
export declare function githubRawUrls(repo: string, refs: readonly string[], path: string): string[];
|
|
29
|
+
export interface ResolveFallbackInput {
|
|
30
|
+
target: Target;
|
|
31
|
+
session: string;
|
|
32
|
+
sandbox: string;
|
|
33
|
+
running: boolean;
|
|
34
|
+
signed: boolean;
|
|
35
|
+
repo: string;
|
|
36
|
+
branch: string;
|
|
37
|
+
base: string;
|
|
38
|
+
events: readonly Pick<Event, 'kind' | 'payload' | 'seq'>[];
|
|
39
|
+
signal?: AbortSignal;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Resolve the best fallback preview when no live dev server or deployed site is serving:
|
|
43
|
+
* 1. Most recently created/modified file in the session (events / changes / artifacts)
|
|
44
|
+
* 2. Project README.md (or first readable root file when no README exists)
|
|
45
|
+
* 3. `null` only when there are genuinely zero files
|
|
46
|
+
*/
|
|
47
|
+
export declare function resolveFallbackPreview(input: ResolveFallbackInput): Promise<FallbackPreview | null>;
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import { blob as sessionBlob, read as readChanges, tree as sessionTree } from './api/changes.js';
|
|
2
|
+
import { artifact, artifacts } from './api/coding.js';
|
|
3
|
+
import { blob as gitBlob, parseGitHubRepo } from './api/git.js';
|
|
4
|
+
import { read as sandboxRead } from './api/sandbox.js';
|
|
5
|
+
import { decode } from './api/turn.js';
|
|
6
|
+
const IMAGE_MIMES = {
|
|
7
|
+
png: 'image/png',
|
|
8
|
+
jpg: 'image/jpeg',
|
|
9
|
+
jpeg: 'image/jpeg',
|
|
10
|
+
gif: 'image/gif',
|
|
11
|
+
webp: 'image/webp',
|
|
12
|
+
avif: 'image/avif',
|
|
13
|
+
ico: 'image/x-icon',
|
|
14
|
+
svg: 'image/svg+xml',
|
|
15
|
+
};
|
|
16
|
+
const MARKDOWN_EXTS = new Set(['md', 'mdx', 'markdown']);
|
|
17
|
+
const HTML_EXTS = new Set(['html', 'htm']);
|
|
18
|
+
const README_NAMES = ['README.md', 'readme.md', 'Readme.md', 'README.MD', 'README.mdx', 'README.txt', 'README'];
|
|
19
|
+
const PREFERRED_FALLBACK_FILES = ['index.html', 'package.json', 'Cargo.toml', 'pyproject.toml', 'go.mod'];
|
|
20
|
+
const str = (v) => (typeof v === 'string' ? v : '');
|
|
21
|
+
const rel = (path) => path.trim().replace(/^\/work\//, '').replace(/^\.\//, '');
|
|
22
|
+
function extOf(path) {
|
|
23
|
+
const base = path.split('/').pop() ?? path;
|
|
24
|
+
const dot = base.lastIndexOf('.');
|
|
25
|
+
return dot > 0 ? base.slice(dot + 1).toLowerCase() : '';
|
|
26
|
+
}
|
|
27
|
+
export function previewFormatOf(path) {
|
|
28
|
+
const ext = extOf(path);
|
|
29
|
+
if (MARKDOWN_EXTS.has(ext))
|
|
30
|
+
return 'markdown';
|
|
31
|
+
if (HTML_EXTS.has(ext))
|
|
32
|
+
return 'html';
|
|
33
|
+
if (ext === 'svg')
|
|
34
|
+
return 'svg';
|
|
35
|
+
if (ext in IMAGE_MIMES)
|
|
36
|
+
return 'image';
|
|
37
|
+
return 'code';
|
|
38
|
+
}
|
|
39
|
+
export function imageMimeOf(path) {
|
|
40
|
+
return IMAGE_MIMES[extOf(path)] ?? 'application/octet-stream';
|
|
41
|
+
}
|
|
42
|
+
/** Minimal sandboxed HTML wrapper for inline `.svg` previews. */
|
|
43
|
+
export function svgPreviewDocument(svg) {
|
|
44
|
+
return `<!doctype html><html><head><meta charset="utf-8"><style>html,body{margin:0;padding:16px;height:100%;box-sizing:border-box;display:flex;align-items:center;justify-content:center;background:transparent;}svg{max-width:100%;max-height:100%;height:auto;}</style></head><body>${svg}</body></html>`;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Extract the paths created or modified during this session in most-recent-first order.
|
|
48
|
+
* Deleted files are removed from the result unless recreated later.
|
|
49
|
+
*/
|
|
50
|
+
export function sessionEditedPaths(events) {
|
|
51
|
+
const ordered = [];
|
|
52
|
+
const touch = (rawPath) => {
|
|
53
|
+
const p = rel(rawPath);
|
|
54
|
+
if (!p)
|
|
55
|
+
return;
|
|
56
|
+
const idx = ordered.indexOf(p);
|
|
57
|
+
if (idx >= 0)
|
|
58
|
+
ordered.splice(idx, 1);
|
|
59
|
+
ordered.push(p);
|
|
60
|
+
};
|
|
61
|
+
const remove = (rawPath) => {
|
|
62
|
+
const p = rel(rawPath);
|
|
63
|
+
const idx = ordered.indexOf(p);
|
|
64
|
+
if (idx >= 0)
|
|
65
|
+
ordered.splice(idx, 1);
|
|
66
|
+
};
|
|
67
|
+
for (const e of [...events].sort((a, b) => a.seq - b.seq)) {
|
|
68
|
+
const body = decode(e.payload);
|
|
69
|
+
if (!body || typeof body === 'string')
|
|
70
|
+
continue;
|
|
71
|
+
if (e.kind === 'event') {
|
|
72
|
+
const item = body.item && typeof body.item === 'object' ? body.item : null;
|
|
73
|
+
if (item && str(item.type) === 'file_change' && Array.isArray(item.changes)) {
|
|
74
|
+
for (const c of item.changes) {
|
|
75
|
+
if (!c || typeof c !== 'object')
|
|
76
|
+
continue;
|
|
77
|
+
const change = c;
|
|
78
|
+
const p = str(change.path);
|
|
79
|
+
if (!p)
|
|
80
|
+
continue;
|
|
81
|
+
if (change.kind === 'delete')
|
|
82
|
+
remove(p);
|
|
83
|
+
else
|
|
84
|
+
touch(p);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
else if (e.kind === 'status' && Array.isArray(body.changed)) {
|
|
89
|
+
for (const entry of body.changed) {
|
|
90
|
+
if (typeof entry === 'string')
|
|
91
|
+
touch(entry);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return ordered.reverse();
|
|
96
|
+
}
|
|
97
|
+
/** Candidate raw GitHub URLs for `path` across the session's ref and default branches. */
|
|
98
|
+
export function githubRawUrls(repo, refs, path) {
|
|
99
|
+
const parsed = parseGitHubRepo(repo);
|
|
100
|
+
if (!parsed)
|
|
101
|
+
return [];
|
|
102
|
+
const encodedPath = path
|
|
103
|
+
.split('/')
|
|
104
|
+
.filter(Boolean)
|
|
105
|
+
.map((segment) => encodeURIComponent(segment))
|
|
106
|
+
.join('/');
|
|
107
|
+
if (!encodedPath)
|
|
108
|
+
return [];
|
|
109
|
+
const uniqueRefs = [];
|
|
110
|
+
for (const ref of [...refs, 'main', 'master']) {
|
|
111
|
+
const trimmed = ref.trim();
|
|
112
|
+
if (trimmed && !uniqueRefs.includes(trimmed))
|
|
113
|
+
uniqueRefs.push(trimmed);
|
|
114
|
+
}
|
|
115
|
+
return uniqueRefs.map((ref) => `https://raw.githubusercontent.com/${encodeURIComponent(parsed.owner)}/${encodeURIComponent(parsed.name)}/${encodeURIComponent(ref)}/${encodedPath}`);
|
|
116
|
+
}
|
|
117
|
+
function isReadmeName(name) {
|
|
118
|
+
const lower = name.toLowerCase();
|
|
119
|
+
return lower === 'readme.md' || lower === 'readme.mdx' || lower === 'readme.txt' || lower === 'readme';
|
|
120
|
+
}
|
|
121
|
+
function pickRootFile(names) {
|
|
122
|
+
const readme = names.find((n) => isReadmeName(n));
|
|
123
|
+
if (readme)
|
|
124
|
+
return { name: readme, isReadme: true };
|
|
125
|
+
for (const preferred of PREFERRED_FALLBACK_FILES) {
|
|
126
|
+
const match = names.find((n) => n.toLowerCase() === preferred.toLowerCase());
|
|
127
|
+
if (match)
|
|
128
|
+
return { name: match, isReadme: false };
|
|
129
|
+
}
|
|
130
|
+
const firstVisible = names.find((n) => n && !n.startsWith('.') && !n.endsWith('.lock') && n !== 'node_modules');
|
|
131
|
+
return firstVisible ? { name: firstVisible, isReadme: false } : null;
|
|
132
|
+
}
|
|
133
|
+
async function blobToDataUrl(blob, mime) {
|
|
134
|
+
const bytes = new Uint8Array(await blob.arrayBuffer());
|
|
135
|
+
let binary = '';
|
|
136
|
+
for (let i = 0; i < bytes.length; i++)
|
|
137
|
+
binary += String.fromCharCode(bytes[i]);
|
|
138
|
+
return `data:${mime};base64,${btoa(binary)}`;
|
|
139
|
+
}
|
|
140
|
+
async function fetchRawText(urls, signal) {
|
|
141
|
+
if (typeof fetch !== 'function')
|
|
142
|
+
return null;
|
|
143
|
+
for (const url of urls) {
|
|
144
|
+
if (signal?.aborted)
|
|
145
|
+
return null;
|
|
146
|
+
try {
|
|
147
|
+
const res = await fetch(url, { signal });
|
|
148
|
+
if (res.ok) {
|
|
149
|
+
const text = await res.text();
|
|
150
|
+
if (text.trim())
|
|
151
|
+
return text;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
catch {
|
|
155
|
+
// Try next branch/source.
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
async function loadPath(path, source, input, artifactNames, changeByPath) {
|
|
161
|
+
if (input.signal?.aborted)
|
|
162
|
+
return null;
|
|
163
|
+
const format = previewFormatOf(path);
|
|
164
|
+
const ref = input.branch || input.base || 'main';
|
|
165
|
+
if (format === 'image') {
|
|
166
|
+
const mime = imageMimeOf(path);
|
|
167
|
+
if (input.running && input.sandbox) {
|
|
168
|
+
const node = await sandboxRead(input.target, input.sandbox, path).catch(() => null);
|
|
169
|
+
if (node && !node.dir && !node.truncated && node.base64) {
|
|
170
|
+
return { path, format, source, text: '', imageUrl: `data:${mime};base64,${node.base64}` };
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
if (input.signed && input.session && artifactNames.has(path)) {
|
|
174
|
+
const data = await artifact(input.target, input.session, path).catch(() => null);
|
|
175
|
+
if (data) {
|
|
176
|
+
const imageUrl = await blobToDataUrl(data, mime).catch(() => '');
|
|
177
|
+
if (imageUrl)
|
|
178
|
+
return { path, format, source, text: '', imageUrl };
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
const rawUrls = githubRawUrls(input.repo, [input.branch, input.base], path);
|
|
182
|
+
if (rawUrls.length > 0 && typeof fetch === 'function') {
|
|
183
|
+
for (const url of rawUrls) {
|
|
184
|
+
if (input.signal?.aborted)
|
|
185
|
+
return null;
|
|
186
|
+
try {
|
|
187
|
+
const res = await fetch(url, { method: 'HEAD', signal: input.signal });
|
|
188
|
+
if (res.ok)
|
|
189
|
+
return { path, format, source, text: '', imageUrl: url };
|
|
190
|
+
}
|
|
191
|
+
catch {
|
|
192
|
+
// Try next ref.
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
// 1. Live sandbox file (uncommitted edits included; never wakes a parked sandbox).
|
|
199
|
+
if (input.running && input.sandbox) {
|
|
200
|
+
const node = await sandboxRead(input.target, input.sandbox, path).catch(() => null);
|
|
201
|
+
if (node && !node.dir && !node.binary && !node.truncated && node.text !== '') {
|
|
202
|
+
return { path, format, source, text: node.text };
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
// 2. Session branch blob via coding API.
|
|
206
|
+
if (input.signed && input.session) {
|
|
207
|
+
const b = await sessionBlob(input.target, input.session, path).catch(() => null);
|
|
208
|
+
if (b && !b.binary && !b.truncated && b.text !== '') {
|
|
209
|
+
return { path, format, source, text: b.text };
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
// 3. Stored session artifact bytes.
|
|
213
|
+
if (input.signed && input.session && artifactNames.has(path)) {
|
|
214
|
+
const data = await artifact(input.target, input.session, path).catch(() => null);
|
|
215
|
+
if (data) {
|
|
216
|
+
const text = await data.text().catch(() => '');
|
|
217
|
+
if (text !== '')
|
|
218
|
+
return { path, format, source, text };
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
// 4. Platform git repo blob.
|
|
222
|
+
if (input.signed && input.repo) {
|
|
223
|
+
const b = await gitBlob(input.target, input.repo, ref, path).catch(() => null);
|
|
224
|
+
if (b && !b.binary && !b.truncated && b.text !== '') {
|
|
225
|
+
return { path, format, source, text: b.text };
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
// 5. GitHub raw fallback when repo is known.
|
|
229
|
+
if (input.repo) {
|
|
230
|
+
const text = await fetchRawText(githubRawUrls(input.repo, [input.branch, input.base], path), input.signal);
|
|
231
|
+
if (text !== null)
|
|
232
|
+
return { path, format, source, text };
|
|
233
|
+
}
|
|
234
|
+
// 6. Diff patch fallback when a session modified the file but full bytes are unavailable.
|
|
235
|
+
const change = changeByPath.get(path);
|
|
236
|
+
if (change?.patch) {
|
|
237
|
+
return { path, format: 'code', source, text: change.patch };
|
|
238
|
+
}
|
|
239
|
+
return null;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Resolve the best fallback preview when no live dev server or deployed site is serving:
|
|
243
|
+
* 1. Most recently created/modified file in the session (events / changes / artifacts)
|
|
244
|
+
* 2. Project README.md (or first readable root file when no README exists)
|
|
245
|
+
* 3. `null` only when there are genuinely zero files
|
|
246
|
+
*/
|
|
247
|
+
export async function resolveFallbackPreview(input) {
|
|
248
|
+
if (input.signal?.aborted)
|
|
249
|
+
return null;
|
|
250
|
+
const [changesResult, artifactsResult] = input.signed && input.session
|
|
251
|
+
? await Promise.all([
|
|
252
|
+
readChanges(input.target, input.session).catch(() => null),
|
|
253
|
+
artifacts(input.target, input.session).catch(() => null),
|
|
254
|
+
])
|
|
255
|
+
: [null, null];
|
|
256
|
+
if (input.signal?.aborted)
|
|
257
|
+
return null;
|
|
258
|
+
const changeByPath = new Map();
|
|
259
|
+
const changePaths = [];
|
|
260
|
+
for (const f of changesResult?.files ?? []) {
|
|
261
|
+
if (f.status === 'deleted')
|
|
262
|
+
continue;
|
|
263
|
+
const p = rel(f.path);
|
|
264
|
+
if (!p)
|
|
265
|
+
continue;
|
|
266
|
+
changeByPath.set(p, f);
|
|
267
|
+
changePaths.push(p);
|
|
268
|
+
}
|
|
269
|
+
const artifactNames = new Set();
|
|
270
|
+
const artifactPaths = [];
|
|
271
|
+
for (const a of artifactsResult?.artifacts ?? []) {
|
|
272
|
+
if (a.kind !== 'file')
|
|
273
|
+
continue;
|
|
274
|
+
const p = rel(a.name);
|
|
275
|
+
if (!p)
|
|
276
|
+
continue;
|
|
277
|
+
artifactNames.add(p);
|
|
278
|
+
artifactPaths.push(p);
|
|
279
|
+
}
|
|
280
|
+
const editedCandidates = [];
|
|
281
|
+
const addCandidate = (p) => {
|
|
282
|
+
if (p && !editedCandidates.includes(p))
|
|
283
|
+
editedCandidates.push(p);
|
|
284
|
+
};
|
|
285
|
+
for (const p of sessionEditedPaths(input.events))
|
|
286
|
+
addCandidate(p);
|
|
287
|
+
for (const p of changePaths)
|
|
288
|
+
addCandidate(p);
|
|
289
|
+
for (const p of artifactPaths)
|
|
290
|
+
addCandidate(p);
|
|
291
|
+
// Step 2: Most recently created/modified file in this session.
|
|
292
|
+
for (const path of editedCandidates.slice(0, 5)) {
|
|
293
|
+
const found = await loadPath(path, 'session', input, artifactNames, changeByPath);
|
|
294
|
+
if (found)
|
|
295
|
+
return found;
|
|
296
|
+
}
|
|
297
|
+
if (input.signal?.aborted)
|
|
298
|
+
return null;
|
|
299
|
+
// Step 3: Project README.md (or first readable root file if repo has files without a README).
|
|
300
|
+
if (input.running && input.sandbox) {
|
|
301
|
+
const root = await sandboxRead(input.target, input.sandbox, '').catch(() => null);
|
|
302
|
+
if (root?.dir && root.names.length > 0) {
|
|
303
|
+
const picked = pickRootFile(root.names);
|
|
304
|
+
if (picked) {
|
|
305
|
+
const found = await loadPath(picked.name, picked.isReadme ? 'readme' : 'repo', input, artifactNames, changeByPath);
|
|
306
|
+
if (found)
|
|
307
|
+
return found;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
if (input.signed && input.session) {
|
|
312
|
+
const entries = await sessionTree(input.target, input.session, '').catch(() => []);
|
|
313
|
+
const fileNames = entries.filter((e) => !e.dir).map((e) => e.path);
|
|
314
|
+
if (fileNames.length > 0) {
|
|
315
|
+
const picked = pickRootFile(fileNames);
|
|
316
|
+
if (picked) {
|
|
317
|
+
const found = await loadPath(picked.name, picked.isReadme ? 'readme' : 'repo', input, artifactNames, changeByPath);
|
|
318
|
+
if (found)
|
|
319
|
+
return found;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
if (input.repo) {
|
|
324
|
+
const ref = input.branch || input.base || 'main';
|
|
325
|
+
if (input.signed) {
|
|
326
|
+
for (const readme of README_NAMES.slice(0, 2)) {
|
|
327
|
+
const b = await gitBlob(input.target, input.repo, ref, readme).catch(() => null);
|
|
328
|
+
if (b && !b.binary && !b.truncated && b.text !== '') {
|
|
329
|
+
return { path: readme, format: previewFormatOf(readme), source: 'readme', text: b.text };
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
for (const readme of README_NAMES.slice(0, 2)) {
|
|
334
|
+
const text = await fetchRawText(githubRawUrls(input.repo, [input.branch, input.base], readme), input.signal);
|
|
335
|
+
if (text !== null) {
|
|
336
|
+
return { path: readme, format: previewFormatOf(readme), source: 'readme', text };
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
return null;
|
|
341
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { c as e, n as t } from "./messages-yqmY7G5x.js";
|
|
2
|
-
import {
|
|
3
|
-
import { P as i } from "./keybindings-
|
|
4
|
-
import { $ as a, E as o, Q as s, Y as c, k as l, l as u, o as d, s as f, u as p } from "./DiffCommentAnnotation-
|
|
5
|
-
import { $ as m, $t as h, A as g, At as _, B as v, Bt as y, C as b, Ct as x, D as S, Dt as C, E as w, Et as T, F as E, Ft as D, G as O, H as k, Ht as A, I as j, It as ee, J as M, Jt as N, K as P, Kt as F, L as I, Lt as L, M as te, Mt as R, Nt as ne, O as re, Ot as ie, Pt as ae, Q as oe, R as se, Rt as ce, S as le, T as ue, U as de, Ut as fe, V as pe, Vt as me, W as he, Wt as ge, X as _e, Xt as ve, Y as ye, Yt as be, Zt as xe, _ as Se, _t as Ce, at as we, b as Te, bt as Ee, c as De, cn as Oe, ct as ke, d as Ae, dt as je, en as Me, et as Ne, f as z, ft as Pe, g as B, gt as Fe, h as Ie, ht as Le, in as Re, it as ze, jt as Be, k as V, kt as Ve, lt as He, m as Ue, mt as We, nn as H, nt as Ge, o as Ke, on as qe, ot as Je, p as Ye, pt as Xe, q as Ze, qt as Qe, r as $e, rn as et, s as tt, sn as U, st as nt, t as rt, tn as it, tt as at, v as ot, vt as st, w as ct, wt as lt, x as ut, xt as dt, y as ft, yt as pt } from "./DiffWorkerPoolProvider-
|
|
2
|
+
import { Ef as n, t as r } from "./utils-DtKQl-D3.js";
|
|
3
|
+
import { P as i } from "./keybindings-D0pBlT1k.js";
|
|
4
|
+
import { $ as a, E as o, Q as s, Y as c, k as l, l as u, o as d, s as f, u as p } from "./DiffCommentAnnotation-2HD5qiyt.js";
|
|
5
|
+
import { $ as m, $t as h, A as g, At as _, B as v, Bt as y, C as b, Ct as x, D as S, Dt as C, E as w, Et as T, F as E, Ft as D, G as O, H as k, Ht as A, I as j, It as ee, J as M, Jt as N, K as P, Kt as F, L as I, Lt as L, M as te, Mt as R, Nt as ne, O as re, Ot as ie, Pt as ae, Q as oe, R as se, Rt as ce, S as le, T as ue, U as de, Ut as fe, V as pe, Vt as me, W as he, Wt as ge, X as _e, Xt as ve, Y as ye, Yt as be, Zt as xe, _ as Se, _t as Ce, at as we, b as Te, bt as Ee, c as De, cn as Oe, ct as ke, d as Ae, dt as je, en as Me, et as Ne, f as z, ft as Pe, g as B, gt as Fe, h as Ie, ht as Le, in as Re, it as ze, jt as Be, k as V, kt as Ve, lt as He, m as Ue, mt as We, nn as H, nt as Ge, o as Ke, on as qe, ot as Je, p as Ye, pt as Xe, q as Ze, qt as Qe, r as $e, rn as et, s as tt, sn as U, st as nt, t as rt, tn as it, tt as at, v as ot, vt as st, w as ct, wt as lt, x as ut, xt as dt, y as ft, yt as pt } from "./DiffWorkerPoolProvider-CEfiCIGR.js";
|
|
6
6
|
import { A as W, B as mt, C as ht, E as gt, F as _t, I as vt, L as yt, O as bt, R as xt, T as St, _ as Ct, b as wt, d as Tt, f as Et, g as Dt, h as Ot, j as kt, k as At, l as jt, p as Mt, t as Nt, v as Pt, w as Ft, x as It, y as Lt, z as Rt } from "./diffRendering-tvIuzFsP.js";
|
|
7
7
|
import { i as zt } from "./themeResolver-n7YLSRSv.js";
|
|
8
8
|
import { a as Bt, i as Vt, o as Ht, r as G, s as Ut } from "./syntaxHighlighting-CqVs1cUM.js";
|
|
9
9
|
import { _ as Wt, a as Gt, c as Kt, d as K, f as qt, m as Jt, r as Yt, u as Xt } from "./appendItems-BI9GqZ3O.js";
|
|
10
10
|
import { r as Zt } from "./getFiletypeFromFileName-DLahV2Rk.js";
|
|
11
|
-
import { t as q } from "./skeleton-
|
|
11
|
+
import { t as q } from "./skeleton-BOKpAZv6.js";
|
|
12
12
|
import { forwardRef as Qt, memo as $t, useContext as en, useEffect as tn, useImperativeHandle as nn, useLayoutEffect as rn, useMemo as an, useRef as on, useState as sn, useSyncExternalStore as cn } from "react";
|
|
13
13
|
import { c as ln } from "react/compiler-runtime";
|
|
14
14
|
import { Fragment as un, jsx as J, jsxs as Y } from "react/jsx-runtime";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Ds as e, Es as t, Io as n, No as r, Oo as i, Ss as a, Ya as o, Za as s, _s as c, ao as l, bs as u, co as d, do as f, es as p, go as m, is as h, ko as g, ks as _, mo as v, so as y, t as b, uo as x, wo as S, ys as C } from "./utils-
|
|
1
|
+
import { Ds as e, Es as t, Io as n, No as r, Oo as i, Ss as a, Ya as o, Za as s, _s as c, ao as l, bs as u, co as d, do as f, es as p, go as m, is as h, ko as g, ks as _, mo as v, so as y, t as b, uo as x, wo as S, ys as C } from "./utils-DtKQl-D3.js";
|
|
2
2
|
import * as w from "react";
|
|
3
3
|
import { c as T } from "react/compiler-runtime";
|
|
4
4
|
import { jsx as E } from "react/jsx-runtime";
|