@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.
- 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/git.d.ts +32 -4
- package/dist/builder/api/git.js +74 -4
- package/dist/builder/api/github.d.ts +54 -0
- package/dist/builder/api/github.js +103 -1
- 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/forge.js +79 -10
- package/dist/builder/github-sync.d.ts +70 -0
- package/dist/builder/github-sync.js +435 -0
- 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/builder/project.js +17 -4
- package/dist/builder/sync.js +27 -4
- 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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { gr as e, hr as t, yr as n } from "./utils-
|
|
1
|
+
import { gr as e, hr as t, yr as n } from "./utils-DtKQl-D3.js";
|
|
2
2
|
import { t as r } from "./observeResize-DRQ9DVLE.js";
|
|
3
3
|
import { useEffect as i, useEffectEvent as a, useLayoutEffect as o, useRef as s, useState as c } from "react";
|
|
4
4
|
import { c as l } from "react/compiler-runtime";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { c as e, n as t } from "./messages-yqmY7G5x.js";
|
|
2
|
-
import {
|
|
3
|
-
import { o as r } from "./presentation-
|
|
2
|
+
import { Ld as n } from "./utils-DtKQl-D3.js";
|
|
3
|
+
import { o as r } from "./presentation-68y8EAuH.js";
|
|
4
4
|
// ../../packages/client-runtime/src/mediaActions.ts
|
|
5
5
|
function i(e, t = e) {
|
|
6
6
|
return n(t) ? e.replaceAll("/", "\\") : e;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { d as e, m as t, t as n, zn as r } from "./session-
|
|
1
|
+
import { d as e, m as t, t as n, zn as r } from "./session-Decc4Fo5.js";
|
|
2
2
|
import { c as i, n as a, s as o } from "./messages-yqmY7G5x.js";
|
|
3
|
-
import {
|
|
4
|
-
import { Bo as m, Z as h, go as g } from "./keybindings-
|
|
5
|
-
import { Gt as _, Ht as v, Kt as y, Ut as b, Wt as x, Y as S } from "./themePalette-
|
|
6
|
-
import { A as
|
|
7
|
-
import { r as O } from "./presentation-
|
|
8
|
-
import { n as k } from "./query-
|
|
3
|
+
import { Ef as s, Kh as c, S_ as l, hf as u, lf as d, qh as f, xg as p } from "./utils-DtKQl-D3.js";
|
|
4
|
+
import { Bo as m, Z as h, go as g } from "./keybindings-D0pBlT1k.js";
|
|
5
|
+
import { Gt as _, Ht as v, Kt as y, Ut as b, Wt as x, Y as S } from "./themePalette-C-GtwwqV.js";
|
|
6
|
+
import { A as C, D as ee, M as w, O as T, k as E, w as D } from "./mediaReference-3wc4ZfY8.js";
|
|
7
|
+
import { r as O } from "./presentation-68y8EAuH.js";
|
|
8
|
+
import { n as k } from "./query-BPk2W3QN.js";
|
|
9
9
|
import { useContext as A } from "react";
|
|
10
10
|
import { c as j } from "react/compiler-runtime";
|
|
11
11
|
// ../../packages/shared/src/searchRanking.ts
|
|
@@ -74,13 +74,13 @@ function R(e, t) {
|
|
|
74
74
|
}
|
|
75
75
|
return n;
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function z(e, t, n) {
|
|
78
78
|
if (n <= 0) return;
|
|
79
79
|
let r = R(e, t);
|
|
80
80
|
e.length < n ? e.splice(r, 0, t) : r >= n || (e.splice(r, 0, t), e.pop());
|
|
81
81
|
}
|
|
82
82
|
// ../../packages/client-runtime/src/state/filesystem.ts
|
|
83
|
-
var
|
|
83
|
+
var te = 5e3;
|
|
84
84
|
function B(e, t = o) {
|
|
85
85
|
if (e.sessionError !== null) return {
|
|
86
86
|
canReadFiles: !1,
|
|
@@ -102,11 +102,11 @@ function B(e, t = o) {
|
|
|
102
102
|
};
|
|
103
103
|
}
|
|
104
104
|
function V(e, t = "", n = !0) {
|
|
105
|
-
let r = n && w(e, t), i = r ?
|
|
105
|
+
let r = n && w(e, t), i = r ? ee(e) : "";
|
|
106
106
|
return {
|
|
107
107
|
isBrowsing: r,
|
|
108
108
|
directoryPath: i,
|
|
109
|
-
filterQuery: r && !
|
|
109
|
+
filterQuery: r && !C(e) ? T(e) : "",
|
|
110
110
|
parentPath: r ? E(i) : null,
|
|
111
111
|
canBrowseUp: r && D(i)
|
|
112
112
|
};
|
|
@@ -187,7 +187,7 @@ function K(e) {
|
|
|
187
187
|
browse: d(e, {
|
|
188
188
|
label: "environment-data:filesystem:browse",
|
|
189
189
|
tag: h.filesystemBrowse,
|
|
190
|
-
idleTtlMs:
|
|
190
|
+
idleTtlMs: te,
|
|
191
191
|
staleTimeMs: 0
|
|
192
192
|
})
|
|
193
193
|
};
|
|
@@ -207,37 +207,37 @@ function J(e, t) {
|
|
|
207
207
|
}
|
|
208
208
|
// src/state/use-atom-query-runner.ts
|
|
209
209
|
function Y(e, t) {
|
|
210
|
-
let n = j(7), r = A(
|
|
211
|
-
return n[0] !== i || n[1] !== e || n[2] !== s || n[3] !== r || n[4] !== o || n[5] !== a ? (
|
|
210
|
+
let n = j(7), r = A(f), i = typeof t == "string" ? t : t?.label, a = typeof t == "string" ? !0 : t?.reportFailure ?? !0, o = typeof t == "string" ? !0 : t?.reportDefect ?? !0, s = typeof t == "string" ? !1 : t?.refresh ?? !1, c;
|
|
211
|
+
return n[0] !== i || n[1] !== e || n[2] !== s || n[3] !== r || n[4] !== o || n[5] !== a ? (c = (t) => {
|
|
212
212
|
let n = e(t);
|
|
213
|
-
return
|
|
213
|
+
return u(r, n, {
|
|
214
214
|
label: i ?? n.label?.[0] ?? "atom query",
|
|
215
215
|
reportFailure: a,
|
|
216
216
|
reportDefect: o,
|
|
217
217
|
refresh: s
|
|
218
218
|
});
|
|
219
|
-
}, n[0] = i, n[1] = e, n[2] = s, n[3] = r, n[4] = o, n[5] = a, n[6] =
|
|
219
|
+
}, n[0] = i, n[1] = e, n[2] = s, n[3] = r, n[4] = o, n[5] = a, n[6] = c) : c = n[6], c;
|
|
220
220
|
}
|
|
221
221
|
// src/assets/assetUrls.ts
|
|
222
222
|
var X = _(S.createUrl);
|
|
223
223
|
function Z(t, n, r) {
|
|
224
|
-
let i = j(16), a = J(t,
|
|
224
|
+
let i = j(16), a = J(t, l()), o;
|
|
225
225
|
i[0] !== n || i[1] !== a ? (o = x(n, a), i[0] = n, i[1] = a, i[2] = o) : o = i[2];
|
|
226
|
-
let
|
|
227
|
-
i[3] !==
|
|
226
|
+
let s = o, u = e(t), d;
|
|
227
|
+
i[3] !== s || i[4] !== t || i[5] !== n || i[6] !== r ? (d = s !== null || t === null || n === null ? v : r === void 0 ? S.createUrl({
|
|
228
228
|
environmentId: t,
|
|
229
229
|
input: { resource: n }
|
|
230
230
|
}) : X({
|
|
231
231
|
environmentId: t,
|
|
232
232
|
input: { resource: n },
|
|
233
233
|
revision: r
|
|
234
|
-
}), i[3] =
|
|
235
|
-
let
|
|
236
|
-
if (
|
|
237
|
-
let
|
|
238
|
-
i[8] !==
|
|
234
|
+
}), i[3] = s, i[4] = t, i[5] = n, i[6] = r, i[7] = d) : d = i[7];
|
|
235
|
+
let f = c(d);
|
|
236
|
+
if (s !== null) return s;
|
|
237
|
+
let p = u._tag === "Some" ? u.value.httpBaseUrl : null, m;
|
|
238
|
+
i[8] !== f || i[9] !== p ? (m = b(f, p), i[8] = f, i[9] = p, i[10] = m) : m = i[10];
|
|
239
239
|
let h;
|
|
240
|
-
i[11] ===
|
|
240
|
+
i[11] === f.waiting ? h = i[12] : (h = f.waiting ? { waiting: !0 } : {}, i[11] = f.waiting, i[12] = h);
|
|
241
241
|
let g;
|
|
242
242
|
return i[13] !== m || i[14] !== h ? (g = {
|
|
243
243
|
...m,
|
|
@@ -250,45 +250,45 @@ function Q(t, n) {
|
|
|
250
250
|
reportFailure: !1,
|
|
251
251
|
refresh: !0
|
|
252
252
|
}, r[0] = o) : o = r[0];
|
|
253
|
-
let
|
|
254
|
-
return r[1] !== t || r[2] !== a || r[3] !==
|
|
253
|
+
let c = Y(S.createUrl, o), l;
|
|
254
|
+
return r[1] !== t || r[2] !== a || r[3] !== c || r[4] !== n ? (l = async () => {
|
|
255
255
|
if (t === null || n === null || a === null) return null;
|
|
256
|
-
let e = await
|
|
256
|
+
let e = await c({
|
|
257
257
|
environmentId: t,
|
|
258
258
|
input: { resource: n }
|
|
259
259
|
});
|
|
260
|
-
if (e._tag === "Failure") throw
|
|
260
|
+
if (e._tag === "Failure") throw s(e);
|
|
261
261
|
return y(a, e.value.relativeUrl);
|
|
262
|
-
}, r[1] = t, r[2] = a, r[3] =
|
|
262
|
+
}, r[1] = t, r[2] = a, r[3] = c, r[4] = n, r[5] = l) : l = r[5], l;
|
|
263
263
|
}
|
|
264
264
|
function ne(t, n) {
|
|
265
265
|
let r = j(13), i = e(t), { canReadFiles: a } = J(t), o;
|
|
266
266
|
r[0] !== a || r[1] !== n ? (o = a ? n : n.filter(ie), r[0] = a, r[1] = n, r[2] = o) : o = r[2];
|
|
267
|
-
let
|
|
268
|
-
r[3] !==
|
|
267
|
+
let s = o, l;
|
|
268
|
+
r[3] !== s || r[4] !== t ? (l = S.createUrls({
|
|
269
269
|
environmentId: t,
|
|
270
|
-
resources:
|
|
271
|
-
}), r[3] =
|
|
272
|
-
let
|
|
270
|
+
resources: s
|
|
271
|
+
}), r[3] = s, r[4] = t, r[5] = l) : l = r[5];
|
|
272
|
+
let u = c(l);
|
|
273
273
|
if (i._tag === "None") {
|
|
274
274
|
let e;
|
|
275
275
|
return r[6] === n ? e = r[7] : (e = n.map(re), r[6] = n, r[7] = e), e;
|
|
276
276
|
}
|
|
277
|
-
let
|
|
278
|
-
if (r[8] !== a || r[9] !== i.value || r[10] !== n || r[11] !==
|
|
279
|
-
|
|
277
|
+
let d;
|
|
278
|
+
if (r[8] !== a || r[9] !== i.value || r[10] !== n || r[11] !== u) {
|
|
279
|
+
d = [];
|
|
280
280
|
let e = 0;
|
|
281
281
|
for (let t of n) {
|
|
282
282
|
if (!a && $(t)) {
|
|
283
|
-
|
|
283
|
+
d.push(null);
|
|
284
284
|
continue;
|
|
285
285
|
}
|
|
286
|
-
let n =
|
|
287
|
-
e += 1,
|
|
286
|
+
let n = u[e];
|
|
287
|
+
e += 1, d.push(n && p(n) ? y(i.value.httpBaseUrl, n.value.relativeUrl) : null);
|
|
288
288
|
}
|
|
289
|
-
r[8] = a, r[9] = i.value, r[10] = n, r[11] =
|
|
290
|
-
} else
|
|
291
|
-
return
|
|
289
|
+
r[8] = a, r[9] = i.value, r[10] = n, r[11] = u, r[12] = d;
|
|
290
|
+
} else d = r[12];
|
|
291
|
+
return d;
|
|
292
292
|
}
|
|
293
293
|
function re() {
|
|
294
294
|
return null;
|
|
@@ -299,4 +299,4 @@ function ie(e) {
|
|
|
299
299
|
function $(e) {
|
|
300
300
|
return e._tag === "workspace-file" || e._tag === "media-file" || e._tag === "draft-workspace-file" || e._tag === "native-app-icon" && e.app._tag === "app-path";
|
|
301
301
|
}
|
|
302
|
-
export { q as a, W as c, U as d,
|
|
302
|
+
export { q as a, W as c, U as d, z as f, Y as i, H as l, I as m, Z as n, J as o, M as p, ne as r, G as s, Q as t, V as u };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { i as e } from "./session-
|
|
1
|
+
import { i as e } from "./session-Decc4Fo5.js";
|
|
2
2
|
import { c as t, n } from "./messages-yqmY7G5x.js";
|
|
3
|
-
import {
|
|
4
|
-
import { Ed as l, Fo as u, Gt as d, Gy as f, Jd as ee, Pu as te, W as p, Wt as m, _p as ne, ad as re, ef as ie, fy as ae, hp as oe, id as se, kd as ce, pp as le, qu as ue, vg as h, wd as g, xo as de, zu as fe } from "./keybindings-
|
|
5
|
-
import "./themePalette-
|
|
6
|
-
import { S as pe, b as me, h as he } from "./mediaReference-
|
|
7
|
-
import { Q as ge, ln as _e } from "./threadSearch-
|
|
8
|
-
import { n as ve, r as ye } from "./useSettings-
|
|
9
|
-
import { N as be } from "./presentation-
|
|
10
|
-
import { t as xe } from "./use-atom-command-
|
|
3
|
+
import { Qd as r, _f as i, ac as a, cc as o, hg as s, uc as c } from "./utils-DtKQl-D3.js";
|
|
4
|
+
import { Ed as l, Fo as u, Gt as d, Gy as f, Jd as ee, Pu as te, W as p, Wt as m, _p as ne, ad as re, ef as ie, fy as ae, hp as oe, id as se, kd as ce, pp as le, qu as ue, vg as h, wd as g, xo as de, zu as fe } from "./keybindings-D0pBlT1k.js";
|
|
5
|
+
import "./themePalette-C-GtwwqV.js";
|
|
6
|
+
import { S as pe, b as me, h as he } from "./mediaReference-3wc4ZfY8.js";
|
|
7
|
+
import { Q as ge, ln as _e } from "./threadSearch-CrtCof6n.js";
|
|
8
|
+
import { n as ve, r as ye } from "./useSettings-B_MtcTyD.js";
|
|
9
|
+
import { N as be } from "./presentation-68y8EAuH.js";
|
|
10
|
+
import { t as xe } from "./use-atom-command-XemtT1Gv.js";
|
|
11
11
|
import { c as _ } from "react/compiler-runtime";
|
|
12
12
|
// ../../packages/shared/src/commandOutput.ts
|
|
13
13
|
var Se = ne("2026-10-08T00:00:00Z"), Ce = ee(ie(l({
|
|
@@ -672,34 +672,34 @@ function Ht(e) {
|
|
|
672
672
|
function Ut(e) {
|
|
673
673
|
let t = new Set(e), n = null;
|
|
674
674
|
try {
|
|
675
|
-
n =
|
|
675
|
+
n = a(Q, d);
|
|
676
676
|
} catch (e) {
|
|
677
677
|
console.warn("Could not read the preferred editor.", e);
|
|
678
678
|
}
|
|
679
679
|
if (n && t.has(n)) return n;
|
|
680
680
|
let r = m.find((e) => t.has(e.id))?.id ?? null;
|
|
681
681
|
if (r) try {
|
|
682
|
-
|
|
682
|
+
o(Q, r, d);
|
|
683
683
|
} catch (e) {
|
|
684
684
|
console.warn("Could not save the preferred editor.", e);
|
|
685
685
|
}
|
|
686
686
|
return r ?? null;
|
|
687
687
|
}
|
|
688
|
-
function Wt(r,
|
|
688
|
+
function Wt(r, a, o) {
|
|
689
689
|
let c = _(6), l;
|
|
690
690
|
c[0] === Symbol.for("react.memo_cache_sentinel") ? (l = { reportFailure: !1 }, c[0] = l) : l = c[0];
|
|
691
691
|
let d = xe(_e.openInEditor, l), f;
|
|
692
|
-
return c[1] !==
|
|
692
|
+
return c[1] !== a || c[2] !== r || c[3] !== d || c[4] !== o ? (f = async (c) => {
|
|
693
693
|
if (r === null) return s(h(new $({ targetPath: c })));
|
|
694
694
|
if (!e(r, "orchestration:operate")) return s(h(new u({
|
|
695
695
|
requiredScope: de,
|
|
696
696
|
message: n(t("This connection cannot open an editor on this environment."))
|
|
697
697
|
})));
|
|
698
|
-
let l = Ut(
|
|
698
|
+
let l = Ut(a);
|
|
699
699
|
if (!l) return s(h(new Vt({
|
|
700
700
|
environmentId: r,
|
|
701
701
|
targetPath: c,
|
|
702
|
-
availableEditorIds:
|
|
702
|
+
availableEditorIds: a
|
|
703
703
|
})));
|
|
704
704
|
let f = /^file:\/\//iu.test(c) ? me(c) : null, { line: ee, column: te } = f ? pe("", f.hash) : {}, p = await d({
|
|
705
705
|
environmentId: r,
|
|
@@ -710,11 +710,11 @@ function Wt(r, i, a) {
|
|
|
710
710
|
column: te
|
|
711
711
|
} } : {},
|
|
712
712
|
editor: l,
|
|
713
|
-
...
|
|
713
|
+
...o ? { projectRoot: o } : {}
|
|
714
714
|
}
|
|
715
715
|
});
|
|
716
|
-
return
|
|
717
|
-
}, c[1] =
|
|
716
|
+
return i(p, () => l);
|
|
717
|
+
}, c[1] = a, c[2] = r, c[3] = d, c[4] = o, c[5] = f) : f = c[5], f;
|
|
718
718
|
}
|
|
719
719
|
// src/browser/browserLinkTarget.ts
|
|
720
720
|
function Gt(e) {
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A repository's files at one revision,
|
|
2
|
+
* A repository's files at one revision, and its outbound mirror targets,
|
|
3
|
+
* from the platform's native git.
|
|
3
4
|
*
|
|
4
|
-
* GET
|
|
5
|
-
* GET
|
|
6
|
-
*
|
|
5
|
+
* GET /v1/git/repos/{name}/tree?ref=&path= one directory, dirs first
|
|
6
|
+
* GET /v1/git/repos/{name}/blob?ref=&path= one file; binary is base64,
|
|
7
|
+
* past 1 MiB it is truncated with no content
|
|
8
|
+
* GET /v1/git/repos/{name}/targets outbound mirror targets
|
|
9
|
+
* POST /v1/git/repos/{name}/targets attach outbound GitHub mirror + initial sync push
|
|
10
|
+
* POST /v1/git/repos/{name}/link link an existing GitHub repo
|
|
7
11
|
*
|
|
8
12
|
* A run pushes its branch to the forge, not here, so a run's files are read
|
|
9
13
|
* through the run (changes.ts); these read a codebase as the platform holds it.
|
|
10
14
|
*/
|
|
15
|
+
import { type At } from '../address.ts';
|
|
11
16
|
import { type Target } from './call.ts';
|
|
12
17
|
export interface Entry {
|
|
13
18
|
name: string;
|
|
@@ -23,6 +28,29 @@ export interface Blob {
|
|
|
23
28
|
truncated: boolean;
|
|
24
29
|
size: number;
|
|
25
30
|
}
|
|
31
|
+
/** An outbound mirror target attached to a Hanzo Git repository. */
|
|
32
|
+
export interface GitTarget {
|
|
33
|
+
id: string;
|
|
34
|
+
repo: string;
|
|
35
|
+
host: string;
|
|
36
|
+
url: string;
|
|
37
|
+
createdAt: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Parse a GitHub repository reference in any form GitHub hands out (`onGitHub`),
|
|
41
|
+
* or in `owner/repo` shorthand (e.g. `hanzoai/dev`).
|
|
42
|
+
*/
|
|
43
|
+
export declare function parseGitHubRepo(input: string): At | null;
|
|
44
|
+
export declare function gitTarget(raw: unknown): GitTarget | null;
|
|
45
|
+
/** List outbound mirror targets for a Hanzo Git repository. */
|
|
46
|
+
export declare function listGitTargets(t: Target, name: string, signal?: AbortSignal): Promise<GitTarget[]>;
|
|
47
|
+
/**
|
|
48
|
+
* Attach an outbound GitHub mirror target to a Hanzo Git repository,
|
|
49
|
+
* which also triggers an initial sync push.
|
|
50
|
+
*/
|
|
51
|
+
export declare function attachGitHubMirror(t: Target, name: string, url: string): Promise<GitTarget>;
|
|
52
|
+
/** Link an existing GitHub repository to a Hanzo Git repository. */
|
|
53
|
+
export declare function linkGitHubRepo(t: Target, name: string, source: string): Promise<void>;
|
|
26
54
|
export declare function tree(t: Target, repo: string, ref: string, path?: string): Promise<Entry[]>;
|
|
27
55
|
/** A tree answer's entries. A run's branch on the forge answers in the same shape. */
|
|
28
56
|
export declare function entries(raw: unknown): Entry[];
|
package/dist/builder/api/git.js
CHANGED
|
@@ -1,15 +1,85 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A repository's files at one revision,
|
|
2
|
+
* A repository's files at one revision, and its outbound mirror targets,
|
|
3
|
+
* from the platform's native git.
|
|
3
4
|
*
|
|
4
|
-
* GET
|
|
5
|
-
* GET
|
|
6
|
-
*
|
|
5
|
+
* GET /v1/git/repos/{name}/tree?ref=&path= one directory, dirs first
|
|
6
|
+
* GET /v1/git/repos/{name}/blob?ref=&path= one file; binary is base64,
|
|
7
|
+
* past 1 MiB it is truncated with no content
|
|
8
|
+
* GET /v1/git/repos/{name}/targets outbound mirror targets
|
|
9
|
+
* POST /v1/git/repos/{name}/targets attach outbound GitHub mirror + initial sync push
|
|
10
|
+
* POST /v1/git/repos/{name}/link link an existing GitHub repo
|
|
7
11
|
*
|
|
8
12
|
* A run pushes its branch to the forge, not here, so a run's files are read
|
|
9
13
|
* through the run (changes.ts); these read a codebase as the platform holds it.
|
|
10
14
|
*/
|
|
15
|
+
import { ADDRESS, clone, onGitHub } from '../address.js';
|
|
11
16
|
import { call, query, seg } from './call.js';
|
|
12
17
|
const str = (v) => (typeof v === 'string' ? v : '');
|
|
18
|
+
const obj = (v) => (v && typeof v === 'object' ? v : {});
|
|
19
|
+
/** GitHub owner/name shorthand segment. */
|
|
20
|
+
const GH_SEG = /^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/;
|
|
21
|
+
/**
|
|
22
|
+
* Parse a GitHub repository reference in any form GitHub hands out (`onGitHub`),
|
|
23
|
+
* or in `owner/repo` shorthand (e.g. `hanzoai/dev`).
|
|
24
|
+
*/
|
|
25
|
+
export function parseGitHubRepo(input) {
|
|
26
|
+
const s = input.trim();
|
|
27
|
+
if (!s)
|
|
28
|
+
return null;
|
|
29
|
+
const full = onGitHub(s);
|
|
30
|
+
if (full)
|
|
31
|
+
return full;
|
|
32
|
+
const cleaned = s.replace(/\/+$/, '').replace(/\.git$/i, '');
|
|
33
|
+
const parts = cleaned.split('/');
|
|
34
|
+
if (parts.length !== 2)
|
|
35
|
+
return null;
|
|
36
|
+
const [owner, name] = parts;
|
|
37
|
+
return owner && name && GH_SEG.test(owner) && GH_SEG.test(name) ? { owner, name } : null;
|
|
38
|
+
}
|
|
39
|
+
export function gitTarget(raw) {
|
|
40
|
+
const o = obj(raw);
|
|
41
|
+
const url = str(o.url);
|
|
42
|
+
if (!url)
|
|
43
|
+
return null;
|
|
44
|
+
return {
|
|
45
|
+
id: str(o.id),
|
|
46
|
+
repo: str(o.repo),
|
|
47
|
+
host: str(o.host),
|
|
48
|
+
url,
|
|
49
|
+
createdAt: str(o.createdAt),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/** List outbound mirror targets for a Hanzo Git repository. */
|
|
53
|
+
export async function listGitTargets(t, name, signal) {
|
|
54
|
+
const raw = await call(t, 'GET', `/v1/git/repos/${seg(name)}/targets`, undefined, { signal });
|
|
55
|
+
const rows = Array.isArray(raw) ? raw : Array.isArray(obj(raw).data) ? obj(raw).data : [];
|
|
56
|
+
return rows.map(gitTarget).filter((x) => x !== null);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Attach an outbound GitHub mirror target to a Hanzo Git repository,
|
|
60
|
+
* which also triggers an initial sync push.
|
|
61
|
+
*/
|
|
62
|
+
export async function attachGitHubMirror(t, name, url) {
|
|
63
|
+
const at = parseGitHubRepo(url);
|
|
64
|
+
if (!at)
|
|
65
|
+
throw new Error(ADDRESS);
|
|
66
|
+
const cloneUrl = clone(at);
|
|
67
|
+
const raw = await call(t, 'POST', `/v1/git/repos/${seg(name)}/targets`, { url: cloneUrl });
|
|
68
|
+
return (gitTarget(raw) ?? {
|
|
69
|
+
id: '',
|
|
70
|
+
repo: name,
|
|
71
|
+
host: 'github.com',
|
|
72
|
+
url: cloneUrl,
|
|
73
|
+
createdAt: '',
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/** Link an existing GitHub repository to a Hanzo Git repository. */
|
|
77
|
+
export async function linkGitHubRepo(t, name, source) {
|
|
78
|
+
const at = parseGitHubRepo(source);
|
|
79
|
+
if (!at)
|
|
80
|
+
throw new Error(ADDRESS);
|
|
81
|
+
await call(t, 'POST', `/v1/git/repos/${seg(name)}/link`, { source: clone(at) });
|
|
82
|
+
}
|
|
13
83
|
export async function tree(t, repo, ref, path = '') {
|
|
14
84
|
return entries(await call(t, 'GET', `/v1/git/repos/${seg(repo)}/tree${query({ ref, path })}`));
|
|
15
85
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { type Target } from './call.ts';
|
|
2
|
+
import { attachGitHubMirror, linkGitHubRepo, listGitTargets, parseGitHubRepo, type GitTarget } from './git.ts';
|
|
3
|
+
export { attachGitHubMirror, linkGitHubRepo, listGitTargets, parseGitHubRepo, type GitTarget };
|
|
2
4
|
export interface Repo {
|
|
3
5
|
owner: string;
|
|
4
6
|
name: string;
|
|
@@ -174,3 +176,55 @@ export interface Synced {
|
|
|
174
176
|
* never duplicates, and the App's webhook keeps them live afterwards.
|
|
175
177
|
*/
|
|
176
178
|
export declare function syncIssues(t: Target, repo?: string): Promise<Synced>;
|
|
179
|
+
/** A repository created or forked on GitHub through the platform. */
|
|
180
|
+
export interface CreatedRepo {
|
|
181
|
+
full_name: string;
|
|
182
|
+
html_url: string;
|
|
183
|
+
clone_url: string;
|
|
184
|
+
default_branch: string;
|
|
185
|
+
private: boolean;
|
|
186
|
+
existing: boolean;
|
|
187
|
+
}
|
|
188
|
+
export interface CreateRepoInput {
|
|
189
|
+
name: string;
|
|
190
|
+
description?: string;
|
|
191
|
+
private?: boolean;
|
|
192
|
+
org?: string;
|
|
193
|
+
linkRepo?: string;
|
|
194
|
+
}
|
|
195
|
+
export interface ForkRepoInput {
|
|
196
|
+
/** `owner/repo`, GitHub URL, or bare repo name. */
|
|
197
|
+
repo: string;
|
|
198
|
+
org?: string;
|
|
199
|
+
name?: string;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Create a GitHub repository via `POST /v1/provider/github/repos`.
|
|
203
|
+
* When `linkRepo` is provided, the platform also links and syncs that Hanzo Git repo to it.
|
|
204
|
+
* May throw `Refusal` with status 412 or 409 when personal GitHub user OAuth is required.
|
|
205
|
+
*/
|
|
206
|
+
export declare function createGitHubRepo(t: Target, input: CreateRepoInput): Promise<CreatedRepo>;
|
|
207
|
+
/**
|
|
208
|
+
* Fork a GitHub repository via `POST /v1/provider/github/fork`.
|
|
209
|
+
* Accepts `owner/repo`, a full GitHub URL (normalized to `owner/repo`), or a bare repo name.
|
|
210
|
+
* May throw `Refusal` with status 412 or 409 when personal GitHub user OAuth is required.
|
|
211
|
+
*/
|
|
212
|
+
export declare function forkGitHubRepo(t: Target, input: ForkRepoInput): Promise<CreatedRepo>;
|
|
213
|
+
/**
|
|
214
|
+
* True when creating or forking a GitHub repository failed because the user's
|
|
215
|
+
* personal GitHub account requires user OAuth authorization (HTTP 412 or 409).
|
|
216
|
+
*/
|
|
217
|
+
export declare function isGitHubUserOAuthRequired(err: unknown): boolean;
|
|
218
|
+
/** Resolved GitHub identity for a project backed directly by GitHub or via an outbound mirror target. */
|
|
219
|
+
export interface GitHubRepoBadgeInfo {
|
|
220
|
+
owner: string;
|
|
221
|
+
name: string;
|
|
222
|
+
fullName: string;
|
|
223
|
+
htmlUrl: string;
|
|
224
|
+
source: 'repo' | 'target' | 'link';
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Resolve a project's GitHub repository from its primary clone URL or outbound mirror targets.
|
|
228
|
+
* Returns null if the project is Hanzo Git only and not yet synced to GitHub.
|
|
229
|
+
*/
|
|
230
|
+
export declare function githubRepoFrom(repoUrl: string, targets?: readonly GitTarget[]): GitHubRepoBadgeInfo | null;
|
|
@@ -21,9 +21,12 @@
|
|
|
21
21
|
* and that page completes it (`complete`, and `landed` in ../back.ts).
|
|
22
22
|
*/
|
|
23
23
|
import { phrase } from '@hanzo/i18n';
|
|
24
|
-
import {
|
|
24
|
+
import { onGitHub } from '../address.js';
|
|
25
|
+
import { call, query, Refusal, seg } from './call.js';
|
|
25
26
|
import { codebases } from './codebases.js';
|
|
27
|
+
import { attachGitHubMirror, linkGitHubRepo, listGitTargets, parseGitHubRepo } from './git.js';
|
|
26
28
|
import { links } from './links.js';
|
|
29
|
+
export { attachGitHubMirror, linkGitHubRepo, listGitTargets, parseGitHubRepo };
|
|
27
30
|
const str = (v) => (typeof v === 'string' ? v : '');
|
|
28
31
|
const num = (v) => (typeof v === 'number' && Number.isFinite(v) ? v : 0);
|
|
29
32
|
const obj = (v) => v && typeof v === 'object' ? v : {};
|
|
@@ -269,3 +272,102 @@ export async function syncIssues(t, repo = '') {
|
|
|
269
272
|
truncated: raw.truncated === true,
|
|
270
273
|
};
|
|
271
274
|
}
|
|
275
|
+
function createdRepo(raw) {
|
|
276
|
+
const r = obj(raw);
|
|
277
|
+
const full = str(r.full_name);
|
|
278
|
+
const html = str(r.html_url) || (full ? `https://github.com/${full}` : '');
|
|
279
|
+
const cloneUrl = str(r.clone_url) || (full ? `https://github.com/${full}.git` : '');
|
|
280
|
+
return {
|
|
281
|
+
full_name: full,
|
|
282
|
+
html_url: html,
|
|
283
|
+
clone_url: cloneUrl,
|
|
284
|
+
default_branch: str(r.default_branch) || 'main',
|
|
285
|
+
private: r.private === true,
|
|
286
|
+
existing: r.existing === true,
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Create a GitHub repository via `POST /v1/provider/github/repos`.
|
|
291
|
+
* When `linkRepo` is provided, the platform also links and syncs that Hanzo Git repo to it.
|
|
292
|
+
* May throw `Refusal` with status 412 or 409 when personal GitHub user OAuth is required.
|
|
293
|
+
*/
|
|
294
|
+
export async function createGitHubRepo(t, input) {
|
|
295
|
+
const name = input.name.trim();
|
|
296
|
+
if (!name)
|
|
297
|
+
throw new Error(phrase('Enter a repository name'));
|
|
298
|
+
const body = { name };
|
|
299
|
+
const desc = input.description?.trim();
|
|
300
|
+
if (desc)
|
|
301
|
+
body.description = desc;
|
|
302
|
+
if (input.private !== undefined)
|
|
303
|
+
body.private = input.private;
|
|
304
|
+
const org = input.org?.trim();
|
|
305
|
+
if (org)
|
|
306
|
+
body.org = org;
|
|
307
|
+
const linkRepo = input.linkRepo?.trim();
|
|
308
|
+
if (linkRepo)
|
|
309
|
+
body.linkRepo = linkRepo;
|
|
310
|
+
return createdRepo(await call(t, 'POST', '/v1/provider/github/repos', body));
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Fork a GitHub repository via `POST /v1/provider/github/fork`.
|
|
314
|
+
* Accepts `owner/repo`, a full GitHub URL (normalized to `owner/repo`), or a bare repo name.
|
|
315
|
+
* May throw `Refusal` with status 412 or 409 when personal GitHub user OAuth is required.
|
|
316
|
+
*/
|
|
317
|
+
export async function forkGitHubRepo(t, input) {
|
|
318
|
+
const rawRepo = input.repo.trim();
|
|
319
|
+
if (!rawRepo)
|
|
320
|
+
throw new Error(phrase('Enter a GitHub repository to fork (owner/repo)'));
|
|
321
|
+
const parsed = onGitHub(rawRepo);
|
|
322
|
+
const repo = parsed ? `${parsed.owner}/${parsed.name}` : rawRepo.replace(/^\/+|\/+$/g, '').replace(/\.git$/i, '');
|
|
323
|
+
const body = { repo };
|
|
324
|
+
const org = input.org?.trim();
|
|
325
|
+
if (org)
|
|
326
|
+
body.org = org;
|
|
327
|
+
const name = input.name?.trim();
|
|
328
|
+
if (name)
|
|
329
|
+
body.name = name;
|
|
330
|
+
return createdRepo(await call(t, 'POST', '/v1/provider/github/fork', body));
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* True when creating or forking a GitHub repository failed because the user's
|
|
334
|
+
* personal GitHub account requires user OAuth authorization (HTTP 412 or 409).
|
|
335
|
+
*/
|
|
336
|
+
export function isGitHubUserOAuthRequired(err) {
|
|
337
|
+
if (err instanceof Refusal)
|
|
338
|
+
return err.status === 412 || err.status === 409;
|
|
339
|
+
if (err && typeof err === 'object' && 'status' in err) {
|
|
340
|
+
const status = err.status;
|
|
341
|
+
return status === 412 || status === 409;
|
|
342
|
+
}
|
|
343
|
+
return false;
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Resolve a project's GitHub repository from its primary clone URL or outbound mirror targets.
|
|
347
|
+
* Returns null if the project is Hanzo Git only and not yet synced to GitHub.
|
|
348
|
+
*/
|
|
349
|
+
export function githubRepoFrom(repoUrl, targets) {
|
|
350
|
+
const direct = repoUrl ? onGitHub(repoUrl) : null;
|
|
351
|
+
if (direct) {
|
|
352
|
+
return {
|
|
353
|
+
owner: direct.owner,
|
|
354
|
+
name: direct.name,
|
|
355
|
+
fullName: `${direct.owner}/${direct.name}`,
|
|
356
|
+
htmlUrl: `https://github.com/${direct.owner}/${direct.name}`,
|
|
357
|
+
source: 'repo',
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
for (const t of targets ?? []) {
|
|
361
|
+
const at = parseGitHubRepo(t.url);
|
|
362
|
+
if (at) {
|
|
363
|
+
return {
|
|
364
|
+
owner: at.owner,
|
|
365
|
+
name: at.name,
|
|
366
|
+
fullName: `${at.owner}/${at.name}`,
|
|
367
|
+
htmlUrl: `https://github.com/${at.owner}/${at.name}`,
|
|
368
|
+
source: 'target',
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
return null;
|
|
373
|
+
}
|
|
@@ -12,6 +12,8 @@ import { type ModelCatalogEntry } from '@hanzo/ui/models/catalog';
|
|
|
12
12
|
import { type Target } from './call.ts';
|
|
13
13
|
export { ENSO } from '@hanzo/ui/models/catalog';
|
|
14
14
|
export type Model = ModelCatalogEntry;
|
|
15
|
+
/** Whether a catalog entry is the retired `Enso Free` tier (never surfaced). */
|
|
16
|
+
export declare function isRemovedEnsoFree(m: Pick<Model, 'id' | 'name'>): boolean;
|
|
15
17
|
export declare function models(t: Target): Promise<Model[]>;
|
|
16
18
|
/** The payer's plan usage, as `GET /v1/ai/limits` answers it: what a picker marks paused. */
|
|
17
19
|
export declare function limits(t: Target, signal?: AbortSignal): Promise<unknown>;
|
|
@@ -11,8 +11,13 @@
|
|
|
11
11
|
import { parseModels } from '@hanzo/ui/models/catalog';
|
|
12
12
|
import { call } from './call.js';
|
|
13
13
|
export { ENSO } from '@hanzo/ui/models/catalog';
|
|
14
|
+
/** Whether a catalog entry is the retired `Enso Free` tier (never surfaced). */
|
|
15
|
+
export function isRemovedEnsoFree(m) {
|
|
16
|
+
const id = m.id.trim().toLowerCase().replace(/^hanzo\//, '');
|
|
17
|
+
return id === 'enso-free' || id === 'enso_free' || (m.name ?? '').trim().toLowerCase() === 'enso free';
|
|
18
|
+
}
|
|
14
19
|
export async function models(t) {
|
|
15
|
-
return parseModels(await call(t, 'GET', '/v1/models'));
|
|
20
|
+
return parseModels(await call(t, 'GET', '/v1/models')).filter((m) => !isRemovedEnsoFree(m));
|
|
16
21
|
}
|
|
17
22
|
/** The payer's plan usage, as `GET /v1/ai/limits` answers it: what a picker marks paused. */
|
|
18
23
|
export function limits(t, signal) {
|
|
@@ -83,6 +83,8 @@ export interface Node {
|
|
|
83
83
|
names: string[];
|
|
84
84
|
/** A file's text, or '' when it is binary or past the view cap. */
|
|
85
85
|
text: string;
|
|
86
|
+
/** Base64 bytes when binary and within the view cap (used for inline image previews). */
|
|
87
|
+
base64?: string;
|
|
86
88
|
binary: boolean;
|
|
87
89
|
truncated: boolean;
|
|
88
90
|
}
|
|
@@ -202,7 +202,8 @@ export async function read(t, sandbox, path) {
|
|
|
202
202
|
const o = (await call(t, 'POST', '/v1/sandbox/read', { id: sandbox, path })) ?? {};
|
|
203
203
|
const dir = o.dir === true;
|
|
204
204
|
const names = Array.isArray(o.entries) ? o.entries.filter((n) => typeof n === 'string').sort() : [];
|
|
205
|
-
const
|
|
205
|
+
const rawB64 = !dir && typeof o.data === 'string' ? o.data : '';
|
|
206
|
+
const bytes = rawB64 ? decode(rawB64) : new Uint8Array();
|
|
206
207
|
const binary = bytes.includes(0);
|
|
207
208
|
const truncated = bytes.length > CAP;
|
|
208
209
|
return {
|
|
@@ -210,6 +211,7 @@ export async function read(t, sandbox, path) {
|
|
|
210
211
|
dir,
|
|
211
212
|
names,
|
|
212
213
|
text: binary || truncated ? '' : new TextDecoder().decode(bytes),
|
|
214
|
+
...(binary && !truncated && rawB64 ? { base64: rawB64 } : {}),
|
|
213
215
|
binary,
|
|
214
216
|
truncated,
|
|
215
217
|
};
|