Sync OneOS workspace with new prototypes, annotations, and Gitea remote fix.

Add vehicle-h2-fee-ledger, customer-management, lease and self-operated ledgers, annotation sources, agent skills, and vite annotation runtime support. Update vehicle management, contract templates, and lease contract flows.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
王冕
2026-06-30 15:27:23 +08:00
parent 00ca1846af
commit af29b26fe8
309 changed files with 73875 additions and 3838 deletions

View File

@@ -1,19 +1,37 @@
import { normalizePath, type HMRPayload, type Plugin, type ViteDevServer } from 'vite';
import { normalizePath, type HMRPayload, type HmrContext, type Plugin, type ViteDevServer } from 'vite';
type SendFunction = (...args: any[]) => void;
const CANVAS_ASSETS_SEGMENT = '/canvas-assets/';
const SPEC_SEGMENT = '/.spec/';
const ANNOTATION_SOURCE_FILE_NAME = '/annotation-source.json';
function cleanHotUpdatePath(filePath: string): string {
return normalizePath(filePath).split(/[?#]/u)[0] || '';
}
export function isCanvasHotUpdateFile(filePath: string): boolean {
const normalized = normalizePath(filePath);
const normalized = cleanHotUpdatePath(filePath);
return (
normalized.endsWith('.excalidraw')
|| normalized.endsWith(ANNOTATION_SOURCE_FILE_NAME)
|| normalized.includes(CANVAS_ASSETS_SEGMENT)
|| normalized.includes(SPEC_SEGMENT)
);
}
function isAnnotationSourceHotUpdateFile(filePath: string): boolean {
return cleanHotUpdatePath(filePath).endsWith(ANNOTATION_SOURCE_FILE_NAME);
}
function invalidateHotUpdateModules(ctx: HmrContext): void {
const moduleGraph = ctx.server?.moduleGraph;
if (!moduleGraph) return;
for (const module of ctx.modules) {
moduleGraph.invalidateModule(module, undefined, ctx.timestamp, true);
}
}
function extractPayloadPath(payload: HMRPayload): string | null {
if (!payload || typeof payload !== 'object') {
return null;
@@ -27,6 +45,33 @@ function extractPayloadPath(payload: HMRPayload): string | null {
return null;
}
function isCanvasUpdateRecord(update: unknown): boolean {
if (!update || typeof update !== 'object') {
return false;
}
const record = update as { path?: unknown; acceptedPath?: unknown };
return [record.path, record.acceptedPath].some((value) => (
typeof value === 'string' && isCanvasHotUpdateFile(value)
));
}
function filterCanvasUpdatePayload(payload: HMRPayload): HMRPayload | null {
if (!payload || typeof payload !== 'object' || payload.type !== 'update' || !Array.isArray((payload as any).updates)) {
return payload;
}
const updates = (payload as any).updates.filter((update: unknown) => !isCanvasUpdateRecord(update));
if (updates.length === 0) {
return null;
}
if (updates.length === (payload as any).updates.length) {
return payload;
}
return {
...(payload as any),
updates,
} as HMRPayload;
}
export function shouldDropCanvasFullReloadPayload(payload: HMRPayload): boolean {
if (!payload || typeof payload !== 'object' || payload.type !== 'full-reload') {
return false;
@@ -45,6 +90,13 @@ function patchSend(target: { send?: SendFunction } | null | undefined): void {
if (shouldDropCanvasFullReloadPayload(payload)) {
return;
}
const filteredPayload = filterCanvasUpdatePayload(payload);
if (!filteredPayload) {
return;
}
if (filteredPayload !== payload) {
return originalSend(filteredPayload, ...args.slice(1));
}
return originalSend(...args);
}) as SendFunction;
}
@@ -66,6 +118,9 @@ export function canvasHotUpdateFilterPlugin(): Plugin {
handleHotUpdate(ctx) {
if (isCanvasHotUpdateFile(ctx.file)) {
if (isAnnotationSourceHotUpdateFile(ctx.file)) {
invalidateHotUpdateModules(ctx);
}
return [];
}
return undefined;