@components-kit/open-workbook 0.1.2 → 0.1.4

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.
Files changed (31) hide show
  1. package/README.md +3 -4
  2. package/assets/backend/dist/runtime-service.d.ts +132 -191
  3. package/assets/backend/dist/runtime-service.d.ts.map +1 -1
  4. package/assets/backend/dist/runtime-service.js +85 -8
  5. package/assets/backend/dist/runtime-service.js.map +1 -1
  6. package/assets/excel-addin/dist/assets/icon-80.png +0 -0
  7. package/assets/excel-addin/dist/connection.d.ts.map +1 -1
  8. package/assets/excel-addin/dist/connection.js +4 -1
  9. package/assets/excel-addin/dist/connection.js.map +1 -1
  10. package/assets/excel-addin/dist/excel-executor.d.ts +7 -2
  11. package/assets/excel-addin/dist/excel-executor.d.ts.map +1 -1
  12. package/assets/excel-addin/dist/excel-executor.js +204 -40
  13. package/assets/excel-addin/dist/excel-executor.js.map +1 -1
  14. package/assets/excel-addin/dist/taskpane.bundle.js +49 -0
  15. package/assets/excel-addin/dist/taskpane.css +572 -0
  16. package/assets/excel-addin/dist/taskpane.d.ts.map +1 -1
  17. package/assets/excel-addin/dist/taskpane.html +28 -0
  18. package/assets/excel-addin/dist/taskpane.js +86 -24
  19. package/assets/excel-addin/dist/taskpane.js.map +1 -1
  20. package/assets/excel-addin/manifest.xml +24 -22
  21. package/assets/excel-addin/public/assets/icon-80.png +0 -0
  22. package/assets/excel-addin/public/taskpane.css +551 -26
  23. package/assets/excel-addin/public/taskpane.html +10 -17
  24. package/assets/excel-addin/scripts/dev-server.mjs +4 -33
  25. package/assets/instructions/open-workbook-excel/references/tool-selection.md +4 -2
  26. package/assets/instructions/open-workbook-excel/references/workflows.md +7 -4
  27. package/assets/mcp-server/dist/index.js +72 -7
  28. package/assets/mcp-server/dist/index.js.map +1 -1
  29. package/dist/index.js +48 -51
  30. package/dist/index.js.map +1 -1
  31. package/package.json +6 -6
@@ -21,9 +21,9 @@ If capabilities are unknown because the add-in is disconnected, stop and ask for
21
21
  - Formatting: `excel.range.read_number_formats`, `excel.range.read_styles`
22
22
  - Full cell payload: `excel.range.read_full`
23
23
  - Search and diagnostics: `excel.range.search`, `excel.range.find_blank_cells`, `excel.range.find_errors`
24
- - Table-shaped data: `excel.table.read`
24
+ - Table-shaped data: `excel.table.read`; pass `columns`, `rowOffset`, `rowLimit`, and include flags for large tables
25
25
 
26
- Use explicit sheet/address ranges whenever possible. Use used-range or workbook-wide scans only for audits, validation, search, or discovery.
26
+ Use explicit sheet/address ranges whenever possible. Use used-range or workbook-wide scans only for audits, validation, search, or discovery. For simple reads, use the facet-specific range tools instead of `excel.range.read_full`.
27
27
 
28
28
  ## Writing Data
29
29
 
@@ -41,11 +41,13 @@ Prefer `excel.plan.*` when a user should review a diff, when formulas/templates
41
41
 
42
42
  - Inspect tables: `excel.table.list`, `excel.table.get_info`, `excel.table.read`
43
43
  - Append or update rows: `excel.table.append_rows`, `excel.table.update_rows`
44
+ - Reorder columns: `excel.table.reorder_columns`
44
45
  - Resize or structure changes: `excel.table.resize`, `excel.table.copy_structure`
45
46
  - Filters: `excel.filter.get_filters`, `excel.filter.apply`, `excel.filter.clear`, `excel.filter.validate`
46
47
  - Sorts: `excel.sort.apply`, `excel.sort.clear`
47
48
 
48
49
  Use table tools instead of range tools when the target is an Excel table. This preserves headers, totals rows, filters, structured references, and table styles.
50
+ Do not clear and recreate a table to reorder columns; use `excel.table.reorder_columns`, or stop for confirmation before any destructive rebuild.
49
51
 
50
52
  ## Templates, Styles, And Formulas
51
53
 
@@ -64,12 +64,15 @@ Cleaning writes must stay within the requested sheet, range, table, or registere
64
64
  ## Update Tables, Filters, Or Sorts
65
65
 
66
66
  1. Inspect with `excel.table.get_info` and `excel.filter.get_filters`.
67
- 2. Use `excel.table.append_rows` or `excel.table.update_rows` for data.
68
- 3. Use `excel.table.resize` only when structure must change.
69
- 4. Preserve or reapply filters with `excel.filter.apply`, `excel.filter.preserve_from_template`, or `excel.table.preserve_filters`.
70
- 5. Validate with `excel.validate.tables` and `excel.validate.filters`.
67
+ 2. Use projected `excel.table.read` options when only some columns or rows are needed.
68
+ 3. Use `excel.table.reorder_columns` for column order changes.
69
+ 4. Use `excel.table.append_rows` or `excel.table.update_rows` for data.
70
+ 5. Use `excel.table.resize` only when structure must change.
71
+ 6. Preserve or reapply filters with `excel.filter.apply`, `excel.filter.preserve_from_template`, or `excel.table.preserve_filters`.
72
+ 7. Validate with `excel.validate.tables` and `excel.validate.filters`.
71
73
 
72
74
  Avoid raw range writes inside table bodies when table tools can express the intent.
75
+ Avoid full-table rewrites for layout changes such as column reorder; they are slow on large tables and can break table identity or dependent objects.
73
76
 
74
77
  ## Create Or Update Pivots And Charts
75
78
 
@@ -45,7 +45,7 @@ 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
+ const runtimeVersion = process.env.OPEN_WORKBOOK_VERSION ?? "0.1.4";
49
49
  const server = new McpServer({
50
50
  name: "open-workbook",
51
51
  version: runtimeVersion
@@ -975,14 +975,14 @@ function registerRangeTools(mcp) {
975
975
  ]) {
976
976
  registerMcpTool(mcp, name, {
977
977
  title: name.replace(/^excel\./, "").replace(/\./g, " "),
978
- description: "Read a range facet using the full range snapshot path.",
978
+ description: "Read one range facet without loading unrelated cell payloads.",
979
979
  inputSchema: readSchema,
980
980
  annotations: {
981
981
  readOnlyHint: true,
982
982
  destructiveHint: false,
983
983
  openWorldHint: false
984
984
  }
985
- }, async ({ workbookId, sheetName, address }) => jsonResult(await readRangeSnapshot(workbookId, sheetName, address)));
985
+ }, async ({ workbookId, sheetName, address }) => jsonResult(await readRangeSnapshot(workbookId, sheetName, address, rangeReadFacets(name))));
986
986
  }
987
987
  for (const [name, method] of [
988
988
  ["excel.range.read_hyperlinks", "range.read_hyperlinks"],
@@ -1952,10 +1952,19 @@ function registerTableTools(mcp) {
1952
1952
  }, async (args) => jsonResult(await runtime.getTableInfo(tableSelector(args))));
1953
1953
  registerMcpTool(mcp, "excel.table.read", {
1954
1954
  title: "Read Excel table",
1955
- description: "Read table headers, values, formulas, text, number formats, and metadata.",
1956
- inputSchema: tableSelectorSchema(),
1955
+ description: "Read table headers, selected data facets, optional columns, optional row page, and metadata.",
1956
+ inputSchema: {
1957
+ ...tableSelectorSchema(),
1958
+ includeValues: z.boolean().optional(),
1959
+ includeFormulas: z.boolean().optional(),
1960
+ includeText: z.boolean().optional(),
1961
+ includeNumberFormats: z.boolean().optional(),
1962
+ columns: z.array(z.union([z.string(), z.number().int().min(0)])).optional(),
1963
+ rowOffset: z.number().int().min(0).optional(),
1964
+ rowLimit: z.number().int().min(0).optional()
1965
+ },
1957
1966
  annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: false }
1958
- }, async (args) => jsonResult(await runtime.readTable(tableSelector(args))));
1967
+ }, async (args) => jsonResult(await runtime.readTable(tableReadRequest(args))));
1959
1968
  registerMcpTool(mcp, "excel.table.create", {
1960
1969
  title: "Create Excel table",
1961
1970
  description: "Create a structured table from a range, optionally writing values first.",
@@ -1977,6 +1986,18 @@ function registerTableTools(mcp) {
1977
1986
  inputSchema: { ...tableSelectorSchema(), address: z.string() },
1978
1987
  annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false }
1979
1988
  }, async (args) => jsonResult(await runtime.resizeTable({ ...tableSelector(args), address: args.address })));
1989
+ registerMcpTool(mcp, "excel.table.reorder_columns", {
1990
+ title: "Reorder Excel table columns",
1991
+ description: "Reorder columns in an existing structured table without clearing or recreating the table.",
1992
+ inputSchema: {
1993
+ ...tableSelectorSchema(),
1994
+ columnOrder: z.array(z.union([z.string(), z.number().int().min(0)]))
1995
+ },
1996
+ annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false }
1997
+ }, async (args) => jsonResult(await runtime.reorderTableColumns({
1998
+ ...tableSelector(args),
1999
+ columnOrder: args.columnOrder
2000
+ })));
1980
2001
  registerMcpTool(mcp, "excel.table.append_rows", {
1981
2002
  title: "Append Excel table rows",
1982
2003
  description: "Append one or more rows to a structured table.",
@@ -3252,7 +3273,23 @@ function registerEventTools(mcp) {
3252
3273
  annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: false }
3253
3274
  }, async ({ debounceMs }) => jsonResult(runtime.setEventDebounce(debounceMs)));
3254
3275
  }
3255
- async function readRangeSnapshot(workbookId, sheetName, address) {
3276
+ function rangeReadFacets(toolName) {
3277
+ switch (toolName) {
3278
+ case "excel.range.read_values":
3279
+ return ["values"];
3280
+ case "excel.range.read_formulas":
3281
+ return ["formulas"];
3282
+ case "excel.range.read_number_formats":
3283
+ return ["numberFormat"];
3284
+ case "excel.range.read_display_text":
3285
+ return ["text"];
3286
+ case "excel.range.read_styles":
3287
+ return ["style"];
3288
+ default:
3289
+ return ["values", "formulas", "numberFormat", "text", "style"];
3290
+ }
3291
+ }
3292
+ async function readRangeSnapshot(workbookId, sheetName, address, facets) {
3256
3293
  const operation = {
3257
3294
  kind: "range.read_full",
3258
3295
  operationId: makeId("op"),
@@ -3265,6 +3302,9 @@ async function readRangeSnapshot(workbookId, sheetName, address) {
3265
3302
  address
3266
3303
  }
3267
3304
  };
3305
+ if (facets !== undefined) {
3306
+ operation.facets = facets;
3307
+ }
3268
3308
  return runtime.applyBatch({
3269
3309
  workbookId: workbookId,
3270
3310
  mode: "apply",
@@ -3291,6 +3331,31 @@ function tableSelector(args) {
3291
3331
  tableName: args.tableName
3292
3332
  };
3293
3333
  }
3334
+ function tableReadRequest(args) {
3335
+ const request = tableSelector(args);
3336
+ if (args.includeValues !== undefined) {
3337
+ request.includeValues = args.includeValues;
3338
+ }
3339
+ if (args.includeFormulas !== undefined) {
3340
+ request.includeFormulas = args.includeFormulas;
3341
+ }
3342
+ if (args.includeText !== undefined) {
3343
+ request.includeText = args.includeText;
3344
+ }
3345
+ if (args.includeNumberFormats !== undefined) {
3346
+ request.includeNumberFormats = args.includeNumberFormats;
3347
+ }
3348
+ if (args.columns !== undefined) {
3349
+ request.columns = args.columns;
3350
+ }
3351
+ if (args.rowOffset !== undefined) {
3352
+ request.rowOffset = args.rowOffset;
3353
+ }
3354
+ if (args.rowLimit !== undefined) {
3355
+ request.rowLimit = args.rowLimit;
3356
+ }
3357
+ return request;
3358
+ }
3294
3359
  function tableCreateRequest(args) {
3295
3360
  const request = {
3296
3361
  workbookId: args.workbookId,