Retire Convex paths and standardize local-first Pi runtime

This commit is contained in:
Agent Board
2026-07-29 01:49:53 +08:00
parent 26ff1a9c9a
commit a40fa25ae6
85 changed files with 1653 additions and 3971 deletions
@@ -806,7 +806,7 @@ import {
? urlFromCaller
: new URL(`/documents/${encodeURIComponent(descriptor.documentId)}`, window.location.origin);
if (!url.searchParams.get('workspaceId') && descriptor.workspaceId) url.searchParams.set('workspaceId', descriptor.workspaceId);
if (descriptor.sourceKind && descriptor.sourceKind !== 'convex_workspace') url.searchParams.set('sourceKind', descriptor.sourceKind);
if (descriptor.sourceKind) url.searchParams.set('sourceKind', descriptor.sourceKind);
if (descriptor.rootUri) url.searchParams.set('rootUri', descriptor.rootUri);
pushUrlState(url);
};
@@ -468,7 +468,7 @@ async function uploadLocalFolderAsset(file, plan, context) {
async function uploadMediaAsset(file, plan, context) {
document.documentElement.setAttribute('data-mnote-media-upload-retired', 'true');
throw new Error('旧 Convex Files 上传链已退役;local-first 附件请使用本地文件夹上传目标。');
throw new Error('仅支持本地文件夹上传。');
}
async function insertUploadedAssetIntoEditor(asset, targetRoot, deps) {
@@ -18,7 +18,7 @@ export const createSidebarFileTreeCommandRuntime = (dependencies = {}) => {
isFileTreePageRow,
localFilePathFromAssetId,
normalizeFileTreePageRenameTitle,
openConvexAssetFromFileTree,
openLocalAssetFromFileTree,
openEditorAttachmentDetail,
openEditorAttachmentDownload,
openEditorAttachmentEditTab,
@@ -592,19 +592,19 @@ export const createSidebarFileTreeCommandRuntime = (dependencies = {}) => {
}
if (isAsset && action === 'new-window') {
recordFileTreeAction('new-window', detail);
void openConvexAssetFromFileTree({ ...detail, openTarget: 'new-window' });
void openLocalAssetFromFileTree({ ...detail, openTarget: 'new-window' });
return;
}
if (isAsset && action === 'open-edit-mode') {
withOfficeEditModeGuard(async function() {
recordFileTreeAction('open-edit-mode', detail);
void openConvexAssetFromFileTree({ ...detail, openTarget: 'edit-mode' });
void openLocalAssetFromFileTree({ ...detail, openTarget: 'edit-mode' });
});
return;
}
if (isAsset && action === 'open-right') {
recordFileTreeAction('open-right', detail);
void openConvexAssetFromFileTree({ ...detail, openTarget: 'side' });
void openLocalAssetFromFileTree({ ...detail, openTarget: 'side' });
return;
}
if (action === 'open-right') {
@@ -381,7 +381,7 @@ export const createSidebarFileTreeOpenRuntime = (dependencies = {}) => {
}
}
async function openConvexAssetFromFileTree(detail) {
async function openLocalAssetFromFileTree(detail) {
var assetId = String(detail && detail.assetId || '').trim();
if (!assetId) return;
var openTarget = String(detail && detail.openTarget || '').trim().toLowerCase();
@@ -520,11 +520,11 @@ export const createSidebarFileTreeOpenRuntime = (dependencies = {}) => {
return;
}
document.documentElement.setAttribute('data-mnote-media-sign-retired', 'true');
await window.mnote.alert('旧 Convex Files 附件签名链已退役;local-first 附件请通过本地文件夹资源打开。');
await window.mnote.alert('仅支持本地文件夹附件;请通过 local_folder 资源打开。');
}
window.addEventListener('tree.asset.open', function(event) {
void openConvexAssetFromFileTree(event.detail || {});
void openLocalAssetFromFileTree(event.detail || {});
});
@@ -541,7 +541,7 @@ export const createSidebarFileTreeOpenRuntime = (dependencies = {}) => {
isMindmapAssetDetail,
localFilePathFromAssetId,
navigateToMindmapObject,
openConvexAssetFromFileTree,
openLocalAssetFromFileTree,
openLocalOfficeFileInActiveTab,
openLocalResourceInActiveTab,
readFileTreeObjectIdentity,
@@ -1073,7 +1073,7 @@ import { createSidebarPageSettingsRuntime } from './sidebar-page-settings-runtim
const openLocalResourceInActiveTab = (...args) => sidebarFileTreeOpen.openLocalResourceInActiveTab(...args);
const readFileTreeObjectIdentity = (...args) => sidebarFileTreeOpen.readFileTreeObjectIdentity(...args);
const fetchCurrentOnlyOfficeUserId = (...args) => sidebarFileTreeOpen.fetchCurrentOnlyOfficeUserId(...args);
const openConvexAssetFromFileTree = (...args) => sidebarFileTreeOpen.openConvexAssetFromFileTree(...args);
const openLocalAssetFromFileTree = (...args) => sidebarFileTreeOpen.openLocalAssetFromFileTree(...args);
var sidebarFileTreeUpload = null;
const fileTreeRowsForUploadPreflight = (...args) => sidebarFileTreeUpload.fileTreeRowsForUploadPreflight(...args);
@@ -2071,7 +2071,7 @@ import { createSidebarPageSettingsRuntime } from './sidebar-page-settings-runtim
}
} else {
document.documentElement.setAttribute('data-mnote-media-upload-retired', 'true');
throw new Error('旧 Convex Files 上传链已退役;local-first 附件请使用本地文件夹上传目标。');
throw new Error('仅支持本地文件夹上传。');
}
appendUploadedAssetRow(payload.asset, plan.targetDocumentId);
if (options && options.insertIntoEditor) {
@@ -2219,7 +2219,7 @@ import { createSidebarPageSettingsRuntime } from './sidebar-page-settings-runtim
isFileTreePageRow,
localFilePathFromAssetId,
normalizeFileTreePageRenameTitle,
openConvexAssetFromFileTree,
openLocalAssetFromFileTree,
openEditorAttachmentDetail: (...args) => openEditorAttachmentDetail(...args),
openEditorAttachmentDownload: (...args) => openEditorAttachmentDownload(...args),
openEditorAttachmentEditTab: (...args) => openEditorAttachmentEditTab(...args),
@@ -223,8 +223,6 @@
// Prefer WebSocket transport when available
var requestedTransport = bootstrap.transport || 'tree-live-sse';
if (requestedTransport === 'convex-command-log-sse') requestedTransport = 'tree-live-sse';
if (requestedTransport === 'convex-command-log-ws') requestedTransport = 'tree-live-ws';
var preferWs = requestedTransport === 'tree-live-ws' && 'WebSocket' in window;
if (preferWs) {
@@ -37,7 +37,6 @@ export function buildTreeShellFileTreeContextMenuProfile(context, target) {
const hasDocument = Boolean(getFileTreeRowDocumentId(item));
const hasAsset = Boolean(getFileTreeRowAssetId(item));
const localSource = context.sourceKind === "local_folder";
const convexSource = context.sourceKind === "convex_workspace";
const canCreateFolder = localSource;
const canCreatePage = rowKind === "root" || rowKind === "folder" || rowKind === "document";
const canRename =
@@ -63,11 +62,11 @@ export function buildTreeShellFileTreeContextMenuProfile(context, target) {
}),
createFileTreeMenuItem("newFolder", "新建文件夹", {
disabled: !canCreateFolder,
reason: convexSource ? "legacy cloud workspace 当前未暴露 folder capability" : "当前 source 不支持新建文件夹",
reason: "仅 local_folder 支持新建文件夹",
}),
createFileTreeMenuItem("upload", "上传/导入", {
disabled: true,
reason: localSource ? "外部文件请拖入 Explorer" : "legacy cloud 上传 executor 尚未接入",
reason: localSource ? "外部文件请拖入 Explorer" : "仅 local_folder 支持上传",
}),
createFileTreeMenuItem("refresh", "刷新", { separatorBefore: true }),
createFileTreeMenuItem("collapseAll", "全部折叠"),
@@ -95,7 +94,7 @@ export function buildTreeShellFileTreeContextMenuProfile(context, target) {
}));
items.push(createFileTreeMenuItem("newFolder", "新建文件夹", {
disabled: !canCreateFolder,
reason: convexSource ? "legacy cloud workspace 当前未暴露 folder capability" : "当前 source 不支持新建文件夹",
reason: "仅 local_folder 支持新建文件夹",
}));
items.push(createFileTreeMenuItem("paste", "粘贴", {
disabled: !canPaste,
@@ -765,21 +765,7 @@ function startTreeShellRuntime() {
scheduleRefresh();
return true;
}
if (sourceKind === "convex_workspace") {
for (const item of deletableItems) {
const documentId = getFileTreeRowDocumentId(item);
await sendCommand({
action: "delete",
workspaceId,
documentId,
});
applyRemovedDocumentLocally(documentId);
}
if (!deletableItems.every((item) => !fileTreeRowById.has(item.rowId))) {
scheduleRefresh();
}
return true;
}
// non-local sources removed; only local_folder path above
postToHost("tree.filetree.delete", {
workspaceId,
rowIds: deletableItems.map((item) => item.rowId),
@@ -823,21 +809,8 @@ function startTreeShellRuntime() {
copy: fileTreeClipboard.action === "copy",
});
if (!accepted) return;
if (sourceKind === "convex_workspace") {
const sourceRowIds = filterRedundantFileTreeRowIds(fileTreeClipboard.rowIds);
for (const rowId of sourceRowIds) {
const sourceItem = fileTreeRowById.get(rowId);
const documentId = getFileTreeRowDocumentId(sourceItem);
if (!documentId) continue;
await sendCommand({
action: fileTreeClipboard.action === "copy" ? "copy" : "move",
workspaceId,
documentId,
parentId: target.documentId || null,
targetParentId: target.documentId || null,
sortOrder: 0,
});
}
if (false) {
// paste: local_folder only
if (fileTreeClipboard.action === "cut") {
fileTreeClipboard = { action: null, rowIds: [] };
}
@@ -1944,7 +1917,7 @@ function startTreeShellRuntime() {
target: { documentId },
payload: { documentId },
});
if (sourceKind === "convex_workspace" && applyCreatedDocumentLocally(result, parentId, title)) {
if (sourceKind === "local_folder" && applyCreatedDocumentLocally(result, parentId, title)) {
if (mode === "filetree") {
beginInlineRename("filetree", `doc:${documentId}`);
} else {