@8btc/office-assistant-mcp 0.0.14 → 0.0.16

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/dist/index.cjs CHANGED
@@ -22,6 +22,8 @@ const fs = require("fs");
22
22
  const fsPromises = require("fs/promises");
23
23
  const playwright = require("playwright");
24
24
  const pdfLib = require("pdf-lib");
25
+ const path$2 = require("path");
26
+ const url = require("url");
25
27
  async function startStdioMcpServer(server) {
26
28
  const transport2 = new stdio_js.StdioServerTransport();
27
29
  await server.connect(transport2);
@@ -119,7 +121,7 @@ const Cover = ({ data }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className:
119
121
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute top-0 left-0 right-0 bottom-0 z-0", children: /* @__PURE__ */ jsxRuntime.jsx("img", { className: "block w-full h-full object-cover", src: bg, alt: "" }) }),
120
122
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "h-full py-[118px] px-[82px] relative z-10 flex flex-col justify-between", children: [
121
123
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
122
- !!data.disclaimer && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex mb-[167px]", children: /* @__PURE__ */ jsxRuntime.jsx(AiWarn, { disclaimer: data.disclaimer }) }),
124
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex mb-[167px]", children: /* @__PURE__ */ jsxRuntime.jsx(AiWarn, { disclaimer: "本报告由 Wujie Agent 生成" }) }),
123
125
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
124
126
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-[54px] text-[#043C68] font-bold leading-[120%] mb-8 fontsongti", children: data.reportTitle }),
125
127
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-[30px] text-[#043C68] font-bold leading-[120%] fontsongti", children: data.secondaryTitle })
@@ -134,7 +136,7 @@ const Cover = ({ data }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className:
134
136
  const End = ({ data }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "full-page relative", children: [
135
137
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute top-0 left-0 right-0 bottom-0 z-0", children: /* @__PURE__ */ jsxRuntime.jsx("img", { className: "block w-full h-full object-cover", src: bg, alt: "" }) }),
136
138
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "h-full py-[118px] px-[82px] relative z-10", children: [
137
- !!data.disclaimer && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex mb-9", children: /* @__PURE__ */ jsxRuntime.jsx(AiWarn, { disclaimer: data.disclaimer }) }),
139
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex mb-9", children: /* @__PURE__ */ jsxRuntime.jsx(AiWarn, { disclaimer: "本报告由 Wujie Agent 生成" }) }),
138
140
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex mb-[25px]", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-white p-3", children: /* @__PURE__ */ jsxRuntime.jsx(qrcode_react.QRCodeSVG, { value: data.qrcodeUrl, size: 126 }) }) }),
139
141
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-black w-[306px] py-2.5 px-2 text-sm leading-[150%]", children: [
140
142
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-1", children: "本文内容由大语言模型(LLM)基于截至训练时间节点的知识库生成。尽管我们力求信息的客观与全面,但鉴于生成式 AI 的概率预测特性,文本中涉及的市场规模预测、技术参数及竞争格局分析可能存在误差。" }),
@@ -13341,7 +13343,7 @@ const domain = {
13341
13343
  tokenize: tokenizeDomain,
13342
13344
  partial: true
13343
13345
  };
13344
- const path$2 = {
13346
+ const path$1 = {
13345
13347
  tokenize: tokenizePath,
13346
13348
  partial: true
13347
13349
  };
@@ -13447,7 +13449,7 @@ function tokenizeWwwAutolink(effects, ok2, nok) {
13447
13449
  }
13448
13450
  effects.enter("literalAutolink");
13449
13451
  effects.enter("literalAutolinkWww");
13450
- return effects.check(wwwPrefix, effects.attempt(domain, effects.attempt(path$2, wwwAfter), nok), nok)(code2);
13452
+ return effects.check(wwwPrefix, effects.attempt(domain, effects.attempt(path$1, wwwAfter), nok), nok)(code2);
13451
13453
  }
13452
13454
  function wwwAfter(code2) {
13453
13455
  effects.exit("literalAutolinkWww");
@@ -13497,7 +13499,7 @@ function tokenizeProtocolAutolink(effects, ok2, nok) {
13497
13499
  return nok(code2);
13498
13500
  }
13499
13501
  function afterProtocol(code2) {
13500
- return code2 === null || asciiControl(code2) || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2) || unicodePunctuation(code2) ? nok(code2) : effects.attempt(domain, effects.attempt(path$2, protocolAfter), nok)(code2);
13502
+ return code2 === null || asciiControl(code2) || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2) || unicodePunctuation(code2) ? nok(code2) : effects.attempt(domain, effects.attempt(path$1, protocolAfter), nok)(code2);
13501
13503
  }
13502
13504
  function protocolAfter(code2) {
13503
13505
  effects.exit("literalAutolinkHttp");
@@ -51859,7 +51861,7 @@ var innerPath = function innerPath2(name2, height) {
51859
51861
  return "";
51860
51862
  }
51861
51863
  };
51862
- var path$1 = {
51864
+ var path = {
51863
51865
  // The doubleleftarrow geometry is from glyph U+21D0 in the font KaTeX Main
51864
51866
  doubleleftarrow: "M262 157\nl10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3\n 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28\n 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5\nc2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5\n 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87\n-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7\n-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z\nm8 0v40h399730v-40zm0 194v40h399730v-40z",
51865
51867
  // doublerightarrow is from glyph U+21D2 in font KaTeX Main
@@ -54952,7 +54954,7 @@ class PathNode {
54952
54954
  if (this.alternate) {
54953
54955
  node2.setAttribute("d", this.alternate);
54954
54956
  } else {
54955
- node2.setAttribute("d", path$1[this.pathName]);
54957
+ node2.setAttribute("d", path[this.pathName]);
54956
54958
  }
54957
54959
  return node2;
54958
54960
  }
@@ -54960,7 +54962,7 @@ class PathNode {
54960
54962
  if (this.alternate) {
54961
54963
  return '<path d="' + utils.escape(this.alternate) + '"/>';
54962
54964
  } else {
54963
- return '<path d="' + utils.escape(path$1[this.pathName]) + '"/>';
54965
+ return '<path d="' + utils.escape(path[this.pathName]) + '"/>';
54964
54966
  }
54965
54967
  }
54966
54968
  }
@@ -74954,11 +74956,11 @@ const replaceMarkdown = (mdContent) => {
74954
74956
  const imgRegex = /!\[(.*?)\]\((.*?)\)/g;
74955
74957
  const windowsPattern = /[a-zA-Z]:(?:\\|\/)[^\s"'`<>|?*]*(?:[\\/][^\s"'`<>|?*]*)*/g;
74956
74958
  return mdContent.replace(imgRegex, (m) => {
74957
- let match;
74959
+ let match = imgRegex.exec(m);
74958
74960
  let result = "";
74959
- while ((match = imgRegex.exec(m)) !== null) {
74961
+ if (match) {
74960
74962
  const [, alt, src] = match;
74961
- if (!src.startsWith("http") && windowsPattern.test(src)) {
74963
+ if (!src?.startsWith("http") && windowsPattern.test(src)) {
74962
74964
  result = `![${alt || ""}](${encodeURIComponent(src)})`;
74963
74965
  }
74964
74966
  }
@@ -75202,9 +75204,6 @@ const style = `/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com *
75202
75204
  .relative {
75203
75205
  position: relative;
75204
75206
  }
75205
- .static {
75206
- position: static;
75207
- }
75208
75207
  .top-0 {
75209
75208
  top: calc(var(--spacing) * 0);
75210
75209
  }
@@ -75226,24 +75225,6 @@ const style = `/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com *
75226
75225
  .z-50 {
75227
75226
  z-index: 50;
75228
75227
  }
75229
- .container {
75230
- width: 100%;
75231
- @media (width >= 40rem) {
75232
- max-width: 40rem;
75233
- }
75234
- @media (width >= 48rem) {
75235
- max-width: 48rem;
75236
- }
75237
- @media (width >= 64rem) {
75238
- max-width: 64rem;
75239
- }
75240
- @media (width >= 80rem) {
75241
- max-width: 80rem;
75242
- }
75243
- @media (width >= 96rem) {
75244
- max-width: 96rem;
75245
- }
75246
- }
75247
75228
  .mx-2 {
75248
75229
  margin-inline: calc(var(--spacing) * 2);
75249
75230
  }
@@ -75322,21 +75303,9 @@ const style = `/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com *
75322
75303
  .grid {
75323
75304
  display: grid;
75324
75305
  }
75325
- .hidden {
75326
- display: none;
75327
- }
75328
- .inline {
75329
- display: inline;
75330
- }
75331
- .inline-block {
75332
- display: inline-block;
75333
- }
75334
75306
  .table {
75335
75307
  display: table;
75336
75308
  }
75337
- .table-cell {
75338
- display: table-cell;
75339
- }
75340
75309
  .h-6 {
75341
75310
  height: calc(var(--spacing) * 6);
75342
75311
  }
@@ -75461,11 +75430,6 @@ const style = `/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com *
75461
75430
  margin-inline-end: calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-x-reverse)));
75462
75431
  }
75463
75432
  }
75464
- .truncate {
75465
- overflow: hidden;
75466
- text-overflow: ellipsis;
75467
- white-space: nowrap;
75468
- }
75469
75433
  .overflow-hidden {
75470
75434
  overflow: hidden;
75471
75435
  }
@@ -75650,19 +75614,6 @@ const style = `/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com *
75650
75614
  .text-white {
75651
75615
  color: var(--color-white);
75652
75616
  }
75653
- .lowercase {
75654
- text-transform: lowercase;
75655
- }
75656
- .italic {
75657
- font-style: italic;
75658
- }
75659
- .ordinal {
75660
- --tw-ordinal: ordinal;
75661
- font-variant-numeric: var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,);
75662
- }
75663
- .overline {
75664
- text-decoration-line: overline;
75665
- }
75666
75617
  .underline {
75667
75618
  text-decoration-line: underline;
75668
75619
  }
@@ -75686,10 +75637,6 @@ const style = `/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com *
75686
75637
  --tw-shadow: 0 10px 15px -3px var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 4px 6px -4px var(--tw-shadow-color, rgb(0 0 0 / 0.1));
75687
75638
  box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
75688
75639
  }
75689
- .ring {
75690
- --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
75691
- box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
75692
- }
75693
75640
  .outline {
75694
75641
  outline-style: var(--tw-outline-style);
75695
75642
  outline-width: 1px;
@@ -76674,26 +76621,6 @@ mjx-container:not([display='true']) svg {
76674
76621
  syntax: "*";
76675
76622
  inherits: false;
76676
76623
  }
76677
- @property --tw-ordinal {
76678
- syntax: "*";
76679
- inherits: false;
76680
- }
76681
- @property --tw-slashed-zero {
76682
- syntax: "*";
76683
- inherits: false;
76684
- }
76685
- @property --tw-numeric-figure {
76686
- syntax: "*";
76687
- inherits: false;
76688
- }
76689
- @property --tw-numeric-spacing {
76690
- syntax: "*";
76691
- inherits: false;
76692
- }
76693
- @property --tw-numeric-fraction {
76694
- syntax: "*";
76695
- inherits: false;
76696
- }
76697
76624
  @property --tw-shadow {
76698
76625
  syntax: "*";
76699
76626
  inherits: false;
@@ -76788,11 +76715,6 @@ mjx-container:not([display='true']) svg {
76788
76715
  --tw-border-style: solid;
76789
76716
  --tw-leading: initial;
76790
76717
  --tw-font-weight: initial;
76791
- --tw-ordinal: initial;
76792
- --tw-slashed-zero: initial;
76793
- --tw-numeric-figure: initial;
76794
- --tw-numeric-spacing: initial;
76795
- --tw-numeric-fraction: initial;
76796
76718
  --tw-shadow: 0 0 #0000;
76797
76719
  --tw-shadow-color: initial;
76798
76720
  --tw-shadow-alpha: 100%;
@@ -76848,9 +76770,9 @@ async function generateBasePdf(data) {
76848
76770
  },
76849
76771
  ...data.paragraph.map((it, idx) => ({
76850
76772
  html: renderSegment({ ...it, abstract: idx === 0 ? data.abstract : "" }),
76851
- headerTitle: data.header,
76852
- footerTitle: data.footer
76773
+ headerTitle: data.header
76853
76774
  })),
76775
+ // 暂时先不要
76854
76776
  // data.reference && {
76855
76777
  // html: renderReference(data),
76856
76778
  // headerTitle: data.header,
@@ -76891,10 +76813,8 @@ const basePdfSchema = {
76891
76813
  time: zod.z.string().describe("生成时间"),
76892
76814
  abstract: zod.z.string().describe("报告摘要"),
76893
76815
  header: zod.z.string().describe("报告页眉内容"),
76894
- footer: zod.z.string().describe("报告页脚内容"),
76895
76816
  reference: zod.z.string().describe("报告引用"),
76896
- paragraph: zod.z.array(paragraph).describe("报告内容"),
76897
- disclaimer: zod.z.string().optional().describe("ai生成声明")
76817
+ paragraph: zod.z.array(paragraph).describe("报告内容")
76898
76818
  };
76899
76819
  zod.z.object({
76900
76820
  ...basePdfSchema
@@ -76968,11 +76888,6 @@ function getDateString() {
76968
76888
  const minu = date.getMinutes();
76969
76889
  return `${month}_${d}_${h2}_${minu}`;
76970
76890
  }
76971
- require("https");
76972
- require("http");
76973
- const fsPromise = require("fs/promises");
76974
- const path = require("path");
76975
- const url = require("url");
76976
76891
  const isLocalPath = (inputPath) => {
76977
76892
  if (typeof inputPath !== "string" || inputPath.trim() === "") {
76978
76893
  return false;
@@ -76992,7 +76907,7 @@ const isLocalPath = (inputPath) => {
76992
76907
  }
76993
76908
  } catch (err) {
76994
76909
  }
76995
- const resolvedPath = path.resolve(normalizedPath);
76910
+ const resolvedPath = path$2.resolve(normalizedPath);
76996
76911
  const isWindowsLocal = process.platform === "win32" && /^[a-zA-Z]:[\\/]/i.test(resolvedPath);
76997
76912
  const isUnixLocal = (process.platform === "linux" || process.platform === "darwin") && resolvedPath.startsWith("/");
76998
76913
  return isWindowsLocal || isUnixLocal || normalizedPath.startsWith("./") || normalizedPath.startsWith("../");
@@ -77002,7 +76917,7 @@ const localImageToBase64 = async (imagePath) => {
77002
76917
  if (!imagePath) {
77003
76918
  return null;
77004
76919
  }
77005
- const buffer = await fsPromise.readFile(imagePath);
76920
+ const buffer = await fsPromises.readFile(imagePath);
77006
76921
  const mimeType = require("mime-types").lookup(imagePath) || "image/jpeg";
77007
76922
  return {
77008
76923
  mimeType,
@@ -77022,26 +76937,19 @@ const extractAllImageSrc = (html2) => {
77022
76937
  if (!match[1].startsWith("data:image/")) {
77023
76938
  logger.info("extractAllImageSrc match[0]:" + match[0], match[1]);
77024
76939
  logger.info("extractAllImageSrc match[1]:" + match[1]);
77025
- }
77026
- const decodedSrc = decodeURIComponent(match[1]);
77027
- if (isLocalPath(decodedSrc)) {
77028
- srcs.push({
77029
- src: decodedSrc,
77030
- originSrc: match[1]
77031
- });
76940
+ const decodedSrc = decodeURIComponent(match[1]);
76941
+ if (isLocalPath(decodedSrc)) {
76942
+ srcs.push({
76943
+ src: decodedSrc,
76944
+ originSrc: match[1]
76945
+ });
76946
+ }
77032
76947
  }
77033
76948
  }
77034
76949
  return srcs;
77035
76950
  };
77036
76951
  const createPage = async (page, item) => {
77037
- const {
77038
- tempFileName,
77039
- headerTitle,
77040
- html: html2,
77041
- footerTitle,
77042
- hideHeader,
77043
- hideFooter
77044
- } = item;
76952
+ const { tempFileName, headerTitle, html: html2, hideHeader, hideFooter } = item;
77045
76953
  const headerTemplate = `
77046
76954
  <header style="height: 83px; position: fixed; top: 0; left: 40px; right: 40px; border-bottom: 1px solid #D4D4D4; display: flex; align-items: center;">
77047
76955
  <div style="font-size: 16px; color: #525252; font-family: SimSun, "宋体", "songti", serif;">
@@ -77056,7 +76964,7 @@ const createPage = async (page, item) => {
77056
76964
  localImageToBase64(srcInfo.src).then((fileInfo) => {
77057
76965
  resolve({
77058
76966
  ...fileInfo,
77059
- // 原本没转换的地址
76967
+ // 原本没转换的地址用来base64匹配
77060
76968
  originSrc: srcInfo.originSrc
77061
76969
  });
77062
76970
  }).catch(() => {
@@ -77083,11 +76991,9 @@ const createPage = async (page, item) => {
77083
76991
  printBackground: true,
77084
76992
  displayHeaderFooter: !hideHeader && !hideFooter,
77085
76993
  headerTemplate: hideHeader ? "" : headerTemplate,
77086
- footerTemplate: hideFooter ? "" : `
77087
- <div style="width: 100%; box-sizing: border-box; height: 67px; display: flex; justify-content: space-between; font-size: 13px; padding: 0 48px; position: fixed; bottom: 0; left: 0; font-family: KaiTi, 楷体, serif;">
77088
- <div>${footerTitle}</div>
77089
- </div>
77090
- `,
76994
+ footerTemplate: hideFooter ? "" : `<div style="width: 100%; box-sizing: border-box; height: 67px; display: flex; justify-content: space-between; font-size: 13px; padding: 0 48px; position: fixed; bottom: 0; left: 0; font-family: KaiTi, 楷体, serif;">
76995
+ <div>本报告由 Wujie Agent 生成</div>
76996
+ </div>`,
77091
76997
  margin: hideHeader && hideFooter ? void 0 : hideFooter ? {
77092
76998
  top: "128px",
77093
76999
  right: 0,
@@ -77096,7 +77002,7 @@ const createPage = async (page, item) => {
77096
77002
  } : {
77097
77003
  top: "128px",
77098
77004
  right: "63px",
77099
- bottom: "128px",
77005
+ bottom: "118px",
77100
77006
  left: "63px"
77101
77007
  }
77102
77008
  });
@@ -77202,14 +77108,15 @@ const createPages = async ({
77202
77108
  const pageInfoList = [];
77203
77109
  try {
77204
77110
  for (let i = 0; i < list2.length; i++) {
77111
+ const item = list2[i];
77205
77112
  const tempFileName = `${dirname}/temp_page_${i}.pdf`;
77206
77113
  tempFiles.push(tempFileName);
77207
- const pageRes = list2[i].pdfUrl ? await loadPdf(list2[i].pdfUrl) : await createPage2(page, {
77114
+ const pageRes = item.pdfUrl ? await loadPdf(item.pdfUrl) : await createPage2(page, {
77208
77115
  tempFileName,
77209
- ...list2[i]
77116
+ ...item
77210
77117
  });
77211
77118
  pageInfoList.push({
77212
- ...list2[i],
77119
+ ...item,
77213
77120
  tempFileName,
77214
77121
  pageBytes: pageRes
77215
77122
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@8btc/office-assistant-mcp",
3
- "version": "0.0.14",
3
+ "version": "0.0.16",
4
4
  "description": "办公agent辅助mcp工具",
5
5
  "main": "dist/index.cjs",
6
6
  "type": "module",