Commit e09a43e
feat(documents): agent tools read_workbook / read_workbook_cell / write_workbook
Exposes the typed Workbook surface to folder-mode agents. Stacks on top
of the XLSX read (osaurus-ai#929) + write (osaurus-ai#936) PRs and completes the stage-4
round-trip goal: an agent can now ingest a spreadsheet, reason about
cells and formulas in their native types, and emit a modified workbook
— all without the model having to handroll XML.
- read_workbook: returns a compact JSON summary of every sheet
(names, row counts, merged ranges, truncated cell sample). Capped at
200 cells per sheet so large workbooks don't blow the context
window; agents drop to read_workbook_cell for specific values.
- read_workbook_cell: single-cell lookup by (path, sheet, A1 ref).
Returns value, formula source, and type in a one-line JSON payload.
- write_workbook: accepts a structured sheets array and emits the
file via XLSXEmitter. Each cell carries its A1 ref, typed value,
and optional formula; the schema enum guards against unknown
types. write_workbook creates parent directories and surfaces a
sheetCount / totalCells summary on success.
- All three plug into FolderToolFactory.buildCoreTools alongside
file_read / file_write, so they're registered the moment a working
folder is selected and go away when it's cleared.
- Tests: 8 tests covering sheet summary rendering, missing-file and
out-of-root rejection, formula preservation on cell lookup, missing-
sheet error, end-to-end write + re-parse fidelity, non-xlsx path
refusal, and empty-sheets validation. Tests reuse the sample.xlsx
fixture from the XLSX read PR.1 parent 9549c12 commit e09a43e
3 files changed
Lines changed: 757 additions & 0 deletions
File tree
- Packages/OsaurusCore
- Folder
- Tests/Documents
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1295 | 1295 | | |
1296 | 1296 | | |
1297 | 1297 | | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
1298 | 1301 | | |
1299 | 1302 | | |
1300 | 1303 | | |
| |||
0 commit comments