@getmodus/sdk 0.5.0 → 0.6.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.
@@ -1,4 +1,4 @@
1
- import { H as HttpClient, M as ModusConfig, c as components, W as WorkflowType, n as OperationId, V as VariationView, P as Page, a as Workflow, C as ContextItem, y as ContextItemDeletion, d as CustomContextItemsResource, z as CreatedContextItem, S as ScopeConversationsResource, h as Scope, i as ModusClientBase, j as ModusOptions } from '../conversations-Pe3kNikF.cjs';
1
+ import { H as HttpClient, M as ModusConfig, c as components, W as WorkflowType, n as OperationId, V as VariationView, P as Page, a as Workflow, C as ContextItem, y as ContextItemDeletion, d as CustomContextItemsResource, z as CreatedContextItem, S as ScopeConversationsResource, h as Scope, i as ModusClientBase, j as ModusOptions } from '../conversations-BRg8gEKX.cjs';
2
2
 
3
3
  type AgentInterface = components['schemas']['AgentInterfaceDto'];
4
4
  type AddAgentInterface = components['schemas']['AddAgentInterfaceDto'];
@@ -255,8 +255,154 @@ declare class ManagementContextItemsResource {
255
255
 
256
256
  type UserFeedback = 'positive' | 'neutral' | 'negative';
257
257
 
258
+ type FileUpload = components['schemas']['FileUploadResourceDto'];
259
+ type FileUploadStatus = components['schemas']['FileUploadResourceStatus'];
260
+ type UploadUrlSlot = components['schemas']['UploadUrlResponseDto'];
261
+ type BulkUploadUrlsResult = components['schemas']['BulkUploadUrlsResponseDto'];
262
+ type BulkUploadFromUrlsResult = components['schemas']['BulkUploadFromUrlsResponseDto'];
263
+ type FailedUploadUrl = components['schemas']['FailedUploadUrlDto'];
264
+ type FailedUploadFromUrl = components['schemas']['FailedUploadFromUrlDto'];
265
+ /** `"processing"` (parsing started) or `"ready"` (parsing finished) — target status for `upload()` / `uploadDir()`. */
266
+ type WaitUntil = 'processing' | 'ready';
267
+ /** One file entry for `createUploadUrls()`. */
268
+ interface UploadUrlInput {
269
+ fileName: string;
270
+ contentType: string;
271
+ fileSize: number;
272
+ }
273
+ /** One URL entry for `uploadFromUrls()`. */
274
+ interface UploadFromUrlInput {
275
+ url: string;
276
+ fileName?: string;
277
+ }
278
+ /** A single file that failed during `uploadDir()` (slot creation or PUT/poll). */
279
+ interface UploadDirFailure {
280
+ path: string;
281
+ error: string;
282
+ }
283
+ /** Outcome of `uploadDir()` — successes and per-file failures. */
284
+ interface UploadDirResult {
285
+ uploaded: FileUpload[];
286
+ failed: UploadDirFailure[];
287
+ }
288
+
289
+ /**
290
+ * Durable file uploads for `ModusManagement`.
291
+ *
292
+ * Call path: `mgmt.context.files` after `new ModusManagement(...)`.
293
+ *
294
+ * - `upload(path)` / `uploadDir(dirPath)` — presign + PUT + poll convenience helpers.
295
+ * - `createUploadUrl(s)`, `uploadFromUrl(s)`, `get`, `list` — raw operations.
296
+ */
297
+ declare class ManagementContextFilesResource {
298
+ private readonly http;
299
+ private readonly config;
300
+ /** @internal */
301
+ constructor(http: HttpClient, config: ModusConfig);
302
+ /**
303
+ * Get a presigned S3 PUT URL for one file.
304
+ *
305
+ * @param input.fileName - Original file name — used to build the S3 object key.
306
+ * @param input.contentType - MIME type. Allowed categories: PDF, images, text,
307
+ * Office/OpenDocument documents, audio, and video.
308
+ * @param input.fileSize - File size in bytes. Rejected above 50MB.
309
+ * @returns Presigned upload slot. PUT the raw bytes to `uploadUrl` within 15
310
+ * minutes, then poll `get(uploadId)` — there is no separate finalize call.
311
+ */
312
+ createUploadUrl(input: UploadUrlInput): Promise<UploadUrlSlot>;
313
+ /**
314
+ * Get presigned S3 PUT URLs for up to 100 files in one call.
315
+ *
316
+ * @param files - Files to create upload slots for (max 100).
317
+ * @returns Slots for every file that passed validation, plus per-index
318
+ * failures (bad MIME type, oversize) for the rest — never a partial 4xx.
319
+ */
320
+ createUploadUrls(files: readonly UploadUrlInput[]): Promise<BulkUploadUrlsResult>;
321
+ /**
322
+ * Fetch one file from a URL and land it as durable context.
323
+ *
324
+ * @param url - Source URL to fetch (SSRF-guarded, 50MB cap, same MIME
325
+ * allow-list as `createUploadUrl`).
326
+ * @param options.fileName - Override file name. Inferred from the URL path when omitted.
327
+ * @returns File upload resource with status `processing` — parsing continues async.
328
+ */
329
+ uploadFromUrl(url: string, options?: {
330
+ fileName?: string;
331
+ }): Promise<FileUpload>;
332
+ /**
333
+ * Fetch up to 100 files from URLs in one call.
334
+ *
335
+ * @param urls - URLs to fetch and upload (max 100).
336
+ * @returns File upload resources for every URL that landed, plus per-index
337
+ * failures for the rest — never a partial 4xx.
338
+ */
339
+ uploadFromUrls(urls: readonly UploadFromUrlInput[]): Promise<BulkUploadFromUrlsResult>;
340
+ /**
341
+ * Fetch one file upload by its id.
342
+ *
343
+ * @param uploadId - Upload id returned by `createUploadUrl` / `uploadFromUrl`.
344
+ * @returns The file upload resource, including its processing `status`.
345
+ */
346
+ get(uploadId: string): Promise<FileUpload>;
347
+ /**
348
+ * List durable file uploads.
349
+ *
350
+ * @param options.pageSize - Items per page (default 50).
351
+ * @param options.pageToken - Opaque token from a previous page's `nextPageToken`.
352
+ * @returns Page of file uploads. Uploads that only have a pending row (not yet
353
+ * landed) aren't included here — use `get(uploadId)` for those.
354
+ */
355
+ list(options?: {
356
+ pageSize?: number;
357
+ pageToken?: string;
358
+ }): Promise<Page<FileUpload>>;
359
+ private listPage;
360
+ /**
361
+ * Upload a local file and wait for it to reach `"processing"` or `"ready"`.
362
+ *
363
+ * Gets a presigned URL, PUTs the file bytes, then polls `get()` until the
364
+ * upload leaves `"pending"` (or reaches `"ready"`/`"failed"`).
365
+ *
366
+ * @param path - Path to a local file.
367
+ * @param options.waitUntil - `"processing"` (parsing started, default) or
368
+ * `"ready"` (parsing finished).
369
+ * @param options.pollIntervalMs - Milliseconds between status polls.
370
+ * @param options.timeoutMs - Max milliseconds to wait before raising.
371
+ * @returns The file upload resource once it reaches `waitUntil` (or `"failed"`).
372
+ * @throws {ModusError} If the PUT fails, or polling times out.
373
+ */
374
+ upload(path: string, options?: {
375
+ waitUntil?: WaitUntil;
376
+ pollIntervalMs?: number;
377
+ timeoutMs?: number;
378
+ }): Promise<FileUpload>;
379
+ private pollUntil;
380
+ /**
381
+ * Upload every file in a local directory.
382
+ *
383
+ * Walks `path` (skipping hidden files/directories and symlinks), pages
384
+ * through `createUploadUrls()` in batches of up to 100, then PUTs and polls
385
+ * each file with up to `concurrency` in flight at once. A failure on one
386
+ * file does not stop the others — check `result.failed`.
387
+ *
388
+ * @param path - Path to a local directory.
389
+ * @param options.recursive - Recurse into subdirectories (default `true`).
390
+ * @param options.concurrency - Max concurrent PUT+poll operations (default 10).
391
+ * @param options.waitUntil - `"processing"` (default) or `"ready"` — same as `upload()`.
392
+ * @returns `UploadDirResult` with every successful `FileUpload` and every
393
+ * per-file failure (slot creation or PUT/poll), each tagged with its local path.
394
+ */
395
+ uploadDir(path: string, options?: {
396
+ recursive?: boolean;
397
+ concurrency?: number;
398
+ waitUntil?: WaitUntil;
399
+ }): Promise<UploadDirResult>;
400
+ private createSlots;
401
+ private uploadBatch;
402
+ }
403
+
258
404
  /**
259
- * Create and update context items (notes, links, saved queries).
405
+ * Create and update context items (notes, links, saved queries, file uploads).
260
406
  *
261
407
  * Call path: `mgmt.context` after `new ModusManagement(...)`.
262
408
  */
@@ -265,6 +411,7 @@ declare class ManagementContextResource {
265
411
  private readonly config;
266
412
  readonly items: ManagementContextItemsResource;
267
413
  readonly customItems: CustomContextItemsResource;
414
+ readonly files: ManagementContextFilesResource;
268
415
  /** @internal */
269
416
  constructor(http: HttpClient, config: ModusConfig);
270
417
  /**
@@ -806,4 +953,4 @@ declare class ModusManagement extends ModusClientBase {
806
953
  constructor(options?: ModusOptions);
807
954
  }
808
955
 
809
- export { type AgentSelectionInput, type CreateAgentOptions, type CreateScopeOptions, type CreateSkillOptions, type CreateWorkflowOptions, type Memory, type MemorySearchRequest, type MemorySearchResult, type MemoryUpdate, ModusManagement, ModusOptions, type ToolsetInput, type TriggerInput, type UpdateAgentOptions, type UpdateScopeOptions, type UpdateSkillOptions, type UpdateWorkflowOptions, type UserFeedback, type WorkflowGraphInput };
956
+ export { type AgentSelectionInput, type BulkUploadFromUrlsResult, type BulkUploadUrlsResult, type CreateAgentOptions, type CreateScopeOptions, type CreateSkillOptions, type CreateWorkflowOptions, type FailedUploadFromUrl, type FailedUploadUrl, type FileUpload, type FileUploadStatus, type Memory, type MemorySearchRequest, type MemorySearchResult, type MemoryUpdate, ModusManagement, ModusOptions, type ToolsetInput, type TriggerInput, type UpdateAgentOptions, type UpdateScopeOptions, type UpdateSkillOptions, type UpdateWorkflowOptions, type UploadDirFailure, type UploadDirResult, type UploadFromUrlInput, type UploadUrlInput, type UploadUrlSlot, type UserFeedback, type WaitUntil, type WorkflowGraphInput };
@@ -1,4 +1,4 @@
1
- import { H as HttpClient, M as ModusConfig, c as components, W as WorkflowType, n as OperationId, V as VariationView, P as Page, a as Workflow, C as ContextItem, y as ContextItemDeletion, d as CustomContextItemsResource, z as CreatedContextItem, S as ScopeConversationsResource, h as Scope, i as ModusClientBase, j as ModusOptions } from '../conversations-Pe3kNikF.js';
1
+ import { H as HttpClient, M as ModusConfig, c as components, W as WorkflowType, n as OperationId, V as VariationView, P as Page, a as Workflow, C as ContextItem, y as ContextItemDeletion, d as CustomContextItemsResource, z as CreatedContextItem, S as ScopeConversationsResource, h as Scope, i as ModusClientBase, j as ModusOptions } from '../conversations-BRg8gEKX.js';
2
2
 
3
3
  type AgentInterface = components['schemas']['AgentInterfaceDto'];
4
4
  type AddAgentInterface = components['schemas']['AddAgentInterfaceDto'];
@@ -255,8 +255,154 @@ declare class ManagementContextItemsResource {
255
255
 
256
256
  type UserFeedback = 'positive' | 'neutral' | 'negative';
257
257
 
258
+ type FileUpload = components['schemas']['FileUploadResourceDto'];
259
+ type FileUploadStatus = components['schemas']['FileUploadResourceStatus'];
260
+ type UploadUrlSlot = components['schemas']['UploadUrlResponseDto'];
261
+ type BulkUploadUrlsResult = components['schemas']['BulkUploadUrlsResponseDto'];
262
+ type BulkUploadFromUrlsResult = components['schemas']['BulkUploadFromUrlsResponseDto'];
263
+ type FailedUploadUrl = components['schemas']['FailedUploadUrlDto'];
264
+ type FailedUploadFromUrl = components['schemas']['FailedUploadFromUrlDto'];
265
+ /** `"processing"` (parsing started) or `"ready"` (parsing finished) — target status for `upload()` / `uploadDir()`. */
266
+ type WaitUntil = 'processing' | 'ready';
267
+ /** One file entry for `createUploadUrls()`. */
268
+ interface UploadUrlInput {
269
+ fileName: string;
270
+ contentType: string;
271
+ fileSize: number;
272
+ }
273
+ /** One URL entry for `uploadFromUrls()`. */
274
+ interface UploadFromUrlInput {
275
+ url: string;
276
+ fileName?: string;
277
+ }
278
+ /** A single file that failed during `uploadDir()` (slot creation or PUT/poll). */
279
+ interface UploadDirFailure {
280
+ path: string;
281
+ error: string;
282
+ }
283
+ /** Outcome of `uploadDir()` — successes and per-file failures. */
284
+ interface UploadDirResult {
285
+ uploaded: FileUpload[];
286
+ failed: UploadDirFailure[];
287
+ }
288
+
289
+ /**
290
+ * Durable file uploads for `ModusManagement`.
291
+ *
292
+ * Call path: `mgmt.context.files` after `new ModusManagement(...)`.
293
+ *
294
+ * - `upload(path)` / `uploadDir(dirPath)` — presign + PUT + poll convenience helpers.
295
+ * - `createUploadUrl(s)`, `uploadFromUrl(s)`, `get`, `list` — raw operations.
296
+ */
297
+ declare class ManagementContextFilesResource {
298
+ private readonly http;
299
+ private readonly config;
300
+ /** @internal */
301
+ constructor(http: HttpClient, config: ModusConfig);
302
+ /**
303
+ * Get a presigned S3 PUT URL for one file.
304
+ *
305
+ * @param input.fileName - Original file name — used to build the S3 object key.
306
+ * @param input.contentType - MIME type. Allowed categories: PDF, images, text,
307
+ * Office/OpenDocument documents, audio, and video.
308
+ * @param input.fileSize - File size in bytes. Rejected above 50MB.
309
+ * @returns Presigned upload slot. PUT the raw bytes to `uploadUrl` within 15
310
+ * minutes, then poll `get(uploadId)` — there is no separate finalize call.
311
+ */
312
+ createUploadUrl(input: UploadUrlInput): Promise<UploadUrlSlot>;
313
+ /**
314
+ * Get presigned S3 PUT URLs for up to 100 files in one call.
315
+ *
316
+ * @param files - Files to create upload slots for (max 100).
317
+ * @returns Slots for every file that passed validation, plus per-index
318
+ * failures (bad MIME type, oversize) for the rest — never a partial 4xx.
319
+ */
320
+ createUploadUrls(files: readonly UploadUrlInput[]): Promise<BulkUploadUrlsResult>;
321
+ /**
322
+ * Fetch one file from a URL and land it as durable context.
323
+ *
324
+ * @param url - Source URL to fetch (SSRF-guarded, 50MB cap, same MIME
325
+ * allow-list as `createUploadUrl`).
326
+ * @param options.fileName - Override file name. Inferred from the URL path when omitted.
327
+ * @returns File upload resource with status `processing` — parsing continues async.
328
+ */
329
+ uploadFromUrl(url: string, options?: {
330
+ fileName?: string;
331
+ }): Promise<FileUpload>;
332
+ /**
333
+ * Fetch up to 100 files from URLs in one call.
334
+ *
335
+ * @param urls - URLs to fetch and upload (max 100).
336
+ * @returns File upload resources for every URL that landed, plus per-index
337
+ * failures for the rest — never a partial 4xx.
338
+ */
339
+ uploadFromUrls(urls: readonly UploadFromUrlInput[]): Promise<BulkUploadFromUrlsResult>;
340
+ /**
341
+ * Fetch one file upload by its id.
342
+ *
343
+ * @param uploadId - Upload id returned by `createUploadUrl` / `uploadFromUrl`.
344
+ * @returns The file upload resource, including its processing `status`.
345
+ */
346
+ get(uploadId: string): Promise<FileUpload>;
347
+ /**
348
+ * List durable file uploads.
349
+ *
350
+ * @param options.pageSize - Items per page (default 50).
351
+ * @param options.pageToken - Opaque token from a previous page's `nextPageToken`.
352
+ * @returns Page of file uploads. Uploads that only have a pending row (not yet
353
+ * landed) aren't included here — use `get(uploadId)` for those.
354
+ */
355
+ list(options?: {
356
+ pageSize?: number;
357
+ pageToken?: string;
358
+ }): Promise<Page<FileUpload>>;
359
+ private listPage;
360
+ /**
361
+ * Upload a local file and wait for it to reach `"processing"` or `"ready"`.
362
+ *
363
+ * Gets a presigned URL, PUTs the file bytes, then polls `get()` until the
364
+ * upload leaves `"pending"` (or reaches `"ready"`/`"failed"`).
365
+ *
366
+ * @param path - Path to a local file.
367
+ * @param options.waitUntil - `"processing"` (parsing started, default) or
368
+ * `"ready"` (parsing finished).
369
+ * @param options.pollIntervalMs - Milliseconds between status polls.
370
+ * @param options.timeoutMs - Max milliseconds to wait before raising.
371
+ * @returns The file upload resource once it reaches `waitUntil` (or `"failed"`).
372
+ * @throws {ModusError} If the PUT fails, or polling times out.
373
+ */
374
+ upload(path: string, options?: {
375
+ waitUntil?: WaitUntil;
376
+ pollIntervalMs?: number;
377
+ timeoutMs?: number;
378
+ }): Promise<FileUpload>;
379
+ private pollUntil;
380
+ /**
381
+ * Upload every file in a local directory.
382
+ *
383
+ * Walks `path` (skipping hidden files/directories and symlinks), pages
384
+ * through `createUploadUrls()` in batches of up to 100, then PUTs and polls
385
+ * each file with up to `concurrency` in flight at once. A failure on one
386
+ * file does not stop the others — check `result.failed`.
387
+ *
388
+ * @param path - Path to a local directory.
389
+ * @param options.recursive - Recurse into subdirectories (default `true`).
390
+ * @param options.concurrency - Max concurrent PUT+poll operations (default 10).
391
+ * @param options.waitUntil - `"processing"` (default) or `"ready"` — same as `upload()`.
392
+ * @returns `UploadDirResult` with every successful `FileUpload` and every
393
+ * per-file failure (slot creation or PUT/poll), each tagged with its local path.
394
+ */
395
+ uploadDir(path: string, options?: {
396
+ recursive?: boolean;
397
+ concurrency?: number;
398
+ waitUntil?: WaitUntil;
399
+ }): Promise<UploadDirResult>;
400
+ private createSlots;
401
+ private uploadBatch;
402
+ }
403
+
258
404
  /**
259
- * Create and update context items (notes, links, saved queries).
405
+ * Create and update context items (notes, links, saved queries, file uploads).
260
406
  *
261
407
  * Call path: `mgmt.context` after `new ModusManagement(...)`.
262
408
  */
@@ -265,6 +411,7 @@ declare class ManagementContextResource {
265
411
  private readonly config;
266
412
  readonly items: ManagementContextItemsResource;
267
413
  readonly customItems: CustomContextItemsResource;
414
+ readonly files: ManagementContextFilesResource;
268
415
  /** @internal */
269
416
  constructor(http: HttpClient, config: ModusConfig);
270
417
  /**
@@ -806,4 +953,4 @@ declare class ModusManagement extends ModusClientBase {
806
953
  constructor(options?: ModusOptions);
807
954
  }
808
955
 
809
- export { type AgentSelectionInput, type CreateAgentOptions, type CreateScopeOptions, type CreateSkillOptions, type CreateWorkflowOptions, type Memory, type MemorySearchRequest, type MemorySearchResult, type MemoryUpdate, ModusManagement, ModusOptions, type ToolsetInput, type TriggerInput, type UpdateAgentOptions, type UpdateScopeOptions, type UpdateSkillOptions, type UpdateWorkflowOptions, type UserFeedback, type WorkflowGraphInput };
956
+ export { type AgentSelectionInput, type BulkUploadFromUrlsResult, type BulkUploadUrlsResult, type CreateAgentOptions, type CreateScopeOptions, type CreateSkillOptions, type CreateWorkflowOptions, type FailedUploadFromUrl, type FailedUploadUrl, type FileUpload, type FileUploadStatus, type Memory, type MemorySearchRequest, type MemorySearchResult, type MemoryUpdate, ModusManagement, ModusOptions, type ToolsetInput, type TriggerInput, type UpdateAgentOptions, type UpdateScopeOptions, type UpdateSkillOptions, type UpdateWorkflowOptions, type UploadDirFailure, type UploadDirResult, type UploadFromUrlInput, type UploadUrlInput, type UploadUrlSlot, type UserFeedback, type WaitUntil, type WorkflowGraphInput };