@components-kit/open-workbook 0.1.0 → 0.1.2
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/assets/backend/dist/runtime-service.d.ts +18 -0
- package/assets/backend/dist/runtime-service.d.ts.map +1 -1
- package/assets/backend/dist/runtime-service.js +8 -1
- package/assets/backend/dist/runtime-service.js.map +1 -1
- package/assets/excel-addin/dist/excel-executor.js +1 -1
- package/assets/excel-addin/manifest.xml +1 -1
- package/assets/excel-addin/scripts/dev-server.mjs +65 -4
- package/assets/instructions/open-workbook-excel/SKILL.md +1 -1
- package/assets/mcp-server/dist/index.js +2 -1
- package/assets/mcp-server/dist/index.js.map +1 -1
- package/dist/index.js +141 -7
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { chunkMatrixRows, createRangeFingerprint, createWorkbookFingerprint, formatA1Cell, hashStable, parseA1Address } from "@components-kit/open-workbook-excel-core";
|
|
2
2
|
import { runtimeError } from "@components-kit/open-workbook-protocol";
|
|
3
3
|
const ENGINE_NAME = "office-js-addin";
|
|
4
|
-
const ENGINE_VERSION = "0.1.
|
|
4
|
+
const ENGINE_VERSION = "0.1.2";
|
|
5
5
|
const CHUNK_CELL_LIMIT = 50_000;
|
|
6
6
|
const OPEN_WORKBOOK_CUSTOM_XML_NAMESPACE = "https://open-workbook.dev/schema/local-config/1";
|
|
7
7
|
const EXCEL_API_VERSIONS = ["1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "1.10", "1.11", "1.12", "1.13", "1.14", "1.15", "1.16", "1.17"];
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
xmlns:ov="http://schemas.microsoft.com/office/taskpaneappversionoverrides"
|
|
6
6
|
xsi:type="TaskPaneApp">
|
|
7
7
|
<Id>6f2d2ac1-69b0-4eb6-a256-0a1fcb000001</Id>
|
|
8
|
-
<Version>0.1.
|
|
8
|
+
<Version>0.1.2.0</Version>
|
|
9
9
|
<ProviderName>Open Workbook</ProviderName>
|
|
10
10
|
<DefaultLocale>en-US</DefaultLocale>
|
|
11
11
|
<DisplayName DefaultValue="Open Workbook" />
|
|
@@ -6,15 +6,27 @@ import { fileURLToPath } from "node:url";
|
|
|
6
6
|
|
|
7
7
|
const root = fileURLToPath(new URL("..", import.meta.url));
|
|
8
8
|
const repoRoot = join(root, "../..");
|
|
9
|
+
const packageScopeRoot = join(repoRoot, "..");
|
|
9
10
|
const publicDir = join(root, "public");
|
|
10
11
|
const workspaceModuleDirs = new Map([
|
|
11
|
-
["/workspace/excel-core/",
|
|
12
|
-
|
|
12
|
+
["/workspace/excel-core/", firstExistingPath([
|
|
13
|
+
join(repoRoot, "packages/excel-core/dist"),
|
|
14
|
+
join(repoRoot, "../excel-core/dist"),
|
|
15
|
+
join(repoRoot, "node_modules/@components-kit/open-workbook-excel-core/dist"),
|
|
16
|
+
join(packageScopeRoot, "open-workbook-excel-core/dist")
|
|
17
|
+
])],
|
|
18
|
+
["/workspace/protocol/", firstExistingPath([
|
|
19
|
+
join(repoRoot, "packages/protocol/dist"),
|
|
20
|
+
join(repoRoot, "../protocol/dist"),
|
|
21
|
+
join(repoRoot, "node_modules/@components-kit/open-workbook-protocol/dist"),
|
|
22
|
+
join(packageScopeRoot, "open-workbook-protocol/dist")
|
|
23
|
+
])]
|
|
13
24
|
]);
|
|
14
25
|
const port = Number(process.env.OPEN_WORKBOOK_ADDIN_PORT ?? 37846);
|
|
15
26
|
const host = process.env.OPEN_WORKBOOK_ADDIN_HOST ?? "127.0.0.1";
|
|
16
27
|
const httpsEnabled = process.env.OPEN_WORKBOOK_ADDIN_HTTPS === "1" || process.env.OPEN_WORKBOOK_ADDIN_PROTOCOL === "https";
|
|
17
28
|
const protocol = httpsEnabled ? "https" : "http";
|
|
29
|
+
const runtimeVersion = process.env.OPEN_WORKBOOK_VERSION ?? readPackageVersion() ?? "0.1.1";
|
|
18
30
|
|
|
19
31
|
const contentTypes = new Map([
|
|
20
32
|
[".html", "text/html; charset=utf-8"],
|
|
@@ -26,6 +38,14 @@ const contentTypes = new Map([
|
|
|
26
38
|
|
|
27
39
|
const requestHandler = (request, response) => {
|
|
28
40
|
const url = new URL(request.url ?? "/", `${protocol}://${host}:${port}`);
|
|
41
|
+
if (request.method === "GET" && url.pathname === "/status") {
|
|
42
|
+
response.writeHead(200, {
|
|
43
|
+
"content-type": "application/json",
|
|
44
|
+
"cache-control": "no-store"
|
|
45
|
+
});
|
|
46
|
+
response.end(JSON.stringify(getStatus()));
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
29
49
|
if (url.pathname.startsWith("/assets/icon-") && url.pathname.endsWith(".png")) {
|
|
30
50
|
response.writeHead(200, {
|
|
31
51
|
"content-type": "image/png",
|
|
@@ -73,19 +93,23 @@ function isAllowedPath(filePath) {
|
|
|
73
93
|
return (
|
|
74
94
|
filePath.startsWith(publicDir) ||
|
|
75
95
|
filePath.startsWith(join(root, "dist")) ||
|
|
76
|
-
Array.from(workspaceModuleDirs.values()).some((moduleDir) => filePath.startsWith(moduleDir))
|
|
96
|
+
Array.from(workspaceModuleDirs.values()).some((moduleDir) => moduleDir && filePath.startsWith(moduleDir))
|
|
77
97
|
);
|
|
78
98
|
}
|
|
79
99
|
|
|
80
100
|
function resolveWorkspaceModule(pathname) {
|
|
81
101
|
for (const [prefix, moduleDir] of workspaceModuleDirs) {
|
|
82
|
-
if (pathname.startsWith(prefix)) {
|
|
102
|
+
if (moduleDir && pathname.startsWith(prefix)) {
|
|
83
103
|
return join(moduleDir, pathname.slice(prefix.length));
|
|
84
104
|
}
|
|
85
105
|
}
|
|
86
106
|
return undefined;
|
|
87
107
|
}
|
|
88
108
|
|
|
109
|
+
function firstExistingPath(paths) {
|
|
110
|
+
return paths.find((path) => existsSync(path));
|
|
111
|
+
}
|
|
112
|
+
|
|
89
113
|
function rewriteBrowserImports(source) {
|
|
90
114
|
return source
|
|
91
115
|
.replaceAll("\"@components-kit/open-workbook-excel-core\"", "\"/workspace/excel-core/index.js\"")
|
|
@@ -94,6 +118,26 @@ function rewriteBrowserImports(source) {
|
|
|
94
118
|
.replaceAll("'@components-kit/open-workbook-protocol'", "'/workspace/protocol/index.js'");
|
|
95
119
|
}
|
|
96
120
|
|
|
121
|
+
function getStatus() {
|
|
122
|
+
const addinUrl = trimTrailingSlash(process.env.OPEN_WORKBOOK_ADDIN_URL ?? `${protocol}://${host}:${port}`);
|
|
123
|
+
const backendUrl = process.env.OPEN_WORKBOOK_BACKEND_URL ?? `ws://${process.env.OPEN_WORKBOOK_HOST ?? "127.0.0.1"}:${process.env.OPEN_WORKBOOK_PORT ?? 37845}${process.env.OPEN_WORKBOOK_ADDIN_PATH ?? "/addin"}`;
|
|
124
|
+
return {
|
|
125
|
+
ok: true,
|
|
126
|
+
service: "open-workbook-addin-server",
|
|
127
|
+
packageName: "@components-kit/open-workbook",
|
|
128
|
+
version: runtimeVersion,
|
|
129
|
+
pid: process.pid,
|
|
130
|
+
taskpaneUrl: `${addinUrl}/taskpane.html?backendUrl=${encodeURIComponent(backendUrl)}`,
|
|
131
|
+
backendUrl,
|
|
132
|
+
workspaceModules: Object.fromEntries(
|
|
133
|
+
Array.from(workspaceModuleDirs.entries()).map(([prefix, moduleDir]) => [
|
|
134
|
+
prefix.replace(/^\/workspace\//, "").replace(/\/$/, ""),
|
|
135
|
+
{ available: Boolean(moduleDir) }
|
|
136
|
+
])
|
|
137
|
+
)
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
|
|
97
141
|
function generateManifest() {
|
|
98
142
|
const addinUrl = trimTrailingSlash(process.env.OPEN_WORKBOOK_ADDIN_URL ?? `${protocol}://${host}:${port}`);
|
|
99
143
|
const backendUrl = process.env.OPEN_WORKBOOK_BACKEND_URL ?? `ws://${process.env.OPEN_WORKBOOK_HOST ?? "127.0.0.1"}:${process.env.OPEN_WORKBOOK_PORT ?? 37845}${process.env.OPEN_WORKBOOK_ADDIN_PATH ?? "/addin"}`;
|
|
@@ -124,5 +168,22 @@ function trimTrailingSlash(value) {
|
|
|
124
168
|
return value.endsWith("/") ? value.slice(0, -1) : value;
|
|
125
169
|
}
|
|
126
170
|
|
|
171
|
+
function readPackageVersion() {
|
|
172
|
+
for (const packageJsonPath of [join(root, "package.json"), join(repoRoot, "package.json")]) {
|
|
173
|
+
if (!existsSync(packageJsonPath)) {
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
try {
|
|
177
|
+
const parsed = JSON.parse(readFileSync(packageJsonPath, "utf8"));
|
|
178
|
+
if (typeof parsed.version === "string") {
|
|
179
|
+
return parsed.version;
|
|
180
|
+
}
|
|
181
|
+
} catch {
|
|
182
|
+
return undefined;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return undefined;
|
|
186
|
+
}
|
|
187
|
+
|
|
127
188
|
const ICON_PNG_BASE64 =
|
|
128
189
|
"iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAIAAAAlC+aJAAAAFUlEQVR4nO3BAQEAAACCIP+vbkhAAQAAAO8GEABAAAGl9n6SAAAAAElFTkSuQmCC";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: open-workbook-excel
|
|
3
|
-
description: Use when an agent needs to automate live Microsoft Excel workbooks through Open Workbook MCP
|
|
3
|
+
description: "Use when an agent needs to automate live Microsoft Excel workbooks through Open Workbook MCP, including inspecting workbooks, reading or writing ranges, updating tables, preserving templates, repairing formulas/styles, creating pivots/charts, validating reports, saving/exporting files, coordinating multiple agents, or choosing the fastest reliable Excel MCP tool instead of slow manual spreadsheet automation."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Open Workbook Excel
|
|
@@ -45,9 +45,10 @@ const STYLE_COPY_TOOL_DIMENSIONS = {
|
|
|
45
45
|
"excel.style.copy_hidden_rows_columns": "hiddenRowsColumns"
|
|
46
46
|
};
|
|
47
47
|
const runtime = await createRuntimeFacade();
|
|
48
|
+
const runtimeVersion = process.env.OPEN_WORKBOOK_VERSION ?? "0.1.2";
|
|
48
49
|
const server = new McpServer({
|
|
49
50
|
name: "open-workbook",
|
|
50
|
-
version:
|
|
51
|
+
version: runtimeVersion
|
|
51
52
|
});
|
|
52
53
|
registerRuntimeTools(server);
|
|
53
54
|
registerWorkbookTools(server);
|