@ptkl/sdk 1.16.0 → 1.17.1

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.
@@ -1795,17 +1795,33 @@ var ProtokolSDK010 = (function (exports, axios) {
1795
1795
  async injectMessage(conversationUUID, data) {
1796
1796
  return await this.client.post(`${BASE$1}/conversations/${conversationUUID}/messages/inject`, data);
1797
1797
  }
1798
+ // ── Stateless chat ──
1799
+ // Stateless completion — no conversation is created and nothing is
1800
+ // persisted. The caller owns the message list.
1801
+ //
1802
+ // Always responds with an SSE stream (message_start, thinking_delta,
1803
+ // content_delta, message_complete, error). Tool calls are surfaced in
1804
+ // message_complete for client-side execution; post the results back as
1805
+ // messages with role 'tool' and the matching tool_call_id.
1806
+ //
1807
+ // Constraints enforced server-side: agent_uuid is required, the last
1808
+ // message must have role 'user', 'context' or 'tool', and no message
1809
+ // content may exceed 32000 bytes.
1810
+ //
1811
+ // Typed as a Node stream because that is what axios `responseType:
1812
+ // 'stream'` yields under Node, which is where this binding is used.
1813
+ // Browser callers should drive the endpoint with fetch directly rather
1814
+ // than through axios.
1815
+ async chat(data) {
1816
+ return await this.client.post(`${BASE$1}/chat`, data, {
1817
+ responseType: 'stream',
1818
+ timeout: 120000,
1819
+ });
1820
+ }
1798
1821
  // ── OCR ──
1799
1822
  async ocr(data) {
1800
1823
  return await this.client.post(`${BASE$1}/ocr`, data, { timeout: 120000 });
1801
1824
  }
1802
- // ── Workflow ──
1803
- async workflowComplete(data) {
1804
- return await this.client.post(`${BASE$1}/workflow/complete`, data);
1805
- }
1806
- async workflowOcr(data) {
1807
- return await this.client.post(`${BASE$1}/workflow/ocr`, data, { timeout: 120000 });
1808
- }
1809
1825
  // ── User Access ──
1810
1826
  async createUserAccess(data) {
1811
1827
  return await this.client.post(`${BASE$1}/user-access`, data);
@@ -2172,6 +2188,70 @@ var ProtokolSDK010 = (function (exports, axios) {
2172
2188
  }
2173
2189
  }
2174
2190
 
2191
+ /**
2192
+ * Build an RFC 7233 Range header value from the SDK's range options.
2193
+ *
2194
+ * Validation happens here rather than at the server so a typo (a float offset, a
2195
+ * negative length) fails immediately and locally instead of arriving as an opaque
2196
+ * 400 after a round trip.
2197
+ */
2198
+ function buildRangeHeader(range) {
2199
+ const { offset, length, suffix } = range;
2200
+ if (suffix !== undefined) {
2201
+ if (offset !== undefined || length !== undefined) {
2202
+ throw new Error('readRange: `suffix` cannot be combined with `offset` or `length`');
2203
+ }
2204
+ if (!Number.isInteger(suffix) || suffix <= 0) {
2205
+ throw new Error('readRange: `suffix` must be a positive integer');
2206
+ }
2207
+ return `bytes=-${suffix}`;
2208
+ }
2209
+ const start = offset !== null && offset !== void 0 ? offset : 0;
2210
+ if (!Number.isInteger(start) || start < 0) {
2211
+ throw new Error('readRange: `offset` must be a non-negative integer');
2212
+ }
2213
+ if (length === undefined) {
2214
+ return `bytes=${start}-`;
2215
+ }
2216
+ if (!Number.isInteger(length) || length <= 0) {
2217
+ throw new Error('readRange: `length` must be a positive integer');
2218
+ }
2219
+ // Range end offsets are inclusive, so a length of N ends at start + N - 1.
2220
+ return `bytes=${start}-${start + length - 1}`;
2221
+ }
2222
+ /**
2223
+ * Turn a 206 response into a ByteRangeResult.
2224
+ *
2225
+ * The Content-Range check is the important part. Requests reach media-api through
2226
+ * two proxies, and if any hop ever dropped the Range header the response would be
2227
+ * a perfectly valid 200 carrying the *entire* file — a caller asking for 64 KiB
2228
+ * of a 2 GB object would quietly receive all 2 GB. Failing loudly here turns that
2229
+ * from a silent memory blow-up into an actionable error.
2230
+ */
2231
+ function toByteRangeResult(resp) {
2232
+ var _a, _b, _c, _d, _e, _f, _g;
2233
+ const contentRange = (_b = (_a = resp === null || resp === void 0 ? void 0 : resp.headers) === null || _a === void 0 ? void 0 : _a['content-range']) !== null && _b !== void 0 ? _b : (_c = resp === null || resp === void 0 ? void 0 : resp.headers) === null || _c === void 0 ? void 0 : _c['Content-Range'];
2234
+ const parsed = /^bytes\s+(\d+)-(\d+)\/(\d+)$/.exec(String(contentRange !== null && contentRange !== void 0 ? contentRange : '').trim());
2235
+ if (!parsed) {
2236
+ throw new Error('readRange: response did not include a Content-Range header, so the returned body ' +
2237
+ 'may be the entire object rather than the requested range. ' +
2238
+ 'Check that the media host supports ranged reads and that no proxy is stripping the Range header.');
2239
+ }
2240
+ const start = Number(parsed[1]);
2241
+ const end = Number(parsed[2]);
2242
+ const totalSize = Number(parsed[3]);
2243
+ const etag = (_e = (_d = resp === null || resp === void 0 ? void 0 : resp.headers) === null || _d === void 0 ? void 0 : _d.etag) !== null && _e !== void 0 ? _e : (_f = resp === null || resp === void 0 ? void 0 : resp.headers) === null || _f === void 0 ? void 0 : _f.ETag;
2244
+ return {
2245
+ data: resp.data,
2246
+ start,
2247
+ end,
2248
+ length: end - start + 1,
2249
+ totalSize,
2250
+ eof: end >= totalSize - 1,
2251
+ etag: typeof etag === 'string' ? etag.replace(/^"|"$/g, '') : undefined,
2252
+ contentType: (_g = resp === null || resp === void 0 ? void 0 : resp.headers) === null || _g === void 0 ? void 0 : _g['content-type'],
2253
+ };
2254
+ }
2175
2255
  /**
2176
2256
  * Document Management System (DMS) API client
2177
2257
  *
@@ -2346,6 +2426,93 @@ var ProtokolSDK010 = (function (exports, axios) {
2346
2426
  responseType: (!encoding) ? 'blob' : null
2347
2427
  });
2348
2428
  }
2429
+ /**
2430
+ * Read a slice of a stored file without transferring the whole object.
2431
+ *
2432
+ * Uses an HTTP Range request, so only the requested bytes cross the wire.
2433
+ * Slicing is positional and format-agnostic — it works on any file.
2434
+ *
2435
+ * ```ts
2436
+ * // First 64 KiB
2437
+ * const head = await dms.readRange('reports/big.csv', { length: 65536 })
2438
+ *
2439
+ * // Continue from where that stopped
2440
+ * const next = await dms.readRange('reports/big.csv', { offset: head.end + 1, length: 65536 })
2441
+ *
2442
+ * // Final 1 KiB
2443
+ * const tail = await dms.readRange('reports/big.csv', { suffix: 1024 })
2444
+ * ```
2445
+ *
2446
+ * The server caps how much a single call may return, so `length` is an upper
2447
+ * bound rather than a guarantee: always advance using the returned `end`
2448
+ * rather than assuming the window you asked for. `eof` tells you when to stop.
2449
+ *
2450
+ * Byte ranges are not meaningful for .xlsx, .zip or .gz — their contents are
2451
+ * compressed as a unit, so no byte window corresponds to a range of rows.
2452
+ *
2453
+ * @param key Path of the file within the library
2454
+ * @param range Which bytes to read
2455
+ * @throws If the object is smaller than `offset` (nothing left to read), or if
2456
+ * the response came back without range metadata — see `readRange`'s
2457
+ * Content-Range check, which prevents silently receiving a whole file.
2458
+ */
2459
+ async readRange(key, range = {}) {
2460
+ const { responseType = 'arraybuffer' } = range;
2461
+ const resp = await this.request('GET', `media/get/${key}`, {
2462
+ headers: { Range: buildRangeHeader(range) },
2463
+ responseType,
2464
+ });
2465
+ return toByteRangeResult(resp);
2466
+ }
2467
+ /**
2468
+ * Read a file as a sequence of byte windows, newest request issued only when
2469
+ * the previous window has been consumed.
2470
+ *
2471
+ * This is the memory-bounded way to process a large file: the whole object is
2472
+ * never held at once, and a caller can stop early simply by breaking out.
2473
+ *
2474
+ * ```ts
2475
+ * for await (const chunk of dms.streamRanges('logs/huge.ndjson', { chunkSize: 1 << 20 })) {
2476
+ * process(chunk.data) // one window at a time
2477
+ * if (foundWhatIWanted) break // no further requests are made
2478
+ * }
2479
+ * ```
2480
+ *
2481
+ * Windows are contiguous and non-overlapping, so concatenating every `data`
2482
+ * reproduces the file byte for byte. A record spanning a window boundary is
2483
+ * the caller's to reassemble — this yields bytes, not records.
2484
+ *
2485
+ * An empty object yields nothing rather than throwing.
2486
+ *
2487
+ * @param key Path of the file within the library
2488
+ * @param options Where to start and how large each window should be
2489
+ */
2490
+ async *streamRanges(key, options = {}) {
2491
+ var _a, _b;
2492
+ const { chunkSize = 1024 * 1024, responseType = 'arraybuffer' } = options;
2493
+ let offset = (_a = options.offset) !== null && _a !== void 0 ? _a : 0;
2494
+ for (;;) {
2495
+ let chunk;
2496
+ try {
2497
+ chunk = await this.readRange(key, { offset, length: chunkSize, responseType });
2498
+ }
2499
+ catch (err) {
2500
+ // 416 means the offset is at or past the end. For the first request
2501
+ // that is an empty object; afterwards it is a benign race with a
2502
+ // truncating writer. Either way the stream is simply over.
2503
+ if (((_b = err === null || err === void 0 ? void 0 : err.response) === null || _b === void 0 ? void 0 : _b.status) === 416)
2504
+ return;
2505
+ throw err;
2506
+ }
2507
+ yield chunk;
2508
+ if (chunk.eof)
2509
+ return;
2510
+ // Advance from what the server actually returned, never from chunkSize:
2511
+ // the per-request cap can make a window shorter than requested, and
2512
+ // assuming otherwise would skip bytes.
2513
+ offset = chunk.end + 1;
2514
+ }
2515
+ }
2349
2516
  async download(key) {
2350
2517
  return this.request('POST', `media/download`, {
2351
2518
  data: {
package/dist/index.0.9.js CHANGED
@@ -1355,6 +1355,70 @@ var ProtokolSDK09 = (function (exports, axios) {
1355
1355
  }
1356
1356
  }
1357
1357
 
1358
+ /**
1359
+ * Build an RFC 7233 Range header value from the SDK's range options.
1360
+ *
1361
+ * Validation happens here rather than at the server so a typo (a float offset, a
1362
+ * negative length) fails immediately and locally instead of arriving as an opaque
1363
+ * 400 after a round trip.
1364
+ */
1365
+ function buildRangeHeader(range) {
1366
+ const { offset, length, suffix } = range;
1367
+ if (suffix !== undefined) {
1368
+ if (offset !== undefined || length !== undefined) {
1369
+ throw new Error('readRange: `suffix` cannot be combined with `offset` or `length`');
1370
+ }
1371
+ if (!Number.isInteger(suffix) || suffix <= 0) {
1372
+ throw new Error('readRange: `suffix` must be a positive integer');
1373
+ }
1374
+ return `bytes=-${suffix}`;
1375
+ }
1376
+ const start = offset !== null && offset !== void 0 ? offset : 0;
1377
+ if (!Number.isInteger(start) || start < 0) {
1378
+ throw new Error('readRange: `offset` must be a non-negative integer');
1379
+ }
1380
+ if (length === undefined) {
1381
+ return `bytes=${start}-`;
1382
+ }
1383
+ if (!Number.isInteger(length) || length <= 0) {
1384
+ throw new Error('readRange: `length` must be a positive integer');
1385
+ }
1386
+ // Range end offsets are inclusive, so a length of N ends at start + N - 1.
1387
+ return `bytes=${start}-${start + length - 1}`;
1388
+ }
1389
+ /**
1390
+ * Turn a 206 response into a ByteRangeResult.
1391
+ *
1392
+ * The Content-Range check is the important part. Requests reach media-api through
1393
+ * two proxies, and if any hop ever dropped the Range header the response would be
1394
+ * a perfectly valid 200 carrying the *entire* file — a caller asking for 64 KiB
1395
+ * of a 2 GB object would quietly receive all 2 GB. Failing loudly here turns that
1396
+ * from a silent memory blow-up into an actionable error.
1397
+ */
1398
+ function toByteRangeResult(resp) {
1399
+ var _a, _b, _c, _d, _e, _f, _g;
1400
+ const contentRange = (_b = (_a = resp === null || resp === void 0 ? void 0 : resp.headers) === null || _a === void 0 ? void 0 : _a['content-range']) !== null && _b !== void 0 ? _b : (_c = resp === null || resp === void 0 ? void 0 : resp.headers) === null || _c === void 0 ? void 0 : _c['Content-Range'];
1401
+ const parsed = /^bytes\s+(\d+)-(\d+)\/(\d+)$/.exec(String(contentRange !== null && contentRange !== void 0 ? contentRange : '').trim());
1402
+ if (!parsed) {
1403
+ throw new Error('readRange: response did not include a Content-Range header, so the returned body ' +
1404
+ 'may be the entire object rather than the requested range. ' +
1405
+ 'Check that the media host supports ranged reads and that no proxy is stripping the Range header.');
1406
+ }
1407
+ const start = Number(parsed[1]);
1408
+ const end = Number(parsed[2]);
1409
+ const totalSize = Number(parsed[3]);
1410
+ const etag = (_e = (_d = resp === null || resp === void 0 ? void 0 : resp.headers) === null || _d === void 0 ? void 0 : _d.etag) !== null && _e !== void 0 ? _e : (_f = resp === null || resp === void 0 ? void 0 : resp.headers) === null || _f === void 0 ? void 0 : _f.ETag;
1411
+ return {
1412
+ data: resp.data,
1413
+ start,
1414
+ end,
1415
+ length: end - start + 1,
1416
+ totalSize,
1417
+ eof: end >= totalSize - 1,
1418
+ etag: typeof etag === 'string' ? etag.replace(/^"|"$/g, '') : undefined,
1419
+ contentType: (_g = resp === null || resp === void 0 ? void 0 : resp.headers) === null || _g === void 0 ? void 0 : _g['content-type'],
1420
+ };
1421
+ }
1358
1422
  /**
1359
1423
  * Document Management System (DMS) API client
1360
1424
  *
@@ -1488,6 +1552,95 @@ var ProtokolSDK09 = (function (exports, axios) {
1488
1552
  responseType: (!encoding) ? 'blob' : null
1489
1553
  });
1490
1554
  }
1555
+ /**
1556
+ * Read a slice of a stored file without transferring the whole object.
1557
+ *
1558
+ * Uses an HTTP Range request, so only the requested bytes cross the wire.
1559
+ * Slicing is positional and format-agnostic — it works on any file.
1560
+ *
1561
+ * ```ts
1562
+ * // First 64 KiB
1563
+ * const head = await dms.readRange(libraryUuid, 'reports/big.csv', { length: 65536 })
1564
+ *
1565
+ * // Continue from where that stopped
1566
+ * const next = await dms.readRange(libraryUuid, 'reports/big.csv', { offset: head.end + 1, length: 65536 })
1567
+ *
1568
+ * // Final 1 KiB
1569
+ * const tail = await dms.readRange(libraryUuid, 'reports/big.csv', { suffix: 1024 })
1570
+ * ```
1571
+ *
1572
+ * The server caps how much a single call may return, so `length` is an upper
1573
+ * bound rather than a guarantee: always advance using the returned `end`
1574
+ * rather than assuming the window you asked for. `eof` tells you when to stop.
1575
+ *
1576
+ * Byte ranges are not meaningful for .xlsx, .zip or .gz — their contents are
1577
+ * compressed as a unit, so no byte window corresponds to a range of rows.
1578
+ *
1579
+ * @param lib Library UUID
1580
+ * @param key Path of the file within the library
1581
+ * @param range Which bytes to read
1582
+ * @throws If the object is smaller than `offset` (nothing left to read), or if
1583
+ * the response came back without range metadata — see `readRange`'s
1584
+ * Content-Range check, which prevents silently receiving a whole file.
1585
+ */
1586
+ async readRange(lib, key, range = {}) {
1587
+ const { responseType = 'arraybuffer' } = range;
1588
+ const resp = await this.request('GET', `media/library/${lib}/get/${key}`, {
1589
+ headers: { Range: buildRangeHeader(range) },
1590
+ responseType,
1591
+ });
1592
+ return toByteRangeResult(resp);
1593
+ }
1594
+ /**
1595
+ * Read a file as a sequence of byte windows, newest request issued only when
1596
+ * the previous window has been consumed.
1597
+ *
1598
+ * This is the memory-bounded way to process a large file: the whole object is
1599
+ * never held at once, and a caller can stop early simply by breaking out.
1600
+ *
1601
+ * ```ts
1602
+ * for await (const chunk of dms.streamRanges(libraryUuid, 'logs/huge.ndjson', { chunkSize: 1 << 20 })) {
1603
+ * process(chunk.data) // one window at a time
1604
+ * if (foundWhatIWanted) break // no further requests are made
1605
+ * }
1606
+ * ```
1607
+ *
1608
+ * Windows are contiguous and non-overlapping, so concatenating every `data`
1609
+ * reproduces the file byte for byte. A record spanning a window boundary is
1610
+ * the caller's to reassemble — this yields bytes, not records.
1611
+ *
1612
+ * An empty object yields nothing rather than throwing.
1613
+ *
1614
+ * @param lib Library UUID
1615
+ * @param key Path of the file within the library
1616
+ * @param options Where to start and how large each window should be
1617
+ */
1618
+ async *streamRanges(lib, key, options = {}) {
1619
+ var _a, _b;
1620
+ const { chunkSize = 1024 * 1024, responseType = 'arraybuffer' } = options;
1621
+ let offset = (_a = options.offset) !== null && _a !== void 0 ? _a : 0;
1622
+ for (;;) {
1623
+ let chunk;
1624
+ try {
1625
+ chunk = await this.readRange(lib, key, { offset, length: chunkSize, responseType });
1626
+ }
1627
+ catch (err) {
1628
+ // 416 means the offset is at or past the end. For the first request
1629
+ // that is an empty object; afterwards it is a benign race with a
1630
+ // truncating writer. Either way the stream is simply over.
1631
+ if (((_b = err === null || err === void 0 ? void 0 : err.response) === null || _b === void 0 ? void 0 : _b.status) === 416)
1632
+ return;
1633
+ throw err;
1634
+ }
1635
+ yield chunk;
1636
+ if (chunk.eof)
1637
+ return;
1638
+ // Advance from what the server actually returned, never from chunkSize:
1639
+ // the per-request cap can make a window shorter than requested, and
1640
+ // assuming otherwise would skip bytes.
1641
+ offset = chunk.end + 1;
1642
+ }
1643
+ }
1491
1644
  async download(lib, key) {
1492
1645
  return this.request('POST', `media/library/${lib}/download`, {
1493
1646
  data: {
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptkl/sdk",
3
- "version": "1.16.0",
3
+ "version": "1.17.1",
4
4
  "scripts": {
5
5
  "build": "rollup -c",
6
6
  "build:monaco": "npm run build && node scripts/generate-monaco-types.cjs",
@@ -1,7 +1,7 @@
1
1
  export type { PlatformFunctions, PlatformFunction, FunctionInput, FunctionOutput, FunctionCallParams, ComponentModels, ComponentFunctions, ComponentModel, ComponentFunctionInput, ComponentFunctionOutput, } from '../types/functions';
2
2
  export type { Settings, SettingsField, FieldRoles, FieldConstraints, Context, Preset, PresetContext, Filters, Extension, Policy, SetupData, Model, } from '../types/component';
3
3
  export type { WorkflowModel, WorkflowSettings, WorkflowNode, WorkflowNodeConnection, WorkflowCreatePayload, WorkflowUpdatePayload, WorkflowListResponse, } from '../types/workflow';
4
- export type { PagedResponse as KortexPagedResponse, PaginationParams as KortexPaginationParams, RAGConfig, LLMSettings, Agent, AgentCreatePayload, AgentUpdatePayload, ChunkingStrategy, KnowledgeBase, KnowledgeBaseCreatePayload, KnowledgeBaseUpdatePayload, Document as KortexDocument, Participant, TokenUsage, ToolCall, RAGSource, Message as KortexMessage, Conversation, ConversationCreatePayload, ConversationUpdatePayload, ParticipantAddPayload, ToolResultPayload, PageContext, SendMessagePayload, InjectMessagePayload, OCRPayload, OCRResult, UserAccess, UserAccessCreatePayload, UserAccessUpdatePayload, TopUpPayload, UserMonthlyUsage, UserUsageBreakdown, MyAccess, AggregatedUsage, Tier, KortexWorkflowMessage, KortexWorkflowPayload, KortexWorkflowResult, } from '../types/kortex';
4
+ export type { PagedResponse as KortexPagedResponse, PaginationParams as KortexPaginationParams, RAGConfig, LLMSettings, Agent, AgentCreatePayload, AgentUpdatePayload, ChunkingStrategy, KnowledgeBase, KnowledgeBaseCreatePayload, KnowledgeBaseUpdatePayload, Document as KortexDocument, Participant, TokenUsage, ToolCall, RAGSource, Message as KortexMessage, Conversation, ConversationCreatePayload, ConversationUpdatePayload, ParticipantAddPayload, ToolResultPayload, PageContext, SendMessagePayload, InjectMessagePayload, OCRPayload, OCRResult, UserAccess, UserAccessCreatePayload, UserAccessUpdatePayload, TopUpPayload, UserMonthlyUsage, UserUsageBreakdown, MyAccess, AggregatedUsage, Tier, KortexChatRole, KortexChatMessage, KortexChatPayload, } from '../types/kortex';
5
5
  export type { TimberActor, TimberActorType, TimberChanges, TimberEntry, TimberLevel, TimberQueryParams, TimberQueryResponse, TimberSource, TimberUsage, TimberWritePayload, TimberLogPayload, } from '../types/timber';
6
6
  export type { SatelliteAuthConfig, SatelliteAuthType, SatelliteCommandExecutePayload, SatelliteCommandExecuteResponse, SatelliteCreatePayload, SatelliteDeployPayload, SatelliteEnv, SatelliteJsonRpcCommand, SatelliteLocaleText, SatelliteLogsParams, SatellitePermission, SatellitePermissionExport, SatelliteSchemaPayload, SatelliteSchemaVersion, SatelliteTemplate, SatelliteTemplatePayload, SatelliteWorkflowNode, SatelliteWorkflowNodeField, } from '../types/satellites';
7
7
  export { default as Component } from './component';
@@ -1,6 +1,6 @@
1
1
  import IntegrationsBaseClient from "../integrationsBaseClient";
2
2
  import { AxiosResponse } from "axios";
3
- import { PDFFillOptions, DataConversionParams, DataValidationParams, DataInfoParams, DataInfo, DataValidationResult, ConversionOptions, HTML2PDFOptions, PDF2HTMLOptions, MediaUploadPayload, MediaUploadBase64Payload, DocumentListParams, DocumentListResponse, DocumentCreatePayload, DocumentUpdatePayload, DocumentRestorePayload, DocumentCommentPayload, DocumentResponse, DocumentGeneratePayload, DocumentGenerateResponse, DocumentRevisionListResponse, ExtractTextPayload, ExtractTextResult, OCRExtractPayload, OCRExtractResult, LibraryExportCreatePayload, LibraryExportListResponse, MediaExportCreateResult, LibraryExportGetResult, LibraryPolicy, LibraryPolicyPayload, DirPolicy, DirPolicyPayload, NotificationRuleCreatePayload, NotificationRule, NotificationRuleListResponse, FileNotificationCreatePayload, FileNotification, FileNotificationListResponse } from "../../types/integrations";
3
+ import { PDFFillOptions, DataConversionParams, DataValidationParams, DataInfoParams, DataInfo, DataValidationResult, ConversionOptions, HTML2PDFOptions, PDF2HTMLOptions, MediaUploadPayload, MediaUploadBase64Payload, DocumentListParams, DocumentListResponse, DocumentCreatePayload, DocumentUpdatePayload, DocumentRestorePayload, DocumentCommentPayload, DocumentResponse, DocumentGeneratePayload, DocumentGenerateResponse, DocumentRevisionListResponse, ExtractTextPayload, ExtractTextResult, OCRExtractPayload, OCRExtractResult, LibraryExportCreatePayload, LibraryExportListResponse, MediaExportCreateResult, LibraryExportGetResult, LibraryPolicy, LibraryPolicyPayload, DirPolicy, DirPolicyPayload, NotificationRuleCreatePayload, NotificationRule, NotificationRuleListResponse, FileNotificationCreatePayload, FileNotification, FileNotificationListResponse, ByteRangeRequest, ByteRangeResult, ByteStreamOptions } from "../../types/integrations";
4
4
  /**
5
5
  * Document Management System (DMS) API client
6
6
  *
@@ -126,6 +126,61 @@ export default class DMS extends IntegrationsBaseClient {
126
126
  */
127
127
  uploadBase64(data: MediaUploadBase64Payload): Promise<AxiosResponse<any, any>>;
128
128
  getMedia(key: string, encoding: string): Promise<AxiosResponse<any, any>>;
129
+ /**
130
+ * Read a slice of a stored file without transferring the whole object.
131
+ *
132
+ * Uses an HTTP Range request, so only the requested bytes cross the wire.
133
+ * Slicing is positional and format-agnostic — it works on any file.
134
+ *
135
+ * ```ts
136
+ * // First 64 KiB
137
+ * const head = await dms.readRange('reports/big.csv', { length: 65536 })
138
+ *
139
+ * // Continue from where that stopped
140
+ * const next = await dms.readRange('reports/big.csv', { offset: head.end + 1, length: 65536 })
141
+ *
142
+ * // Final 1 KiB
143
+ * const tail = await dms.readRange('reports/big.csv', { suffix: 1024 })
144
+ * ```
145
+ *
146
+ * The server caps how much a single call may return, so `length` is an upper
147
+ * bound rather than a guarantee: always advance using the returned `end`
148
+ * rather than assuming the window you asked for. `eof` tells you when to stop.
149
+ *
150
+ * Byte ranges are not meaningful for .xlsx, .zip or .gz — their contents are
151
+ * compressed as a unit, so no byte window corresponds to a range of rows.
152
+ *
153
+ * @param key Path of the file within the library
154
+ * @param range Which bytes to read
155
+ * @throws If the object is smaller than `offset` (nothing left to read), or if
156
+ * the response came back without range metadata — see `readRange`'s
157
+ * Content-Range check, which prevents silently receiving a whole file.
158
+ */
159
+ readRange(key: string, range?: ByteRangeRequest): Promise<ByteRangeResult>;
160
+ /**
161
+ * Read a file as a sequence of byte windows, newest request issued only when
162
+ * the previous window has been consumed.
163
+ *
164
+ * This is the memory-bounded way to process a large file: the whole object is
165
+ * never held at once, and a caller can stop early simply by breaking out.
166
+ *
167
+ * ```ts
168
+ * for await (const chunk of dms.streamRanges('logs/huge.ndjson', { chunkSize: 1 << 20 })) {
169
+ * process(chunk.data) // one window at a time
170
+ * if (foundWhatIWanted) break // no further requests are made
171
+ * }
172
+ * ```
173
+ *
174
+ * Windows are contiguous and non-overlapping, so concatenating every `data`
175
+ * reproduces the file byte for byte. A record spanning a window boundary is
176
+ * the caller's to reassemble — this yields bytes, not records.
177
+ *
178
+ * An empty object yields nothing rather than throwing.
179
+ *
180
+ * @param key Path of the file within the library
181
+ * @param options Where to start and how large each window should be
182
+ */
183
+ streamRanges(key: string, options?: ByteStreamOptions): AsyncGenerator<ByteRangeResult>;
129
184
  download(key: string): Promise<AxiosResponse<any, any>>;
130
185
  getExifData(key: string): Promise<AxiosResponse<any, any>>;
131
186
  html2pdf(data: HTML2PDFOptions): Promise<AxiosResponse<any, any>>;
@@ -1,6 +1,6 @@
1
1
  import { AxiosResponse } from 'axios';
2
2
  import PlatformBaseClient from "./platformBaseClient";
3
- import { PagedResponse, PaginationParams, Agent, AgentCreatePayload, AgentUpdatePayload, KnowledgeBase, KnowledgeBaseCreatePayload, KnowledgeBaseUpdatePayload, Document, Conversation, ConversationCreatePayload, ConversationUpdatePayload, ParticipantAddPayload, Message, SendMessagePayload, InjectMessagePayload, OCRPayload, OCRResult, UserAccess, UserAccessCreatePayload, UserAccessUpdatePayload, UserMonthlyUsage, UserUsageBreakdown, MyAccess, AggregatedUsage, Tier, KnowledgeBaseSearchPayload, KnowledgeBaseSearchResult, KortexWorkflowPayload, KortexWorkflowResult } from '../types/kortex';
3
+ import { PagedResponse, PaginationParams, Agent, AgentCreatePayload, AgentUpdatePayload, KnowledgeBase, KnowledgeBaseCreatePayload, KnowledgeBaseUpdatePayload, Document, Conversation, ConversationCreatePayload, ConversationUpdatePayload, ParticipantAddPayload, Message, SendMessagePayload, InjectMessagePayload, OCRPayload, OCRResult, UserAccess, UserAccessCreatePayload, UserAccessUpdatePayload, UserMonthlyUsage, UserUsageBreakdown, MyAccess, AggregatedUsage, Tier, KnowledgeBaseSearchPayload, KnowledgeBaseSearchResult, KortexChatPayload } from '../types/kortex';
4
4
  export default class Kortex extends PlatformBaseClient {
5
5
  createAgent(data: AgentCreatePayload): Promise<AxiosResponse<Agent>>;
6
6
  listAgents(params?: PaginationParams): Promise<AxiosResponse<PagedResponse<Agent>>>;
@@ -35,9 +35,8 @@ export default class Kortex extends PlatformBaseClient {
35
35
  streamMessage(conversationUUID: string, data: SendMessagePayload): Promise<AxiosResponse<ReadableStream>>;
36
36
  listMessages(conversationUUID: string, params?: PaginationParams): Promise<AxiosResponse<PagedResponse<Message>>>;
37
37
  injectMessage(conversationUUID: string, data: InjectMessagePayload): Promise<AxiosResponse<Message>>;
38
+ chat(data: KortexChatPayload): Promise<AxiosResponse<NodeJS.ReadableStream>>;
38
39
  ocr(data: OCRPayload): Promise<AxiosResponse<OCRResult>>;
39
- workflowComplete(data: KortexWorkflowPayload): Promise<AxiosResponse<KortexWorkflowResult>>;
40
- workflowOcr(data: OCRPayload): Promise<AxiosResponse<OCRResult>>;
41
40
  createUserAccess(data: UserAccessCreatePayload): Promise<AxiosResponse<UserAccess>>;
42
41
  listUserAccess(params?: PaginationParams): Promise<AxiosResponse<PagedResponse<UserAccess>>>;
43
42
  getUserAccess(uuid: string): Promise<AxiosResponse<UserAccess>>;