Repository: nutstore/obsidian-nutstore-sync Branch: main Commit: 4617bc966db2 Files: 231 Total size: 3.2 MB Directory structure: gitextract_y4gmj5jl/ ├── .github/ │ └── workflows/ │ ├── changelog.yml │ ├── ci.yml │ ├── release.yml │ └── update-changelog-version.yml ├── .gitignore ├── .prettierrc ├── .swcrc ├── .vscode/ │ └── settings.json ├── CHANGELOG.md ├── LICENSE ├── README.md ├── esbuild.config.mjs ├── manifest.json ├── package.json ├── packages/ │ ├── chatbox/ │ │ ├── package.json │ │ ├── postcss.config.mjs │ │ ├── rslib.config.ts │ │ ├── src/ │ │ │ ├── App.tsx │ │ │ ├── assets/ │ │ │ │ └── styles/ │ │ │ │ └── global.css │ │ │ ├── components/ │ │ │ │ ├── ConfirmDialog.tsx │ │ │ │ ├── ContentParts.tsx │ │ │ │ ├── CopyButton.tsx │ │ │ │ ├── FragmentDivider.tsx │ │ │ │ ├── MarkdownContent.tsx │ │ │ │ ├── MessageCard.tsx │ │ │ │ ├── PaneResizer.tsx │ │ │ │ ├── PendingList.tsx │ │ │ │ ├── RunStateCard.tsx │ │ │ │ ├── SessionHistoryItem.tsx │ │ │ │ ├── TaskCard.tsx │ │ │ │ └── TasksPanel.tsx │ │ │ ├── i18n/ │ │ │ │ ├── index.ts │ │ │ │ └── locales/ │ │ │ │ ├── en.ts │ │ │ │ └── zh.ts │ │ │ ├── index.tsx │ │ │ ├── types.ts │ │ │ └── utils.ts │ │ ├── tsconfig.json │ │ └── unocss.config.ts │ └── webdav-explorer/ │ ├── package.json │ ├── postcss.config.mjs │ ├── rslib.config.ts │ ├── src/ │ │ ├── App.tsx │ │ ├── assets/ │ │ │ └── styles/ │ │ │ └── global.css │ │ ├── components/ │ │ │ ├── File.tsx │ │ │ ├── FileList.tsx │ │ │ ├── Folder.tsx │ │ │ └── NewFolder.tsx │ │ ├── i18n/ │ │ │ ├── index.ts │ │ │ └── locales/ │ │ │ ├── en.ts │ │ │ └── zh.ts │ │ └── index.tsx │ ├── tsconfig.json │ └── unocss.config.ts ├── pnpm-workspace.yaml ├── src/ │ ├── ai/ │ │ ├── bash/ │ │ │ ├── fs.ts │ │ │ ├── runtime.test.ts │ │ │ └── runtime.ts │ │ ├── config.test.ts │ │ ├── config.ts │ │ ├── file-operation.ts │ │ ├── models-api.json │ │ ├── permission-guard.test.ts │ │ ├── permission-guard.ts │ │ ├── providers/ │ │ │ ├── openai.ts │ │ │ ├── registry.ts │ │ │ └── types.ts │ │ ├── runtime.ts │ │ ├── search-path-filter.ts │ │ ├── tool-call-repeat.ts │ │ ├── tools.test.ts │ │ ├── tools.ts │ │ ├── transport/ │ │ │ ├── obsidian-fetch.test.ts │ │ │ └── obsidian-fetch.ts │ │ ├── tree.test.ts │ │ ├── tree.ts │ │ └── types.ts │ ├── api/ │ │ ├── delta.ts │ │ ├── latestDeltaCursor.ts │ │ └── webdav.ts │ ├── assets/ │ │ └── styles/ │ │ └── global.css │ ├── chat/ │ │ └── domain.ts │ ├── chatbox/ │ │ └── types.ts │ ├── components/ │ │ ├── AIPermissionModal.ts │ │ ├── CacheClearModal.ts │ │ ├── CacheRestoreModal.ts │ │ ├── CacheSaveModal.ts │ │ ├── DeleteConfirmModal.ts │ │ ├── FailedTasksModal.ts │ │ ├── FilterEditorModal.ts │ │ ├── LogoutConfirmModal.ts │ │ ├── ModelEditorModal.ts │ │ ├── ProviderEditorModal.ts │ │ ├── ProvidersManagerModal.ts │ │ ├── SelectRemoteBaseDirModal.ts │ │ ├── SyncConfirmModal.ts │ │ ├── SyncProgressModal.ts │ │ ├── SyncRibbonManager.ts │ │ ├── TaskListConfirmModal.ts │ │ └── TextAreaModal.ts │ ├── consts.ts │ ├── events/ │ │ ├── index.ts │ │ ├── sso-receive.ts │ │ ├── sync-cancel.ts │ │ ├── sync-end.ts │ │ ├── sync-error.ts │ │ ├── sync-preparing.ts │ │ ├── sync-progress.ts │ │ ├── sync-start.ts │ │ ├── sync-update-mtime-progress.ts │ │ └── vault.ts │ ├── fs/ │ │ ├── fs.interface.ts │ │ ├── local-vault.ts │ │ ├── nutstore.ts │ │ └── utils/ │ │ ├── complete-loss-dir.ts │ │ └── is-root.ts │ ├── i18n/ │ │ ├── index.ts │ │ └── locales/ │ │ ├── en.ts │ │ └── zh.ts │ ├── index.ts │ ├── model/ │ │ ├── stat.model.ts │ │ └── sync-record.model.ts │ ├── polyfill.test.ts │ ├── polyfill.ts │ ├── services/ │ │ ├── cache.service.v1.ts │ │ ├── chat.service.test.ts │ │ ├── chat.service.ts │ │ ├── command.service.ts │ │ ├── events.service.ts │ │ ├── i18n.service.ts │ │ ├── logger.service.ts │ │ ├── progress.service.ts │ │ ├── realtime-sync.service.ts │ │ ├── scheduled-sync.service.ts │ │ ├── status.service.ts │ │ ├── sync-executor.service.ts │ │ └── webdav.service.ts │ ├── settings/ │ │ ├── account.ts │ │ ├── ai.ts │ │ ├── cache.ts │ │ ├── common.ts │ │ ├── filter.ts │ │ ├── index.ts │ │ ├── log.ts │ │ └── settings.base.ts │ ├── shims/ │ │ └── node-zlib.ts │ ├── storage/ │ │ ├── blob.ts │ │ ├── index.ts │ │ ├── kv.ts │ │ ├── sync-record.ts │ │ └── use-storage.ts │ ├── sync/ │ │ ├── core/ │ │ │ ├── merge-utils.test.ts │ │ │ └── merge-utils.ts │ │ ├── decision/ │ │ │ ├── base.decider.ts │ │ │ ├── has-folder-content-changed.ts │ │ │ ├── sync-decision.interface.ts │ │ │ ├── two-way.decider.function.ts │ │ │ └── two-way.decider.ts │ │ ├── index.ts │ │ ├── tasks/ │ │ │ ├── adapter-tasks.test.ts │ │ │ ├── clean-record.task.ts │ │ │ ├── conflict-resolve.task.ts │ │ │ ├── filename-error.task.ts │ │ │ ├── mkdir-local.task.ts │ │ │ ├── mkdir-remote.task.ts │ │ │ ├── mkdirs-remote.task.ts │ │ │ ├── noop.task.ts │ │ │ ├── pull.task.ts │ │ │ ├── push.task.ts │ │ │ ├── remove-local.task.ts │ │ │ ├── remove-remote-recursively.task.ts │ │ │ ├── remove-remote.task.ts │ │ │ ├── skipped.task.ts │ │ │ └── task.interface.ts │ │ └── utils/ │ │ ├── has-ignored-in-folder.ts │ │ ├── is-mergeable-path.ts │ │ ├── merge-mkdir-tasks.ts │ │ ├── merge-remove-remote-tasks.ts │ │ ├── update-records.test.ts │ │ └── update-records.ts │ ├── types/ │ │ └── obsidian-extended.d.ts │ ├── utils/ │ │ ├── api-limiter.ts │ │ ├── apply-deltas-to-stats.ts │ │ ├── breakable-sleep.ts │ │ ├── config-dir-rules.test.ts │ │ ├── config-dir-rules.ts │ │ ├── create-id.ts │ │ ├── decrypt-ticket-response.ts │ │ ├── deep-stringify.ts │ │ ├── file-stat-to-stat-model.ts │ │ ├── format-relative-time.ts │ │ ├── get-db-key.ts │ │ ├── get-root-folder-name.ts │ │ ├── get-task-name.ts │ │ ├── glob-match.test.ts │ │ ├── glob-match.ts │ │ ├── has-invalid-char.ts │ │ ├── is-503-error.ts │ │ ├── is-numeric.ts │ │ ├── is-same-time.ts │ │ ├── is-sub.ts │ │ ├── logger.ts │ │ ├── logs-stringify.ts │ │ ├── merge-dig-in.ts │ │ ├── mime/ │ │ │ └── is_markdown_path.ts │ │ ├── mkdirs-vault.ts │ │ ├── mkdirs-webdav.ts │ │ ├── ns-api.ts │ │ ├── rate-limited-client.ts │ │ ├── remote-path-to-absolute.ts │ │ ├── remote-path-to-local-path.ts │ │ ├── request-url.ts │ │ ├── sha256.ts │ │ ├── sleep.ts │ │ ├── stat-vault-item.ts │ │ ├── stat-webdav-item.ts │ │ ├── std-remote-path.ts │ │ ├── traverse-local-vault.ts │ │ ├── traverse-webdav.ts │ │ ├── types.ts │ │ ├── uint8array-to-arraybuffer.ts │ │ ├── vault-adapter-utils.test.ts │ │ └── wait-until.ts │ ├── views/ │ │ └── chatbox.view.ts │ └── webdav-patch.ts ├── test/ │ └── mocks/ │ └── obsidian.ts ├── tsconfig.json ├── uno.config.ts ├── version-bump.mjs ├── versions.json └── vitest.config.ts ================================================ FILE CONTENTS ================================================ ================================================ FILE: .github/workflows/changelog.yml ================================================ name: Generate Changelog on: push: tags: - "*" permissions: contents: write jobs: generate_changelog: runs-on: ubuntu-latest if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }} steps: - name: Checkout Code uses: actions/checkout@v4 with: fetch-depth: 0 token: ${{ secrets.GITHUB_TOKEN }} - name: Set up Git user run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" - name: Get release context id: release_context shell: bash run: | set -euo pipefail CURRENT_TAG=${GITHUB_REF#refs/tags/} PREVIOUS_TAG=$(git tag --sort=-v:refname | grep -A 1 "^${CURRENT_TAG}$" | tail -n 1 || true) if [ -n "$PREVIOUS_TAG" ] && [ "$PREVIOUS_TAG" != "$CURRENT_TAG" ]; then COMMIT_RANGE="${PREVIOUS_TAG}..${CURRENT_TAG}" echo "Collecting commits from ${COMMIT_RANGE}" else COMMIT_RANGE="HEAD~20..HEAD" echo "No previous tag found. Falling back to ${COMMIT_RANGE}" fi COMMIT_LOG=$(git log "$COMMIT_RANGE" --pretty=format:"- %s" --no-merges | grep -E "^- (feat|fix|refactor)(\(.+\))?:" || true) echo "current_tag=$CURRENT_TAG" >> "$GITHUB_OUTPUT" echo "previous_tag=$PREVIOUS_TAG" >> "$GITHUB_OUTPUT" echo "commit_range=$COMMIT_RANGE" >> "$GITHUB_OUTPUT" echo "commits<> "$GITHUB_OUTPUT" printf '%s\n' "$COMMIT_LOG" >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" echo "Raw commits fetched:" printf '%s\n' "$COMMIT_LOG" - name: Generate changelog with Gemini id: ai_changelog if: steps.release_context.outputs.commits != '' env: GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} COMMIT_MESSAGES: ${{ steps.release_context.outputs.commits }} shell: bash run: | set -euo pipefail MODEL="gemini-3-flash-preview" MAX_RETRIES=3 RETRY_DELAY=5 SUCCESS=false SYSTEM_PROMPT=$(cat <<'EOF' You generate release changelog entries from git commits. Output only Markdown bullet points. Requirements: - Write Chinese first, then English in the same bullet. - Focus on user-facing changes, features, fixes, and important refactors. - Group related commits into concise bullets. - Do not invent changes not present in the commits. - Do not include headings, introductions, or code fences. - Keep the output suitable for CI logs and CHANGELOG.md. EOF ) COMMIT_LINES=$(printf '%s\n' "$COMMIT_MESSAGES" | grep -c '^- ' || true) if [ "$COMMIT_LINES" -le 0 ]; then echo "No eligible commit lines found." exit 0 fi MAX_OUTPUT_TOKENS=$((500 + (COMMIT_LINES * 80))) if [ "$MAX_OUTPUT_TOKENS" -gt 4096 ]; then MAX_OUTPUT_TOKENS=4096 fi for ATTEMPT in $(seq 1 "$MAX_RETRIES"); do echo "Attempt $ATTEMPT of $MAX_RETRIES" JSON_PAYLOAD=$(jq -n \ --arg system_prompt "$SYSTEM_PROMPT" \ --arg commit_messages "$COMMIT_MESSAGES" \ --argjson max_output_tokens "$MAX_OUTPUT_TOKENS" \ '{ system_instruction: { parts: [ { text: $system_prompt } ] }, contents: [ { role: "user", parts: [ { text: ("Commit messages:\n\n" + $commit_messages) } ] } ], generationConfig: { maxOutputTokens: $max_output_tokens, topP: 0.95, thinkingConfig: { thinkingBudget: 0 } }, safetySettings: [ { category: "HARM_CATEGORY_DANGEROUS_CONTENT", threshold: "BLOCK_NONE" } ] }') API_ENDPOINT="https://generativelanguage.googleapis.com/v1beta/models/${MODEL}:generateContent" HTTP_CODE=$(curl -sS -o gemini_response.json -w "%{http_code}" \ -X POST "$API_ENDPOINT" \ -H "x-goog-api-key: ${GEMINI_API_KEY}" \ -H "Content-Type: application/json" \ --data "$JSON_PAYLOAD") echo "Gemini HTTP status: $HTTP_CODE" echo "Gemini Raw Response:" cat gemini_response.json if [ "$HTTP_CODE" -lt 200 ] || [ "$HTTP_CODE" -ge 300 ]; then echo "Gemini API returned non-2xx status." sleep "$RETRY_DELAY" continue fi ERROR_MSG=$(jq -r '.error.message // empty' gemini_response.json) if [ -n "$ERROR_MSG" ]; then echo "API Error: $ERROR_MSG" sleep "$RETRY_DELAY" continue fi GENERATED_TEXT=$(jq -r '[.candidates[0].content.parts[]? | select(has("text")) | .text] | join("\n")' gemini_response.json | sed '/^[[:space:]]*$/d') FINISH_REASON=$(jq -r '.candidates[0].finishReason // empty' gemini_response.json) THOUGHTS_TOKENS=$(jq -r '.usageMetadata.thoughtsTokenCount // 0' gemini_response.json) echo "Finish reason: ${FINISH_REASON:-}" echo "Thought tokens: $THOUGHTS_TOKENS" if [ -z "$GENERATED_TEXT" ]; then echo "Empty response from Gemini." sleep "$RETRY_DELAY" continue fi if [ "$FINISH_REASON" = "MAX_TOKENS" ]; then echo "Gemini output was truncated by MAX_TOKENS; retrying." sleep "$RETRY_DELAY" continue fi echo "Generated Changelog Text:" printf '%s\n' "$GENERATED_TEXT" { echo "changelog_entry<> "$GITHUB_OUTPUT" SUCCESS=true break done if [ "$SUCCESS" != "true" ]; then echo "Failed to generate changelog after ${MAX_RETRIES} attempts." exit 1 fi - name: Update CHANGELOG.md if: steps.ai_changelog.outputs.changelog_entry != '' env: GENERATED_CONTENT: ${{ steps.ai_changelog.outputs.changelog_entry }} shell: bash run: | set -euo pipefail CHANGELOG_FILE="CHANGELOG.md" UNRELEASED_HEADING="## [Unreleased]" if [ ! -f "$CHANGELOG_FILE" ]; then cat > "$CHANGELOG_FILE" <<'EOF' # Changelog All notable changes to this project will be documented in this file. ## [Unreleased] EOF fi if grep -Fq "$UNRELEASED_HEADING" "$CHANGELOG_FILE"; then awk -v unreleased_heading="$UNRELEASED_HEADING" -v generated_content="$GENERATED_CONTENT" ' BEGIN { inserted = 0 } { print if (!inserted && $0 == unreleased_heading) { print "" print generated_content inserted = 1 } } ' "$CHANGELOG_FILE" > temp_changelog.md else awk -v unreleased_heading="$UNRELEASED_HEADING" -v generated_content="$GENERATED_CONTENT" ' NR <= 3 { print; next } NR == 4 { print "" print unreleased_heading print "" print generated_content print "" } { print } ' "$CHANGELOG_FILE" > temp_changelog.md fi mv temp_changelog.md "$CHANGELOG_FILE" echo "CHANGELOG.md updated." - name: Commit and push CHANGELOG.md if: steps.ai_changelog.outputs.changelog_entry != '' shell: bash run: | set -euo pipefail CHANGELOG_FILE="CHANGELOG.md" if git diff --quiet -- "$CHANGELOG_FILE"; then echo "No changes to ${CHANGELOG_FILE} to commit." exit 0 fi git add "$CHANGELOG_FILE" git commit -m "chore: update changelog for ${GITHUB_REF#refs/tags/} [skip ci]" git push origin HEAD:refs/heads/main ================================================ FILE: .github/workflows/ci.yml ================================================ name: CI on: pull_request: jobs: build: runs-on: ubuntu-latest permissions: contents: read packages: read steps: - uses: actions/checkout@v3 - name: Use Node.js uses: actions/setup-node@v3 with: node-version: '18.x' registry-url: 'https://npm.pkg.github.com' scope: '@nutstore' - name: Install pnpm uses: pnpm/action-setup@v2 with: version: latest - name: Install dependencies env: NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: pnpm install - name: Build plugin env: NS_NSDAV_ENDPOINT: ${{ vars.NS_NSDAV_ENDPOINT }} NS_DAV_ENDPOINT: ${{ vars.NS_DAV_ENDPOINT }} NUTSTORE_PAT: ${{ secrets.GITHUB_TOKEN }} NODE_ENV: production NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: pnpm run build - name: Check build artifacts run: | if [ ! -f main.js ] || [ ! -f manifest.json ] || [ ! -f styles.css ]; then echo "Error: Required build artifacts not found" exit 1 fi echo "Build successful! All required files generated." ================================================ FILE: .github/workflows/release.yml ================================================ name: Release Obsidian plugin on: push: tags: - '*' jobs: build: runs-on: ubuntu-latest environment: production permissions: contents: write packages: read steps: - uses: actions/checkout@v3 - name: Use Node.js uses: actions/setup-node@v3 with: node-version: '18.x' registry-url: 'https://npm.pkg.github.com' scope: '@nutstore' - name: Install pnpm uses: pnpm/action-setup@v2 with: version: latest - name: Build plugin env: NS_NSDAV_ENDPOINT: ${{ vars.NS_NSDAV_ENDPOINT }} NS_DAV_ENDPOINT: ${{ vars.NS_DAV_ENDPOINT }} NUTSTORE_PAT: ${{ secrets.GITHUB_TOKEN }} NODE_ENV: production NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | pnpm install pnpm run build - name: Package plugin run: | tag="${GITHUB_REF#refs/tags/}" mkdir ${{ github.event.repository.name }} cp main.js manifest.json styles.css ${{ github.event.repository.name }} zip -r ${{ github.event.repository.name }}-${tag}.zip ${{ github.event.repository.name }} tar -czf ${{ github.event.repository.name }}-${tag}.tar.gz ${{ github.event.repository.name }} - name: Create release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | tag="${GITHUB_REF#refs/tags/}" gh release create "$tag" \ --title="$tag" \ --draft \ main.js manifest.json styles.css \ ${{ github.event.repository.name }}-${tag}.zip \ ${{ github.event.repository.name }}-${tag}.tar.gz ================================================ FILE: .github/workflows/update-changelog-version.yml ================================================ name: Update Changelog Version on: release: types: [published] permissions: contents: write jobs: update-changelog: runs-on: ubuntu-latest steps: - name: Checkout main branch uses: actions/checkout@v4 with: ref: main # Explicitly checkout main branch fetch-depth: 0 token: ${{ secrets.GITHUB_TOKEN }} - name: Set up Git user run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" - name: Update version in CHANGELOG.md run: | echo "GITHUB_REF: $GITHUB_REF" # Get release version (without 'v' prefix if present) VERSION=${GITHUB_REF#refs/tags/} echo "After removing refs/tags/: $VERSION" VERSION=${VERSION#v} echo "After removing v prefix: $VERSION" echo "Current content before replacement:" cat CHANGELOG.md # Only replace "Unreleased" in the heading, not in other places sed -i "s/## \[Unreleased\]/## [$VERSION]/" CHANGELOG.md echo "Content after replacement:" cat CHANGELOG.md # Check if there are changes if git diff --quiet CHANGELOG.md; then echo "No changes were made to CHANGELOG.md" exit 1 fi # Commit and push changes git add CHANGELOG.md git commit -m "docs: update changelog version to $VERSION [skip ci]" git push origin HEAD:main # Update release description with CHANGELOG link CHANGELOG_URL="https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md#$VERSION" RELEASE_ID=$(jq --raw-output .release.id "$GITHUB_EVENT_PATH") # Add CHANGELOG link to release description curl \ -X PATCH \ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ -H "Accept: application/vnd.github.v3+json" \ "https://api.github.com/repos/${{ github.repository }}/releases/$RELEASE_ID" \ -d "{ \"body\": \"📝 View the changelog for this version: $CHANGELOG_URL\" }" ================================================ FILE: .gitignore ================================================ # Intellij *.iml .idea # npm node_modules # Exclude sourcemaps *.map # obsidian data.json # Exclude macOS Finder (System Explorer) View States .DS_Store # Local *.local *.log* # Environment variables .env # build output dist styles.css main.js ================================================ FILE: .prettierrc ================================================ { "semi": false, "singleQuote": true, "trailingComma": "all", "useTabs": true } ================================================ FILE: .swcrc ================================================ { "$schema": "https://swc.rs/schema.json", "jsc": { "parser": { "syntax": "ecmascript", "jsx": false, "dynamicImport": false, "privateMethod": false, "functionBind": false, "exportDefaultFrom": false, "exportNamespaceFrom": false, "decorators": false, "decoratorsBeforeExport": false, "topLevelAwait": false, "importMeta": false }, "target": "es5", "loose": false, "externalHelpers": false, "keepClassNames": false }, "minify": true } ================================================ FILE: .vscode/settings.json ================================================ { "editor.formatOnSave": true, "tailwindCSS.codeActions": false, "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.codeActionsOnSave": { "source.organizeImports": "explicit", "source.removeUnusedImports": "explicit" }, "[typescript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[json]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[jsonc]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[css]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[yaml]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[markdown]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "cSpell.words": ["fflate", "jedec", "Mkdirs", "Nutstore", "webdav"], "i18n-ally.localesPaths": [ "src/i18n", "src/i18n/locales", "packages/webdav-explorer/src/i18n", "packages/webdav-explorer/src/i18n/locales" ] } ================================================ FILE: CHANGELOG.md ================================================ # Changelog 本项目的所有重要更改都将记录在此文件中。All notable changes to this project will be documented in this file. ## [1.2.1] - 修复未选择会话时的默认模型应用问题 | Fixed default model application for empty unselected sessions. - 修复对话模型显示名称记录问题,并确保任务运行使用模型 ID | Fixed chat model display name recording and ensured model IDs are used for task runs. - 修复用户配置目录过滤规则失效的问题 (#123) | Fixed an issue where user configuration directory filter rules were not being respected (#123). - 重构 AI 配置为基于记录的结构并支持预设功能 | Refactored AI configuration to a record-based structure with support for presets. - 新增聊天框功能区 (Ribbon) | Added a new ribbon interface for the chatbox. ## [1.2.0] - 2026-04-28 - 新增 AI 助手主流程与 Agent loop,支持多轮任务执行、会话管理、任务状态展示,以及消息删除、重新生成、召回与复制等交互。 / Added the core AI assistant flow and Agent loop, including multi-step task execution, session management, task status views, and message actions such as delete, regenerate, recall, and copy. - 新增 AI Provider 配置与管理能力,完善模型与提供商设置结构、必填/选填提示、校验与错误处理,并加入权限确认弹窗与可逆操作保护。 / Added AI provider configuration and management, with reworked model/provider settings, required or optional field indicators, stronger validation and error handling, plus a permission modal and safeguards for reversible operations. - 新增 Vault Bash 执行环境与相关工具增强,改进 Bash 输出处理、文本内容展示,以及 `collectTreeItems` 的深度和数量限制支持。 / Added a Vault Bash execution environment and improved related tools, including better Bash output handling, clearer text rendering, and support for depth and limit parameters in `collectTreeItems`. - 新增配置目录同步规则与设置,允许更细致地控制 config 目录同步行为,并补充跨平台适配与基于 Adapter API 的文件系统重构。 / Added config directory sync rules and settings for finer control over config synchronization, along with cross-platform fixes and filesystem refactoring based on the Adapter API. - 优化聊天与命令界面体验,加入可拖拽输入区、命令按钮图标、聊天消息卡片与历史任务面板,提升 AI 交互可用性。 / Improved the chat and command UI with a resizable input pane, command button icons, chat message cards, and session task panels for a better AI experience. - 改进同步冲突处理与文件操作能力,引入 DiffMatchPatchOrSkip 策略,并增强本地 Vault 文件操作与搜索路径过滤等底层支持。 / Improved conflict resolution and file operations with the new DiffMatchPatchOrSkip strategy, alongside stronger local vault handling and search path filtering support. ## [1.1.3] - 2026-02-14 - 优化了设置访问的稳定性和错误处理。 - 优化账户同步流程:在同步前增加配置校验,引导用户前往设置页面。 - Improved stability and error handling for settings access. - Enhanced account sync workflow: Added configuration validation before sync and guided users to settings page. ## [1.1.2] - 2026-02-11 - **新增对 traverseWebDAV 缓存清理的支持** - **Added support for clearing the traverseWebDAV cache** ## [1.1.1] - 2026-02-10 - 修复:增强了 HTML 实体解码支持,提升了对特殊字符的处理能力。 - Fix: Enhanced HTML entity decoding support, improving special character handling. ## [1.1.0] - 2026-02-05 ### 新增功能 / Features - 新增可恢复的 WebDAV 遍历功能,支持大规模目录树的高效扫描。 - 新增失败任务弹窗,集中展示同步错误信息。 - 新增同步准备事件,提供更细致的同步状态反馈。 - 新增删除确认设置,允许在自动同步时控制是否显示删除确认。 - 新增显示相对时间功能,改善时间显示的可读性。 - 新增更多任务图标,丰富任务类型的视觉反馈。 - 新增文件跳过原因显示(文件大小、被忽略项等),提升同步透明度。 - Added resumable WebDAV traversal for efficient large directory tree scanning. - Added failed tasks modal to centralize sync error information display. - Added sync preparing event for more detailed sync status feedback. - Added delete confirmation setting to control confirmation display during auto-sync. - Added relative time display for improved time readability. - Added more task icons to enrich visual feedback for task types. - Added skip reason display (file size, ignored items, etc.) to improve sync transparency. ### 修复 / Fixes - 修复同步进度弹窗按钮未定义的问题。 - 修复 FilterEditorModal 描述显示问题。 - 修复文件大小限制判断逻辑。 - 修复 traverseWebDAVKV 异步等待问题。 - 修复 delta 增量获取不完整的问题,确保持续检索直到无更多可用数据。 - 修复节点键值的标准化问题。 - 修复取消检测在确认前的问题。 - 修复可恢复遍历的返回值。 - 修复远程目录创建前的文件名有效性检查。 - Fixed undefined button reference in SyncProgressModal. - Fixed FilterEditorModal description display issue. - Fixed file size limit logic. - Fixed traverseWebDAVKV async await issue. - Fixed incomplete delta retrieval, ensuring continuous retrieval until no more data is available. - Fixed node key normalization issue. - Fixed cancel detection before confirmation. - Fixed resumable traverse return value. - Fixed filename validity check before remote directory creation. ### 重构与优化 / Refactoring & Improvements - 重构并增强 glob 匹配逻辑,改进路径标准化。 - 重构 delta 应用逻辑,新增 applyDeltasToStats 工具函数。 - 移除 delta 缓存键值存储,简化架构。 - 改用 Vault API 进行文件操作,提升稳定性。 - 将语言设置从 Obsidian API 获取改为插件设置中配置。 - Refactored and enhanced glob matching logic with improved path normalization. - Refactored delta application logic and added applyDeltasToStats utility. - Removed delta cache key-value storage to simplify architecture. - Switched to Vault API for file operations to improve stability. - Changed language setting from Obsidian API to plugin settings configuration. ## [1.0.0] - 2025-12-29 - 功能: 分块执行同步任务并新增批量远端操作(批量建目录、递归删除)、覆盖推送与跳过冲突,显著提升大批量同步效率。/ Feature: Execute sync jobs in chunks with new batch remote operations (bulk mkdir, recursive delete), overwrite push, and conflict skipping to speed up large syncs. - 功能: 扩展 glob 规则和路径判定(Mergeable、Markdown、二进制文件),自动排除 configDir,并支持禁用间隔自动同步,增强策略可控性。/ Feature: Extended glob rules and path detection (mergeable, markdown, binary), auto-exclusion of configDir, and ability to disable interval auto sync for finer control. - 功能: 新增删除确认弹窗、将同步日志保存到 Vault,并在同步结束时显示 Close 状态,整体提升可用性与反馈。/ Feature: Added delete confirmation modal, saving sync logs to the vault, and showing Close instead of Hidden after sync to improve UX and feedback. - 修复: 保护忽略文件不被远端删除、修复缓存服务、记录跳过、进度上报与任务分块等问题,保证同步稳定性。/ Fix: Safeguarded ignored files from remote deletion and fixed cache service, record skipping, progress reporting, and chunked task handling to keep sync stable. - 优化: 使用 `fflate` 压缩缓存、以 SWC 支持 ES5、改进 ArrayBuffer 转换与时长 clamping,提供更快更兼容的运行体验。/ Improvement: Switched to `fflate` caching, compile with SWC for ES5 support, and improved ArrayBuffer conversion plus duration clamping for faster, more compatible runtime. ## [0.8.5] - 2025-12-02 - 功能: 允许跳过初始同步确认。/ Feature: Allow skipping initial sync confirmation. - 修复: 移除无用的卸载服务进程。/ Fix: Remove useless unload service process. - 优化: 优化记录更新的防抖性能。/ Refactor: Debounce record updates for performance. ## [0.8.4] - 2025-08-06 * **改进:** 实现了可配置的自动同步间隔。 * **修复:** 删除了孤立的记录。 * **内部优化:** 重构了同步决策架构,并添加了全面的 glob 匹配测试;对 `SyncRecord` 类进行了解耦和重构,提升了代码可维护性;改进了 `StatModel` 的类型安全性和修复了相关的类型问题;使用了 `path-browserify` 提升兼容性。 * **Improvements:** Implemented configurable auto-sync interval. * **Fixes:** Removed orphaned record. * **Internal Improvements:** Refactored sync decision architecture and added comprehensive glob matching tests; Decoupled and refactored the `SyncRecord` class for improved maintainability; Improved `StatModel` type safety and fixed related type issues; Used `path-browserify` for better compatibility. ## [0.8.3] - 2025-07-21 * 优化二进制文件检测:通过扩展名检查优化了二进制文件的检测。 * Optimized binary file detection: Improved binary file detection with extension checking. ## [0.8.2] - 2025-06-26 * **改进:** 提升了文件处理的稳定性,修复了 `PullTask` 执行方法中的错误。 * **改进:** 改进了 `deepStringify` 函数的错误处理,使其能够更好地处理 `Error` 对象。 * **Improvements:** Improved file handling stability, fixing errors in the `PullTask` execution method. * **Improvements:** Improved error handling in the `deepStringify` function to better manage `Error` objects. ## [0.8.1] - 2025-06-25 * **改进与修复:** * 更新了文件检索方法,提高了效率和稳定性。 * 优化了文件夹创建逻辑,减少了潜在错误。 * 增强了语言获取方法的健壮性,避免了潜在的运行时错误。 * **Improvements and Fixes:** * Updated file retrieval method for improved efficiency and stability. * Improved folder creation logic to reduce potential errors. * Enhanced robustness of language retrieval method to prevent potential runtime errors. ## [0.8.0] - 2025-06-23 * **改进:** * 优化同步流程,避免同步进度条被意外清空。 * 修复开始同步指令逻辑,使其更可靠。 * 统一英文翻译大小写格式,提升用户体验。 * 同步数据库时显示进度条,提升用户感知。 * **底层优化:** * 使用 Vault API 重构部分代码,提升效率和稳定性。 * 使用 `Setting` 组件替换 `h2` 元素,统一设置界面样式。 * 移除未使用的代码,精简代码库。 * 使用 `window.clearTimeout` 和 `window.setTimeout` 优化计时器管理。 * **Improvements:** * Optimized sync process to prevent unexpected clearing of the progress bar. * Fixed the logic of the start sync command for better reliability. * Unified capitalization in English translations for improved user experience. * Added a progress bar during database synchronization for better user feedback. * **Under the hood:** * Refactored parts of the code using the Vault API for improved efficiency and stability. * Replaced `h2` elements with the `Setting` component for consistent settings interface styling. * Removed unused code to streamline the codebase. * Optimized timer management using `window.clearTimeout` and `window.setTimeout`. ## [0.7.0] - 2025-05-14 * **特性** * 增强智能合并策略,提升冲突解决效率。 * 新增启动后自动同步选项,允许配置同步延迟。 * **修复** * 为 `updateMtimeInRecord` 方法增加错误处理,提高稳定性。 * 兼容 1.8.x 及更早版本。 --- * **Features** * Enhanced intelligent merge strategy for more efficient conflict resolution. * Added an option for automatic synchronization after startup, with configurable delay. * **Bug Fixes** * Improved stability of the `updateMtimeInRecord` method by adding error handling. * Ensured compatibility with versions 1.8.x and earlier. ## [0.6.1] - 2025-05-13 * 改进 Glob 匹配逻辑和性能 (重构文件系统结构) * Improve glob matching logic and performance (Refactored filesystem structure) ## [0.6.0] - 2025-05-09 * **新功能** * 解码文件路径中的 HTML Entity 编码 * 添加文件名错误任务,处理不支持的特殊字符 * 自动同步时不显示通知 * 添加过滤规则设置,支持包含和排除规则 * **Features** * Decode HTML entities in file paths * Add task for filename errors to handle unsupported special characters * Suppress notifications during automatic synchronization * Add filter rule settings with support for include and exclude rules ## [0.5.1] - 2025-04-30 * 修复:修复了 NutstorePlugin 类型不存在 'logs' 属性的问题。 * Fixed: Resolved an issue where the 'logs' property was missing from the NutstorePlugin type. * **功能改进:** * 实现了实时同步服务,并添加了相应的设置选项。 * 添加了 BaseSyncDecision 抽象类以支持同步决策逻辑。 * **错误修复:** * 更新了过滤器描述,移除了关于 globstar 的描述。 * 修复了生成的正则表达式标志,移除了默认的全局标志。 * 将 configDir 添加到过滤器规则中。 * **Features:** * Implemented a real-time synchronization service and added corresponding settings. * Added a BaseSyncDecision abstract class to support synchronization decision logic. * **Bug Fixes:** * Updated the filter description, removing the description about globstar. * Fixed the generated regular expression flags, removing the default global flag. * Added configDir to the filter rules. ## [0.4.2] - 2025-04-28 * 修复:优化实时保存同步记录功能,避免同步大量文件中断后需要重新读写。 * 修复:处理空目录或根目录情况。 * 修复:改进了 WebDAV 连接检查功能,现在可以处理 503 错误并提供相应的通知。 * Fixed: Optimized real-time saving of sync records to prevent rereading and rewriting after interruptions during large file synchronizations. * Fixed: Handled cases with empty or root directories. * Fixed: Improved WebDAV connection check to handle 503 errors and provide corresponding notifications. ## [0.4.1] - 2025-04-27 * 修复了首次同步时本地数据会覆盖远程数据的问题,现在会进行合并。 * Fixed an issue where local data would overwrite remote data during the initial synchronization. Now, the data will be merged. ## [0.4.0] - 2025-04-25 * 可以配置跳过大文件,避免 OOM;同步进度窗口可以取消同步和隐藏窗口;可选择性清除缓存。 * 串行保存 blob 数据,日志持久化。 * Configure skip large files to avoid OOM; The sync progress window can cancel sync and hide the window; Selectable cache clearing modal. * Serialize blob saving; Logs are now persistent. ## [0.3.2] - 2025-04-23 * 恢复同步记录后显示同步完成提示。 * 完善了同步记录功能,自动补充缺失文件夹的同步记录。 * 新增内存文件系统。 * 新增同步完成标记功能。 * 新增同步进度弹窗。 * 新增同步和终止命令。 * 优化了同步机制,包括可中断的 503 重试机制和睡眠函数,修复了大量任务并发读取文件时闪退的问题。 * Synchronization complete message is now displayed after synchronization records are restored. * Enhanced synchronization record functionality by automatically adding missing folder records. * Implemented an in-memory file system (memfs). * Added a synchronization completion marker. * Added a synchronization progress popup. * Added commands for starting and stopping synchronization. * Improved synchronization mechanism with interruptible 503 retry and sleep functions, fixing the crash issue when concurrently reading files with a large number of tasks. ## [0.3.1] - 2025-04-21 * 修复: * 仅导出当前 vault 的缓存 * 修复 delta 响应中的类型解析错误 * 功能: * 使用标准远程路径处理选择的远程路径,确保路径一致性 * 添加空操作任务以优化任务执行流程 * 添加松散同步模式,跳过同名且大小相同的文件 * Bug fixes: * Only export the cache of the current vault. * Fixed a type parsing error in delta responses. * Features: * Use standardized remote paths to ensure path consistency. * Added a no-op task to optimize task execution flow. * Added a loose synchronization mode to skip files with the same name and size. ## [0.3.0] - 2025-04-18 * **功能改进:** * 实现了 Indexed DB 缓存数据的导入导出功能,并支持保存到坚果云盘。 * 使用图标代替了选择文件夹的文本。 * 添加了日志界面。 * **问题修复:** * 修复了 stringify 导致的错误。 * **其他改进:** * 为生产模式添加了日志记录功能。 * 将设置模块重构为类。 * **Features:** * Implemented import and export of Indexed DB cache data, with support for saving to Nutstore Cloud. * Replaced folder selection text with an icon. * Added a log interface. * **Bug Fixes:** * Fixed an error caused by stringify. * **Other Improvements:** * Added logging functionality for production mode. * Refactored the settings module as a class. ## [0.2.3] - 2025-04-14 * 修复相对路径处理逻辑 * 为过滤器添加 flag * fix relative path bug * allow config flag for filter ## [0.2.2] - 2025-04-10 * 修复了部分旧环境下的兼容性问题 (通过 polyfill 数组方法)。 * 修复了导致移动端无法同步的问题。 * Fixed compatibility issues in some older environments (by polyfilling array methods). * Fixed an issue preventing synchronization on mobile devices. ## [0.2.1] - 2025-04-10 * 修正了相对路径的处理。 * Corrected handling of relative paths. ## [0.2.0] - 2025-04-09 * 简化了登录流程。 * 增加了自定义过滤功能。 * 支持自定义请求 URL。 * 增加了当同步任务过多时建议使用客户端的提示信息。 * 修复了 iOS 设备上无法通过浏览器进行 SSO 登录的问题。 * 修复了数值可能以科学记数法 (eNotation) 显示的问题。 * 更新了冲突解决策略的描述,增加了备份建议。 * 调整了差异匹配阈值。 * 对路径进行了编码以改善处理。 * Simplified the login process. * Added custom filtering capabilities. * Added support for custom request URLs. * Added a prompt suggesting client use for numerous sync tasks. * Fixed an issue preventing SSO login via browser on iOS devices. * Fixed an issue where numbers might display in scientific notation (eNotation). * Updated conflict resolution strategy descriptions to include a backup recommendation. * Adjusted the match threshold for diffs. * Encoded paths for improved handling. ## [0.1.0] - 2025-04-03 * 为冲突解决策略描述添加了备份建议。 * 改进了手动登录帮助链接的结构。 * 禁用了数字显示的科学计数法 (eNotation)。 * 更新了单点登录 (SSO) 组件 (使用 `@nutstore/sso-js`)。 * Added backup recommendation to conflict resolution strategy descriptions. * Improved the structure of the manual login help link. * Disabled scientific notation (eNotation) for number display. * Updated the Single Sign-On (SSO) component (using `@nutstore/sso-js`). ## [0.0.7] - 2025-03-28 * 新增:执行同步任务前增加确认步骤,通过包含说明文字的新弹窗进行确认。 * 新增:添加 `confirmBeforeSync` 设置项,用于控制是否在同步前进行确认。 * 改进:文件列表(FileList)现在可以同时显示文件和文件夹。 * 改进:为远程目录创建过程中遇到的错误添加了通知提示。 * 优化:优化了同步流程(包括远程目录存在性检查和记录清理)。 * Added a confirmation step before executing sync tasks, shown in a new modal with instructions. * Added a `confirmBeforeSync` setting to control the sync confirmation behavior. * Updated FileList to display both files and folders. * Added notifications for errors during remote directory creation. * Optimized the synchronization process (includes remote directory checks and record cleanup). ## [0.0.6] - 2025-03-25 * 提高了获取目录内容时的可靠性,增加了 API 速率限制和针对临时服务器错误 (503) 的自动重试机制。 * Improved reliability when fetching directory contents by adding API rate limiting and automatic retries for temporary server errors (503). ## [0.0.5] - 2025-03-21 * 修复:创建新文件夹后自动刷新列表。 * 功能:更新了坚果云单点登录(SSO)支持。 * Fix: Refresh list automatically after creating a new folder. * Feature: Updated Nutstore Single Sign-On (SSO) support. ## [0.0.4] - 2025-03-13 * 更新了单点登录 (SSO) 功能。 * Updated Single Sign-On (SSO) functionality. ## [0.0.3] - 2025-03-13 * **同步核心与进度** * 新增 同步状态管理、进度百分比显示、完成状态(含失败计数)和同步按钮视觉反馈。 * 新增 同步取消/停止功能。 * 新增 SSO(单点登录)用户界面。 * 新增 同步确认对话框及风险提示。 * 新增 在本地创建文件夹时,在远端也创建对应文件夹。 * 新增 同步任务失败时的本地化错误信息。 * 新增 对二进制文件进行哈希比较。 * 新增 针对 503 错误的重试机制。 * 优化 远程基础目录 (`remoteBaseDir`) 回退使用仓库名称。 * 优化 调整了 API 请求频率限制以提高稳定性。 * 修复 同步动画旋转方向错误。 * 修复 从正确的 `remoteBaseDir` 开始遍历文件。 * 修复 获取目录内容以正确处理服务器基础路径。 * **冲突处理** * 新增 冲突处理策略可选。 * 新增 冲突标记(支持 Git 风格及自定义),并保留原始内容格式。 * 新增 跳过空文件冲突。 * 优化 冲突解决支持可选的本地和远程文件状态信息。 * **文件处理** * 新增 文件属性中包含文件大小。 * 新增 获取目录内容支持分页。 * 修复 处理文件系统中的空文件状态。 * **其他** * 新增 插件图标。 * 新增 中英文文档及同步流程图。 * 修复 文本自动换行问题。 * 更新 插件名称。 * **Sync Core & Progress** * Added sync state management, progress percentage display, completion status (with failed count), and visual feedback for the sync button. * Added sync cancellation/stop functionality. * Added SSO (Single Sign-On) user interface. * Added sync confirmation dialog and risk warning. * Added remote folder creation when a local folder is created. * Added localized error messages for sync task failures. * Added hash comparison for binary files. * Added retry mechanism for 503 errors. * Improved `remoteBaseDir` to use the vault name as a fallback. * Adjusted API rate limiting parameters for better stability. * Fixed sync animation rotation direction. * Fixed walking from the correct `remoteBaseDir`. * Fixed `getDirectoryContents` to handle server base paths correctly. * **Conflict Handling** * Added selectable conflict resolution strategies. * Added conflict markers (supporting Git style and customization), preserving original content formatting. * Added skipping of blank file conflicts. * Improved conflict resolution to support optional local and remote file stats. * **File Handling** * Added file size to file properties. * Added pagination support for getting directory contents. * Fixed handling of empty file stats in the file system. * **Other** * Added plugin icons. * Added English and Chinese documentation, including a sync flowchart. * Fixed automatic word wrapping issues. * Updated plugin name. ## [0.0.2] - 2025-03-07 * **WebDAV:** * 新增 WebDAV 文件浏览器功能。 * 为 WebDAV 配置添加远程基础目录选择器。 * 支持通过环境变量配置 WebDAV。 * 提升 WebDAV 可靠性与性能(改进令牌处理、避免重复创建目录、修复 `nextLink` 解码问题)。 * **用户界面与体验:** * 移除同步模态框(SyncModal)组件。 * 改进移动端适配。 * 更新坚果云(Nutstore)设置界面。 * 统一界面文本的大小写。 * **其他:** * 为中文用户添加了帮助说明。 * 修复了访问 `configDir` 中配置值的问题。 * **WebDAV:** * Added a WebDAV file explorer feature. * Added a remote base directory selector for WebDAV configuration. * Enabled WebDAV configuration via environment variables. * Enhanced WebDAV reliability and performance (improved token handling, avoided duplicate mkdir, fixed `nextLink` decoding). * **User Interface & Experience:** * Removed the SyncModal component. * Improved mobile adaptability. * Updated the Nutstore Setting Tab UI. * Standardized capitalization in UI text. * **Other:** * Added Chinese help documentation (`help` for zh). * Fixed accessing configured value from `configDir`. ## [0.0.1] - 2025-02-26 * 新增 WebDAV 及本地文件同步功能,包括文件和文件夹的遍历、创建、删除(支持递归删除)以及基础的冲突解决机制。 * 改进同步冲突处理:增加解决策略,支持跳过空文件冲突,并在解决后更新记录。 * 增强同步用户体验: * 增加同步状态管理、进度百分比显示、加载动画(修复了旋转方向)及完成后的失败任务计数。 * 增加同步过程中的通知提示和本地化错误信息。 * 添加取消/停止同步按钮。 * 优化了同步状态的 UI 显示并添加了图标。 * 引入国际化 (i18n) 支持和语言切换功能。 * 添加 SSO (单点登录) 相关界面(后已隐藏)。 * 优化同步设置:远程目录将回退使用仓库名称。 * 修复了同步中处理服务器基本路径、空文件统计信息等问题。 * Added basic file synchronization for WebDAV and local vaults, including traversal, creation, deletion (with recursive support), and basic conflict resolution. * Improved sync conflict handling: added resolution strategies, support for skipping blank file conflicts, and record updates after resolution. * Enhanced sync user experience: * Added sync state management, progress percentage display, loading animation (fixed rotation direction), and failed task count on completion. * Added notifications during sync and localized error messages. * Added a cancel/stop sync button. * Improved the sync status UI and added icons. * Introduced internationalization (i18n) support and language switching functionality. * Added SSO (Single Sign-On) related UI (later hidden). * Improved sync setup: Remote base directory now falls back to using the vault name. * Fixed issues related to handling server base paths, empty file stats, etc., during synchronization. ================================================ FILE: LICENSE ================================================ GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software. A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public. The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version. An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU Affero General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Remote Network Interaction; Use with the GNU General Public License. Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements. You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see . ================================================ FILE: README.md ================================================ # 🔄 Nutstore Sync ## 简介 | Introduction 此插件允许您通过 WebDAV 协议将 Obsidian 笔记与坚果云进行双向同步。 _This plugin enables two-way synchronization between Obsidian notes and Nutstore via WebDAV protocol._ --- ## ✨ 主要特性 | Key Features - 🔄 **双向同步 | Two-way Sync** 高效地在多设备间同步笔记。 _Efficiently synchronize your notes across devices._ - ⚡ **增量同步 | Incremental Sync** 只传输更改过的文件,使大型笔记库也能快速同步。 _Fast updates that only transfer changed files, making large vaults sync quickly._ - 🔐 **单点登录 | Single Sign-On** 通过简单授权连接坚果云,无需手动输入 WebDAV 凭据。 _Connect to Nutstore with simple authorization instead of manually entering WebDAV credentials._ - 📁 **WebDAV 文件浏览器 | WebDAV Explorer** 远程文件管理的可视化界面。 _Visual file browser for remote file management._ - 🔀 **智能冲突解决 | Smart Conflict Resolution** 字符级比较自动合并可能的更改;支持基于时间戳的解决方案(最新文件优先)。 _Character-level comparison to automatically merge changes when possible. Option to use timestamp-based resolution (newest file wins)._ - 🚀 **宽松同步模式 | Loose Sync Mode** 优化对包含数千笔记的仓库的性能。 _Optimize performance for vaults with thousands of notes._ - 📦 **大文件处理 | Large File Handling** 设置大小限制以跳过大文件,提升性能。 _Set size limits to skip large files for better performance._ - 📊 **同步状态跟踪 | Sync Status Tracking** 清晰的同步进度和完成提示。 _Clear visual indicators of sync progress and completion._ - 📝 **详细日志 | Detailed Logging** 全面的故障排查日志。 _Comprehensive logs for troubleshooting._ - 🤖 **AI 智能助手 | AI Agent** 内置 AI 助手,可通过自然语言读取、编辑和管理 Vault 中的文件。 _Built-in AI assistant that can read, edit, and manage files in your vault through natural language._ --- ## 🤖 AI 智能助手 | AI Agent AI 助手是一个内置的智能代理,让你通过自然语言管理 Obsidian Vault。支持任意兼容 OpenAI 接口的服务商,可自主完成复杂的多步骤任务。 _The AI Agent is a built-in assistant that lets you manage your Obsidian vault through natural language. It supports any OpenAI-compatible provider and can handle complex, multi-step tasks autonomously._ Agent 在做出任何更改前都会请求用户确认。你可以逐条批准、按操作类型批准当前会话,或在设置中开启 *YOLO 模式* 全部自动通过。 _Before the agent makes any changes, it asks for your approval. You can approve individual operations, approve an operation type for the entire session, or enable _YOLO mode_ in settings to auto-approve everything._ **配置方法 | Setup:** 1. 打开插件设置 → **AI** 标签页 _Open plugin settings → **AI** tab_ 2. 添加 AI 服务商(支持任意兼容 OpenAI 接口的端点)并填写模型名称 _Add an AI provider (any OpenAI-compatible endpoint) and fill in the model name_ 3. 从左侧边栏打开 AI 对话框,开始对话 _Open the AI chat panel from the left sidebar and start chatting_ --- ## ⚠️ 注意事项 | Important Notes - ⏳ **首次同步 | Initial Sync** 首次同步可能需要较长时间(文件比较多时)。 _Initial sync may take longer (especially with many files)._ - 💾 **数据备份 | Backup** 请在同步之前备份。 _Please backup before syncing._ ================================================ FILE: esbuild.config.mjs ================================================ import postcss from '@deanc/esbuild-plugin-postcss' import UnoCSS from '@unocss/postcss' import dotenv from 'dotenv' import esbuild from 'esbuild' import fs, { readFileSync } from 'fs' import postcssMergeRules from 'postcss-merge-rules' import process from 'process' const pkgJson = JSON.parse(readFileSync('./package.json', 'utf-8')) dotenv.config() const prod = process.argv[2] === 'production' const renamePlugin = { name: 'rename-plugin', setup(build) { build.onEnd(async () => { const source = prod ? './dist/main.css' : './main.css' if (fs.existsSync(source)) { fs.renameSync(source, './styles.css') } }) }, } const context = await esbuild.context({ entryPoints: ['src/index.ts'], bundle: true, external: [ 'obsidian', 'electron', '@codemirror/autocomplete', '@codemirror/collab', '@codemirror/commands', '@codemirror/language', '@codemirror/lint', '@codemirror/search', '@codemirror/state', '@codemirror/view', '@lezer/common', '@lezer/highlight', '@lezer/lr', ], define: { 'process.env.NS_NSDAV_ENDPOINT': JSON.stringify( process.env.NS_NSDAV_ENDPOINT, ), 'process.env.NS_DAV_ENDPOINT': JSON.stringify(process.env.NS_DAV_ENDPOINT), 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || ''), 'process.env.PLUGIN_VERSION': JSON.stringify(pkgJson.version), }, format: 'cjs', target: 'es2018', logLevel: 'info', sourcemap: prod ? false : 'inline', treeShaking: true, outfile: prod ? 'dist/main.js' : 'main.js', minify: prod, platform: 'browser', plugins: [ postcss({ plugins: [UnoCSS(), postcssMergeRules()], }), renamePlugin, ], alias: { 'node:zlib': './src/shims/node-zlib.ts', }, }) if (prod) { await context.rebuild() process.exit(0) } else { await context.watch() } ================================================ FILE: manifest.json ================================================ { "id": "nutstore-sync", "name": "Nutstore Sync", "version": "1.2.1", "minAppVersion": "0.15.0", "description": "Sync your vault with Nutstore/坚果云 using WebDAV protocol.", "author": "nutstore", "authorUrl": "https://github.com/nutstore", "isDesktopOnly": false } ================================================ FILE: package.json ================================================ { "name": "obsidian-nutstore-sync", "version": "1.2.1", "main": "main.js", "scripts": { "dev": "run-p dev:*", "dev:plugin": "node esbuild.config.mjs", "dev:chatbox": "pnpm --filter chatbox dev", "dev:webdav-explorer": "pnpm --filter webdav-explorer dev", "build": "run-s build:webdav-explorer build:chatbox build:plugin", "build:chatbox": "pnpm --filter chatbox build", "build:webdav-explorer": "pnpm --filter webdav-explorer build", "build:plugin": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production && swc ./dist/main.js -o main.js", "version": "node version-bump.mjs && git add manifest.json versions.json", "test": "vitest" }, "devDependencies": { "@ai-sdk/openai": "^3.0.48", "@deanc/esbuild-plugin-postcss": "^1.0.2", "@electron/remote": "^2.1.2", "@nutstore/sso-js": "^0.0.8", "@swc/cli": "^0.7.9", "@swc/core": "^1.15.6", "@types/diff-match-patch": "^1.0.36", "@types/glob-to-regexp": "^0.4.4", "@types/lodash-es": "^4.17.12", "@types/node": "^16.11.6", "@types/path-browserify": "^1.0.3", "@types/ramda": "^0.30.2", "@typescript-eslint/eslint-plugin": "5.29.0", "@typescript-eslint/parser": "5.29.0", "@unocss/postcss": "66.1.0-beta.3", "@vitest/coverage-v8": "^3.1.2", "ai": "^6.0.149", "assert": "^2.1.0", "async-mutex": "^0.5.0", "blob-polyfill": "^9.0.20240710", "bottleneck": "^2.19.5", "buffer": "^6.0.3", "builtin-modules": "3.3.0", "bytes-iec": "^3.1.1", "chatbox": "workspace: *", "consola": "^3.4.0", "core-js": "^3.41.0", "crypto-browserify": "^3.12.1", "diff-match-patch": "^1.0.5", "dotenv": "^16.4.7", "esbuild": "0.17.3", "esbuild-sass-plugin": "^3.3.1", "fast-xml-parser": "^4.5.1", "fflate": "^0.8.2", "glob-to-regexp": "^0.4.1", "hash-wasm": "^4.12.0", "html-entities": "^2.6.0", "http-status-codes": "^2.3.0", "i18next": "^24.2.2", "js-base64": "^3.7.7", "just-bash": "^2.14.0", "localforage": "^1.10.0", "lodash-es": "^4.17.21", "node-diff3": "^3.1.2", "npm-run-all2": "^7.0.2", "obsidian": "latest", "ohash": "^1.1.4", "path-browserify": "^1.0.1", "postcss-merge-rules": "^7.0.4", "prettier": "^3.5.0", "ramda": "^0.30.1", "rxjs": "^7.8.1", "stream-browserify": "^3.0.0", "superjson": "^2.2.2", "tslib": "2.4.0", "typescript": "^5.9.3", "unocss": "66.1.0-beta.3", "uuid": "^13.0.0", "vitest": "^3.1.2", "webdav": "^5.7.1", "webdav-explorer": "workspace: *", "zod": "^4.3.6" }, "browser": { "path": "path-browserify", "stream": "stream-browserify", "buffer": "buffer", "crypto": "crypto-browserify" } } ================================================ FILE: packages/chatbox/package.json ================================================ { "name": "chatbox", "version": "0.0.0", "type": "module", "exports": { ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" } }, "module": "./dist/index.js", "types": "./dist/index.d.ts", "files": [ "dist" ], "scripts": { "build": "rslib build", "dev": "rslib build --watch" }, "devDependencies": { "@rsbuild/plugin-babel": "^1.0.4", "@rsbuild/plugin-solid": "^1.0.5", "@rslib/core": "^0.5.3", "@solid-primitives/i18n": "^2.2.0", "@solid-primitives/media": "^2.3.0", "@unocss/postcss": "66.1.0-beta.3", "typescript": "^5.8.2", "unocss": "66.1.0-beta.3" }, "dependencies": { "solid-js": "^1.9.5" } } ================================================ FILE: packages/chatbox/postcss.config.mjs ================================================ import UnoCSS from '@unocss/postcss' export default { plugins: [UnoCSS()], } ================================================ FILE: packages/chatbox/rslib.config.ts ================================================ import { pluginBabel } from '@rsbuild/plugin-babel' import { pluginSolid } from '@rsbuild/plugin-solid' import { defineConfig } from '@rslib/core' export default defineConfig({ source: { entry: { index: ['./src/**'], }, }, tools: { rspack: { plugins: [], }, }, lib: [ { bundle: false, dts: true, format: 'esm', }, ], output: { target: 'web', }, plugins: [ pluginBabel({ include: /\.(?:jsx|tsx)$/, }), pluginSolid(), ], }) ================================================ FILE: packages/chatbox/src/App.tsx ================================================ import { For, Match, Show, Switch, createEffect, createSignal, onCleanup, } from 'solid-js' import { ConfirmDialog } from './components/ConfirmDialog' import { FragmentDivider } from './components/FragmentDivider' import { MessageCard } from './components/MessageCard' import { PaneResizer } from './components/PaneResizer' import { PendingList } from './components/PendingList' import { RunStateCard } from './components/RunStateCard' import { SessionHistoryItem } from './components/SessionHistoryItem' import { TasksPanel } from './components/TasksPanel' import { t } from './i18n' import type { ChatTimelineFragmentItem, ChatTimelineMessageItem, ChatboxProps, } from './types' export type AppProps = ChatboxProps const DESKTOP_RESIZE_MEDIA_QUERY = '(pointer: fine) and (min-width: 1024px)' const INPUT_HEIGHT_STORAGE_KEY = 'nutstore-sync.chatbox.desktop-input-height' const DEFAULT_DESKTOP_INPUT_HEIGHT = 184 const DESKTOP_INPUT_MIN_HEIGHT = 120 const DESKTOP_INPUT_ABSOLUTE_MIN_HEIGHT = 72 const DESKTOP_MESSAGES_MIN_HEIGHT = 200 const RESIZER_HITBOX_HEIGHT = 10 const DESKTOP_INPUT_MAX_VIEWPORT_RATIO = 0.6 function App(props: AppProps) { const [input, setInput] = createSignal('') const [isComposing, setIsComposing] = createSignal(false) const [historyOpen, setHistoryOpen] = createSignal(false) const [tasksOpen, setTasksOpen] = createSignal(false) const [modelPickerOpen, setModelPickerOpen] = createSignal(false) const [sessionPendingDeleteId, setSessionPendingDeleteId] = createSignal() const [pendingDeleteMessage, setPendingDeleteMessage] = createSignal() const [pendingRegenerateMessage, setPendingRegenerateMessage] = createSignal() const [pendingRecallMessage, setPendingRecallMessage] = createSignal() const [desktopResizeEnabled, setDesktopResizeEnabled] = createSignal(false) const [inputPaneHeight, setInputPaneHeight] = createSignal() let messagesEl: HTMLDivElement | undefined let splitLayoutEl: HTMLDivElement | undefined let inputPaneEl: HTMLDivElement | undefined let historyEl: HTMLDivElement | undefined let modelPickerEl: HTMLDivElement | undefined let previousActiveSessionId = props.activeSessionId let defaultDesktopInputHeight = DEFAULT_DESKTOP_INPUT_HEIGHT let dragStartHeight = 0 const hasTasks = () => props.currentSessionTasks.length + props.otherSessionTasks.length > 0 const runningTaskCount = () => props.currentSessionTasks.filter((task) => task.status === 'running') .length + props.otherSessionTasks.filter((task) => task.status === 'running').length const isBusy = () => props.runState !== 'idle' const selectedProvider = () => props.providers.find((provider) => provider.id === props.selectedProviderId) const modelPickerLabel = () => { const provider = selectedProvider() const selectedModel = provider?.models.find( (model) => model.id === props.selectedModelId, ) return ( [provider?.name, selectedModel?.name].filter(Boolean).join('/') || t('noModel') ) } function readStoredInputPaneHeight() { try { const raw = window.localStorage.getItem(INPUT_HEIGHT_STORAGE_KEY) if (!raw) { return undefined } const value = Number(raw) return Number.isFinite(value) ? value : undefined } catch { return undefined } } function persistInputPaneHeight(height: number) { try { window.localStorage.setItem( INPUT_HEIGHT_STORAGE_KEY, String(Math.round(height)), ) } catch { // Ignore storage errors, resize should still work. } } function getMaxInputPaneHeight() { const viewportMax = Math.floor( window.innerHeight * DESKTOP_INPUT_MAX_VIEWPORT_RATIO, ) const splitHeight = splitLayoutEl?.getBoundingClientRect().height ?? 0 if (splitHeight <= 0) { return Math.max(DESKTOP_INPUT_MIN_HEIGHT, viewportMax) } const messagesBound = Math.floor( splitHeight - DESKTOP_MESSAGES_MIN_HEIGHT - RESIZER_HITBOX_HEIGHT, ) const maxHeight = Math.min(messagesBound, viewportMax) return Math.max(DESKTOP_INPUT_ABSOLUTE_MIN_HEIGHT, maxHeight) } function clampInputPaneHeight(height: number) { const maxHeight = getMaxInputPaneHeight() const minHeight = Math.min(DESKTOP_INPUT_MIN_HEIGHT, maxHeight) return Math.round(Math.min(Math.max(height, minHeight), maxHeight)) } function applyInputPaneHeight(height: number, persist = false) { const next = clampInputPaneHeight(height) setInputPaneHeight(next) if (persist) { persistInputPaneHeight(next) } return next } function resetInputPaneHeight() { if (!desktopResizeEnabled()) { return } applyInputPaneHeight(defaultDesktopInputHeight, true) } function onInputPaneResizeStart() { if (!desktopResizeEnabled()) { return } dragStartHeight = inputPaneHeight() ?? clampInputPaneHeight(defaultDesktopInputHeight) } function onInputPaneResize(deltaY: number) { if (!desktopResizeEnabled()) { return } applyInputPaneHeight(dragStartHeight + deltaY) } function onInputPaneResizeEnd() { const height = inputPaneHeight() if (typeof height === 'number') { persistInputPaneHeight(height) } } function scrollMessagesToBottom(behavior: ScrollBehavior = 'smooth') { requestAnimationFrame(() => { if (!messagesEl) { return } messagesEl.scrollTo({ top: messagesEl.scrollHeight, behavior, }) }) } createEffect(() => { const activeSessionId = props.activeSessionId props.timeline.length props.currentSessionTasks.length props.otherSessionTasks.length props.pendingMessages.length props.runState const behavior = previousActiveSessionId !== activeSessionId ? 'auto' : 'smooth' previousActiveSessionId = activeSessionId scrollMessagesToBottom(behavior) }) createEffect(() => { if (!hasTasks() && tasksOpen()) { setTasksOpen(false) } }) createEffect(() => { if (!historyOpen() && !modelPickerOpen()) { return } const onPointerDown = (event: PointerEvent) => { const target = event.target if (!(target instanceof Node)) { return } if (historyEl?.contains(target) || modelPickerEl?.contains(target)) { return } setHistoryOpen(false) setModelPickerOpen(false) } document.addEventListener('pointerdown', onPointerDown) onCleanup(() => document.removeEventListener('pointerdown', onPointerDown)) }) createEffect(() => { const mediaQuery = window.matchMedia(DESKTOP_RESIZE_MEDIA_QUERY) const update = () => setDesktopResizeEnabled(mediaQuery.matches) update() mediaQuery.addEventListener('change', update) onCleanup(() => mediaQuery.removeEventListener('change', update)) }) createEffect(() => { if (!desktopResizeEnabled() || !inputPaneEl) { return } defaultDesktopInputHeight = Math.round(inputPaneEl.getBoundingClientRect().height) || DEFAULT_DESKTOP_INPUT_HEIGHT const storedHeight = readStoredInputPaneHeight() applyInputPaneHeight(storedHeight ?? defaultDesktopInputHeight) }) createEffect(() => { if (desktopResizeEnabled()) { return } setInputPaneHeight(undefined) }) createEffect(() => { if (!desktopResizeEnabled()) { return } const onResize = () => { const height = inputPaneHeight() if (typeof height !== 'number') { return } const clampedHeight = clampInputPaneHeight(height) if (clampedHeight !== height) { applyInputPaneHeight(clampedHeight, true) } } window.addEventListener('resize', onResize) onCleanup(() => window.removeEventListener('resize', onResize)) }) async function submit() { const text = input().trim() if (!text || !props.canSend) { return } setInput('') scrollMessagesToBottom('auto') await props.onSendMessage(text) } async function confirmDeleteSession() { const sessionId = sessionPendingDeleteId() if (!sessionId) { return } setSessionPendingDeleteId(undefined) await props.onDeleteSession(sessionId) } const requestDeleteMessage = props.onDeleteMessage ? (messageId: string) => { const item = props.timeline.find( (i): i is ChatTimelineMessageItem => i.kind === 'message' && i.message.id === messageId, ) if (!item) return setPendingDeleteMessage(item) } : undefined const requestRegenerateMessage = props.onRegenerateMessage ? (messageId: string) => { const item = props.timeline.find( (i): i is ChatTimelineMessageItem => i.kind === 'message' && i.message.id === messageId, ) if (!item) return setPendingRegenerateMessage(item) } : undefined const requestRecallMessage = props.onRecallMessage ? (messageId: string) => { const item = props.timeline.find( (i): i is ChatTimelineMessageItem => i.kind === 'message' && i.message.id === messageId, ) if (!item) return setPendingRecallMessage(item) } : undefined async function doRecallMessage( item: ChatTimelineMessageItem, options?: { restoreFiles?: boolean }, ) { const text = (item.message.message.content ?? []) .filter((p) => p.type === 'text') .map((p) => (p as { type: 'text'; text: string }).text) .join('\n') setInput(text) await props.onRecallMessage?.(item.message.id, options) } async function confirmRecallMessage() { const item = pendingRecallMessage() if (!item) return setPendingRecallMessage(undefined) await doRecallMessage(item) } function confirmRegenerateMessage() { const item = pendingRegenerateMessage() if (!item) return setPendingRegenerateMessage(undefined) props.onRegenerateMessage?.(item.message.id) } function confirmDeleteMessage() { const item = pendingDeleteMessage() if (!item) return setPendingDeleteMessage(undefined) props.onDeleteMessage?.(item.message.id) } const deleteMessageConfirmText = () => { const item = pendingDeleteMessage() if (!item) return '' switch (item.message.message.role) { case 'user': return t('deleteUserMessageConfirm') case 'tool': return t('deleteToolMessageConfirm') default: return t('deleteAssistantMessageConfirm') } } const deleteMessageHasReversibleOps = () => Boolean(pendingDeleteMessage()?.message.reversibleOps?.length) const recallHasReversibleOps = () => { const item = pendingRecallMessage() if (!item) return false let seenTarget = false for (const timelineItem of props.timeline) { if (timelineItem.kind !== 'message') { if (seenTarget) { break } continue } if (!seenTarget) { seenTarget = timelineItem.message.id === item.message.id continue } if (timelineItem.message.reversibleOps?.length) { return true } } return item.message.reversibleOps?.length ? true : false } async function confirmRecallAndRestoreMessage() { const item = pendingRecallMessage() if (!item) return setPendingRecallMessage(undefined) await doRecallMessage(item, { restoreFiles: true }) } return (
{/* Header */}
{props.title || t('newChat')}
{t('provider')}
{t('model')}
{t('history')}
{(session) => ( { props.onSwitchSession(sessionId) setHistoryOpen(false) }} onDelete={(sessionId) => { setSessionPendingDeleteId(sessionId) }} /> )}
{/* Messages */}
0 || props.pendingMessages.length > 0 || isBusy() } fallback={
{t('empty')}
} >
{(item) => ( )}
{/* Input */}