Repository navigation
feat(AIAgent): support EmbedPDF dependency updates - #1360
Conversation
Reviewer's GuideDocumentationRegister 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.
Document how to verify and safely replace EmbedPDF runtime assets, validate compatibility and behavior, and report generated-file whitespace warnings.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Linked issuesChecked at commit 8de2bbc #1359 feat(AIAgent): support EmbedPDF dependency updates · 3 of 3 met
|
There was a problem hiding this comment.
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>|
|
||
| 以 `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 引用;查看上游发布说明,若需要适配或跨大版本涉及不兼容变更,报告影响并等待用户确认适配范围。 |
There was a problem hiding this comment.
🟡 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 引用;查看上游发布说明,若需要适配或跨大版本涉及不兼容变更,报告影响并等待用户确认适配范围。 |
There was a problem hiding this comment.
🟡 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 |
There was a problem hiding this comment.
🟠 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'] |
There was a problem hiding this comment.
🟡 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 |
There was a problem hiding this comment.
⚪ 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`.
Link issues
fixes #1359
Summary By Copilot
Register
embedpdfin theupdate-dependencyskill, including the official GitHub Release archive, stable-version lookup, runtime asset mapping, and guidance for validating and replacing the bundled assets safely.Regression?
Risk
Documentation-only change to the dependency update workflow; no component runtime or package contents are changed.
Verification
Commands/results:
git diff --check 80e174d9baefb88920677bb841c69a041adfb768...8de2bbce385822550e08b1ce83b34893440e47a5— passed..agents/skills/update-dependency/SKILL.mdwith$dep = 'embedpdf'— passed; reported current3.3.0and latest3.4.0.Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Enable the dependency update workflow to safely manage EmbedPDF releases and bundled runtime assets.
New Features:
Enhancements:
Documentation: