@ycodium-ai/plugin-office 0.2.3510 → 0.2.3576
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +84 -75
- package/assets/check_runtime.py +8 -0
- package/assets/run_office.py +34 -0
- package/dist/index.js +218 -669
- package/locales/en.json +16 -81
- package/locales/zh-CN.json +19 -84
- package/package.json +4 -6
- package/skills/office-docx/SKILL.md +3 -3
- package/skills/office-pptx/SKILL.md +3 -3
- package/skills/office-xlsx/SKILL.md +2 -2
- package/ui/ui.js +1 -1
package/README.md
CHANGED
|
@@ -1,99 +1,108 @@
|
|
|
1
1
|
# @ycodium-ai/plugin-office
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
- **Chinese fonts**: Noto Sans CJK SC and Noto Serif CJK SC, regular and bold
|
|
23
|
-
(SIL OFL). Only the engine uses them. Windows and macOS already have Chinese
|
|
24
|
-
fonts; on Linux without them, Chinese text renders as boxes.
|
|
25
|
-
|
|
26
|
-
**Check** reports whether the engine starts, the document libraries load, and
|
|
27
|
-
Chinese fonts are available. **Delete engine** removes all three.
|
|
28
|
-
|
|
29
|
-
Downloads follow the Ycodium server's proxy settings. The settings
|
|
30
|
-
card can point them elsewhere: an npm registry mirror for the engine, a prefix
|
|
31
|
-
put in front of GitHub addresses for Python and fonts, a PyPI files mirror for
|
|
32
|
-
the wheels, and a local folder holding files downloaded ahead of time. Files
|
|
33
|
-
from any source are checked against the same checksums.
|
|
34
|
-
|
|
35
|
-
## Tools and skills
|
|
36
|
-
|
|
37
|
-
The plugin gives agents five MCP tools. They run in the conversation's project
|
|
38
|
-
folder, and paths are relative to it.
|
|
39
|
-
|
|
40
|
-
| Tool | What it does |
|
|
41
|
-
| -------------------- | ---------------------------------------------------------------------------- |
|
|
42
|
-
| `office_python` | Tells the agent where the installed Python is, for its own document scripts. |
|
|
43
|
-
| `office_check` | Checks a document's structure, expected text, and slide or sheet count. |
|
|
44
|
-
| `office_render` | Renders pages, slides, or a sheet range to PNG files. |
|
|
45
|
-
| `office_convert` | Converts between formats, such as DOCX to PDF or XLSX to CSV. |
|
|
46
|
-
| `office_recalculate` | Recalculates a workbook's formulas and saves the values. |
|
|
47
|
-
|
|
48
|
-
The three skills `office-docx`, `office-pptx`, and `office-xlsx` tell agents how
|
|
49
|
-
to write each kind of file with these tools. The result of `office_render`
|
|
50
|
-
shows the rendered pages in the conversation.
|
|
51
|
-
|
|
52
|
-
## Preview
|
|
3
|
+
Agents can create, edit, check, render, convert, and recalculate Word,
|
|
4
|
+
PowerPoint, and Excel files on the connected Ycodium machine. The app also
|
|
5
|
+
previews Office files. The complete Ycodium installation includes the engine,
|
|
6
|
+
isolated document libraries, and Chinese fonts for offline use.
|
|
7
|
+
|
|
8
|
+
## What it does
|
|
9
|
+
|
|
10
|
+
The five tools `office_python`, `office_check`, `office_render`,
|
|
11
|
+
`office_convert`, and `office_recalculate` run in the conversation's project
|
|
12
|
+
folder. The three bundled skills explain document creation and editing.
|
|
13
|
+
`office_render` returns page images and missing-font diagnostics; the app
|
|
14
|
+
shows the images in the conversation.
|
|
15
|
+
|
|
16
|
+
`office_python` returns the shared Ycodium Python executable together with
|
|
17
|
+
required arguments and environment entries. Run the executable with every
|
|
18
|
+
returned argument, followed by the workspace script path and its arguments.
|
|
19
|
+
These arguments load this plugin's isolated python-docx, python-pptx,
|
|
20
|
+
openpyxl, XlsxWriter, pandas, Pillow, and lxml libraries. Using only the
|
|
21
|
+
executable path does not load the document libraries.
|
|
53
22
|
|
|
54
23
|
The app previews `.doc`, `.docx`, `.odt`, `.ppt`, `.pptx`, `.odp`, `.xls`,
|
|
55
|
-
`.xlsx`, and `.ods`
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
24
|
+
`.xlsx`, and `.ods` through the plugin's PDF converter. Converted files go
|
|
25
|
+
into the writable plugin cache. Documents and authoring scripts remain in
|
|
26
|
+
the project folder; installed resources are read-only.
|
|
27
|
+
|
|
28
|
+
## Requirements
|
|
29
|
+
|
|
30
|
+
Use a complete Ycodium installation that supplies the shared Node and Python
|
|
31
|
+
runtimes and this plugin's platform payload. The plugin uses public plugin
|
|
32
|
+
API version 39 with `host:node`, `host:python`, `process.workspace`, and
|
|
33
|
+
`workspace.read` permissions. It does not look for a system Python,
|
|
34
|
+
LibreOffice, or Node executable.
|
|
35
|
+
|
|
36
|
+
Windows and macOS use a native LibreOffice engine; Linux uses WebAssembly,
|
|
37
|
+
which needs more memory and starts more slowly. Engine targets are Windows,
|
|
38
|
+
macOS, and Linux on x64 and ARM64. The pinned Python libraries have no
|
|
39
|
+
Windows ARM64 build, so document authoring and Python checks are unavailable
|
|
40
|
+
on that target. LibreOffice pagination can differ from Microsoft Office.
|
|
59
41
|
|
|
60
42
|
## Install
|
|
61
43
|
|
|
62
|
-
|
|
44
|
+
The plugin ships enabled with Ycodium as `core.office`. Its npm package can
|
|
45
|
+
also be added to a compatible Ycodium installation:
|
|
46
|
+
|
|
47
|
+
```text
|
|
63
48
|
ycodium plugin add @ycodium-ai/plugin-office
|
|
64
49
|
```
|
|
65
50
|
|
|
66
|
-
The plugin
|
|
67
|
-
its
|
|
68
|
-
|
|
51
|
+
The installed plugin must include the matching platform payload; copying only
|
|
52
|
+
its JavaScript entry does not provide document operations. No engine, font,
|
|
53
|
+
or Python package installation occurs when tools run.
|
|
69
54
|
|
|
70
|
-
##
|
|
55
|
+
## Read this before installing
|
|
71
56
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
57
|
+
Settings → Plugins → Office → **Check** reports the engine backend and
|
|
58
|
+
version, shared Python and document-library availability, and Chinese-font
|
|
59
|
+
version. The check works offline and reports missing, incomplete, or damaged
|
|
60
|
+
components. Restore those files by reinstalling the complete Ycodium package
|
|
61
|
+
from an offline installer.
|
|
62
|
+
|
|
63
|
+
The bundled Noto Sans SC and Noto Serif SC fonts are private to the engine.
|
|
64
|
+
System fonts are unchanged. Disabling or uninstalling the plugin removes its
|
|
65
|
+
tools and preview converter; documents and saved plugin data remain. Shared
|
|
66
|
+
runtimes belong to Ycodium and are not removed by plugin actions.
|
|
67
|
+
|
|
68
|
+
## Upgrading
|
|
69
|
+
|
|
70
|
+
Upgrade the complete Ycodium installation so the plugin and its platform
|
|
71
|
+
payload stay at matching versions. Artifact construction verifies downloads
|
|
72
|
+
against `src/lock.ts`; user machines do not download or run pip to prepare
|
|
73
|
+
document libraries.
|
|
76
74
|
|
|
77
75
|
## Developing
|
|
78
76
|
|
|
79
|
-
```
|
|
77
|
+
```text
|
|
80
78
|
vp run --filter @ycodium-ai/plugin-office build
|
|
81
79
|
vp run --filter @ycodium-ai/plugin-office test
|
|
80
|
+
vp run --filter @ycodium-ai/plugin-office typecheck
|
|
82
81
|
```
|
|
83
82
|
|
|
84
|
-
The package builds
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
The package builds `dist/index.js` and `ui/ui.js`; the host supplies the
|
|
84
|
+
shared plugin API and React. Runtime assets live in `runtime/<target>`.
|
|
85
|
+
Build and release scripts stage the platform payload and retain its source,
|
|
86
|
+
license, and font notice files.
|
|
87
87
|
|
|
88
|
-
`test/checker.test.ts` runs
|
|
89
|
-
|
|
88
|
+
`test/checker.test.ts` runs Python checker tests when a test interpreter is
|
|
89
|
+
available; `YCODIUM_OFFICE_TEST_PYTHON` selects that interpreter. This test
|
|
90
|
+
setting does not change product runtime discovery.
|
|
91
|
+
|
|
92
|
+
To check a complete staged artifact, use a new output directory:
|
|
93
|
+
|
|
94
|
+
```text
|
|
95
|
+
node plugins/office/scripts/remote-check.ts <shared-runtime-target-dir> <office-plugin-dir> <new-output-dir>
|
|
96
|
+
```
|
|
90
97
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
98
|
+
This check uses only the supplied executables with an empty PATH and disabled
|
|
99
|
+
network proxy. It creates and edits all three document types, checks their
|
|
100
|
+
structure, renders Chinese text, converts PDFs and CSV, and verifies cached
|
|
101
|
+
formula results after recalculation. It also checks a controlled failing
|
|
102
|
+
content assertion. Run it on each release platform; a pass on one platform
|
|
103
|
+
does not establish compatibility on another.
|
|
96
104
|
|
|
97
105
|
## License
|
|
98
106
|
|
|
99
|
-
UNLICENSED.
|
|
107
|
+
UNLICENSED. Third-party runtime resources retain their own licenses and
|
|
108
|
+
notices in the distributed payload.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""用此插件隔离的文档库运行工作区脚本。"""
|
|
2
|
+
import pathlib
|
|
3
|
+
import runpy
|
|
4
|
+
import sys
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def library_search_path(libraries):
|
|
8
|
+
value = str(libraries)
|
|
9
|
+
if sys.platform != "win32" or value.startswith("\\\\?\\"):
|
|
10
|
+
return value
|
|
11
|
+
if value.startswith("\\\\"):
|
|
12
|
+
return "\\\\?\\UNC\\" + value[2:]
|
|
13
|
+
return "\\\\?\\" + value
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def main():
|
|
17
|
+
if len(sys.argv) < 5 or sys.argv[1] != "--libraries" or sys.argv[3] != "--":
|
|
18
|
+
raise SystemExit("Expected --libraries <bundled site-packages> -- <script.py> [args...]")
|
|
19
|
+
libraries = pathlib.Path(sys.argv[2]).resolve(strict=True)
|
|
20
|
+
script = pathlib.Path(sys.argv[4]).resolve(strict=True)
|
|
21
|
+
if not libraries.is_dir():
|
|
22
|
+
raise SystemExit("The bundled Office document libraries are missing")
|
|
23
|
+
# -I 排除用户 site-packages 与环境变量;仅此插件的业务依赖进入搜索路径。
|
|
24
|
+
# 原生扩展的 DLL 加载不继承 Python 的长路径支持,必须显式使用 Windows 扩展路径。
|
|
25
|
+
sys.path.insert(0, library_search_path(libraries))
|
|
26
|
+
sys.path.insert(1, str(script.parent))
|
|
27
|
+
sys.argv = [str(script), *sys.argv[5:]]
|
|
28
|
+
sys.stdout.reconfigure(encoding="utf-8")
|
|
29
|
+
sys.stderr.reconfigure(encoding="utf-8")
|
|
30
|
+
runpy.run_path(str(script), run_name="__main__")
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
if __name__ == "__main__":
|
|
34
|
+
main()
|