@exulu/backend 5.13.0 → 5.15.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.
Files changed (32) hide show
  1. package/dist/{chunk-RNZ4IDCT.js → chunk-KLPCQWM3.js} +74 -18
  2. package/dist/{chunk-4W3V7IHR.js → chunk-NBDSN45T.js} +22 -0
  3. package/dist/{chunk-URX7KJQV.js → chunk-S4UXKMN5.js} +3641 -1701
  4. package/dist/{convert-exulu-tools-to-ai-sdk-tools-IYEO2RV6.js → convert-exulu-tools-to-ai-sdk-tools-GLRM3PM6.js} +2 -2
  5. package/dist/doc_processor-SVOSOVOY.js +12 -0
  6. package/dist/index.cjs +3736 -1579
  7. package/dist/index.d.cts +91 -3
  8. package/dist/index.d.ts +91 -3
  9. package/dist/index.js +202 -196
  10. package/ee/invoke-skills/artifact-filter.test.ts +42 -1
  11. package/ee/invoke-skills/artifact-filter.ts +37 -0
  12. package/ee/invoke-skills/create-sandbox.env.test.ts +7 -1
  13. package/ee/invoke-skills/create-sandbox.readonly-skills.sandbox.test.ts +221 -0
  14. package/ee/invoke-skills/create-sandbox.readonly-skills.test.ts +290 -0
  15. package/ee/invoke-skills/create-sandbox.run-command.test.ts +135 -0
  16. package/ee/invoke-skills/create-sandbox.skill-actions.test.ts +176 -0
  17. package/ee/invoke-skills/create-sandbox.ts +268 -88
  18. package/ee/invoke-skills/safe-fs.test.ts +59 -1
  19. package/ee/invoke-skills/safe-fs.ts +61 -2
  20. package/ee/invoke-skills/skill-actions/load.test.ts +88 -0
  21. package/ee/invoke-skills/skill-actions/load.ts +107 -0
  22. package/ee/invoke-skills/skill-actions/schema.test.ts +72 -0
  23. package/ee/invoke-skills/skill-actions/schema.ts +97 -0
  24. package/ee/invoke-skills/skill-actions/tool.test.ts +464 -0
  25. package/ee/invoke-skills/skill-actions/tool.ts +415 -0
  26. package/ee/python/documents/processing/doc_processor.limits.test.ts +257 -0
  27. package/ee/python/documents/processing/doc_processor.progress.test.ts +151 -0
  28. package/ee/python/documents/processing/doc_processor.ts +115 -13
  29. package/ee/python/documents/processing/limits.test.ts +35 -0
  30. package/ee/python/documents/processing/limits.ts +54 -0
  31. package/package.json +2 -1
  32. package/dist/doc_processor-E5GCE2ZT.js +0 -10
package/dist/index.d.cts CHANGED
@@ -208,6 +208,49 @@ type ResolveOcrInput = {
208
208
  id: string;
209
209
  name: string;
210
210
  };
211
+ /**
212
+ * Abort an OCR request after this long (a timeout rejects, which the caller's retry logic treats
213
+ * as a failed attempt). Omitted = no explicit timeout, as before.
214
+ */
215
+ timeoutMs?: number;
216
+ };
217
+
218
+ /**
219
+ * Progress of reading one document into the store; delivered to every caller waiting on it.
220
+ * "text" is reserved (not emitted today; the frontend handles it).
221
+ */
222
+ type ProgressFn = (p: {
223
+ phase: "text" | "ocr" | "vision" | "storing";
224
+ pagesDone: number;
225
+ pagesTotal: number;
226
+ }) => void;
227
+ /**
228
+ * Interim tool result shown in the chat while a document is read. Never model-facing:
229
+ * the SDK marks every yielded value but the last as preliminary, and the convert
230
+ * wrapper passes these through untouched (no guard, no audit).
231
+ */
232
+ type ReadingStatus = {
233
+ status: "reading";
234
+ filename: string;
235
+ phase: "cached" | "text" | "ocr" | "vision" | "storing";
236
+ pagesDone: number;
237
+ pagesTotal: number;
238
+ };
239
+
240
+ /** Runs `fn` under a ceiling. */
241
+ type ProviderLimiter = <T>(fn: () => Promise<T>) => Promise<T>;
242
+ /**
243
+ * What the chat paths pass to documentProcessor. The call time limits travel with the limiters:
244
+ * a stalled provider must not pin chat slots, while knowledge-base processing (which passes
245
+ * none) keeps the transport's own, longer limit exactly as before.
246
+ */
247
+ type ProviderLimiters = {
248
+ ocr: ProviderLimiter;
249
+ vision: ProviderLimiter;
250
+ /** Longest one OCR request may take; a timeout counts as a failed attempt for the retry logic. */
251
+ ocrTimeoutMs?: number;
252
+ /** Longest one vision (page validation) call may take; same retry treatment. */
253
+ visionTimeoutMs?: number;
211
254
  };
212
255
 
213
256
  type DocumentProcessorConfig = {
@@ -222,6 +265,14 @@ type DocumentProcessorConfig = {
222
265
  model: string;
223
266
  concurrency: number;
224
267
  };
268
+ /**
269
+ * OCR settings. `concurrency` is how many OCR chunk calls ONE document runs
270
+ * at once (default 3, 1..8). Reads in chat additionally share a process-wide
271
+ * ceiling of 8 (see limits.ts); knowledge-base processing does not.
272
+ */
273
+ ocr?: {
274
+ concurrency?: number;
275
+ };
225
276
  processor: {
226
277
  name: "liteparse" | "mistral" | "officeparser";
227
278
  /**
@@ -259,12 +310,23 @@ type ProcessedPage = {
259
310
  image?: string;
260
311
  vlm_corrected_text?: string;
261
312
  vlm_validated?: boolean;
313
+ /** Set only under tolerateVisionFailures: the vision pass failed for this page, the text is OCR only. */
314
+ vlm_failed?: boolean;
262
315
  };
263
316
  type ProcessedDocument = ProcessedPage[];
264
- declare function documentProcessor({ file, name, config }: {
317
+ declare function documentProcessor({ file, name, config, tolerateVisionFailures, onProgress, limiters, }: {
265
318
  file: string | Buffer;
266
319
  name: string;
267
320
  config?: DocumentProcessorConfig;
321
+ /** A page whose vision pass failed keeps its OCR text and is flagged `vlm_failed` instead of failing the document. */
322
+ tolerateVisionFailures?: boolean;
323
+ /** Reports OCR progress per finished chunk and vision progress per finished page. */
324
+ onProgress?: ProgressFn;
325
+ /**
326
+ * Process-wide ceilings on OCR and vision calls. Passed by the chat paths only (extractDocument);
327
+ * absent for knowledge-base processing, which keeps its per-document limits unchanged.
328
+ */
329
+ limiters?: ProviderLimiters;
268
330
  }): Promise<ProcessedDocument | undefined>;
269
331
 
270
332
  interface TestCase {
@@ -1060,7 +1122,7 @@ declare class ExuluTool {
1060
1122
  result?: string;
1061
1123
  job?: string;
1062
1124
  items?: Item[];
1063
- }>;
1125
+ } | ReadingStatus>;
1064
1126
  });
1065
1127
  /**
1066
1128
  * Framework-only factory for tools whose `type` is managed by Exulu itself —
@@ -1341,6 +1403,32 @@ declare class ExuluApp {
1341
1403
  private server;
1342
1404
  }
1343
1405
 
1406
+ type AddFileResult = {
1407
+ name: string;
1408
+ skipped?: true;
1409
+ } | {
1410
+ error: string;
1411
+ };
1412
+ /**
1413
+ * For trusted server-side code (scripts, migrations). There is no user context: never call
1414
+ * this from a tool on behalf of a user.
1415
+ */
1416
+ declare const ExuluProjects: {
1417
+ create(input: {
1418
+ name: string;
1419
+ description?: string;
1420
+ ownerId: number | string;
1421
+ }): Promise<{
1422
+ id: string;
1423
+ }>;
1424
+ addFile(input: {
1425
+ projectId: string;
1426
+ name: string;
1427
+ data: Uint8Array | Buffer;
1428
+ ifExists?: "error" | "skip";
1429
+ }): Promise<AddFileResult>;
1430
+ };
1431
+
1344
1432
  declare class ExuluQueues {
1345
1433
  queues: {
1346
1434
  queue: Queue;
@@ -2895,4 +2983,4 @@ declare const ExuluPython: {
2895
2983
  instructions: typeof getPythonSetupInstructions;
2896
2984
  };
2897
2985
 
2898
- export { type AuditConfig, type AuditEvent, type AuditLogger, type ChunkerOperation, type ChunkerResponse, type CredentialField, CredentialInvalidError, type JOB_STATUS as EXULU_JOB_STATUS, JOB_STATUS_ENUM as EXULU_JOB_STATUS_ENUM, type STATISTICS_TYPE as EXULU_STATISTICS_TYPE, STATISTICS_TYPE_ENUM as EXULU_STATISTICS_TYPE_ENUM, type ExuluAgent, ExuluApp, type ExuluAuthConfig, ExuluAuthentication, ExuluChunkers, ExuluContext, type ExuluContextEmbedder, type ExuluCredentialsToolContext, ExuluDatabase, ExuluDefaultTools, ExuluDocumentProcessor, ExuluEval, type Item as ExuluItem, ExuluJobs, ExuluModels, type ExuluOauthConfig, type ExuluOauthToolContext, ExuluOtel, ExuluPython, queues as ExuluQueues, ExuluReadApi, ExuluRecall, ExuluReranker, ExuluTool, type ExuluUserCredentialsConfig, ExuluVariables, PROJECTION_VERSION, type RoutineHandle, type RoutineRunPatch, type VectorSearchChunkResult, backfillCoordinates, checkMemoryBase, defaultChunker, enableLiteLLMClientMode, fitContextProjection, listFittableContexts, postgresClient, recallMemories };
2986
+ export { type AuditConfig, type AuditEvent, type AuditLogger, type ChunkerOperation, type ChunkerResponse, type CredentialField, CredentialInvalidError, type JOB_STATUS as EXULU_JOB_STATUS, JOB_STATUS_ENUM as EXULU_JOB_STATUS_ENUM, type STATISTICS_TYPE as EXULU_STATISTICS_TYPE, STATISTICS_TYPE_ENUM as EXULU_STATISTICS_TYPE_ENUM, type ExuluAgent, ExuluApp, type ExuluAuthConfig, ExuluAuthentication, ExuluChunkers, ExuluContext, type ExuluContextEmbedder, type ExuluCredentialsToolContext, ExuluDatabase, ExuluDefaultTools, ExuluDocumentProcessor, ExuluEval, type Item as ExuluItem, ExuluJobs, ExuluModels, type ExuluOauthConfig, type ExuluOauthToolContext, ExuluOtel, ExuluProjects, ExuluPython, queues as ExuluQueues, ExuluReadApi, ExuluRecall, ExuluReranker, ExuluTool, type ExuluUserCredentialsConfig, ExuluVariables, PROJECTION_VERSION, type RoutineHandle, type RoutineRunPatch, type VectorSearchChunkResult, backfillCoordinates, checkMemoryBase, defaultChunker, enableLiteLLMClientMode, fitContextProjection, listFittableContexts, postgresClient, recallMemories };
package/dist/index.d.ts CHANGED
@@ -208,6 +208,49 @@ type ResolveOcrInput = {
208
208
  id: string;
209
209
  name: string;
210
210
  };
211
+ /**
212
+ * Abort an OCR request after this long (a timeout rejects, which the caller's retry logic treats
213
+ * as a failed attempt). Omitted = no explicit timeout, as before.
214
+ */
215
+ timeoutMs?: number;
216
+ };
217
+
218
+ /**
219
+ * Progress of reading one document into the store; delivered to every caller waiting on it.
220
+ * "text" is reserved (not emitted today; the frontend handles it).
221
+ */
222
+ type ProgressFn = (p: {
223
+ phase: "text" | "ocr" | "vision" | "storing";
224
+ pagesDone: number;
225
+ pagesTotal: number;
226
+ }) => void;
227
+ /**
228
+ * Interim tool result shown in the chat while a document is read. Never model-facing:
229
+ * the SDK marks every yielded value but the last as preliminary, and the convert
230
+ * wrapper passes these through untouched (no guard, no audit).
231
+ */
232
+ type ReadingStatus = {
233
+ status: "reading";
234
+ filename: string;
235
+ phase: "cached" | "text" | "ocr" | "vision" | "storing";
236
+ pagesDone: number;
237
+ pagesTotal: number;
238
+ };
239
+
240
+ /** Runs `fn` under a ceiling. */
241
+ type ProviderLimiter = <T>(fn: () => Promise<T>) => Promise<T>;
242
+ /**
243
+ * What the chat paths pass to documentProcessor. The call time limits travel with the limiters:
244
+ * a stalled provider must not pin chat slots, while knowledge-base processing (which passes
245
+ * none) keeps the transport's own, longer limit exactly as before.
246
+ */
247
+ type ProviderLimiters = {
248
+ ocr: ProviderLimiter;
249
+ vision: ProviderLimiter;
250
+ /** Longest one OCR request may take; a timeout counts as a failed attempt for the retry logic. */
251
+ ocrTimeoutMs?: number;
252
+ /** Longest one vision (page validation) call may take; same retry treatment. */
253
+ visionTimeoutMs?: number;
211
254
  };
212
255
 
213
256
  type DocumentProcessorConfig = {
@@ -222,6 +265,14 @@ type DocumentProcessorConfig = {
222
265
  model: string;
223
266
  concurrency: number;
224
267
  };
268
+ /**
269
+ * OCR settings. `concurrency` is how many OCR chunk calls ONE document runs
270
+ * at once (default 3, 1..8). Reads in chat additionally share a process-wide
271
+ * ceiling of 8 (see limits.ts); knowledge-base processing does not.
272
+ */
273
+ ocr?: {
274
+ concurrency?: number;
275
+ };
225
276
  processor: {
226
277
  name: "liteparse" | "mistral" | "officeparser";
227
278
  /**
@@ -259,12 +310,23 @@ type ProcessedPage = {
259
310
  image?: string;
260
311
  vlm_corrected_text?: string;
261
312
  vlm_validated?: boolean;
313
+ /** Set only under tolerateVisionFailures: the vision pass failed for this page, the text is OCR only. */
314
+ vlm_failed?: boolean;
262
315
  };
263
316
  type ProcessedDocument = ProcessedPage[];
264
- declare function documentProcessor({ file, name, config }: {
317
+ declare function documentProcessor({ file, name, config, tolerateVisionFailures, onProgress, limiters, }: {
265
318
  file: string | Buffer;
266
319
  name: string;
267
320
  config?: DocumentProcessorConfig;
321
+ /** A page whose vision pass failed keeps its OCR text and is flagged `vlm_failed` instead of failing the document. */
322
+ tolerateVisionFailures?: boolean;
323
+ /** Reports OCR progress per finished chunk and vision progress per finished page. */
324
+ onProgress?: ProgressFn;
325
+ /**
326
+ * Process-wide ceilings on OCR and vision calls. Passed by the chat paths only (extractDocument);
327
+ * absent for knowledge-base processing, which keeps its per-document limits unchanged.
328
+ */
329
+ limiters?: ProviderLimiters;
268
330
  }): Promise<ProcessedDocument | undefined>;
269
331
 
270
332
  interface TestCase {
@@ -1060,7 +1122,7 @@ declare class ExuluTool {
1060
1122
  result?: string;
1061
1123
  job?: string;
1062
1124
  items?: Item[];
1063
- }>;
1125
+ } | ReadingStatus>;
1064
1126
  });
1065
1127
  /**
1066
1128
  * Framework-only factory for tools whose `type` is managed by Exulu itself —
@@ -1341,6 +1403,32 @@ declare class ExuluApp {
1341
1403
  private server;
1342
1404
  }
1343
1405
 
1406
+ type AddFileResult = {
1407
+ name: string;
1408
+ skipped?: true;
1409
+ } | {
1410
+ error: string;
1411
+ };
1412
+ /**
1413
+ * For trusted server-side code (scripts, migrations). There is no user context: never call
1414
+ * this from a tool on behalf of a user.
1415
+ */
1416
+ declare const ExuluProjects: {
1417
+ create(input: {
1418
+ name: string;
1419
+ description?: string;
1420
+ ownerId: number | string;
1421
+ }): Promise<{
1422
+ id: string;
1423
+ }>;
1424
+ addFile(input: {
1425
+ projectId: string;
1426
+ name: string;
1427
+ data: Uint8Array | Buffer;
1428
+ ifExists?: "error" | "skip";
1429
+ }): Promise<AddFileResult>;
1430
+ };
1431
+
1344
1432
  declare class ExuluQueues {
1345
1433
  queues: {
1346
1434
  queue: Queue;
@@ -2895,4 +2983,4 @@ declare const ExuluPython: {
2895
2983
  instructions: typeof getPythonSetupInstructions;
2896
2984
  };
2897
2985
 
2898
- export { type AuditConfig, type AuditEvent, type AuditLogger, type ChunkerOperation, type ChunkerResponse, type CredentialField, CredentialInvalidError, type JOB_STATUS as EXULU_JOB_STATUS, JOB_STATUS_ENUM as EXULU_JOB_STATUS_ENUM, type STATISTICS_TYPE as EXULU_STATISTICS_TYPE, STATISTICS_TYPE_ENUM as EXULU_STATISTICS_TYPE_ENUM, type ExuluAgent, ExuluApp, type ExuluAuthConfig, ExuluAuthentication, ExuluChunkers, ExuluContext, type ExuluContextEmbedder, type ExuluCredentialsToolContext, ExuluDatabase, ExuluDefaultTools, ExuluDocumentProcessor, ExuluEval, type Item as ExuluItem, ExuluJobs, ExuluModels, type ExuluOauthConfig, type ExuluOauthToolContext, ExuluOtel, ExuluPython, queues as ExuluQueues, ExuluReadApi, ExuluRecall, ExuluReranker, ExuluTool, type ExuluUserCredentialsConfig, ExuluVariables, PROJECTION_VERSION, type RoutineHandle, type RoutineRunPatch, type VectorSearchChunkResult, backfillCoordinates, checkMemoryBase, defaultChunker, enableLiteLLMClientMode, fitContextProjection, listFittableContexts, postgresClient, recallMemories };
2986
+ export { type AuditConfig, type AuditEvent, type AuditLogger, type ChunkerOperation, type ChunkerResponse, type CredentialField, CredentialInvalidError, type JOB_STATUS as EXULU_JOB_STATUS, JOB_STATUS_ENUM as EXULU_JOB_STATUS_ENUM, type STATISTICS_TYPE as EXULU_STATISTICS_TYPE, STATISTICS_TYPE_ENUM as EXULU_STATISTICS_TYPE_ENUM, type ExuluAgent, ExuluApp, type ExuluAuthConfig, ExuluAuthentication, ExuluChunkers, ExuluContext, type ExuluContextEmbedder, type ExuluCredentialsToolContext, ExuluDatabase, ExuluDefaultTools, ExuluDocumentProcessor, ExuluEval, type Item as ExuluItem, ExuluJobs, ExuluModels, type ExuluOauthConfig, type ExuluOauthToolContext, ExuluOtel, ExuluProjects, ExuluPython, queues as ExuluQueues, ExuluReadApi, ExuluRecall, ExuluReranker, ExuluTool, type ExuluUserCredentialsConfig, ExuluVariables, PROJECTION_VERSION, type RoutineHandle, type RoutineRunPatch, type VectorSearchChunkResult, backfillCoordinates, checkMemoryBase, defaultChunker, enableLiteLLMClientMode, fitContextProjection, listFittableContexts, postgresClient, recallMemories };