Graphene.OfficeSupportTool
1.26.8.25
dotnet add package Graphene.OfficeSupportTool --version 1.26.8.25
NuGet\Install-Package Graphene.OfficeSupportTool -Version 1.26.8.25
<PackageReference Include="Graphene.OfficeSupportTool" Version="1.26.8.25" />
<PackageVersion Include="Graphene.OfficeSupportTool" Version="1.26.8.25" />
<PackageReference Include="Graphene.OfficeSupportTool" />
paket add Graphene.OfficeSupportTool --version 1.26.8.25
#r "nuget: Graphene.OfficeSupportTool, 1.26.8.25"
#:package Graphene.OfficeSupportTool@1.26.8.25
#addin nuget:?package=Graphene.OfficeSupportTool&version=1.26.8.25
#tool nuget:?package=Graphene.OfficeSupportTool&version=1.26.8.25
OfficeSupportTool
Office document (DOCX) agent tool for AIOrchestrator. The LLM fills a per-type HTML
template with the requested content, the HTML is converted to a real .docx with
HtmlToOpenXml, and the source HTML is stored
inside the DOCX as hidden metadata (custom XML part) so the document can be updated later.
Templates live in Assets/*.html (one per document type: invoice, balance sheet, contract,
SOP, …). When a requested type has no template, the LLM generates a new one following
Assets/DESIGN-GUIDELINES.md (layout + category colors) and Assets/ESSENTIAL-GUIDELINES.md
(strict HTML rules), in English and with the same {{ placeholder_name }} format, and saves
it alongside the others for future reuse.
Methods
| Method | Purpose |
|---|---|
create_document |
Creates a new DOCX from the template matching the requested type (optional draft, context text/file, image files, output path). |
update_document |
Applies requested changes to an existing DOCX (reads the HTML from the embedded metadata, regenerates the document; the new content becomes a new version in the workspace git repo). |
update_template |
Modifies an existing template (feasibility-gated, keeps the template rules: English, category colors, {{ placeholder_name }} format, design guidelines); the updated template is reused by create_document. |
Usage
Loads as a plugin (see AGENT_TOOLS_GUIDE.md):
drop the dll + xml into the host's Tools/ folder, or let the host build it via its
BuildToolPlugins target. The tool is auto-updatable from NuGet (Graphene.OfficeSupportTool).
create_document
create_document(type, note, draft?, contextText?, contextFile?, imageFiles?, saveFullNameFile?, outputTwoLetterLanguage?)
type(required): document type, e.g."balance sheet"(maps tobalance-sheet.html). Matching is case-insensitive and ignores-/space differences. Known template types are listed in the tool definition; types not in the list are accepted too — a new template is generated by the LLM following the design guidelines.note(required): descriptive notes about the document to create (practical suggestions/tips).draft(optional, defaultfalse): whentruethe material check is skipped and an incomplete document can be generated even if the context lacks data to fill the template.contextText/contextFile(optional): essential material for the document (company data, parties, values, tables…). One of the two is expected unlessdraftis used. The material check evaluates the context against the template field by field; when it is rejected, the error lists the missing fields deterministically asDocument fields: <comma-separated field names>(extracted from the template's{{ placeholder_name }}placeholders) plus thedrafthint.imageFiles(optional): workspace images embedded into the document (Unix-style paths). Each image is shown to the LLM via the unifiedFileManager.GetFilesInfoblock: path + size +Classification:+ YOLOMetadata:JSON (created and embedded permanently in the image when absent).saveFullNameFile(optional): output path/name (.docx, Unix-style). Default:/documents/document_yyyyMMdd_HHmmss.docxin the workspace.outputTwoLetterLanguage(optional): two-letter language code; if omitted it is detected from the context.
update_document
update_document(filePath, changes, contextText?, imageFiles?)
Reads the source HTML from the DOCX metadata, has the LLM apply changes faithfully to the
template, converts back to DOCX and re-embeds the new HTML. The new content becomes a new
version in the workspace git repo — rollback via GitTool.restore (the tool does not keep
the file open).
update_template
update_template(type, changes)
Modifies the template matching type (same case/-/space-insensitive matching as
create_document; available types are listed via [[available_templates]]). Flow:
the template existence is checked deterministically (unknown types are rejected with an
error), then an LLM gate validates whether the requested changes are feasible and make
sense for that template (JSON verdict; infeasible changes return an error with a brief
explanation), and only then the LLM applies the changes and the result is validated
(HTML5 + template rules) before being saved for reuse. The updated template keeps the same
rules as created templates — English language, the category colors (the design set matching
the document's primary purpose), the {{ placeholder_name }} placeholder format and the
design guidelines.
Testing / Harness
The OfficeSupportTool.Harness console project drives the tool end-to-end against a live
LLM provider, plus an offline deterministic self-test:
dotnet run --project OfficeSupportTool.Harness -- --selftest # offline: no LLM needed
dotnet run --project OfficeSupportTool.Harness -- --provider NAME # LLM campaign (T1–T8)
--selftest: deterministic checks (type normalization, placeholder field extraction, HTML→DOCX round-trip, metadata, nested-comment/bare-svg/table-background detection, template category-color conformity, versioning semantics).--provider NAME(defaultDeepSeekBridge, fallbackOllama_Qwen): runs the behavioral LLM campaign — create (incl. overwrite versioning), update, template generation + conformity inspection, images, material-gate rejection (with the deterministicDocument fields:list), foreign DOCX, template update (incl. the feasibility-gate rejection) + reuse, and the create→update→rollback flow at agent level.- Results are appended to
%TEMP%\officesupporttool_test_results.txtwith a finalDONEmarker; the agent's tool-call trace is logged per test. The workspace lives in%TEMP%(the repo sits under OneDrive, where test files would be cloud-synced on every write).
Packaging
Date-based auto versioning (1.yy.MM.dd) and CI publish to NuGet on every push to
master — see .github/workflows/publish.yml and the plugin creation guide in
AGENT_TOOLS_GUIDE.md.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Graphene.AIOrchestrator (>= 1.26.8.21)
- HtmlAgilityPack (>= 1.12.4)
- HtmlToOpenXml.dll (>= 3.5.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.