@ycodium-ai/plugin-office 0.2.3506 → 0.2.3566

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 CHANGED
@@ -1,99 +1,108 @@
1
1
  # @ycodium-ai/plugin-office
2
2
 
3
- Lets agents create, check, and render Word, PowerPoint, and Excel files on this
4
- Ycodium machine, and lets the app preview Office files. Nothing is downloaded
5
- until you start an install from the plugin's settings card.
6
-
7
- ## What it installs
8
-
9
- Each install runs from the settings card, downloads only what is pinned in
10
- `src/lock.ts`, checks every file against its pinned checksum before unpacking
11
- it, and discards it on a mismatch. Everything lands in the plugin data
12
- directory under `runtime/`; system files and fonts are not changed.
13
-
14
- - **Engine**: `@deepseek-ai/libreoffice-kit` 0.1.5 and its platform package from
15
- npm (a LibreOffice build, MPL-2.0). Windows and macOS run the native engine;
16
- Linux runs its WebAssembly build, which needs more memory and starts more
17
- slowly. Windows needs the Microsoft Visual C++ 2015–2022 runtime for the
18
- machine's architecture.
19
- - **Python**: Python 3.12 from python-build-standalone with python-docx,
20
- python-pptx, openpyxl, XlsxWriter, pandas, Pillow, and lxml, installed from
21
- pinned wheels without contacting an index. Windows on ARM has no build.
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` files by asking this plugin to convert them to PDF. The
56
- converted file is cached in the plugin's cache directory; changing the source
57
- converts it again. Until the engine is installed, the preview says the plugin
58
- is not set up yet and links to plugin settings.
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 ships enabled with Ycodium as `core.office`. Uninstalling it leaves
67
- its data directory, including anything it downloaded; **Delete engine** first
68
- if you want that space back.
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
- ## Requirements
55
+ ## Read this before installing
71
56
 
72
- A Ycodium server with plugin API version 3, including `process.spawn` for
73
- `host:node`, `tar`, `fc-list`, and the installed Python (at most six processes
74
- at once), `process.workspace`, and `workspace.read`. Supported engine
75
- platforms: Windows x64/arm64, macOS x64/arm64, Linux x64/arm64.
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 its own code into `dist/index.js` and the result view into
85
- `ui/ui.js`. The host supplies the shared `@ycodium-ai/plugin-api` and React at
86
- runtime. Language catalogs live in `locales/`.
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 the checker's Python tests and is skipped when no
89
- Python 3 is found; point `YCODIUM_OFFICE_TEST_PYTHON` at one to run it.
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
- To move to other versions, regenerate the whole of `src/lock.ts`; do not edit
92
- single entries. Then run `scripts/remote-check.ts` on a real Linux and macOS
93
- machine: it installs and runs everything outside Ycodium, and its header says how
94
- to bundle it, which steps exist, and how to simulate a machine without Chinese
95
- fonts.
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,8 @@
1
+ """通过隔离入口验证随包 Office 创作库。"""
2
+ import docx
3
+ import pptx
4
+ import openpyxl
5
+ import pandas
6
+ import PIL
7
+ import lxml
8
+ import xlsxwriter
@@ -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()