feat(agent): add artifact probe and inspection - #25
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 599ff7ce47
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ) => | ||
| { | ||
| patch.scoped_replacements.push(ScopedDocxReplace { | ||
| scope: DocxTextScope::AllText, |
There was a problem hiding this comment.
Limit DOCX replacements to the requested locator
When a patch targets a specific DocxParagraph or DocxTableCell, this queues the replacement with DocxTextScope::AllText, so any matching expected_text elsewhere in the document is rewritten too. For common strings such as a status label or table value, an agent patch intended for one located cell/paragraph can silently change unrelated content while reporting the targeted operation as applied.
Useful? React with 👍 / 👎.
| let value = table | ||
| .rows | ||
| .get(row_idx) | ||
| .and_then(|row| row.get(col_idx)) | ||
| .map(cell_text) |
There was a problem hiding this comment.
Fix XLSX range indexing for sparse sheets
The row/column indexes parsed from the A1 range are absolute sheet coordinates, but the table returned by the XLSX extractor is rebased to the first populated row/column. On sheets whose data does not start at A1, querying the real address (for example C5) looks past the rebased table and returns no value, while querying A1 can return the C5 value under the wrong locator, causing incorrect inspection results for sparse spreadsheets.
Useful? React with 👍 / 👎.
| AgentDocumentFormat::Xlsx => vec![ | ||
| MutationKind::SetXlsxCellValue, | ||
| MutationKind::SetXlsxCellFormula, | ||
| MutationKind::RenameXlsxSheet, |
There was a problem hiding this comment.
Report only XLSX mutations that apply supports
The capability report advertises SetXlsxCellValue and SetXlsxCellFormula, but apply_xlsx returns those operations as unsupported, and it omits ReplaceText even though the XLSX apply path accepts that operation. Agents that rely on probe will be steered toward patch plans that are immediately rejected and away from a supported XLSX text replacement path.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 52a6910ff7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| patch.scoped_replacements.push(ScopedXlsxReplace { | ||
| scope: XlsxTextScope::AllText, | ||
| replace: TextReplace::all(expected_text, replacement), |
There was a problem hiding this comment.
Limit XLSX replacements to the requested locator
When an agent patch targets a specific XlsxCell, this maps the operation to XlsxTextScope::AllText, so a request to change one inspected cell rewrites every matching string in the workbook, including other sheets, comments, metadata, and sheet names. For common values such as Status or Yes, the report says the targeted operation was applied while unrelated workbook content is silently mutated.
Useful? React with 👍 / 👎.
| patch.scoped_replacements.push(ScopedPptxReplace { | ||
| scope: PptxTextScope::AllText, | ||
| replace: TextReplace::all(expected_text, replacement), |
There was a problem hiding this comment.
Limit PPTX shape edits to the target shape
For ReplacePptxShapeText, the supplied PptxShape locator is ignored and the replacement is queued with PptxTextScope::AllText. If the same label or phrase appears in another slide/shape/notes/comments, a patch intended for one shape will mutate those unrelated occurrences while reporting the targeted shape operation as applied.
Useful? React with 👍 / 👎.
| if count == 0 { | ||
| output.push_str(text.as_str()); | ||
| } else { | ||
| output.push_str(&text.as_str().replace(expected_text, replacement)); |
There was a problem hiding this comment.
Escape DOCX text replacements before writing XML
This writes the replacement string directly inside a <w:t> node without XML escaping. When the replacement contains common characters such as & or <, the generated DOCX XML becomes invalid; the same raw-text matching also prevents replacing inspected text that is stored escaped in the source, such as AT&T being reported to the agent as AT&T.
Useful? React with 👍 / 👎.
Summary
Adds the agentic artifact lifecycle foundation for OfficeMD:
officemd_agentwith artifact identity, fingerprints, capability reports, locators, bounded inspection reports, typed apply reports, render reports, and verification reportsofficemd_rendererwith system renderer discovery, Poppler PDF rasterization, and LibreOffice DOCX/XLSX/PPTX-to-PDF conversion followed by Poppler rasterizationofficemd probe,officemd inspect --agent-query,officemd apply,officemd render-artifact, andofficemd verify--render-output-diris providedrenderand metadatainspectbehavior intactCLI smoke coverage
examples/data/OpenXML_WhitePaper.pdfwith Poppler into 14 PNG filesexamples/data/showcase.docx,showcase.xlsx, andshowcase.pptxthrough LibreOffice plus Popplerstructure,visual-render, producing rendered evidenceValidation
cargo fmt --allcargo test --workspace --quiet- passed