@exulu/backend 5.17.2 → 5.19.0

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.
@@ -6,7 +6,7 @@ import {
6
6
  isPythonEnvironmentSetup,
7
7
  setupPythonEnvironment,
8
8
  validatePythonEnvironment
9
- } from "./chunk-JIZCKSJO.js";
9
+ } from "./chunk-NJWNOXLJ.js";
10
10
  export {
11
11
  getPackageRoot,
12
12
  getPythonSetupInstructions,
@@ -9,7 +9,7 @@ import { withRetry } from '@SRC/utils/with-retry';
9
9
  import * as mammoth from 'mammoth';
10
10
  import TurndownService from 'turndown';
11
11
  import WordExtractor from 'word-extractor';
12
- import { parseOfficeAsync } from "officeparser";
12
+ import { officeToText } from "@SRC/utils/office-text";
13
13
  import { checkLicense } from '@EE/entitlements';
14
14
  import { executePythonScript } from '@SRC/utils/python-executor';
15
15
  import { LiteParse } from '@llamaindex/liteparse';
@@ -809,6 +809,24 @@ async function processDocument(
809
809
  };
810
810
  }
811
811
 
812
+ /**
813
+ * Writes one PNG per page into `dir` and returns page number -> file path.
814
+ * Kept apart from the liteparse result, whose type has no place for a path.
815
+ */
816
+ async function saveScreenshots(
817
+ screenshots: { pageNum: number; imageBuffer: Buffer | Uint8Array }[],
818
+ dir: string,
819
+ ): Promise<Map<number, string>> {
820
+ await fs.promises.mkdir(dir, { recursive: true });
821
+ const saved = new Map<number, string>();
822
+ for (const screenshot of screenshots) {
823
+ const file = path.join(dir, `${screenshot.pageNum}.png`);
824
+ await fs.promises.writeFile(file, screenshot.imageBuffer);
825
+ saved.set(screenshot.pageNum, file);
826
+ }
827
+ return saved;
828
+ }
829
+
812
830
  async function processPdf(
813
831
  buffer: Buffer,
814
832
  paths: ProcessingPaths,
@@ -822,10 +840,7 @@ async function processPdf(
822
840
  let json: ProcessedDocument = [];
823
841
  // Call the PDF processor script
824
842
  if (config?.processor.name === "officeparser") {
825
- const text = await parseOfficeAsync(buffer, {
826
- outputErrorToConsole: false,
827
- newlineDelimiter: "\n",
828
- });
843
+ const text = await officeToText(buffer);
829
844
  json = [{
830
845
  page: 1,
831
846
  content: text,
@@ -923,23 +938,14 @@ async function processPdf(
923
938
  pages.map(p => ({ ...p, index: p.index + offset }))
924
939
  );
925
940
 
926
- const parser = new LiteParse();
941
+ const parser = new LiteParse({ quiet: true });
927
942
  const screenshots = await parser.screenshot(paths.source, undefined);
928
-
929
- // Save the screenshots in the temp image directory
930
- await fs.promises.mkdir(paths.images, { recursive: true });
931
- for (const screenshot of screenshots) {
932
- await fs.promises.writeFile(path.join(
933
- paths.images, `${screenshot.pageNum}.png`),
934
- screenshot.imageBuffer
935
- );
936
- screenshot.imagePath = path.join(paths.images, `${screenshot.pageNum}.png`);
937
- }
943
+ const imagePaths = await saveScreenshots(screenshots, paths.images);
938
944
 
939
945
  json = mergedPages.map(page => ({
940
946
  page: page.index + 1,
941
947
  content: page.markdown,
942
- image: screenshots.find(s => s.pageNum === page.index + 1)?.imagePath,
948
+ image: imagePaths.get(page.index + 1),
943
949
  headings: [],
944
950
  }));
945
951
 
@@ -947,23 +953,15 @@ async function processPdf(
947
953
 
948
954
  } else if (config?.processor.name === "liteparse") {
949
955
 
950
- const parser = new LiteParse();
956
+ const parser = new LiteParse({ quiet: true });
951
957
  const result = await parser.parse(paths.source);
952
958
  const screenshots = await parser.screenshot(paths.source, undefined);
953
-
954
- console.log(`[EXULU] Liteparse screenshots: ${JSON.stringify(screenshots)}`);
955
-
956
- // Save the screenshots in the temp image directory
957
- await fs.promises.mkdir(paths.images, { recursive: true });
958
- for (const screenshot of screenshots) {
959
- await fs.promises.writeFile(path.join(paths.images, `${screenshot.pageNum}.png`), screenshot.imageBuffer);
960
- screenshot.imagePath = path.join(paths.images, `${screenshot.pageNum}.png`);
961
- }
959
+ const imagePaths = await saveScreenshots(screenshots, paths.images);
962
960
 
963
961
  json = result.pages.map(page => ({
964
962
  page: page.pageNum,
965
963
  content: page.text,
966
- image: screenshots.find(s => s.pageNum === page.pageNum)?.imagePath,
964
+ image: imagePaths.get(page.pageNum),
967
965
  }));
968
966
 
969
967
  fs.writeFileSync(paths.json, JSON.stringify(json, null, 2));
@@ -9,7 +9,7 @@ defusedxml
9
9
  # BSD-3-Clause, no dependencies. Replaced PyMuPDF, which is AGPL-3.0 or a paid
10
10
  # Artifex commercial licence; see split_pdf.py. Do not reintroduce a PDF library
11
11
  # without checking its licence.
12
- pypdf>=6.1
12
+ pypdf>=6.21.4,<8
13
13
  # Whisper transcription server. Used by `npx @exulu/backend exulu-start-whisper`.
14
14
  #
15
15
  # Notes on the pins:
@@ -31,29 +31,29 @@ uvicorn
31
31
  python-multipart
32
32
  requests
33
33
  # LiteLLM proxy — only used when EXULU_USE_LITELLM=true. Always installed so
34
- # the dep is ready when the env var is flipped. Pinned to a tested version;
35
- # upgrade deliberately.
34
+ # the dep is ready when the env var is flipped. Pinned to a tested version on
35
+ # LiteLLM's LTS line (lts/1.108.x); upgrade deliberately, and move along that
36
+ # line for patches.
37
+ # Upgrading across schema changes: Exulu syncs LiteLLM's database with
38
+ # `prisma db push`, which refuses some changes. See
39
+ # src/exulu/litellm/pre-push-migrations.ts before bumping this pin.
36
40
  # NOTE: the [proxy] extra hard-requires litellm-enterprise, which is NOT MIT —
37
41
  # it carries the proprietary BerriAI Enterprise License. setup.sh step 6.4
38
42
  # uninstalls it right after this file is installed; see the comment there. Keep
39
- # the extra (we need its other 29 packages) and keep that uninstall step
43
+ # the extra (we need its other packages) and keep that uninstall step
40
44
  # together.
41
- litellm[proxy]==1.97.0
42
- # FastAPI ceiling — NOT cosmetic. litellm 1.97.0 declares fastapi>=0.136.3,<1.0
43
- # but imports the private `get_flat_dependant` from fastapi.dependencies.utils
44
- # (proxy/management_endpoints/management_v1/common.py:7), which FastAPI deleted
45
- # in 0.140.7. Any resolve that picks 0.140.7+ yields a proxy that cannot start:
46
- # "ImportError: cannot import name 'get_flat_dependant'". 0.140.6 is the last
47
- # version that still has it. NOTE: fastapi is also a first-party dependency of
48
- # ee/python/transcription/server.py (not just a litellm transitive). Once
49
- # litellm ships its own ceiling, replace this constrained pin with a bare
50
- # `fastapi` line — do not delete it entirely.
51
- fastapi>=0.136.3,<0.140.7 # to confirm this pin is still needed: grep -r get_flat_dependant $(pip show litellm | awk '/Location/{print $2}')/litellm/proxy/
45
+ litellm[proxy]==1.108.18
46
+ # fastapi is a first-party dependency of ee/python/transcription/server.py, not
47
+ # only a litellm transitive, so it stays listed. The <0.140.7 ceiling that
48
+ # litellm 1.97.0 needed (it imported the private `get_flat_dependant`, removed
49
+ # in FastAPI 0.140.7) is gone: 1.108.18 no longer imports it.
50
+ fastapi
52
51
  # Prisma Python client — required by LiteLLM proxy whenever a `database_url`
53
52
  # is set in config.litellm.yaml (used for user/budget tracking, key
54
- # management, etc.). NOT included in litellm[proxy] in 1.97.0, hence the
55
- # separate pin. setup.sh runs `prisma generate` against LiteLLM's bundled
56
- # schema after pip install so the Python client module is materialized.
53
+ # management, etc.). NOT included in litellm[proxy] (it sits in the separate
54
+ # `extra-proxy` extra), hence the pin here. setup.sh runs `prisma generate`
55
+ # against LiteLLM's bundled schema after pip install so the Python client
56
+ # module is materialized.
57
57
  prisma==0.15.0
58
58
  # Vertex AI SDK — required by LiteLLM when routing to `vertex_ai/*` models
59
59
  # (the `vertexai` Python module lives inside google-cloud-aiplatform).
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@exulu/backend",
3
3
  "author": "Qventu B.V.",
4
- "version": "5.17.2",
4
+ "version": "5.19.0",
5
5
  "main": "./dist/index.js",
6
6
  "private": false,
7
7
  "publishConfig": {
@@ -74,16 +74,16 @@
74
74
  "@types/pg": "^8.15.1",
75
75
  "@types/safe-regex": "^1.1.6",
76
76
  "@types/supertest": "^6.0.2",
77
- "@typescript-eslint/eslint-plugin": "^8.20.0",
78
- "@typescript-eslint/parser": "^8.20.0",
77
+ "@typescript-eslint/eslint-plugin": "^8.74.0",
78
+ "@typescript-eslint/parser": "^8.74.0",
79
79
  "conventional-changelog-atom": "^5.0.0",
80
80
  "eslint": "^9.20.0",
81
81
  "husky": "^9.1.7",
82
82
  "jest": "^29.7.0",
83
83
  "jscpd": "^4.0.8",
84
84
  "prettier": "^3.4.2",
85
- "semantic-release": "24.2.9",
86
- "serve": "^14.2.6",
85
+ "semantic-release": "25.0.9",
86
+ "serve": "^14.2.8",
87
87
  "supertest": "^7.0.0",
88
88
  "ts-jest": "^29.2.5",
89
89
  "tsc-alias": "^1.8.16",
@@ -94,70 +94,59 @@
94
94
  "typescript": "^5.8.3"
95
95
  },
96
96
  "dependencies": {
97
- "@ai-sdk/anthropic": "^3.0.23",
98
- "@ai-sdk/azure": "^3.0.53",
99
- "@ai-sdk/cerebras": "^2.0.51",
100
- "@ai-sdk/google-vertex": "^4.0.136",
101
- "@ai-sdk/openai": "^3.0.18",
102
- "@ai-sdk/openai-compatible": "^2.0.37",
97
+ "@ai-sdk/openai-compatible": "^2.0.96",
103
98
  "@anthropic-ai/sandbox-runtime": "^0.0.49",
104
- "@anthropic-ai/sdk": "^0.88.0",
105
- "@apollo/server": "^5.4.0",
99
+ "@apollo/server": "^5.5.2",
106
100
  "@as-integrations/express5": "^1.0.0",
107
101
  "@aws-sdk/client-s3": "^3.338.0",
108
102
  "@aws-sdk/client-sts": "^3.338.0",
109
103
  "@aws-sdk/s3-request-presigner": "^3.338.0",
110
104
  "@chat-adapter/state-pg": "4.45.0",
111
105
  "@chat-adapter/whatsapp": "4.45.0",
112
- "@llamaindex/liteparse": "^1.0.1",
113
- "@mistralai/mistralai": "^2.1.1",
114
- "@modelcontextprotocol/sdk": "^1.14.0",
115
- "@opentelemetry/api-logs": "^0.203.0",
116
- "@opentelemetry/auto-instrumentations-node": "^0.62.1",
117
- "@opentelemetry/exporter-logs-otlp-http": "^0.203.0",
118
- "@opentelemetry/exporter-trace-otlp-http": "^0.203.0",
119
- "@opentelemetry/resources": "^2.0.1",
120
- "@opentelemetry/sdk-logs": "^0.203.0",
121
- "@opentelemetry/sdk-node": "^0.203.0",
106
+ "@llamaindex/liteparse": "^2.21.3",
107
+ "@modelcontextprotocol/sdk": "^1.32.2",
108
+ "@opentelemetry/api": "^1.9.0",
109
+ "@opentelemetry/auto-instrumentations-node": "^0.81.2",
110
+ "@opentelemetry/exporter-logs-otlp-http": "^0.223.2",
111
+ "@opentelemetry/exporter-trace-otlp-http": "^0.223.2",
112
+ "@opentelemetry/resources": "^2.12.1",
113
+ "@opentelemetry/sdk-logs": "^0.223.2",
114
+ "@opentelemetry/sdk-node": "^0.223.2",
122
115
  "@opentelemetry/semantic-conventions": "^1.36.0",
123
- "@opentelemetry/winston-transport": "^0.14.1",
116
+ "@opentelemetry/winston-transport": "^0.34.0",
124
117
  "@perplexity-ai/perplexity_ai": "^0.25.0",
125
118
  "ai": "6.0.330",
126
119
  "ajv": "^8.20.0",
127
120
  "ajv-formats": "^3.0.1",
128
- "bash-tool": "^1.3.16",
121
+ "bash-tool": "^1.3.19",
129
122
  "bcryptjs": "^3.0.2",
130
- "body-parser": "^2.2.0",
123
+ "body-parser": "^2.4.0",
131
124
  "bullmq": "^5.48.1",
132
125
  "bullmq-otel": "^1.0.1",
133
126
  "busboy": "^1.6.0",
134
127
  "chat": "4.45.0",
135
- "class-validator": "^0.14.2",
136
128
  "cookie-parser": "^1.4.7",
137
129
  "cors": "^2.8.5",
138
130
  "cron-validator": "^1.4.0",
139
131
  "crypto-js": "^4.2.0",
140
- "csv-parse": "^5.6.0",
132
+ "csv-parse": "^7.0.3",
141
133
  "dotenv": "^16.5.0",
142
134
  "express": "^5.1.0",
143
- "express-http-proxy": "^2.1.2",
144
135
  "franc": "^6.2.0",
145
136
  "fuse.js": "^7.4.2",
146
137
  "graphql": "^16.11.0",
147
138
  "graphql-tools": "^9.0.18",
148
139
  "graphql-type-json": "^0.3.2",
149
- "http-proxy-middleware": "^3.0.5",
140
+ "http-proxy-middleware": "^3.0.11",
150
141
  "jose": "^6.0.10",
151
- "json-schema-to-zod": "^2.6.1",
152
- "jsonwebtoken": "^9.0.2",
153
142
  "knex": "^3.1.0",
154
143
  "link": "^2.1.1",
155
- "mailparser": "^3.9.14",
144
+ "mailparser": "^3.15.0",
156
145
  "mammoth": "^1.11.0",
157
- "multer": "^2.1.1",
158
- "natural": "^8.1.0",
159
- "nodemailer": "^8.0.7",
160
- "officeparser": "^5.2.2",
146
+ "multer": "^2.5.0",
147
+ "natural": "^8.2.6",
148
+ "nodemailer": "^10.6.1",
149
+ "officeparser": "~8.4.1",
161
150
  "openai": "^6.34.0",
162
151
  "p-limit": "^7.3.0",
163
152
  "papaparse": "^5.5.2",
@@ -169,15 +158,12 @@
169
158
  "tiktoken": "^1.0.21",
170
159
  "turndown": "^7.2.2",
171
160
  "umap-js": "^1.4.0",
172
- "uuid": "^11.1.0",
173
- "wink-nlp": "^2.4.0",
161
+ "uuid": "^11.1.1",
174
162
  "winston": "^3.17.0",
175
163
  "word-extractor": "^1.0.4",
176
164
  "yaml": "^2.8.3",
177
165
  "zod": "^4.3.6",
178
- "zod-from-json-schema": "^0.5.2",
179
- "zod-to-json-schema": "^3.25.1",
180
- "zodex": "^0.18.2"
166
+ "zod-from-json-schema": "^0.5.2"
181
167
  },
182
168
  "files": [
183
169
  "dist",
@@ -65,7 +65,7 @@ async function setupPythonEnvironment() {
65
65
 
66
66
  const { stdout, stderr } = await execAsync(`bash "${setupScriptPath}"`, {
67
67
  cwd: resolve(__dirname, '..'),
68
- timeout: 600000, // 10 minutes
68
+ timeout: 1800000, // 30 minutes
69
69
  maxBuffer: 10 * 1024 * 1024,
70
70
  });
71
71