@components-kit/open-workbook 0.1.1 → 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 +46 -0
- 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" />
|
|
@@ -26,6 +26,7 @@ const port = Number(process.env.OPEN_WORKBOOK_ADDIN_PORT ?? 37846);
|
|
|
26
26
|
const host = process.env.OPEN_WORKBOOK_ADDIN_HOST ?? "127.0.0.1";
|
|
27
27
|
const httpsEnabled = process.env.OPEN_WORKBOOK_ADDIN_HTTPS === "1" || process.env.OPEN_WORKBOOK_ADDIN_PROTOCOL === "https";
|
|
28
28
|
const protocol = httpsEnabled ? "https" : "http";
|
|
29
|
+
const runtimeVersion = process.env.OPEN_WORKBOOK_VERSION ?? readPackageVersion() ?? "0.1.1";
|
|
29
30
|
|
|
30
31
|
const contentTypes = new Map([
|
|
31
32
|
[".html", "text/html; charset=utf-8"],
|
|
@@ -37,6 +38,14 @@ const contentTypes = new Map([
|
|
|
37
38
|
|
|
38
39
|
const requestHandler = (request, response) => {
|
|
39
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
|
+
}
|
|
40
49
|
if (url.pathname.startsWith("/assets/icon-") && url.pathname.endsWith(".png")) {
|
|
41
50
|
response.writeHead(200, {
|
|
42
51
|
"content-type": "image/png",
|
|
@@ -109,6 +118,26 @@ function rewriteBrowserImports(source) {
|
|
|
109
118
|
.replaceAll("'@components-kit/open-workbook-protocol'", "'/workspace/protocol/index.js'");
|
|
110
119
|
}
|
|
111
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
|
+
|
|
112
141
|
function generateManifest() {
|
|
113
142
|
const addinUrl = trimTrailingSlash(process.env.OPEN_WORKBOOK_ADDIN_URL ?? `${protocol}://${host}:${port}`);
|
|
114
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"}`;
|
|
@@ -139,5 +168,22 @@ function trimTrailingSlash(value) {
|
|
|
139
168
|
return value.endsWith("/") ? value.slice(0, -1) : value;
|
|
140
169
|
}
|
|
141
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
|
+
|
|
142
188
|
const ICON_PNG_BASE64 =
|
|
143
189
|
"iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAIAAAAlC+aJAAAAFUlEQVR4nO3BAQEAAACCIP+vbkhAAQAAAO8GEABAAAGl9n6SAAAAAElFTkSuQmCC";
|
|
@@ -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);
|