@orbit-build/cli 0.8.0 → 0.8.2
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/index.js +380 -109
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -259667,7 +259667,13 @@ function canonicalizeProjectPath(projectPath) {
|
|
|
259667
259667
|
}
|
|
259668
259668
|
if (!isDirectory(requested))
|
|
259669
259669
|
throw new Error("Project path must be an existing directory.");
|
|
259670
|
-
|
|
259670
|
+
const canonical = realpathSync2.native(requested);
|
|
259671
|
+
if (canonical === parse2(canonical).root) {
|
|
259672
|
+
throw new Error(
|
|
259673
|
+
"A filesystem root cannot be registered as an Orbit project."
|
|
259674
|
+
);
|
|
259675
|
+
}
|
|
259676
|
+
return canonical;
|
|
259671
259677
|
}
|
|
259672
259678
|
function projectIdentity(projectPath) {
|
|
259673
259679
|
const normalized = projectPath.replace(/\\/g, "/");
|
|
@@ -276723,65 +276729,163 @@ var WEB_UI_CLIENT_BINDINGS_SCRIPT = String.raw` elements.composer.addEventListe
|
|
|
276723
276729
|
closeContextPicker({ skipRestore: true });
|
|
276724
276730
|
void updateSession({ action: 'new' });
|
|
276725
276731
|
});
|
|
276726
|
-
const closeProjectDialog = (restoreFocus = true) => {
|
|
276732
|
+
const closeProjectDialog = (restoreFocus = true, force = false) => {
|
|
276727
276733
|
if (elements.projectDialog.hidden) return;
|
|
276734
|
+
if (state.projectLaunchPending && !force) return;
|
|
276728
276735
|
elements.projectDialog.hidden = true;
|
|
276729
276736
|
elements.projectDialog.setAttribute('aria-hidden', 'true');
|
|
276730
276737
|
if (restoreFocus && state.projectDialogReturnFocus) state.projectDialogReturnFocus.focus();
|
|
276731
276738
|
state.projectDialogReturnFocus = null;
|
|
276732
276739
|
};
|
|
276733
276740
|
const openProjectDialog = () => {
|
|
276734
|
-
if (state.busy) return;
|
|
276741
|
+
if (state.busy || state.projectLaunchPending) return;
|
|
276735
276742
|
state.projectDialogReturnFocus = document.activeElement;
|
|
276736
276743
|
elements.projectDialog.hidden = false;
|
|
276737
276744
|
elements.projectDialog.setAttribute('aria-hidden', 'false');
|
|
276738
276745
|
elements.projectPathInput.focus();
|
|
276739
276746
|
elements.projectPathInput.select();
|
|
276740
276747
|
};
|
|
276741
|
-
const
|
|
276748
|
+
const showReservedProjectStatus = (projectTab, label, failed = false) => {
|
|
276749
|
+
if (!projectTab || projectTab.closed) return;
|
|
276750
|
+
try {
|
|
276751
|
+
const projectDocument = projectTab.document;
|
|
276752
|
+
const sourceStyle = getComputedStyle(document.documentElement);
|
|
276753
|
+
const themeValue = (name, fallback) =>
|
|
276754
|
+
sourceStyle.getPropertyValue(name).trim() || fallback;
|
|
276755
|
+
projectDocument.title = 'Orbit · ' + label;
|
|
276756
|
+
projectDocument.documentElement.lang = document.documentElement.lang;
|
|
276757
|
+
projectDocument.documentElement.style.colorScheme = sourceStyle.colorScheme;
|
|
276758
|
+
projectDocument.body.replaceChildren();
|
|
276759
|
+
Object.assign(projectDocument.body.style, {
|
|
276760
|
+
minHeight: '100vh',
|
|
276761
|
+
margin: '0',
|
|
276762
|
+
display: 'grid',
|
|
276763
|
+
placeItems: 'center',
|
|
276764
|
+
color: themeValue('--ink', '#2c3834'),
|
|
276765
|
+
background: themeValue('--canvas', '#f4f6f3'),
|
|
276766
|
+
fontFamily: themeValue('--font-sans', 'Inter, ui-sans-serif, system-ui, sans-serif'),
|
|
276767
|
+
});
|
|
276768
|
+
const status = projectDocument.createElement('main');
|
|
276769
|
+
status.setAttribute('role', 'status');
|
|
276770
|
+
status.dataset.orbitProjectHandoff = failed ? 'failed' : 'pending';
|
|
276771
|
+
Object.assign(status.style, {
|
|
276772
|
+
display: 'grid',
|
|
276773
|
+
gap: '10px',
|
|
276774
|
+
justifyItems: 'center',
|
|
276775
|
+
minWidth: 'min(360px, calc(100vw - 40px))',
|
|
276776
|
+
padding: '28px',
|
|
276777
|
+
textAlign: 'center',
|
|
276778
|
+
background: themeValue('--surface-raised', '#ffffff'),
|
|
276779
|
+
border: '1px solid ' + themeValue('--border', 'rgba(28, 49, 42, 0.105)'),
|
|
276780
|
+
borderRadius: themeValue('--radius-lg', '18px'),
|
|
276781
|
+
boxShadow: themeValue('--shadow-md', '0 18px 48px rgba(10, 24, 20, 0.14)'),
|
|
276782
|
+
});
|
|
276783
|
+
const brand = projectDocument.createElement('strong');
|
|
276784
|
+
brand.textContent = 'Orbit';
|
|
276785
|
+
Object.assign(brand.style, {
|
|
276786
|
+
color: themeValue('--accent-strong', '#276a5f'),
|
|
276787
|
+
fontSize: '24px',
|
|
276788
|
+
letterSpacing: '-0.02em',
|
|
276789
|
+
});
|
|
276790
|
+
const message = projectDocument.createElement('span');
|
|
276791
|
+
message.textContent = label;
|
|
276792
|
+
Object.assign(message.style, {
|
|
276793
|
+
maxWidth: '42ch',
|
|
276794
|
+
color: failed
|
|
276795
|
+
? themeValue('--danger', '#bb5755')
|
|
276796
|
+
: themeValue('--muted', '#596761'),
|
|
276797
|
+
fontSize: '14px',
|
|
276798
|
+
lineHeight: '1.55',
|
|
276799
|
+
});
|
|
276800
|
+
status.append(brand, message);
|
|
276801
|
+
projectDocument.body.append(status);
|
|
276802
|
+
} catch {
|
|
276803
|
+
// A browser may isolate the placeholder before Orbit can decorate it.
|
|
276804
|
+
}
|
|
276805
|
+
};
|
|
276806
|
+
const reserveProjectTab = (label) => {
|
|
276807
|
+
const projectTab = window.open('about:blank', '_blank');
|
|
276808
|
+
showReservedProjectStatus(projectTab, label);
|
|
276809
|
+
return projectTab;
|
|
276810
|
+
};
|
|
276811
|
+
const closeReservedProjectTab = (projectTab, message = copy.projectSwitchFailed) => {
|
|
276812
|
+
if (!projectTab || projectTab.closed) return;
|
|
276813
|
+
showReservedProjectStatus(projectTab, message, true);
|
|
276814
|
+
try {
|
|
276815
|
+
projectTab.close();
|
|
276816
|
+
} catch {
|
|
276817
|
+
// The visible failure state remains if the browser refuses window.close().
|
|
276818
|
+
}
|
|
276819
|
+
};
|
|
276820
|
+
const switchToProject = (result, projectTab) => {
|
|
276742
276821
|
if (!result || typeof result.url !== 'string') {
|
|
276822
|
+
closeReservedProjectTab(projectTab);
|
|
276743
276823
|
throw new Error(copy.projectSwitchFailed);
|
|
276744
276824
|
}
|
|
276745
|
-
const
|
|
276746
|
-
const token = new URLSearchParams(
|
|
276825
|
+
const projectUrl = new URL(result.url);
|
|
276826
|
+
const token = new URLSearchParams(projectUrl.hash.slice(1)).get('token');
|
|
276747
276827
|
if (
|
|
276748
|
-
|
|
276749
|
-
!['127.0.0.1', '::1', 'localhost'].includes(
|
|
276750
|
-
|
|
276751
|
-
|
|
276828
|
+
projectUrl.protocol !== 'http:' ||
|
|
276829
|
+
!['127.0.0.1', '::1', 'localhost'].includes(projectUrl.hostname) ||
|
|
276830
|
+
projectUrl.username ||
|
|
276831
|
+
projectUrl.password ||
|
|
276752
276832
|
!token ||
|
|
276753
276833
|
!/^[A-Za-z0-9_-]{32,128}$/.test(token)
|
|
276754
276834
|
) {
|
|
276835
|
+
closeReservedProjectTab(projectTab);
|
|
276755
276836
|
throw new Error(copy.projectSwitchFailed);
|
|
276756
276837
|
}
|
|
276757
|
-
|
|
276838
|
+
if (projectTab && !projectTab.closed) {
|
|
276839
|
+
projectTab.opener = null;
|
|
276840
|
+
projectTab.location.replace(projectUrl.href);
|
|
276841
|
+
projectTab.focus();
|
|
276842
|
+
showToast(copy.projectOpened, 'success');
|
|
276843
|
+
return;
|
|
276844
|
+
}
|
|
276845
|
+
window.location.assign(projectUrl.href);
|
|
276758
276846
|
};
|
|
276759
|
-
const launchProject = async (
|
|
276847
|
+
const launchProject = async (selectedPath) => {
|
|
276760
276848
|
const path = String(selectedPath || elements.projectPathInput.value).trim();
|
|
276761
276849
|
if (!path) {
|
|
276762
276850
|
showToast(copy.projectPathRequired, 'error');
|
|
276763
276851
|
elements.projectPathInput.focus();
|
|
276764
276852
|
return;
|
|
276765
276853
|
}
|
|
276766
|
-
if (elements.
|
|
276854
|
+
if (elements.projectDialogCreate.disabled) return;
|
|
276855
|
+
const pendingButton = elements.projectDialogCreate;
|
|
276856
|
+
const pendingLabel = copy.projectCreating;
|
|
276857
|
+
const projectTab = reserveProjectTab(pendingLabel);
|
|
276858
|
+
const originalLabel = pendingButton.textContent;
|
|
276859
|
+
state.projectLaunchPending = true;
|
|
276860
|
+
elements.projectDialog.setAttribute('aria-busy', 'true');
|
|
276861
|
+
elements.projectDialogBackdrop.disabled = true;
|
|
276862
|
+
elements.projectDialogCancel.disabled = true;
|
|
276767
276863
|
elements.projectDialogBrowse.disabled = true;
|
|
276768
|
-
elements.projectDialogOpen.disabled = true;
|
|
276769
276864
|
elements.projectDialogCreate.disabled = true;
|
|
276770
|
-
|
|
276865
|
+
pendingButton.textContent = pendingLabel;
|
|
276866
|
+
pendingButton.setAttribute('aria-busy', 'true');
|
|
276771
276867
|
try {
|
|
276772
276868
|
const result = await api('/api/project', {
|
|
276773
276869
|
method: 'POST',
|
|
276774
276870
|
headers: { 'Content-Type': 'application/json' },
|
|
276775
|
-
body: JSON.stringify({ action, path }),
|
|
276871
|
+
body: JSON.stringify({ action: 'create', path }),
|
|
276776
276872
|
});
|
|
276777
|
-
|
|
276873
|
+
await loadStatus().catch(() => {});
|
|
276874
|
+
closeProjectDialog(false, true);
|
|
276778
276875
|
elements.projectPathInput.value = '';
|
|
276779
|
-
switchToProject(result);
|
|
276876
|
+
switchToProject(result, projectTab);
|
|
276780
276877
|
} catch (error) {
|
|
276781
|
-
|
|
276878
|
+
const message = projectErrorMessage(error);
|
|
276879
|
+
closeReservedProjectTab(projectTab, message);
|
|
276880
|
+
showToast(message, 'error');
|
|
276782
276881
|
} finally {
|
|
276882
|
+
state.projectLaunchPending = false;
|
|
276883
|
+
elements.projectDialog.removeAttribute('aria-busy');
|
|
276884
|
+
elements.projectDialogBackdrop.disabled = false;
|
|
276885
|
+
elements.projectDialogCancel.disabled = false;
|
|
276886
|
+
pendingButton.textContent = originalLabel;
|
|
276887
|
+
pendingButton.removeAttribute('aria-busy');
|
|
276783
276888
|
elements.projectDialogBrowse.disabled = false;
|
|
276784
|
-
elements.projectDialogOpen.disabled = false;
|
|
276785
276889
|
elements.projectDialogCreate.disabled = false;
|
|
276786
276890
|
}
|
|
276787
276891
|
};
|
|
@@ -276790,7 +276894,6 @@ var WEB_UI_CLIENT_BINDINGS_SCRIPT = String.raw` elements.composer.addEventListe
|
|
|
276790
276894
|
state.projectPickerPending = true;
|
|
276791
276895
|
elements.projectDialogBrowse.disabled = true;
|
|
276792
276896
|
elements.projectDialogBrowse.setAttribute('aria-busy', 'true');
|
|
276793
|
-
elements.projectDialogOpen.disabled = true;
|
|
276794
276897
|
elements.projectDialogCreate.disabled = true;
|
|
276795
276898
|
elements.newProjectButton.disabled = true;
|
|
276796
276899
|
try {
|
|
@@ -276809,7 +276912,6 @@ var WEB_UI_CLIENT_BINDINGS_SCRIPT = String.raw` elements.composer.addEventListe
|
|
|
276809
276912
|
state.projectPickerPending = false;
|
|
276810
276913
|
elements.projectDialogBrowse.disabled = false;
|
|
276811
276914
|
elements.projectDialogBrowse.removeAttribute('aria-busy');
|
|
276812
|
-
elements.projectDialogOpen.disabled = false;
|
|
276813
276915
|
elements.projectDialogCreate.disabled = false;
|
|
276814
276916
|
elements.newProjectButton.disabled = false;
|
|
276815
276917
|
}
|
|
@@ -276818,8 +276920,7 @@ var WEB_UI_CLIENT_BINDINGS_SCRIPT = String.raw` elements.composer.addEventListe
|
|
|
276818
276920
|
elements.projectDialogBackdrop.addEventListener('click', () => closeProjectDialog());
|
|
276819
276921
|
elements.projectDialogCancel.addEventListener('click', () => closeProjectDialog());
|
|
276820
276922
|
elements.projectDialogBrowse.addEventListener('click', () => void pickProjectFolder());
|
|
276821
|
-
elements.
|
|
276822
|
-
elements.projectDialogCreate.addEventListener('click', () => void launchProject('create'));
|
|
276923
|
+
elements.projectDialogCreate.addEventListener('click', () => void launchProject());
|
|
276823
276924
|
elements.projectList.addEventListener('click', (event) => {
|
|
276824
276925
|
const remove = event.target.closest('[data-project-action="remove"]');
|
|
276825
276926
|
if (remove && !state.busy) {
|
|
@@ -276849,15 +276950,19 @@ var WEB_UI_CLIENT_BINDINGS_SCRIPT = String.raw` elements.composer.addEventListe
|
|
|
276849
276950
|
const button = event.target.closest('[data-project-path]');
|
|
276850
276951
|
if (!button || button.disabled || state.busy) return;
|
|
276851
276952
|
state.busy = true;
|
|
276953
|
+
const projectTab = reserveProjectTab(copy.projectOpening);
|
|
276852
276954
|
button.classList.add('is-switching');
|
|
276853
276955
|
button.setAttribute('aria-busy', 'true');
|
|
276854
|
-
showToast(copy.
|
|
276956
|
+
showToast(copy.projectOpening);
|
|
276855
276957
|
api('/api/project', {
|
|
276856
276958
|
method: 'POST',
|
|
276857
276959
|
headers: { 'Content-Type': 'application/json' },
|
|
276858
276960
|
body: JSON.stringify({ action: 'open', path: button.dataset.projectPath || '' }),
|
|
276859
|
-
}).then(switchToProject)
|
|
276860
|
-
.catch((error) =>
|
|
276961
|
+
}).then((result) => switchToProject(result, projectTab))
|
|
276962
|
+
.catch((error) => {
|
|
276963
|
+
closeReservedProjectTab(projectTab, error.message || String(error));
|
|
276964
|
+
showToast(error.message || String(error), 'error');
|
|
276965
|
+
})
|
|
276861
276966
|
.finally(() => {
|
|
276862
276967
|
state.busy = false;
|
|
276863
276968
|
button.classList.remove('is-switching');
|
|
@@ -276867,12 +276972,14 @@ var WEB_UI_CLIENT_BINDINGS_SCRIPT = String.raw` elements.composer.addEventListe
|
|
|
276867
276972
|
elements.projectPathInput.addEventListener('keydown', (event) => {
|
|
276868
276973
|
if (event.key === 'Enter') {
|
|
276869
276974
|
event.preventDefault();
|
|
276870
|
-
void launchProject(
|
|
276975
|
+
void launchProject();
|
|
276871
276976
|
}
|
|
276872
276977
|
});
|
|
276873
276978
|
elements.projectDialog.addEventListener('keydown', (event) => {
|
|
276874
276979
|
if (event.key !== 'Tab') return;
|
|
276875
|
-
const focusable = [elements.projectPathInput, elements.projectDialogBrowse, elements.projectDialogCancel, elements.
|
|
276980
|
+
const focusable = [elements.projectPathInput, elements.projectDialogBrowse, elements.projectDialogCancel, elements.projectDialogCreate]
|
|
276981
|
+
.filter((control) => !control.disabled);
|
|
276982
|
+
if (!focusable.length) return;
|
|
276876
276983
|
const first = focusable[0];
|
|
276877
276984
|
const last = focusable[focusable.length - 1];
|
|
276878
276985
|
if (event.shiftKey && document.activeElement === first) {
|
|
@@ -278118,12 +278225,14 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
|
|
|
278118
278225
|
sessionArchived: '对话已归档',
|
|
278119
278226
|
sessionRestored: '对话已恢复',
|
|
278120
278227
|
sessionDeleted: '对话已删除',
|
|
278121
|
-
|
|
278122
|
-
|
|
278228
|
+
projectOpening: '正在新标签页打开项目…',
|
|
278229
|
+
projectCreating: '正在准备项目并打开新标签页…',
|
|
278230
|
+
projectOpened: '项目已在新标签页中打开',
|
|
278231
|
+
projectSwitchFailed: '项目已启动,但无法安全打开页面',
|
|
278123
278232
|
projectRemoved: '项目已从 Orbit 移除,磁盘文件未删除',
|
|
278124
278233
|
removeProject: '从 Orbit 移除项目',
|
|
278125
278234
|
confirmRemoveProject: '再次点击确认移除',
|
|
278126
|
-
projectPathRequired: '
|
|
278235
|
+
projectPathRequired: '请输入项目文件夹的绝对路径',
|
|
278127
278236
|
archiveSession: '归档',
|
|
278128
278237
|
restoreSession: '恢复',
|
|
278129
278238
|
deleteSession: '删除',
|
|
@@ -278268,12 +278377,14 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
|
|
|
278268
278377
|
sessionArchived: 'Chat archived',
|
|
278269
278378
|
sessionRestored: 'Chat restored',
|
|
278270
278379
|
sessionDeleted: 'Chat deleted',
|
|
278271
|
-
|
|
278272
|
-
|
|
278380
|
+
projectOpening: 'Opening project in a new tab…',
|
|
278381
|
+
projectCreating: 'Preparing project in a new tab…',
|
|
278382
|
+
projectOpened: 'Project opened in a new tab',
|
|
278383
|
+
projectSwitchFailed: 'The project started, but Orbit could not open it safely',
|
|
278273
278384
|
projectRemoved: 'Project removed from Orbit; files were not deleted',
|
|
278274
278385
|
removeProject: 'Remove project from Orbit',
|
|
278275
278386
|
confirmRemoveProject: 'Click again to confirm removal',
|
|
278276
|
-
projectPathRequired: 'Enter
|
|
278387
|
+
projectPathRequired: 'Enter an absolute project folder path',
|
|
278277
278388
|
archiveSession: 'Archive',
|
|
278278
278389
|
restoreSession: 'Restore',
|
|
278279
278390
|
deleteSession: 'Delete',
|
|
@@ -278382,9 +278493,13 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
|
|
|
278382
278493
|
sessionArchived: '對話已封存',
|
|
278383
278494
|
sessionRestored: '對話已復原',
|
|
278384
278495
|
sessionDeleted: '對話已刪除',
|
|
278385
|
-
|
|
278496
|
+
projectOpening: '正在新分頁開啟專案…',
|
|
278497
|
+
projectCreating: '正在準備專案並開啟新分頁…',
|
|
278498
|
+
projectOpened: '專案已在新分頁中開啟',
|
|
278499
|
+
projectSwitchFailed: '專案已啟動,但無法安全開啟頁面',
|
|
278386
278500
|
projectRemoved: '專案已從 Orbit 移除,磁碟檔案未刪除',
|
|
278387
278501
|
removeProject: '從 Orbit 移除專案',
|
|
278502
|
+
projectPathRequired: '請輸入專案資料夾的絕對路徑',
|
|
278388
278503
|
archiveSession: '封存',
|
|
278389
278504
|
restoreSession: '復原',
|
|
278390
278505
|
deleteSession: '刪除',
|
|
@@ -278432,6 +278547,38 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
|
|
|
278432
278547
|
});
|
|
278433
278548
|
}
|
|
278434
278549
|
|
|
278550
|
+
const projectErrorMessages = isChinese
|
|
278551
|
+
? {
|
|
278552
|
+
absolute_path_required: chinese('请输入项目文件夹的绝对路径。', '請輸入專案資料夾的絕對路徑。'),
|
|
278553
|
+
filesystem_root: chinese('为保护系统,不能把磁盘根目录作为 Orbit 项目。', '為保護系統,不能把磁碟根目錄作為 Orbit 專案。'),
|
|
278554
|
+
entrypoint_unavailable: chinese('Orbit CLI 启动入口不可用,请重启 Orbit 后再试。', 'Orbit CLI 啟動入口無法使用,請重新啟動 Orbit 後再試。'),
|
|
278555
|
+
project_missing: chinese('项目文件夹不存在。', '專案資料夾不存在。'),
|
|
278556
|
+
project_not_directory: chinese('选择的路径不是文件夹。', '選擇的路徑不是資料夾。'),
|
|
278557
|
+
parent_missing: chinese('上级文件夹不存在,请先选择一个已有位置。', '上層資料夾不存在,請先選擇一個現有位置。'),
|
|
278558
|
+
parent_not_directory: chinese('项目的上级路径不是文件夹。', '專案的上層路徑不是資料夾。'),
|
|
278559
|
+
create_failed: chinese('无法创建项目文件夹,请检查路径和权限。', '無法建立專案資料夾,請檢查路徑與權限。'),
|
|
278560
|
+
launch_failed: chinese('无法启动此项目的 Orbit 实例。', '無法啟動此專案的 Orbit 執行個體。'),
|
|
278561
|
+
startup_failed: chinese('项目实例在 WebUI 就绪前退出。', '專案執行個體在 WebUI 就緒前結束。'),
|
|
278562
|
+
startup_timeout: chinese('启动项目超时,请重试或检查运行诊断。', '啟動專案逾時,請重試或檢查執行診斷。'),
|
|
278563
|
+
}
|
|
278564
|
+
: {
|
|
278565
|
+
absolute_path_required: 'Enter an absolute project folder path.',
|
|
278566
|
+
filesystem_root: 'A filesystem root cannot be used as an Orbit project.',
|
|
278567
|
+
entrypoint_unavailable: 'The Orbit CLI entry point is unavailable. Restart Orbit and try again.',
|
|
278568
|
+
project_missing: 'The project folder does not exist.',
|
|
278569
|
+
project_not_directory: 'The selected path is not a folder.',
|
|
278570
|
+
parent_missing: 'The parent folder does not exist. Choose an existing location first.',
|
|
278571
|
+
parent_not_directory: 'The project parent path is not a folder.',
|
|
278572
|
+
create_failed: 'Orbit could not create the project folder. Check the path and permissions.',
|
|
278573
|
+
launch_failed: 'Orbit could not start this project.',
|
|
278574
|
+
startup_failed: 'The project exited before its Web UI was ready.',
|
|
278575
|
+
startup_timeout: 'The project took too long to start. Retry or open Diagnostics.',
|
|
278576
|
+
};
|
|
278577
|
+
const projectErrorMessage = (error) =>
|
|
278578
|
+
projectErrorMessages[error && error.projectErrorCode] ||
|
|
278579
|
+
error && error.message ||
|
|
278580
|
+
String(error);
|
|
278581
|
+
|
|
278435
278582
|
const suggestionPrompts = isChinese
|
|
278436
278583
|
? [
|
|
278437
278584
|
'全面审查这个项目,找出影响最大的问题并直接修复,最后运行完整验证。',
|
|
@@ -278481,7 +278628,6 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
|
|
|
278481
278628
|
projectDialog: byId('projectDialog'),
|
|
278482
278629
|
projectDialogBackdrop: byId('projectDialogBackdrop'),
|
|
278483
278630
|
projectDialogCancel: byId('projectDialogCancel'),
|
|
278484
|
-
projectDialogOpen: byId('projectDialogOpen'),
|
|
278485
278631
|
projectDialogCreate: byId('projectDialogCreate'),
|
|
278486
278632
|
projectDialogBrowse: byId('projectDialogBrowse'),
|
|
278487
278633
|
projectPathInput: byId('projectPathInput'),
|
|
@@ -278673,6 +278819,7 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
|
|
|
278673
278819
|
sessionDeleteReturnFocus: null,
|
|
278674
278820
|
projectDialogReturnFocus: null,
|
|
278675
278821
|
projectPickerPending: false,
|
|
278822
|
+
projectLaunchPending: false,
|
|
278676
278823
|
promptQueue: [],
|
|
278677
278824
|
queueEditingId: null,
|
|
278678
278825
|
queueEditDraft: '',
|
|
@@ -278823,6 +278970,7 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
|
|
|
278823
278970
|
: data.message || data.error || response.statusText || 'Request failed';
|
|
278824
278971
|
const error = new Error(message);
|
|
278825
278972
|
error.status = response.status;
|
|
278973
|
+
error.projectErrorCode = typeof data.errorCode === 'string' ? data.errorCode : '';
|
|
278826
278974
|
throw error;
|
|
278827
278975
|
}
|
|
278828
278976
|
return data;
|
|
@@ -280319,7 +280467,7 @@ var WEB_UI_CLIENT_PALETTE_SCRIPT = String.raw` let paletteActions = [];
|
|
|
280319
280467
|
function buildPaletteActions() {
|
|
280320
280468
|
const actions = [
|
|
280321
280469
|
{ icon: '+', label: language !== 'en' ? chinese('新建任务', '新增任務') : 'New task', detail: 'Ctrl N', keywords: 'new session task', idle: true, run: () => updateSession({ action: 'new' }) },
|
|
280322
|
-
{ icon: '▣', label: language !== 'en' ? chinese('
|
|
280470
|
+
{ icon: '▣', label: language !== 'en' ? chinese('添加或创建项目', '加入或建立專案') : 'Add or create project', detail: language !== 'en' ? chinese('选择项目文件夹', '選擇專案資料夾') : 'Choose a project folder', keywords: 'add new open create project workspace folder', idle: true, run: openProjectDialog },
|
|
280323
280471
|
{ icon: '›', label: copy.focusComposer, detail: language !== 'en' ? chinese('发送消息', '傳送訊息') : 'Message Orbit', keywords: 'focus prompt message composer', run: () => elements.prompt.focus() },
|
|
280324
280472
|
{ icon: '◫', label: copy.openActivity, detail: language !== 'en' ? chinese('运行状态与工具', '執行狀態與工具') : 'Runtime and tools', keywords: 'activity details runtime tools', run: () => setInspector(true, 'activity') },
|
|
280325
280473
|
{ icon: '⚙', label: copy.openSettings, detail: 'Ctrl ,', keywords: 'settings preferences configuration', run: () => setInspector(true, 'settings') },
|
|
@@ -282320,7 +282468,25 @@ var WebUiRequestError = class extends Error {
|
|
|
282320
282468
|
name = "WebUiRequestError";
|
|
282321
282469
|
};
|
|
282322
282470
|
|
|
282471
|
+
// src/runtime/webui/WebUiContracts.ts
|
|
282472
|
+
var WEB_UI_PROJECT_ERROR_CODES = [
|
|
282473
|
+
"absolute_path_required",
|
|
282474
|
+
"filesystem_root",
|
|
282475
|
+
"entrypoint_unavailable",
|
|
282476
|
+
"project_missing",
|
|
282477
|
+
"project_not_directory",
|
|
282478
|
+
"parent_missing",
|
|
282479
|
+
"parent_not_directory",
|
|
282480
|
+
"create_failed",
|
|
282481
|
+
"launch_failed",
|
|
282482
|
+
"startup_failed",
|
|
282483
|
+
"startup_timeout"
|
|
282484
|
+
];
|
|
282485
|
+
|
|
282323
282486
|
// src/runtime/webui/WebUiSecurity.ts
|
|
282487
|
+
var WEB_UI_PROJECT_ERROR_CODE_SET = new Set(
|
|
282488
|
+
WEB_UI_PROJECT_ERROR_CODES
|
|
282489
|
+
);
|
|
282324
282490
|
function sanitizeWebEventPayload(type, payload) {
|
|
282325
282491
|
if (!isRecord4(payload)) return void 0;
|
|
282326
282492
|
switch (type) {
|
|
@@ -282588,13 +282754,15 @@ function sanitizeActionResult(result) {
|
|
|
282588
282754
|
return result.message ? { ok: result.ok, message: safeWebMessage(result.message) } : { ok: result.ok };
|
|
282589
282755
|
}
|
|
282590
282756
|
function sanitizeProjectActionResult(result) {
|
|
282591
|
-
const url = sanitizeLocalWebUiUrl(result.url);
|
|
282757
|
+
const url = result.ok ? sanitizeLocalWebUiUrl(result.url) : void 0;
|
|
282758
|
+
const errorCode = !result.ok && WEB_UI_PROJECT_ERROR_CODE_SET.has(result.errorCode) ? result.errorCode : void 0;
|
|
282592
282759
|
return {
|
|
282593
282760
|
ok: result.ok,
|
|
282594
282761
|
...result.message ? { message: safeWebMessage(result.message) } : {},
|
|
282595
|
-
...
|
|
282762
|
+
...errorCode ? { errorCode } : {},
|
|
282763
|
+
...result.ok && result.path ? { path: safeWebText(result.path, 4096) } : {},
|
|
282596
282764
|
...url ? { url } : {},
|
|
282597
|
-
...result.cancelled ? { cancelled: true } : {}
|
|
282765
|
+
...result.ok && result.cancelled ? { cancelled: true } : {}
|
|
282598
282766
|
};
|
|
282599
282767
|
}
|
|
282600
282768
|
function sanitizeLocalWebUiUrl(value) {
|
|
@@ -283673,14 +283841,13 @@ var BASE_COPY = {
|
|
|
283673
283841
|
navigation: "Tools",
|
|
283674
283842
|
projects: "Projects",
|
|
283675
283843
|
recentProjects: "Recent projects",
|
|
283676
|
-
newProject: "
|
|
283844
|
+
newProject: "Add project",
|
|
283677
283845
|
projectDialogTitle: "Open or create a project",
|
|
283678
|
-
projectDialogBody: "Choose an existing folder, or enter the absolute path of a new folder. Orbit opens it in a separate local tab with its own chats and context.",
|
|
283846
|
+
projectDialogBody: "Choose an existing folder to add it to Orbit, or enter the absolute path of a new folder whose parent already exists. Orbit opens it in a separate local browser tab with its own chats and context.",
|
|
283679
283847
|
projectPath: "Project folder path",
|
|
283680
283848
|
projectPathPlaceholder: "C:\\path\\to\\project",
|
|
283681
283849
|
browseProject: "Browse folders",
|
|
283682
|
-
|
|
283683
|
-
createProject: "Create & open",
|
|
283850
|
+
createProject: "Open or create",
|
|
283684
283851
|
recentTasks: "Chats",
|
|
283685
283852
|
searchChats: "Search chats",
|
|
283686
283853
|
showMoreChats: "Show more",
|
|
@@ -283854,14 +284021,13 @@ var BASE_COPY = {
|
|
|
283854
284021
|
navigation: "\u5DE5\u5177",
|
|
283855
284022
|
projects: "\u9879\u76EE",
|
|
283856
284023
|
recentProjects: "\u6700\u8FD1\u9879\u76EE",
|
|
283857
|
-
newProject: "\
|
|
284024
|
+
newProject: "\u6DFB\u52A0\u9879\u76EE",
|
|
283858
284025
|
projectDialogTitle: "\u6253\u5F00\u6216\u521B\u5EFA\u9879\u76EE",
|
|
283859
|
-
projectDialogBody: "\
|
|
284026
|
+
projectDialogBody: "\u9009\u62E9\u5DF2\u6709\u6587\u4EF6\u5939\u53EF\u76F4\u63A5\u52A0\u5165 Orbit\uFF1B\u4E5F\u53EF\u4EE5\u8F93\u5165\u7236\u76EE\u5F55\u5DF2\u5B58\u5728\u7684\u65B0\u6587\u4EF6\u5939\u7EDD\u5BF9\u8DEF\u5F84\u3002Orbit \u4F1A\u5728\u72EC\u7ACB\u7684\u672C\u5730\u6D4F\u89C8\u5668\u6807\u7B7E\u9875\u4E2D\u6253\u5F00\uFF0C\u5E76\u4FDD\u7559\u81EA\u5DF1\u7684\u804A\u5929\u548C\u4E0A\u4E0B\u6587\u3002",
|
|
283860
284027
|
projectPath: "\u9879\u76EE\u6587\u4EF6\u5939\u8DEF\u5F84",
|
|
283861
284028
|
projectPathPlaceholder: "C:\\\u8DEF\u5F84\\\u9879\u76EE\u540D\u79F0",
|
|
283862
284029
|
browseProject: "\u6D4F\u89C8\u6587\u4EF6\u5939",
|
|
283863
|
-
|
|
283864
|
-
createProject: "\u521B\u5EFA\u5E76\u6253\u5F00",
|
|
284030
|
+
createProject: "\u6253\u5F00\u6216\u521B\u5EFA",
|
|
283865
284031
|
recentTasks: "\u5BF9\u8BDD",
|
|
283866
284032
|
searchChats: "\u641C\u7D22\u5BF9\u8BDD",
|
|
283867
284033
|
showMoreChats: "\u663E\u793A\u66F4\u591A",
|
|
@@ -284039,13 +284205,12 @@ var COPY = {
|
|
|
284039
284205
|
navigation: "\u5DE5\u5177",
|
|
284040
284206
|
projects: "\u5C08\u6848",
|
|
284041
284207
|
recentProjects: "\u6700\u8FD1\u5C08\u6848",
|
|
284042
|
-
newProject: "\
|
|
284208
|
+
newProject: "\u52A0\u5165\u5C08\u6848",
|
|
284043
284209
|
projectDialogTitle: "\u958B\u555F\u6216\u5EFA\u7ACB\u5C08\u6848",
|
|
284044
|
-
projectDialogBody: "\
|
|
284210
|
+
projectDialogBody: "\u9078\u64C7\u73FE\u6709\u8CC7\u6599\u593E\u53EF\u76F4\u63A5\u52A0\u5165 Orbit\uFF1B\u4E5F\u53EF\u4EE5\u8F38\u5165\u7236\u8CC7\u6599\u593E\u5DF2\u5B58\u5728\u7684\u65B0\u8CC7\u6599\u593E\u7D55\u5C0D\u8DEF\u5F91\u3002Orbit \u6703\u5728\u7368\u7ACB\u7684\u672C\u6A5F\u700F\u89BD\u5668\u5206\u9801\u958B\u555F\uFF0C\u4E26\u4FDD\u7559\u81EA\u5DF1\u7684\u804A\u5929\u548C\u4E0A\u4E0B\u6587\u3002",
|
|
284045
284211
|
projectPath: "\u5C08\u6848\u8CC7\u6599\u593E\u8DEF\u5F91",
|
|
284046
284212
|
browseProject: "\u700F\u89BD\u8CC7\u6599\u593E",
|
|
284047
|
-
|
|
284048
|
-
createProject: "\u5EFA\u7ACB\u4E26\u958B\u555F",
|
|
284213
|
+
createProject: "\u958B\u555F\u6216\u5EFA\u7ACB",
|
|
284049
284214
|
recentTasks: "\u5C0D\u8A71",
|
|
284050
284215
|
searchChats: "\u641C\u5C0B\u5C0D\u8A71",
|
|
284051
284216
|
showMoreChats: "\u986F\u793A\u66F4\u591A",
|
|
@@ -284361,7 +284526,7 @@ function renderWebUiPage(language) {
|
|
|
284361
284526
|
<span class="project-chat-count" id="projectChatCount" aria-label="0">0</span>
|
|
284362
284527
|
<span class="project-toggle-chevron">${renderUiIcon("down")}</span>
|
|
284363
284528
|
</button>
|
|
284364
|
-
<div class="project-chat-body" id="projectChatBody">
|
|
284529
|
+
<div class="project-chat-body" id="projectChatBody" role="region" aria-label="${copy.recentTasks}" tabindex="0">
|
|
284365
284530
|
<section class="recent-section" id="recentSection" aria-labelledby="recentHeading">
|
|
284366
284531
|
<div class="nav-section-heading session-section-heading" id="recentHeading">
|
|
284367
284532
|
<span>${copy.recentTasks}</span><i></i>
|
|
@@ -284388,7 +284553,7 @@ function renderWebUiPage(language) {
|
|
|
284388
284553
|
|
|
284389
284554
|
<section class="recent-projects-shell" id="recentProjectsShell" aria-label="${copy.recentProjects}" hidden>
|
|
284390
284555
|
<div class="project-list-label">${copy.recentProjects}</div>
|
|
284391
|
-
<div class="project-list" id="projectList"></div>
|
|
284556
|
+
<div class="project-list" id="projectList" role="region" aria-label="${copy.recentProjects}" tabindex="0"></div>
|
|
284392
284557
|
</section>
|
|
284393
284558
|
|
|
284394
284559
|
<div class="sidebar-spacer"></div>
|
|
@@ -284771,7 +284936,6 @@ function renderWebUiPage(language) {
|
|
|
284771
284936
|
</div>
|
|
284772
284937
|
<div class="project-dialog-actions">
|
|
284773
284938
|
<button class="project-dialog-cancel" id="projectDialogCancel" type="button">${copy.cancel}</button>
|
|
284774
|
-
<button class="project-dialog-open" id="projectDialogOpen" type="button">${copy.openProject}</button>
|
|
284775
284939
|
<button class="project-dialog-create" id="projectDialogCreate" type="button">${copy.createProject}</button>
|
|
284776
284940
|
</div>
|
|
284777
284941
|
</section>
|
|
@@ -286017,14 +286181,12 @@ var WEB_UI_CONVERSATION_STYLES = String.raw`
|
|
|
286017
286181
|
}
|
|
286018
286182
|
|
|
286019
286183
|
.message-scroll::-webkit-scrollbar,
|
|
286020
|
-
.inspector-content::-webkit-scrollbar
|
|
286021
|
-
.sidebar::-webkit-scrollbar {
|
|
286184
|
+
.inspector-content::-webkit-scrollbar {
|
|
286022
286185
|
width: 9px;
|
|
286023
286186
|
}
|
|
286024
286187
|
|
|
286025
286188
|
.message-scroll::-webkit-scrollbar-thumb,
|
|
286026
|
-
.inspector-content::-webkit-scrollbar-thumb
|
|
286027
|
-
.sidebar::-webkit-scrollbar-thumb {
|
|
286189
|
+
.inspector-content::-webkit-scrollbar-thumb {
|
|
286028
286190
|
background: color-mix(in srgb, var(--faint) 48%, transparent);
|
|
286029
286191
|
border: 3px solid transparent;
|
|
286030
286192
|
border-radius: 9px;
|
|
@@ -287161,8 +287323,7 @@ var WEB_UI_FEEDBACK_STYLES = String.raw`
|
|
|
287161
287323
|
font-weight: 620;
|
|
287162
287324
|
}
|
|
287163
287325
|
|
|
287164
|
-
.project-dialog-cancel
|
|
287165
|
-
.project-dialog-open {
|
|
287326
|
+
.project-dialog-cancel {
|
|
287166
287327
|
color: var(--muted);
|
|
287167
287328
|
background: var(--surface-subtle);
|
|
287168
287329
|
border: 1px solid var(--border);
|
|
@@ -289512,11 +289673,6 @@ var WEB_UI_RESPONSIVE_STYLES = String.raw`
|
|
|
289512
289673
|
width: 100%;
|
|
289513
289674
|
}
|
|
289514
289675
|
|
|
289515
|
-
.project-dialog-cancel {
|
|
289516
|
-
grid-column: 1 / -1;
|
|
289517
|
-
grid-row: 2;
|
|
289518
|
-
}
|
|
289519
|
-
|
|
289520
289676
|
.workspace-view {
|
|
289521
289677
|
grid-template-rows: 54px auto minmax(0, 1fr);
|
|
289522
289678
|
}
|
|
@@ -290057,10 +290213,7 @@ var WEB_UI_SHELL_STYLES = String.raw`
|
|
|
290057
290213
|
flex-direction: column;
|
|
290058
290214
|
gap: 9px;
|
|
290059
290215
|
padding: 12px 13px;
|
|
290060
|
-
overflow
|
|
290061
|
-
overflow-y: auto;
|
|
290062
|
-
overscroll-behavior: contain;
|
|
290063
|
-
scrollbar-gutter: stable;
|
|
290216
|
+
overflow: hidden;
|
|
290064
290217
|
color: var(--sidebar-ink);
|
|
290065
290218
|
background: transparent;
|
|
290066
290219
|
border-right: 0;
|
|
@@ -290326,7 +290479,10 @@ var WEB_UI_SHELL_STYLES = String.raw`
|
|
|
290326
290479
|
|
|
290327
290480
|
.project-section {
|
|
290328
290481
|
min-width: 0;
|
|
290482
|
+
min-height: 148px;
|
|
290329
290483
|
display: grid;
|
|
290484
|
+
grid-template-rows: auto minmax(0, 1fr);
|
|
290485
|
+
flex: 1 1 280px;
|
|
290330
290486
|
overflow: hidden;
|
|
290331
290487
|
background: color-mix(in srgb, var(--sidebar-surface) 44%, transparent);
|
|
290332
290488
|
border: 1px solid var(--sidebar-border);
|
|
@@ -290335,7 +290491,11 @@ var WEB_UI_SHELL_STYLES = String.raw`
|
|
|
290335
290491
|
|
|
290336
290492
|
.recent-projects-shell {
|
|
290337
290493
|
min-width: 0;
|
|
290494
|
+
min-height: 0;
|
|
290495
|
+
max-height: min(196px, 26dvh);
|
|
290338
290496
|
display: grid;
|
|
290497
|
+
grid-template-rows: auto minmax(0, 1fr);
|
|
290498
|
+
flex: 0 1 auto;
|
|
290339
290499
|
gap: 3px;
|
|
290340
290500
|
margin: 12px 4px 0;
|
|
290341
290501
|
padding-top: 10px;
|
|
@@ -290356,8 +290516,14 @@ var WEB_UI_SHELL_STYLES = String.raw`
|
|
|
290356
290516
|
|
|
290357
290517
|
.project-list {
|
|
290358
290518
|
min-width: 0;
|
|
290519
|
+
min-height: 0;
|
|
290359
290520
|
display: grid;
|
|
290521
|
+
align-content: start;
|
|
290360
290522
|
gap: 6px;
|
|
290523
|
+
overflow-x: hidden;
|
|
290524
|
+
overflow-y: auto;
|
|
290525
|
+
overscroll-behavior: contain;
|
|
290526
|
+
scrollbar-gutter: stable;
|
|
290361
290527
|
}
|
|
290362
290528
|
|
|
290363
290529
|
.registered-project {
|
|
@@ -290540,10 +290706,56 @@ var WEB_UI_SHELL_STYLES = String.raw`
|
|
|
290540
290706
|
|
|
290541
290707
|
.project-chat-body {
|
|
290542
290708
|
min-width: 0;
|
|
290709
|
+
min-height: 0;
|
|
290543
290710
|
padding: 0 5px 5px;
|
|
290711
|
+
overflow-x: hidden;
|
|
290712
|
+
overflow-y: auto;
|
|
290713
|
+
overscroll-behavior: contain;
|
|
290714
|
+
scrollbar-gutter: stable;
|
|
290544
290715
|
border-top: 1px solid color-mix(in srgb, var(--sidebar-border) 70%, transparent);
|
|
290545
290716
|
}
|
|
290546
290717
|
|
|
290718
|
+
.project-chat-body,
|
|
290719
|
+
.project-list {
|
|
290720
|
+
scrollbar-width: thin;
|
|
290721
|
+
scrollbar-color: color-mix(in srgb, var(--accent) 42%, var(--sidebar-faint)) color-mix(in srgb, var(--sidebar-border) 36%, transparent);
|
|
290722
|
+
}
|
|
290723
|
+
|
|
290724
|
+
.project-chat-body:focus-visible,
|
|
290725
|
+
.project-list:focus-visible {
|
|
290726
|
+
outline: 2px solid color-mix(in srgb, var(--accent) 58%, transparent);
|
|
290727
|
+
outline-offset: -2px;
|
|
290728
|
+
border-radius: 0 0 11px 11px;
|
|
290729
|
+
}
|
|
290730
|
+
|
|
290731
|
+
.project-chat-body::-webkit-scrollbar,
|
|
290732
|
+
.project-list::-webkit-scrollbar {
|
|
290733
|
+
width: 9px;
|
|
290734
|
+
}
|
|
290735
|
+
|
|
290736
|
+
.project-chat-body::-webkit-scrollbar-track,
|
|
290737
|
+
.project-list::-webkit-scrollbar-track {
|
|
290738
|
+
background: color-mix(in srgb, var(--sidebar-border) 36%, transparent);
|
|
290739
|
+
border-radius: 999px;
|
|
290740
|
+
}
|
|
290741
|
+
|
|
290742
|
+
.project-chat-body::-webkit-scrollbar-thumb,
|
|
290743
|
+
.project-list::-webkit-scrollbar-thumb {
|
|
290744
|
+
min-height: 34px;
|
|
290745
|
+
background: color-mix(in srgb, var(--accent) 42%, var(--sidebar-faint));
|
|
290746
|
+
border: 2px solid transparent;
|
|
290747
|
+
border-radius: 999px;
|
|
290748
|
+
background-clip: padding-box;
|
|
290749
|
+
}
|
|
290750
|
+
|
|
290751
|
+
.project-chat-body:hover::-webkit-scrollbar-thumb,
|
|
290752
|
+
.project-chat-body:focus-within::-webkit-scrollbar-thumb,
|
|
290753
|
+
.project-list:hover::-webkit-scrollbar-thumb,
|
|
290754
|
+
.project-list:focus-within::-webkit-scrollbar-thumb {
|
|
290755
|
+
background: color-mix(in srgb, var(--accent) 48%, var(--sidebar-faint));
|
|
290756
|
+
background-clip: padding-box;
|
|
290757
|
+
}
|
|
290758
|
+
|
|
290547
290759
|
.project-chat-body[hidden] {
|
|
290548
290760
|
display: none;
|
|
290549
290761
|
}
|
|
@@ -290552,6 +290764,7 @@ var WEB_UI_SHELL_STYLES = String.raw`
|
|
|
290552
290764
|
min-height: 0;
|
|
290553
290765
|
display: grid;
|
|
290554
290766
|
grid-template-rows: auto auto minmax(0, auto) auto auto auto;
|
|
290767
|
+
align-content: start;
|
|
290555
290768
|
margin-top: 2px;
|
|
290556
290769
|
}
|
|
290557
290770
|
|
|
@@ -290850,8 +291063,8 @@ var WEB_UI_SHELL_STYLES = String.raw`
|
|
|
290850
291063
|
}
|
|
290851
291064
|
|
|
290852
291065
|
.sidebar-spacer {
|
|
290853
|
-
min-height:
|
|
290854
|
-
flex:
|
|
291066
|
+
min-height: 4px;
|
|
291067
|
+
flex: 0 0 4px;
|
|
290855
291068
|
}
|
|
290856
291069
|
|
|
290857
291070
|
.workspace-view {
|
|
@@ -291402,11 +291615,14 @@ var SessionActionSchema = z58.discriminatedUnion("action", [
|
|
|
291402
291615
|
}).strict()
|
|
291403
291616
|
)
|
|
291404
291617
|
]);
|
|
291618
|
+
var ProjectPathSchema = z58.string().trim().min(1).max(4096).refine((value) => !/[\u0000-\u001f\u007f]/.test(value), {
|
|
291619
|
+
message: "Project paths cannot contain control characters."
|
|
291620
|
+
});
|
|
291405
291621
|
var ProjectActionSchema = z58.discriminatedUnion("action", [
|
|
291406
291622
|
z58.object({ action: z58.literal("pick") }).strict(),
|
|
291407
291623
|
z58.object({
|
|
291408
291624
|
action: z58.enum(["open", "create"]),
|
|
291409
|
-
path:
|
|
291625
|
+
path: ProjectPathSchema
|
|
291410
291626
|
}).strict(),
|
|
291411
291627
|
z58.object({
|
|
291412
291628
|
action: z58.literal("remove"),
|
|
@@ -294309,33 +294525,57 @@ import { spawn as spawn4 } from "child_process";
|
|
|
294309
294525
|
import { existsSync as existsSync20, mkdirSync as mkdirSync7, realpathSync as realpathSync3, statSync as statSync5 } from "fs";
|
|
294310
294526
|
import { dirname as dirname13, isAbsolute as isAbsolute7, parse as parse4, resolve as resolve13 } from "path";
|
|
294311
294527
|
var PROJECT_WEB_UI_READY_MESSAGE = "orbit-webui-ready";
|
|
294528
|
+
var ProjectLaunchError = class extends Error {
|
|
294529
|
+
constructor(code, message2, options) {
|
|
294530
|
+
super(message2, options);
|
|
294531
|
+
this.code = code;
|
|
294532
|
+
}
|
|
294533
|
+
code;
|
|
294534
|
+
name = "ProjectLaunchError";
|
|
294535
|
+
};
|
|
294312
294536
|
async function launchOrbitProject(request, options = {}) {
|
|
294313
294537
|
if (!isAbsolute7(request.path)) {
|
|
294314
|
-
throw new
|
|
294538
|
+
throw new ProjectLaunchError(
|
|
294539
|
+
"absolute_path_required",
|
|
294540
|
+
"Enter an absolute project folder path."
|
|
294541
|
+
);
|
|
294315
294542
|
}
|
|
294316
294543
|
const requestedPath = resolve13(request.path);
|
|
294317
|
-
|
|
294318
|
-
throw new Error("A filesystem root cannot be opened as an Orbit project.");
|
|
294319
|
-
}
|
|
294544
|
+
rejectFilesystemRoot(requestedPath);
|
|
294320
294545
|
const entryPoint = options.entryPoint || process.argv[1];
|
|
294321
|
-
if (!entryPoint)
|
|
294546
|
+
if (!entryPoint) {
|
|
294547
|
+
throw new ProjectLaunchError(
|
|
294548
|
+
"entrypoint_unavailable",
|
|
294549
|
+
"Orbit CLI entry point is unavailable."
|
|
294550
|
+
);
|
|
294551
|
+
}
|
|
294322
294552
|
if (request.action === "create") {
|
|
294323
|
-
|
|
294553
|
+
ensureProjectDirectory(requestedPath);
|
|
294324
294554
|
} else {
|
|
294325
294555
|
requireProjectDirectory(requestedPath);
|
|
294326
294556
|
}
|
|
294327
|
-
const projectPath = realpathSync3(requestedPath);
|
|
294557
|
+
const projectPath = realpathSync3.native(requestedPath);
|
|
294558
|
+
rejectFilesystemRoot(projectPath);
|
|
294328
294559
|
const launch = options.launch || spawn4;
|
|
294329
|
-
|
|
294330
|
-
|
|
294331
|
-
|
|
294332
|
-
|
|
294333
|
-
|
|
294334
|
-
|
|
294335
|
-
|
|
294336
|
-
|
|
294337
|
-
|
|
294338
|
-
|
|
294560
|
+
let child;
|
|
294561
|
+
try {
|
|
294562
|
+
child = launch(
|
|
294563
|
+
options.executable || process.execPath,
|
|
294564
|
+
[entryPoint, "webui", "--cwd", projectPath],
|
|
294565
|
+
{
|
|
294566
|
+
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
294567
|
+
cwd: projectPath,
|
|
294568
|
+
detached: true,
|
|
294569
|
+
stdio: ["ignore", "ignore", "ignore", "ipc"]
|
|
294570
|
+
}
|
|
294571
|
+
);
|
|
294572
|
+
} catch (error) {
|
|
294573
|
+
throw new ProjectLaunchError(
|
|
294574
|
+
"launch_failed",
|
|
294575
|
+
"Orbit project could not be started.",
|
|
294576
|
+
{ cause: error }
|
|
294577
|
+
);
|
|
294578
|
+
}
|
|
294339
294579
|
return await new Promise(
|
|
294340
294580
|
(resolveLaunch, rejectLaunch) => {
|
|
294341
294581
|
let settled = false;
|
|
@@ -294365,11 +294605,16 @@ async function launchOrbitProject(request, options = {}) {
|
|
|
294365
294605
|
};
|
|
294366
294606
|
const onError = (error) => finish(
|
|
294367
294607
|
void 0,
|
|
294368
|
-
new
|
|
294608
|
+
new ProjectLaunchError(
|
|
294609
|
+
"launch_failed",
|
|
294610
|
+
`Orbit project could not be opened: ${error.message}`,
|
|
294611
|
+
{ cause: error }
|
|
294612
|
+
)
|
|
294369
294613
|
);
|
|
294370
294614
|
const onExit2 = (code) => finish(
|
|
294371
294615
|
void 0,
|
|
294372
|
-
new
|
|
294616
|
+
new ProjectLaunchError(
|
|
294617
|
+
"startup_failed",
|
|
294373
294618
|
`Orbit project exited before its Web UI was ready${code === null ? "." : ` (code ${code}).`}`
|
|
294374
294619
|
)
|
|
294375
294620
|
);
|
|
@@ -294378,7 +294623,10 @@ async function launchOrbitProject(request, options = {}) {
|
|
|
294378
294623
|
child.kill();
|
|
294379
294624
|
finish(
|
|
294380
294625
|
void 0,
|
|
294381
|
-
new
|
|
294626
|
+
new ProjectLaunchError(
|
|
294627
|
+
"startup_timeout",
|
|
294628
|
+
"Timed out while starting the Orbit project."
|
|
294629
|
+
)
|
|
294382
294630
|
);
|
|
294383
294631
|
},
|
|
294384
294632
|
Math.max(1e3, options.startupTimeoutMs ?? 15e3)
|
|
@@ -294396,38 +294644,59 @@ function parseReadyUrl(message2) {
|
|
|
294396
294644
|
}
|
|
294397
294645
|
return sanitizeLocalWebUiUrl(message2.url);
|
|
294398
294646
|
}
|
|
294399
|
-
function
|
|
294647
|
+
function ensureProjectDirectory(projectPath) {
|
|
294400
294648
|
if (existsSync20(projectPath)) {
|
|
294401
|
-
|
|
294649
|
+
requireProjectDirectory(projectPath);
|
|
294650
|
+
return;
|
|
294402
294651
|
}
|
|
294403
294652
|
const parentPath = dirname13(projectPath);
|
|
294404
294653
|
if (!existsSync20(parentPath)) {
|
|
294405
|
-
throw new
|
|
294654
|
+
throw new ProjectLaunchError(
|
|
294655
|
+
"parent_missing",
|
|
294406
294656
|
"The parent folder does not exist. Choose an existing location first."
|
|
294407
294657
|
);
|
|
294408
294658
|
}
|
|
294409
294659
|
if (!statSync5(parentPath).isDirectory()) {
|
|
294410
|
-
throw new
|
|
294660
|
+
throw new ProjectLaunchError(
|
|
294661
|
+
"parent_not_directory",
|
|
294662
|
+
"The project parent path must be a directory."
|
|
294663
|
+
);
|
|
294411
294664
|
}
|
|
294412
294665
|
try {
|
|
294413
294666
|
mkdirSync7(projectPath);
|
|
294414
294667
|
} catch (error) {
|
|
294415
294668
|
if (isNodeError4(error) && error.code === "EEXIST") {
|
|
294416
|
-
|
|
294417
|
-
|
|
294418
|
-
);
|
|
294669
|
+
requireProjectDirectory(projectPath);
|
|
294670
|
+
return;
|
|
294419
294671
|
}
|
|
294420
|
-
throw new
|
|
294421
|
-
|
|
294422
|
-
|
|
294672
|
+
throw new ProjectLaunchError(
|
|
294673
|
+
"create_failed",
|
|
294674
|
+
"Orbit could not create the project folder.",
|
|
294675
|
+
{ cause: error }
|
|
294676
|
+
);
|
|
294423
294677
|
}
|
|
294424
294678
|
}
|
|
294425
294679
|
function requireProjectDirectory(projectPath) {
|
|
294426
294680
|
if (!existsSync20(projectPath)) {
|
|
294427
|
-
throw new
|
|
294681
|
+
throw new ProjectLaunchError(
|
|
294682
|
+
"project_missing",
|
|
294683
|
+
"Project folder does not exist."
|
|
294684
|
+
);
|
|
294428
294685
|
}
|
|
294429
294686
|
if (!statSync5(projectPath).isDirectory()) {
|
|
294430
|
-
throw new
|
|
294687
|
+
throw new ProjectLaunchError(
|
|
294688
|
+
"project_not_directory",
|
|
294689
|
+
"Project path must point to a directory."
|
|
294690
|
+
);
|
|
294691
|
+
}
|
|
294692
|
+
}
|
|
294693
|
+
function rejectFilesystemRoot(projectPath) {
|
|
294694
|
+
const normalized = resolve13(projectPath);
|
|
294695
|
+
if (normalized === parse4(normalized).root) {
|
|
294696
|
+
throw new ProjectLaunchError(
|
|
294697
|
+
"filesystem_root",
|
|
294698
|
+
"A filesystem root cannot be opened as an Orbit project."
|
|
294699
|
+
);
|
|
294431
294700
|
}
|
|
294432
294701
|
}
|
|
294433
294702
|
function isNodeError4(error) {
|
|
@@ -294602,7 +294871,7 @@ async function selectOrbitProjectFolder(options = {}) {
|
|
|
294602
294871
|
const result = await run(command.executable, command.args);
|
|
294603
294872
|
return result.stdout.trim() || null;
|
|
294604
294873
|
} catch (error) {
|
|
294605
|
-
if (isPickerCancellation(error)) return null;
|
|
294874
|
+
if (isPickerCancellation(error, platform)) return null;
|
|
294606
294875
|
throw new Error(
|
|
294607
294876
|
platform === "linux" ? "The system folder picker is unavailable. Install zenity or enter the path manually." : "The system folder picker could not be opened. Enter the path manually.",
|
|
294608
294877
|
{ cause: error }
|
|
@@ -294640,10 +294909,11 @@ function projectPickerCommand(platform) {
|
|
|
294640
294909
|
]
|
|
294641
294910
|
};
|
|
294642
294911
|
}
|
|
294643
|
-
function isPickerCancellation(error) {
|
|
294912
|
+
function isPickerCancellation(error, platform) {
|
|
294644
294913
|
if (!error || typeof error !== "object") return false;
|
|
294645
294914
|
const candidate = error;
|
|
294646
|
-
|
|
294915
|
+
const stderr = typeof candidate.stderr === "string" ? candidate.stderr.trim() : "";
|
|
294916
|
+
return stderr.includes("User canceled") || platform === "linux" && candidate.code === 1 && stderr.length === 0;
|
|
294647
294917
|
}
|
|
294648
294918
|
|
|
294649
294919
|
// src/runtime/commands/SessionMetadataCommandHandler.ts
|
|
@@ -295563,6 +295833,7 @@ var CommandRouter = class {
|
|
|
295563
295833
|
} catch (error) {
|
|
295564
295834
|
return {
|
|
295565
295835
|
ok: false,
|
|
295836
|
+
...error instanceof ProjectLaunchError ? { errorCode: error.code } : {},
|
|
295566
295837
|
message: error instanceof Error ? error.message : "Orbit could not open the selected project."
|
|
295567
295838
|
};
|
|
295568
295839
|
}
|