Skip to content

feat(AIAgent): support EmbedPDF dependency updates - #1360

Merged
ArgoZhang merged 2 commits into
masterfrom
ArgoZhang/feat-pdf
Nov 26, 2026
Merged

ArgoZhang merged 2 commits into
masterfrom
ArgoZhang/feat-pdf

Conversation

@ArgoZhang

@ArgoZhang ArgoZhang commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Link issues

fixes #1359

Summary By Copilot

Register embedpdf in the update-dependency skill, including the official GitHub Release archive, stable-version lookup, runtime asset mapping, and guidance for validating and replacing the bundled assets safely.

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Documentation-only change to the dependency update workflow; no component runtime or package contents are changed.

Verification

  • Manual (required)
  • Automated

Commands/results:

  • git diff --check 80e174d9baefb88920677bb841c69a041adfb768...8de2bbce385822550e08b1ce83b34893440e47a5 — passed.
  • PowerShell version-query block in .agents/skills/update-dependency/SKILL.md with $dep = 'embedpdf' — passed; reported current 3.3.0 and latest 3.4.0.
  • No component build or browser smoke test was run because this change only updates the skill; no dependency assets were changed.

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Summary by Sourcery

Enable the dependency update workflow to safely manage EmbedPDF releases and bundled runtime assets.

New Features:

  • Add EmbedPDF as a supported dependency in the update-dependency workflow, including stable GitHub Release discovery and runtime asset mapping.

Enhancements:

  • Document safe validation, replacement, compatibility checks, and verification requirements for EmbedPDF browser assets.

Documentation:

  • Expand the dependency update skill with EmbedPDF version tracking, release archive guidance, and runtime asset update procedures.

@sourcery-ai

sourcery-ai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Documentation

Register EmbedPDF as a supported dependency and add its release metadata, parameter selection, and stable-version lookup so the update workflow can identify the current and latest versions.

  • .agents/skills/update-dependency/SKILL.md L57-61, L96-109 (+4 small edits)

Document how to verify and safely replace EmbedPDF runtime assets, validate compatibility and behavior, and report generated-file whitespace warnings.

  • .agents/skills/update-dependency/SKILL.md L175-182, L202-203

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@bb-auto bb-auto Bot added the enhancement New feature or request label Nov 26, 2026
@bb-auto bb-auto Bot added this to the v11.0.0 milestone Nov 26, 2026

@bb-auto bb-auto Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto approved by bb-auto

@ArgoZhang
ArgoZhang merged commit 814a104 into master Nov 26, 2026
3 checks passed
@ArgoZhang
ArgoZhang deleted the ArgoZhang/feat-pdf branch November 26, 2026 01:47
@sourcery-ai

sourcery-ai Bot commented Nov 26, 2026

Copy link
Copy Markdown

Linked issues

Checked at commit 8de2bbc

#1359 feat(AIAgent): support EmbedPDF dependency updates · 3 of 3 met

# Requirement Status Notes
1 Register the official EmbedPDF GitHub Release archive and version source ✅ Met The skill maps the official repository and embedpdf-viewer-dist.zip, reads the current version from wwwroot/readme.txt, and queries the latest stable Release.
2 Register the bundled runtime asset mapping ✅ Met The mapping covers the viewer entry point, workers, WASM, and chunks from the Release archive.
3 Provide verification and build guidance ✅ Met The skill documents archive and byte-integrity checks, safe replacement and stale-chunk handling, compatibility and runtime checks, and building the mapped component project.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 5 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path=".agents/skills/update-dependency/SKILL.md" line_range="179" />
<code_context>
+
+以 `wwwroot/readme.txt` 的版本和 `$release.tag_name` 分别从 `embedpdf/embed-pdf-viewer` 对应的正式 Release 获取 `embedpdf-viewer-dist.zip`,不要使用 npm 的 `@embedpdf/snippet` 或重新构建产物。核对 Release 标签、唯一资源名及下载文件的 SHA-256 与 Release 资源的 `digest` 一致;无法核实则暂停。先在系统临时目录安全解压,拒绝越界路径,确认归档内 `dist/embedpdf.js`、`dist/embedpdf-worker.js`、`dist/encoder-worker.js`、`dist/embedpdf.wasm` 和 `dist/chunks/*.js` 均存在,并检查入口与依赖引用;布局或运行时资源范围变化时先核实,不能机械套用旧映射。
+
+更新前,逐文件比较当前版本归档和仓库的运行时文件字节及文件集合,包括全部 `chunks/*.js`。若不一致,先说明差异并询问,不覆盖已有改动。目标版本核实后,将上述运行时文件作为一组按原字节替换,并删除仅属于旧版本、目标归档中已不存在的哈希 chunk;保留 `readme.txt` 和其他非上游文件,不添加 source map 或声明文件。更新 `readme.txt` 的版本和组件项目的 patch 版本。核对 `EmbedPDF.razor.js` 使用的默认导出、初始化配置、文档和 stage API、worker/WASM 路径及动态 chunk 引用;查看上游发布说明,若需要适配或跨大版本涉及不兼容变更,报告影响并等待用户确认适配范围。
+
+除构建外,使用适用的 Blazor 宿主或最小复现检查 PDF 加载、页码和滚动、切换文档、主题、语言及释放,并确认本地 worker、WASM 和动态 chunk 加载成功;明确区分最小复现和完整宿主验证。核对目标归档与替换后的全部运行时文件字节和集合,确认没有遗漏或过期 chunk。
</code_context>
<issue_to_address>
**PDF updates leave mixed files**

When two updates overlap, or an update stops partway through replacing runtime files, the updater writes runtime files and version markers individually, so interruption leaves a mixed tree and mismatched version records; the next update rejects the tree and the packaged viewer fails to load PDFs.

Stage the complete update, revalidate the current files before committing, and replace the runtime tree and version markers atomically.
</issue_to_address>

### Comment 2
<location path=".agents/skills/update-dependency/SKILL.md" line_range="179" />
<code_context>
+
+以 `wwwroot/readme.txt` 的版本和 `$release.tag_name` 分别从 `embedpdf/embed-pdf-viewer` 对应的正式 Release 获取 `embedpdf-viewer-dist.zip`,不要使用 npm 的 `@embedpdf/snippet` 或重新构建产物。核对 Release 标签、唯一资源名及下载文件的 SHA-256 与 Release 资源的 `digest` 一致;无法核实则暂停。先在系统临时目录安全解压,拒绝越界路径,确认归档内 `dist/embedpdf.js`、`dist/embedpdf-worker.js`、`dist/encoder-worker.js`、`dist/embedpdf.wasm` 和 `dist/chunks/*.js` 均存在,并检查入口与依赖引用;布局或运行时资源范围变化时先核实,不能机械套用旧映射。
+
+更新前,逐文件比较当前版本归档和仓库的运行时文件字节及文件集合,包括全部 `chunks/*.js`。若不一致,先说明差异并询问,不覆盖已有改动。目标版本核实后,将上述运行时文件作为一组按原字节替换,并删除仅属于旧版本、目标归档中已不存在的哈希 chunk;保留 `readme.txt` 和其他非上游文件,不添加 source map 或声明文件。更新 `readme.txt` 的版本和组件项目的 patch 版本。核对 `EmbedPDF.razor.js` 使用的默认导出、初始化配置、文档和 stage API、worker/WASM 路径及动态 chunk 引用;查看上游发布说明,若需要适配或跨大版本涉及不兼容变更,报告影响并等待用户确认适配范围。
+
+除构建外,使用适用的 Blazor 宿主或最小复现检查 PDF 加载、页码和滚动、切换文档、主题、语言及释放,并确认本地 worker、WASM 和动态 chunk 加载成功;明确区分最小复现和完整宿主验证。核对目标归档与替换后的全部运行时文件字节和集合,确认没有遗漏或过期 chunk。
</code_context>
<issue_to_address>
**Concurrent edits get overwritten**

When another user or update process changes a runtime file after the comparison but before replacement, the updater replaces the files based on its earlier comparison and overwrites the other actor’s changes, leaving that work lost from the working tree.

Recheck the working-tree files immediately before replacement and stop if they changed since comparison.
</issue_to_address>

### Comment 3
<location path=".agents/skills/update-dependency/SKILL.md" line_range="102" />
<code_context>
+    $currentVersion = $versionMatch.Groups['version'].Value
+    $releaseJson = gh api "repos/$packageName/releases/latest"
+    if ($LASTEXITCODE -ne 0) { throw "查询 $packageName Release 失败" }
+    $release = $releaseJson | ConvertFrom-Json
+    if ($release.draft -or $release.prerelease -or $release.tag_name -cnotmatch '^v(?<version>\d+\.\d+\.\d+)$') {
+        throw '最新 Release 不是可识别的稳定版本'
</code_context>
<issue_to_address>
**EmbedPDF version lookup aborts**

When `$dep` is `embedpdf` and `gh api` returns its normal multi-line JSON response, `ConvertFrom-Json` receives the GitHub CLI’s pretty-printed JSON one output line at a time and fails to parse it, so version lookup stops before `$latestVersion` is set and users cannot check or update EmbedPDF.

Join the captured output into one string before passing it to `ConvertFrom-Json`, or have `gh api` return the required fields in a single-line form.
</issue_to_address>

### Comment 4
<location path=".agents/skills/update-dependency/SKILL.md" line_range="106" />
<code_context>
+    if ($release.draft -or $release.prerelease -or $release.tag_name -cnotmatch '^v(?<version>\d+\.\d+\.\d+)$') {
+        throw '最新 Release 不是可识别的稳定版本'
+    }
+    $latestVersion = $Matches['version']
+    $asset = @($release.assets | Where-Object { $_.name -ceq $dependency.ReleaseAsset })
+    if ($asset.Count -ne 1) { throw '最新 Release 缺少唯一的 EmbedPDF 运行时归档' }
</code_context>
<issue_to_address>
**EmbedPDF version lookup fails**

When the EmbedPDF version query runs in a PowerShell session without a preexisting `$Matches['version']`, `-cnotmatch` does not populate `$Matches`; `$latestVersion` is therefore empty in a clean PowerShell session, and the version guard throws instead of reporting the latest release.

Use a positive regex match result for `tag_name`, verify its `Success` property, and read the captured version from that result.
</issue_to_address>

### Comment 5
<location path=".agents/skills/update-dependency/SKILL.md" line_range="32" />
<code_context>
 ```powershell
 $targetVersion = $null
-$dep = 'dom2image' # 可选 dom2image、driverjs、tableexport、html2pdf
+$dep = 'dom2image' # 可选 dom2image、driverjs、tableexport、html2pdf、embedpdf
 $dependencies = @{
     dom2image = @{
</code_context>
<issue_to_address>
**EmbedPDF is missing from update prompt**

When an agent uses the repository’s standard dependency-update prompt, the standard dependency-update prompt still offers only dom2image, tableexport, driverjs, and html2pdf, so agents following it do not select the newly supported EmbedPDF workflow without extra direction.

Add `embedpdf` to the dependency choices in `.github/AI-TEAM-PROMPTS.md`.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨


以 `wwwroot/readme.txt` 的版本和 `$release.tag_name` 分别从 `embedpdf/embed-pdf-viewer` 对应的正式 Release 获取 `embedpdf-viewer-dist.zip`,不要使用 npm 的 `@embedpdf/snippet` 或重新构建产物。核对 Release 标签、唯一资源名及下载文件的 SHA-256 与 Release 资源的 `digest` 一致;无法核实则暂停。先在系统临时目录安全解压,拒绝越界路径,确认归档内 `dist/embedpdf.js`、`dist/embedpdf-worker.js`、`dist/encoder-worker.js`、`dist/embedpdf.wasm` 和 `dist/chunks/*.js` 均存在,并检查入口与依赖引用;布局或运行时资源范围变化时先核实,不能机械套用旧映射。

更新前,逐文件比较当前版本归档和仓库的运行时文件字节及文件集合,包括全部 `chunks/*.js`。若不一致,先说明差异并询问,不覆盖已有改动。目标版本核实后,将上述运行时文件作为一组按原字节替换,并删除仅属于旧版本、目标归档中已不存在的哈希 chunk;保留 `readme.txt` 和其他非上游文件,不添加 source map 或声明文件。更新 `readme.txt` 的版本和组件项目的 patch 版本。核对 `EmbedPDF.razor.js` 使用的默认导出、初始化配置、文档和 stage API、worker/WASM 路径及动态 chunk 引用;查看上游发布说明,若需要适配或跨大版本涉及不兼容变更,报告影响并等待用户确认适配范围。

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · PDF updates leave mixed files

When two updates overlap, or an update stops partway through replacing runtime files, the updater writes runtime files and version markers individually, so interruption leaves a mixed tree and mismatched version records; the next update rejects the tree and the packaged viewer fails to load PDFs.

Stage the complete update, revalidate the current files before committing, and replace the runtime tree and version markers atomically.

Prompt for AI agents
In `.agents/skills/update-dependency/SKILL.md` at line 179:

**PDF updates leave mixed files**

When two updates overlap, or an update stops partway through replacing runtime files, the updater writes runtime files and version markers individually, so interruption leaves a mixed tree and mismatched version records; the next update rejects the tree and the packaged viewer fails to load PDFs.

Stage the complete update, revalidate the current files before committing, and replace the runtime tree and version markers atomically.


以 `wwwroot/readme.txt` 的版本和 `$release.tag_name` 分别从 `embedpdf/embed-pdf-viewer` 对应的正式 Release 获取 `embedpdf-viewer-dist.zip`,不要使用 npm 的 `@embedpdf/snippet` 或重新构建产物。核对 Release 标签、唯一资源名及下载文件的 SHA-256 与 Release 资源的 `digest` 一致;无法核实则暂停。先在系统临时目录安全解压,拒绝越界路径,确认归档内 `dist/embedpdf.js`、`dist/embedpdf-worker.js`、`dist/encoder-worker.js`、`dist/embedpdf.wasm` 和 `dist/chunks/*.js` 均存在,并检查入口与依赖引用;布局或运行时资源范围变化时先核实,不能机械套用旧映射。

更新前,逐文件比较当前版本归档和仓库的运行时文件字节及文件集合,包括全部 `chunks/*.js`。若不一致,先说明差异并询问,不覆盖已有改动。目标版本核实后,将上述运行时文件作为一组按原字节替换,并删除仅属于旧版本、目标归档中已不存在的哈希 chunk;保留 `readme.txt` 和其他非上游文件,不添加 source map 或声明文件。更新 `readme.txt` 的版本和组件项目的 patch 版本。核对 `EmbedPDF.razor.js` 使用的默认导出、初始化配置、文档和 stage API、worker/WASM 路径及动态 chunk 引用;查看上游发布说明,若需要适配或跨大版本涉及不兼容变更,报告影响并等待用户确认适配范围。

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Concurrent edits get overwritten

When another user or update process changes a runtime file after the comparison but before replacement, the updater replaces the files based on its earlier comparison and overwrites the other actor’s changes, leaving that work lost from the working tree.

Recheck the working-tree files immediately before replacement and stop if they changed since comparison.

Prompt for AI agents
In `.agents/skills/update-dependency/SKILL.md` at line 179:

**Concurrent edits get overwritten**

When another user or update process changes a runtime file after the comparison but before replacement, the updater replaces the files based on its earlier comparison and overwrites the other actor’s changes, leaving that work lost from the working tree.

Recheck the working-tree files immediately before replacement and stop if they changed since comparison.

$currentVersion = $versionMatch.Groups['version'].Value
$releaseJson = gh api "repos/$packageName/releases/latest"
if ($LASTEXITCODE -ne 0) { throw "查询 $packageName Release 失败" }
$release = $releaseJson | ConvertFrom-Json

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 High · EmbedPDF version lookup aborts

When $dep is embedpdf and gh api returns its normal multi-line JSON response, ConvertFrom-Json receives the GitHub CLI’s pretty-printed JSON one output line at a time and fails to parse it, so version lookup stops before $latestVersion is set and users cannot check or update EmbedPDF.

Join the captured output into one string before passing it to ConvertFrom-Json, or have gh api return the required fields in a single-line form.

Prompt for AI agents
In `.agents/skills/update-dependency/SKILL.md` at line 102:

**EmbedPDF version lookup aborts**

When `$dep` is `embedpdf` and `gh api` returns its normal multi-line JSON response, `ConvertFrom-Json` receives the GitHub CLI’s pretty-printed JSON one output line at a time and fails to parse it, so version lookup stops before `$latestVersion` is set and users cannot check or update EmbedPDF.

Join the captured output into one string before passing it to `ConvertFrom-Json`, or have `gh api` return the required fields in a single-line form.

if ($release.draft -or $release.prerelease -or $release.tag_name -cnotmatch '^v(?<version>\d+\.\d+\.\d+)$') {
throw '最新 Release 不是可识别的稳定版本'
}
$latestVersion = $Matches['version']

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · EmbedPDF version lookup fails

When the EmbedPDF version query runs in a PowerShell session without a preexisting $Matches['version'], -cnotmatch does not populate $Matches; $latestVersion is therefore empty in a clean PowerShell session, and the version guard throws instead of reporting the latest release.

Use a positive regex match result for tag_name, verify its Success property, and read the captured version from that result.

Prompt for AI agents
In `.agents/skills/update-dependency/SKILL.md` at line 106:

**EmbedPDF version lookup fails**

When the EmbedPDF version query runs in a PowerShell session without a preexisting `$Matches['version']`, `-cnotmatch` does not populate `$Matches`; `$latestVersion` is therefore empty in a clean PowerShell session, and the version guard throws instead of reporting the latest release.

Use a positive regex match result for `tag_name`, verify its `Success` property, and read the captured version from that result.

```powershell
$targetVersion = $null
$dep = 'dom2image' # 可选 dom2image、driverjs、tableexport、html2pdf
$dep = 'dom2image' # 可选 dom2image、driverjs、tableexport、html2pdf、embedpdf

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚪ Low · EmbedPDF is missing from update prompt

When an agent uses the repository’s standard dependency-update prompt, the standard dependency-update prompt still offers only dom2image, tableexport, driverjs, and html2pdf, so agents following it do not select the newly supported EmbedPDF workflow without extra direction.

Add embedpdf to the dependency choices in .github/AI-TEAM-PROMPTS.md.

Prompt for AI agents
In `.agents/skills/update-dependency/SKILL.md` at line 32:

**EmbedPDF is missing from update prompt**

When an agent uses the repository’s standard dependency-update prompt, the standard dependency-update prompt still offers only dom2image, tableexport, driverjs, and html2pdf, so agents following it do not select the newly supported EmbedPDF workflow without extra direction.

Add `embedpdf` to the dependency choices in `.github/AI-TEAM-PROMPTS.md`.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(AIAgent): support EmbedPDF dependency updates

1 participant