Magic Notes can now show a default-on incomplete todo badge in the primary navigation. The badge hides at zero, caps its visual label at 99+ while retaining the exact accessible count, and refreshes after user or Agent/MCP note changes. Platform Features > Magic Notes includes a persistent switch that hides only the count without changing notes or the Magic Notes entry. Existing settings migrate with the count enabled. Release note: 左侧“魔法笔记”入口现在可显示未完成待办数量;可在“平台功能 → 魔法笔记”中关闭,超过 99 项显示“99+”。
80 lines
1.9 KiB
TypeScript
80 lines
1.9 KiB
TypeScript
import { z } from 'zod'
|
|
import { magicNoteCommentFormatSchema } from './magic-notes-contracts'
|
|
import { modelDownloadSourceSchema } from './model-download-contracts'
|
|
import { settingsWarningsSchema } from './settings-warning-contracts'
|
|
|
|
export {
|
|
modelDownloadSourceSchema,
|
|
type ModelDownloadSource
|
|
} from './model-download-contracts'
|
|
|
|
export const magicNoteCommentModeSchema = z.enum([
|
|
'immediate',
|
|
'after-save-auto',
|
|
'after-save-manual'
|
|
])
|
|
|
|
export type MagicNoteCommentMode = z.infer<
|
|
typeof magicNoteCommentModeSchema
|
|
>
|
|
|
|
export const updateSourceSchema = z.enum([
|
|
'github',
|
|
'mirror'
|
|
])
|
|
export type UpdateSource = z.infer<typeof updateSourceSchema>
|
|
|
|
const applicationPreferencesSchema = z
|
|
.object({
|
|
checkUpdatesOnStartup: z.boolean(),
|
|
updateSource: updateSourceSchema,
|
|
modelDownloadSource: modelDownloadSourceSchema,
|
|
magicNotesEnabled: z.boolean(),
|
|
magicNotesShowIncompleteTodoCount: z.boolean(),
|
|
magicNoteCommentMode: magicNoteCommentModeSchema,
|
|
magicNoteCommentFormat: magicNoteCommentFormatSchema
|
|
})
|
|
.strict()
|
|
|
|
export const applicationSettingsSchema = applicationPreferencesSchema
|
|
.extend({
|
|
warnings: settingsWarningsSchema.optional()
|
|
})
|
|
.strict()
|
|
|
|
export const applicationSettingsUpdateSchema = applicationPreferencesSchema
|
|
.partial()
|
|
.refine((input) => Object.keys(input).length > 0, {
|
|
message: 'At least one application setting is required'
|
|
})
|
|
|
|
export type ApplicationSettings = z.infer<
|
|
typeof applicationSettingsSchema
|
|
>
|
|
|
|
export type ApplicationSettingsUpdate = z.infer<
|
|
typeof applicationSettingsUpdateSchema
|
|
>
|
|
|
|
|
|
export type VersionCheckFile = {
|
|
name: string
|
|
size: number
|
|
sha256: string
|
|
}
|
|
|
|
export type VersionCheckTarget = {
|
|
platform: 'windows' | 'macos' | 'linux'
|
|
arch: 'x64' | 'arm64'
|
|
formats: string[]
|
|
files: VersionCheckFile[]
|
|
}
|
|
|
|
export type VersionCheckResult = {
|
|
updateAvailable: boolean
|
|
currentVersion: string
|
|
latestVersion: string
|
|
releaseUrl: string
|
|
target: VersionCheckTarget
|
|
}
|