@getmodus/sdk 0.6.0 → 0.8.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.
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { c as components, H as HttpClient, M as ModusConfig, P as Page, W as WorkflowType, V as VariationView, a as Workflow, C as ContextItem, b as ContextItemLookupRow, d as CustomContextItemsResource, e as ConversationKind, f as ConversationListItem, g as Conversation, S as ScopeConversationsResource, h as Scope, i as ModusClientBase, j as ModusOptions } from './conversations-BRg8gEKX.cjs';
2
- export { A as Agent, k as AgentType, l as ContextType, m as Message, O as OPERATIONS, n as OperationId, o as OperationSpec, p as ScopeStatus, q as ScopeVariation, r as Skill, s as SkillStatus, t as SkillVariation, u as conversationScopeId, v as conversationSkillId, w as operations, x as paths } from './conversations-BRg8gEKX.cjs';
1
+ import { c as components, H as HttpClient, M as ModusConfig, P as Page, W as WorkflowType, V as VariationView, a as Workflow, C as ContextItem, b as ContextItemLookupRow, d as CustomContextItemsResource, e as ConversationKind, f as ConversationListItem, g as Conversation, S as ScopeConversationsResource, h as Scope, i as ModusClientBase, j as ModusOptions } from './conversations-COA6NW8I.cjs';
2
+ export { A as Agent, k as AgentType, l as ContextItemAncestor, m as ContextItemDeletion, n as ContextItemMove, o as ContextType, p as Message, O as OPERATIONS, q as OperationId, r as OperationSpec, s as ScopeStatus, t as ScopeVariation, u as Skill, v as SkillStatus, w as SkillVariation, x as conversationScopeId, y as conversationSkillId, z as operations, B as paths } from './conversations-COA6NW8I.cjs';
3
3
 
4
4
  /**
5
5
  * Base class for all Modus SDK errors.
@@ -48,8 +48,11 @@ declare class NotFoundError extends ModusError {
48
48
  constructor(message: string, options?: ConstructorParameters<typeof ModusError>[1]);
49
49
  }
50
50
  /**
51
- * Idempotency conflict — a run with this ID already exists with a different
52
- * body (HTTP 409). Use a new idempotency key or omit it to auto-generate.
51
+ * The request conflicts with existing state (HTTP 409).
52
+ *
53
+ * Inspect the API message for the operation-specific outcome. For ingested-data
54
+ * uploads, this means the complete payload is already stored and is a safe retry
55
+ * outcome.
53
56
  */
54
57
  declare class ConflictError extends ModusError {
55
58
  constructor(message: string, options?: ConstructorParameters<typeof ModusError>[1]);
@@ -104,18 +107,18 @@ declare class ValidationError extends ModusError {
104
107
  * validation before the request is sent.
105
108
  *
106
109
  * Allowed values:
107
- * - `claude-sonnet-5`, `claude-sonnet-4.6`, `claude-opus-4.8`
108
- * - `gpt-5.2`, `gpt-5.5`, `gpt-5-mini`, `gpt-oss-120b`, `gpt-oss-20b`
110
+ * - `claude-sonnet-5`, `claude-sonnet-5.5`, `claude-sonnet-4.6`, `claude-opus-4.8`, `claude-opus-5.5`
111
+ * - `gpt-5.2`, `gpt-5.5`, `gpt-5-mini`, `gpt-5.6-luna`, `gpt-6-luna`, `gpt-oss-120b`, `gpt-oss-20b`
109
112
  * - `qwen3-235b-a22b-2507`, `qwen3-coder`, `qwen3-32b`
110
113
  * - `deepseek-chat-v3.1`, `deepseek-v4-pro`, `deepseek-v4-flash-latest`, `minimax-m2.7`
111
114
  * - `llama-4-maverick`, `llama-4-scout`, `llama-3.3-70b-instruct`
112
115
  * - `gemini-3.1-pro-preview`, `gemini-3-flash-preview`
113
- * - `grok-4.3-fast`, `grok-4.3`
116
+ * - `grok-4.3-fast`, `grok-4.3`, `grok-4.7`, `kimi-k3`
114
117
  *
115
118
  * @example
116
119
  * ```ts
117
120
  * const result = await client.modus.chat('Summarize open tickets', {
118
- * model: 'claude-sonnet-4.6',
121
+ * model: 'claude-sonnet-5.5',
119
122
  * })
120
123
  * ```
121
124
  */
@@ -243,6 +246,23 @@ interface AgentRunStream extends AsyncIterable<RunEvent> {
243
246
  readonly runId: string;
244
247
  readonly events: AsyncIterable<RunEvent>;
245
248
  }
249
+ /**
250
+ * Start, inspect, and control workflow runs.
251
+ *
252
+ * Typical path: `create` (or `createScope` / `createModus`) → stream events →
253
+ * `list` / `get` history → `cancel` or `resume` when needed.
254
+ *
255
+ * @example
256
+ * ```ts
257
+ * const stream = client.workflows.runs.create(workflowId, {
258
+ * message: "Summarize yesterday's sales",
259
+ * config: { model: 'claude-sonnet-5' },
260
+ * })
261
+ * for await (const event of stream) {
262
+ * if (event.type === 'token') process.stdout.write(event.content)
263
+ * }
264
+ * ```
265
+ */
246
266
  declare class WorkflowRunsResource {
247
267
  private readonly http;
248
268
  private readonly config;
@@ -258,7 +278,16 @@ declare class WorkflowRunsResource {
258
278
  * @param options.timeframe - Filter by recency (`last_hour`, `last_day`, or `last_week`).
259
279
  * @param options.approvalScope - Filter approval-related runs (`mine` or `all`).
260
280
  * @param options.search - Free-text search filter.
261
- * @returns A page of run summaries.
281
+ * @returns A page of run summaries — use `.autoPagingIter()` for all pages.
282
+ *
283
+ * @example
284
+ * ```ts
285
+ * for await (const run of (
286
+ * await client.workflows.runs.list(workflowId, { status: 'completed' })
287
+ * ).autoPagingIter()) {
288
+ * console.log(run.workflowId, run.status, run.startedAt)
289
+ * }
290
+ * ```
262
291
  */
263
292
  list(workflowId: number | string, options?: {
264
293
  pageSize?: number;
@@ -273,10 +302,16 @@ declare class WorkflowRunsResource {
273
302
  * Retrieve a workflow run by id.
274
303
  *
275
304
  * @param workflowId - Workflow id or slug the run belongs to.
276
- * @param runId - Run id.
305
+ * @param runId - Run id (the list row's `workflowId` field, not the composite `id`).
277
306
  * @param options.temporalRunId - Optional internal execution id when disambiguating retries.
278
307
  * @returns Run details including status and output.
279
308
  * @throws {NotFoundError} When the run does not exist.
309
+ *
310
+ * @example
311
+ * ```ts
312
+ * const run = await client.workflows.runs.get(workflowId, runId)
313
+ * console.log(run.status)
314
+ * ```
280
315
  */
281
316
  get(workflowId: number | string, runId: string, options?: {
282
317
  temporalRunId?: string;
@@ -292,8 +327,8 @@ declare class WorkflowRunsResource {
292
327
  * @example
293
328
  * ```ts
294
329
  * const stream = client.workflows.runs.create(workflowId, {
295
- * message: 'Summarize yesterday\'s sales',
296
- * sessionId: 'conv-abc',
330
+ * message: "Summarize yesterday's sales",
331
+ * config: { model: 'claude-sonnet-5' },
297
332
  * })
298
333
  * for await (const event of stream) {
299
334
  * if (event.type === 'token') process.stdout.write(event.content)
@@ -307,20 +342,44 @@ declare class WorkflowRunsResource {
307
342
  /**
308
343
  * Start a scope run and stream run events.
309
344
  *
345
+ * Same event stream shape as {@link create}, but targets a published scope.
346
+ *
310
347
  * @param scopeId - Scope id to run.
311
348
  * @param body - Run body (`message`, optional `sessionId`, optional `version` as `published` or `draft`).
312
349
  * @param options.idempotencyKey - Client-supplied idempotency key; defaults to `body.runId` or a new uuid.
313
350
  * @returns A stream of run events.
351
+ *
352
+ * @example
353
+ * ```ts
354
+ * const stream = client.workflows.runs.createScope(scopeId, {
355
+ * message: 'What is our ARR trend?',
356
+ * config: { model: 'claude-sonnet-5' },
357
+ * })
358
+ * for await (const event of stream) {
359
+ * if (event.type === 'token') process.stdout.write(event.content)
360
+ * }
361
+ * ```
314
362
  */
315
363
  createScope(scopeId: number | string, body: SkillRunCreateRequest, options?: {
316
364
  idempotencyKey?: string;
317
365
  }): AgentRunStream;
318
366
  /**
319
- * Start a Modus assistant run and stream run events.
367
+ * Start a Modus org-assistant run and stream run events.
320
368
  *
321
369
  * @param body - Run body (`message`, optional `sessionId`, optional `subordinateSkillIds` to narrow context).
322
370
  * @param options.idempotencyKey - Client-supplied idempotency key; defaults to `body.runId` or a new uuid.
323
371
  * @returns A stream of run events.
372
+ *
373
+ * @example
374
+ * ```ts
375
+ * const stream = client.workflows.runs.createModus({
376
+ * message: 'Summarize ARR in three bullets.',
377
+ * config: { model: 'claude-sonnet-5' },
378
+ * })
379
+ * for await (const event of stream) {
380
+ * if (event.type === 'token') process.stdout.write(event.content)
381
+ * }
382
+ * ```
324
383
  */
325
384
  createModus(body: ModusRunCreateRequest, options?: {
326
385
  idempotencyKey?: string;
@@ -332,6 +391,18 @@ declare class WorkflowRunsResource {
332
391
  * @param body - Resume body (`message`, `sessionId`, and `decision`: `approve` / `deny` / `connected` / `cancelled`).
333
392
  * @param options.idempotencyKey - Client-supplied idempotency key; defaults to `body.runId` or a new uuid.
334
393
  * @returns A stream of run events.
394
+ *
395
+ * @example
396
+ * ```ts
397
+ * const stream = client.workflows.runs.resume(runId, {
398
+ * decision: 'approve',
399
+ * message: 'Looks good — continue.',
400
+ * sessionId,
401
+ * })
402
+ * for await (const event of stream) {
403
+ * if (event.type === 'token') process.stdout.write(event.content)
404
+ * }
405
+ * ```
335
406
  */
336
407
  resume(runId: string, body: ResumeRunRequest, options?: {
337
408
  idempotencyKey?: string;
@@ -340,6 +411,11 @@ declare class WorkflowRunsResource {
340
411
  * Cancel a run that is still in progress.
341
412
  *
342
413
  * @param runId - Run id to cancel.
414
+ *
415
+ * @example
416
+ * ```ts
417
+ * await client.workflows.runs.cancel(runId)
418
+ * ```
343
419
  */
344
420
  cancel(runId: string): Promise<void>;
345
421
  /**
@@ -419,6 +495,20 @@ type SuggestionEventSource = components['schemas']['SuggestionEventSource'];
419
495
  /** Request body for recording a suggestion event (camelCase, matches the wire). */
420
496
  type RecordSuggestionEventRequest = components['schemas']['RecordSuggestionEventDto'];
421
497
 
498
+ type SqlIngestedDataRequest = components['schemas']['SqlIngestedDataRequestDto'];
499
+ type HttpIngestedDataRequest = components['schemas']['HttpIngestedDataRequestDto'];
500
+ type IngestedDataRequest = components['schemas']['CreateIngestedDataDto']['request'];
501
+ type IngestedDataResponseFormat = components['schemas']['IngestedDataResponseFormat'];
502
+ type IngestedDataResponse = components['schemas']['IngestedDataResponseDto'];
503
+ /** Complete content used to identify an immutable ingested-data upload. */
504
+ interface UploadIngestedDataOptions {
505
+ integrationType: string;
506
+ request: IngestedDataRequest;
507
+ response: IngestedDataResponse;
508
+ }
509
+ /** Location and identity of a newly stored ingested-data envelope. */
510
+ type IngestedDataUploadResult = components['schemas']['CreatedIngestedDataResponseDto'];
511
+
422
512
  declare class AgentWorkflowActionsResource {
423
513
  private readonly http;
424
514
  private readonly config;
@@ -446,8 +536,18 @@ declare class AgentWorkflowActionsResource {
446
536
  /**
447
537
  * Read and run access to Modus workflows.
448
538
  *
449
- * - {@link WorkflowRunsResource runs} — start, monitor, and control workflow runs.
450
- * - {@link AgentWorkflowActionsResource workflowActions} — execute workflow actions.
539
+ * - `list` / `get` — browse workflows (`view: 'active'` or `'draft'`)
540
+ * - {@link WorkflowRunsResource runs} — start, monitor, and control workflow runs
541
+ * - {@link AgentWorkflowActionsResource workflowActions} — execute workflow actions
542
+ *
543
+ * @example
544
+ * ```ts
545
+ * import { Modus } from '@getmodus/sdk'
546
+ * const client = new Modus()
547
+ * for await (const wf of (await client.workflows.list()).autoPagingIter()) {
548
+ * console.log(wf.id, wf.name, wf.status)
549
+ * }
550
+ * ```
451
551
  */
452
552
  declare class WorkflowsResource {
453
553
  private readonly http;
@@ -457,15 +557,22 @@ declare class WorkflowsResource {
457
557
  /** @internal */
458
558
  constructor(http: HttpClient, config: ModusConfig);
459
559
  /**
460
- * List workflows.
560
+ * List workflows in the organisation.
461
561
  *
462
562
  * @param options.pageSize - Maximum items per page (default 25).
463
563
  * @param options.pageToken - Opaque token from a previous page.
464
- * @param options.search - Free-text search filter.
564
+ * @param options.search - Case-insensitive substring filter on the workflow name.
465
565
  * @param options.type - Workflow kind: `"task"` or `"workflow"`.
466
566
  * @param options.view - Which saved version to return (`active` or `draft`).
467
567
  * @param options.includeVariation - Include variation metadata when supported.
468
- * @returns A page of workflows.
568
+ * @returns A page of workflows — use `.autoPagingIter()` for all pages.
569
+ *
570
+ * @example
571
+ * ```ts
572
+ * for await (const wf of (await client.workflows.list({ search: 'digest' })).autoPagingIter()) {
573
+ * console.log(wf.id, wf.name, wf.status)
574
+ * }
575
+ * ```
469
576
  */
470
577
  list(options?: {
471
578
  pageSize?: number;
@@ -482,8 +589,14 @@ declare class WorkflowsResource {
482
589
  * @param workflowId - Numeric id or slug.
483
590
  * @param options.view - Which saved version to return (`active` or `draft`).
484
591
  * @param options.includeVariation - Include variation metadata when supported.
485
- * @returns The workflow.
592
+ * @returns The workflow (`id`, `name`, `status`, …).
486
593
  * @throws {NotFoundError} When no workflow matches the id or slug.
594
+ *
595
+ * @example
596
+ * ```ts
597
+ * const wf = await client.workflows.get('weekly-digest')
598
+ * console.log(wf.name, wf.status)
599
+ * ```
487
600
  */
488
601
  get(workflowId: number | string, options?: {
489
602
  view?: VariationView;
@@ -534,7 +647,20 @@ type JsonObjectInput = Record<string, unknown>;
534
647
  type ContentProjection = components['schemas']['ContentProjectionDto'];
535
648
 
536
649
  /**
537
- * Read access to Modus knowledge-base items.
650
+ * Read the org knowledge base (notes, metrics, saved queries, integration items).
651
+ *
652
+ * Use `client.context.items` after `new Modus()`. Prefer `list` / `get` /
653
+ * `lookup` for discovery; use `listValues` when a field holds a large array
654
+ * inside `content`.
655
+ *
656
+ * @example
657
+ * ```ts
658
+ * import { Modus } from '@getmodus/sdk'
659
+ * const client = new Modus()
660
+ * for await (const item of (await client.context.items.list({ pageSize: 25 })).autoPagingIter()) {
661
+ * console.log(item.contextType, item.description ?? item.uid)
662
+ * }
663
+ * ```
538
664
  */
539
665
  declare class ContextItemsResource {
540
666
  private readonly http;
@@ -546,30 +672,86 @@ declare class ContextItemsResource {
546
672
  *
547
673
  * @param options.pageSize - Maximum items per page (default 25).
548
674
  * @param options.pageToken - Opaque token from a previous page.
549
- * @param options.contextType - Filter to a single context type.
550
- * @returns A page of context items.
675
+ * @param options.contextType - Filter to a single context type (e.g. `"note"`).
676
+ * @param options.parentUids - Exact ordered native ancestry chain for direct
677
+ * children. Omit to leave parent unrestricted; pass `[]` for the known-empty
678
+ * root. Native UIDs are exact tokens (including whitespace); do not use the
679
+ * hashed context-item `uid`. For a folder's children, send that item's
680
+ * `ancestry` UIDs plus its last `dataPath` token.
681
+ * @param options.ancestorUids - Ordered UID ancestry prefix for strict
682
+ * descendants. Omit to leave unrestricted; pass `[]` for every item with
683
+ * non-null ancestry.
684
+ * @param options.connectionIds - Restrict to these connection ids. Omit to
685
+ * leave unfiltered; pass `[]` to match none. The Files root is
686
+ * `connectionIds: ['files']` with `parentUids: []`.
687
+ * @returns A page of context items — use `.autoPagingIter()` for all pages.
688
+ *
689
+ * @example
690
+ * ```ts
691
+ * const notes = await client.context.items.list({ contextType: 'note', pageSize: 50 })
692
+ * for (const item of notes.items) {
693
+ * console.log(item.description ?? item.uid, item.uid)
694
+ * }
695
+ * ```
696
+ *
697
+ * @example
698
+ * ```ts
699
+ * const rootFolders = await client.context.items.list({
700
+ * connectionIds: ['files'],
701
+ * contextType: 'file_folder_metadata',
702
+ * parentUids: [],
703
+ * })
704
+ * const folder = rootFolders.items[0]
705
+ * const nativeUid = folder?.dataPath?.at(-1)
706
+ * // Known ancestry only — never treat null/omitted ancestry as a root chain.
707
+ * if (folder?.ancestry != null && nativeUid !== undefined) {
708
+ * const filesInFolder = await client.context.items.list({
709
+ * connectionIds: ['files'],
710
+ * contextType: 'file_upload',
711
+ * parentUids: [...folder.ancestry.map((a) => a.uid), nativeUid],
712
+ * })
713
+ * }
714
+ * ```
551
715
  */
552
716
  list(options?: {
553
717
  pageSize?: number;
554
718
  pageToken?: string;
555
719
  contextType?: string;
720
+ parentUids?: readonly string[];
721
+ ancestorUids?: readonly string[];
722
+ connectionIds?: readonly string[];
556
723
  }): Promise<Page<ContextItem>>;
557
724
  private listPage;
558
725
  /**
559
726
  * Retrieve a knowledge-base item by uid.
560
727
  *
561
728
  * @param uid - Item uid.
562
- * @returns The context item.
729
+ * @returns The context item (`uid`, `contextType`, `content`, …).
563
730
  * @throws {NotFoundError} When no item matches the uid.
731
+ *
732
+ * @example
733
+ * ```ts
734
+ * const item = await client.context.items.get(uid)
735
+ * console.log(item.contextType, item.description ?? item.uid)
736
+ * ```
564
737
  */
565
738
  get(uid: string): Promise<ContextItem>;
566
739
  /**
567
740
  * Look up a knowledge-base item by type and data path.
568
741
  *
569
- * @param options.contextType - Context type to match.
742
+ * @param options.contextType - Context type to match (e.g. `"note"`).
570
743
  * @param options.dataPath - Hierarchical path segments that identify the item.
571
744
  * @param options.contentProjection - Optional fields to include from item content.
572
745
  * @returns The matching row, or `undefined` when no item is found (404).
746
+ *
747
+ * @example
748
+ * ```ts
749
+ * const found = await client.context.items.lookup({
750
+ * contextType: 'note',
751
+ * dataPath: ['finance', 'arr-definition'],
752
+ * })
753
+ * if (found) console.log(found.uid, found.description ?? found.uid)
754
+ * ```
573
755
  */
574
756
  lookup(options: {
575
757
  contextType: string;
@@ -581,10 +763,22 @@ declare class ContextItemsResource {
581
763
  *
582
764
  * @param uid - Item uid.
583
765
  * @param contextType - Context type of the item.
584
- * @param contentKeyPath - Dot path to the value field inside item content.
766
+ * @param contentKeyPath - Dot path to the value field inside item content (e.g. `"enumValues"`).
585
767
  * @param options.pageSize - Maximum items per page (default 25).
586
768
  * @param options.pageToken - Opaque token from a previous page.
587
769
  * @returns A page of value rows.
770
+ *
771
+ * @example
772
+ * ```ts
773
+ * // Replace PLACEHOLDER_UID with a real uid whose content has enumValues.
774
+ * const page = await client.context.items.listValues(
775
+ * 'PLACEHOLDER_UID',
776
+ * 'table_column',
777
+ * 'enumValues',
778
+ * { pageSize: 25 },
779
+ * )
780
+ * for (const row of page.items) console.log(row)
781
+ * ```
588
782
  */
589
783
  listValues(uid: string, contextType: string, contentKeyPath: string, options?: {
590
784
  pageSize?: number;
@@ -598,6 +792,14 @@ declare class ContextItemsResource {
598
792
  * @param options.pageSize - Maximum items per page (default 25).
599
793
  * @param options.pageToken - Opaque token from a previous page.
600
794
  * @returns A page of value rows.
795
+ *
796
+ * @example
797
+ * ```ts
798
+ * // Replace PLACEHOLDER_UID with a real uid that has enumValues in content.
799
+ * const item = await client.context.items.get('PLACEHOLDER_UID')
800
+ * const page = await client.context.items.listValuesFor(item, 'enumValues')
801
+ * for (const row of page.items) console.log(row)
802
+ * ```
601
803
  */
602
804
  listValuesFor(item: ContextItem, contentKeyPath: string, options?: {
603
805
  pageSize?: number;
@@ -621,6 +823,38 @@ declare class ContextResource {
621
823
  constructor(http: HttpClient, config: ModusConfig);
622
824
  }
623
825
 
826
+ /** Store exact integration requests and responses as immutable ingested data. */
827
+ declare class IngestedDataResource {
828
+ private readonly http;
829
+ private readonly config;
830
+ /** @internal */
831
+ constructor(http: HttpClient, config: ModusConfig);
832
+ /**
833
+ * Store a complete SQL or HTTP request and response exactly once.
834
+ *
835
+ * Identity covers the complete organization, integration, request, and response
836
+ * content. A duplicate raises `ConflictError`, which means the identical payload
837
+ * is already stored and may be treated as a safe retry outcome.
838
+ *
839
+ * @param options.integrationType - Canonical Modus integration identifier.
840
+ * @param options.request - Exact SQL or HTTP request that produced the response.
841
+ * @param options.response - Response format, optional source HTTP status, and exact string content. SQL requires CSV.
842
+ * @returns The checksum of the stored envelope.
843
+ * @throws {ConflictError} When the complete payload is already stored.
844
+ *
845
+ * @example
846
+ * ```ts
847
+ * const stored = await client.ingestedData.upload({
848
+ * integrationType: 'generic',
849
+ * request: { type: 'sql', query: 'SELECT id, total FROM orders' },
850
+ * response: { format: 'csv', content: 'id,total\n1,42.00\n' },
851
+ * })
852
+ * console.log(stored.checksum)
853
+ * ```
854
+ */
855
+ upload(options: UploadIngestedDataOptions): Promise<IngestedDataUploadResult>;
856
+ }
857
+
624
858
  /** List and retrieve Modus / scope conversations. */
625
859
  declare class ModusConversationsResource {
626
860
  private readonly http;
@@ -632,12 +866,22 @@ declare class ModusConversationsResource {
632
866
  * @param options.pageSize - Items per page (default 25).
633
867
  * @param options.pageToken - Opaque token from a previous page.
634
868
  * @param options.kind - `"modus"`, `"scopes"`, or `"all"`.
869
+ * @param options.source - Restrict to conversations started from this UI surface
870
+ * (e.g. `"context_chat"`, `"dashboard_copilot"`, `"slack"`). Only valid with an
871
+ * omitted `kind` or `kind: "all"`; the API throws an `UnprocessableError` (422)
872
+ * if combined with `kind: "modus"` or `kind: "scopes"`.
873
+ * @param options.sourceRef - Narrow `source` to one instance of that surface — for
874
+ * `"dashboard_copilot"`, a dashboard id. Requires `source`; the API throws an
875
+ * `UnprocessableError` (422) if sent on its own. Conversations recorded before
876
+ * this filter shipped carry no instance key and never match it.
635
877
  * @returns Page of conversation list items.
636
878
  */
637
879
  list(options?: {
638
880
  pageSize?: number;
639
881
  pageToken?: string;
640
882
  kind?: ConversationKind;
883
+ source?: string;
884
+ sourceRef?: string;
641
885
  }): Promise<Page<ConversationListItem>>;
642
886
  private listPage;
643
887
  /**
@@ -649,34 +893,66 @@ declare class ModusConversationsResource {
649
893
  get(threadId: string): Promise<Conversation>;
650
894
  }
651
895
 
652
- /** Org-wide Modus assistant. */
896
+ /**
897
+ * Org-wide Modus assistant (full environment context and tools).
898
+ *
899
+ * Prefer `client.modus` over `client.scopes` when the question is not tied to one
900
+ * published scope. Construct with `new Modus()` (reads `MODUS_API_KEY`).
901
+ *
902
+ * - `chat` — one complete reply
903
+ * - `chatStream` — print tokens as they arrive (consume `textStream()`)
904
+ * - `getContext` — preview composed context without a chat turn
905
+ * - `conversations` — list/get prior Modus threads
906
+ *
907
+ * @example
908
+ * ```ts
909
+ * import { Modus } from '@getmodus/sdk'
910
+ * const client = new Modus()
911
+ * const result = await client.modus.chat('What tables describe revenue?', {
912
+ * model: 'claude-sonnet-5',
913
+ * })
914
+ * console.log(result.content, result.threadId)
915
+ * ```
916
+ */
653
917
  declare class ModusResource {
654
918
  private readonly http;
655
919
  private readonly config;
656
920
  readonly conversations: ModusConversationsResource;
657
921
  constructor(http: HttpClient, config: ModusConfig);
658
922
  /**
659
- * Return composed full-environment context for an intent, without running chat.
923
+ * Compose full-environment context for an intent without running chat.
924
+ *
925
+ * @param message - Natural-language intent used to select context.
926
+ * @param options.limit - Maximum context items to return. Omit to return all selected items.
927
+ * @returns Composition metadata (counts / session id). Use `chat` for a reply.
660
928
  *
661
- * @param message - User intent or question to compose context for.
662
- * @param options.limit - Optional cap on structured fallback items.
663
- * @returns Composed Modus context.
929
+ * @example
930
+ * ```ts
931
+ * const ctx = await client.modus.getContext('What tables describe revenue?', { limit: 5 })
932
+ * console.log(ctx.originalCount, ctx.sessionId)
933
+ * ```
664
934
  */
665
935
  getContext(message: string, options?: {
666
936
  limit?: number;
667
937
  }): Promise<ModusContextComposition>;
668
938
  /**
669
- * Send a message to Modus (org-wide assistant) and get the complete reply.
939
+ * Send a message to Modus and wait for the complete reply.
670
940
  *
671
- * @param message - Message to send.
941
+ * @param message - User message text.
672
942
  * @param options.model - Required model id (e.g. `"claude-sonnet-5"`).
673
- * @param options.threadId - Continue an existing conversation.
674
- * @returns Chat result with content and threadId.
943
+ * @param options.threadId - Continue an existing conversation; omit to start new.
944
+ * @returns Chat result: `content`, `threadId` (for follow-ups), `runId`.
675
945
  *
676
946
  * @example
677
947
  * ```ts
678
- * const result = await client.modus.chat('What tables describe revenue?', { model: 'claude-sonnet-5' })
948
+ * const result = await client.modus.chat('What tables describe revenue?', {
949
+ * model: 'claude-sonnet-5',
950
+ * })
679
951
  * console.log(result.content, result.threadId)
952
+ * const follow = await client.modus.chat('Break that down by region.', {
953
+ * model: 'claude-sonnet-5',
954
+ * threadId: result.threadId,
955
+ * })
680
956
  * ```
681
957
  */
682
958
  chat(message: string, options: {
@@ -684,12 +960,25 @@ declare class ModusResource {
684
960
  threadId?: string;
685
961
  }): Promise<ChatResult>;
686
962
  /**
687
- * Stream a Modus reply token by token.
963
+ * Stream a Modus reply token by token (SSE).
688
964
  *
689
- * @param message - Message to send.
965
+ * The request starts when you consume `textStream()` or `eventStream()`.
966
+ *
967
+ * @param message - User message text.
690
968
  * @param options.model - Required model id (e.g. `"claude-sonnet-5"`).
691
- * @param options.threadId - Continue an existing conversation.
692
- * @returns Chat stream.
969
+ * @param options.threadId - Continue an existing conversation; omit to start new.
970
+ * @returns Chat stream — iterate `textStream()` for tokens.
971
+ *
972
+ * @example
973
+ * ```ts
974
+ * const stream = client.modus.chatStream('Summarize ARR in three bullets.', {
975
+ * model: 'claude-sonnet-5',
976
+ * })
977
+ * for await (const token of stream.textStream()) {
978
+ * process.stdout.write(token)
979
+ * }
980
+ * console.log(stream.getFinalResult().threadId)
981
+ * ```
693
982
  */
694
983
  chatStream(message: string, options: {
695
984
  model: ChatModel;
@@ -698,9 +987,19 @@ declare class ModusResource {
698
987
  }
699
988
 
700
989
  /**
701
- * Read / chat with scopes.
990
+ * Read / chat with published scopes.
991
+ *
992
+ * Call path: `client.scopes` after `new Modus(...)`. Prefer `client.modus` for
993
+ * the org-wide assistant. Create/deploy via `ModusManagement`.
702
994
  *
703
- * Call path: `client.scopes` after `new Modus(...)`.
995
+ * @example
996
+ * ```ts
997
+ * const scope = await client.scopes.get('revenue-analysis')
998
+ * const result = await client.scopes.chat(scope.id, 'What is our ARR trend?', {
999
+ * model: 'claude-sonnet-5',
1000
+ * })
1001
+ * console.log(result.content, result.threadId)
1002
+ * ```
704
1003
  */
705
1004
  declare class ScopesResource {
706
1005
  private readonly http;
@@ -712,6 +1011,15 @@ declare class ScopesResource {
712
1011
  *
713
1012
  * @param scopeId - Scope numeric id or slug.
714
1013
  * @returns Conversations resource for the scope.
1014
+ *
1015
+ * @example
1016
+ * ```ts
1017
+ * for await (const row of (
1018
+ * await client.scopes.conversations(scopeId).list({ pageSize: 10 })
1019
+ * ).autoPagingIter()) {
1020
+ * console.log(row.threadId, row.firstMessage)
1021
+ * }
1022
+ * ```
715
1023
  */
716
1024
  conversations(scopeId: number | string): ScopeConversationsResource;
717
1025
  /**
@@ -722,7 +1030,14 @@ declare class ScopesResource {
722
1030
  * @param options.search - Case-insensitive substring filter on the scope name.
723
1031
  * @param options.view - `"active"` (deployed) or `"draft"`.
724
1032
  * @param options.managerId - Only scopes supervised by this manager scope id.
725
- * @returns Page of scopes.
1033
+ * @returns Page of scopes — use `.autoPagingIter()` for all pages.
1034
+ *
1035
+ * @example
1036
+ * ```ts
1037
+ * for await (const scope of (await client.scopes.list()).autoPagingIter()) {
1038
+ * console.log(scope.id, scope.name, scope.status)
1039
+ * }
1040
+ * ```
726
1041
  */
727
1042
  list(options?: {
728
1043
  pageSize?: number;
@@ -738,35 +1053,57 @@ declare class ScopesResource {
738
1053
  * @param scopeId - Scope numeric id or slug.
739
1054
  * @param options.view - `"active"` (deployed) or `"draft"`.
740
1055
  * @throws {NotFoundError} When no scope matches the id or slug.
741
- * @returns Scope.
1056
+ * @returns Scope (`id`, `name`, `status`, …).
1057
+ *
1058
+ * @example
1059
+ * ```ts
1060
+ * const scope = await client.scopes.get('revenue-analysis')
1061
+ * console.log(scope.name, scope.status)
1062
+ * ```
742
1063
  */
743
1064
  get(scopeId: number | string, options?: {
744
1065
  view?: VariationView;
745
1066
  }): Promise<Scope>;
746
1067
  /**
747
- * Return composed context Modus would use for a scope query, without running chat.
1068
+ * Compose context this scope would use for an intent, without running chat.
748
1069
  *
749
1070
  * @param scopeId - Scope numeric id or slug.
750
- * @param message - User intent or question to compose context for.
751
- * @param options.limit - Optional cap on structured fallback items.
752
- * @returns Composed scope context.
1071
+ * @param message - Natural-language intent used to select context.
1072
+ * @param options.limit - Maximum context items to return. Omit to return all selected items.
1073
+ * @returns Composition metadata. Use `chat` when you need an assistant reply.
1074
+ *
1075
+ * @example
1076
+ * ```ts
1077
+ * const ctx = await client.scopes.getContext(scopeId, 'Which tables describe churn?', {
1078
+ * limit: 5,
1079
+ * })
1080
+ * console.log(ctx.originalCount, ctx.sessionId)
1081
+ * ```
753
1082
  */
754
1083
  getContext(scopeId: number | string, message: string, options?: {
755
1084
  limit?: number;
756
1085
  }): Promise<SkillContextComposition>;
757
1086
  /**
758
- * Send a message to a scope and get the complete reply.
1087
+ * Send a message to a published scope and wait for the complete reply.
759
1088
  *
760
- * @param scopeId - Scope numeric id or slug.
761
- * @param message - Message to send.
1089
+ * For the org-wide assistant use `client.modus.chat` instead.
1090
+ *
1091
+ * @param scopeId - Scope numeric id or slug (must be active for chat).
1092
+ * @param message - User message text.
762
1093
  * @param options.model - Required model id (e.g. `"claude-sonnet-5"`).
763
- * @param options.threadId - Continue an existing conversation.
764
- * @returns Chat result with content and threadId.
1094
+ * @param options.threadId - Continue an existing conversation; omit to start new.
1095
+ * @returns Chat result: `content`, `threadId`, `runId`.
765
1096
  *
766
1097
  * @example
767
1098
  * ```ts
768
- * const result = await client.scopes.chat(scopeId, 'Hello', { model: 'claude-sonnet-5' })
1099
+ * const result = await client.scopes.chat(scopeId, 'What is our ARR trend?', {
1100
+ * model: 'claude-sonnet-5',
1101
+ * })
769
1102
  * console.log(result.content, result.threadId)
1103
+ * const follow = await client.scopes.chat(scopeId, 'Break that down by segment.', {
1104
+ * model: 'claude-sonnet-5',
1105
+ * threadId: result.threadId,
1106
+ * })
770
1107
  * ```
771
1108
  */
772
1109
  chat(scopeId: number | string, message: string, options: {
@@ -774,14 +1111,27 @@ declare class ScopesResource {
774
1111
  threadId?: string;
775
1112
  }): Promise<ChatResult>;
776
1113
  /**
777
- * Stream a scope reply token by token.
1114
+ * Stream a scope reply token by token (SSE).
1115
+ *
1116
+ * The request starts when you consume `textStream()` or `eventStream()`.
778
1117
  *
779
1118
  * @param scopeId - Scope numeric id or slug.
780
- * @param message - Message to send.
1119
+ * @param message - User message text.
781
1120
  * @param options.model - Required model id (e.g. `"claude-sonnet-5"`).
782
- * @param options.threadId - Continue an existing conversation.
1121
+ * @param options.threadId - Continue an existing conversation; omit to start new.
783
1122
  * @param options.version - `"published"` or `"draft"`.
784
- * @returns Chat stream.
1123
+ * @returns Chat stream — iterate `textStream()` for tokens.
1124
+ *
1125
+ * @example
1126
+ * ```ts
1127
+ * const stream = client.scopes.chatStream(scopeId, 'Summarize in three bullets.', {
1128
+ * model: 'claude-sonnet-5',
1129
+ * })
1130
+ * for await (const token of stream.textStream()) {
1131
+ * process.stdout.write(token)
1132
+ * }
1133
+ * console.log(stream.getFinalResult().threadId)
1134
+ * ```
785
1135
  */
786
1136
  chatStream(scopeId: number | string, message: string, options: {
787
1137
  model: ChatModel;
@@ -837,7 +1187,8 @@ declare class Modus extends ModusClientBase {
837
1187
  readonly context: ContextResource;
838
1188
  readonly connections: ConnectionsResource;
839
1189
  readonly suggestions: SuggestionsResource;
1190
+ readonly ingestedData: IngestedDataResource;
840
1191
  constructor(options?: ModusOptions);
841
1192
  }
842
1193
 
843
- export { APIConnectionError, type AgentRun, type AgentRunCreateRequest, type AgentRunListItem, type AgentRunStream, type ApprovalScope, type AssistantContentResetEvent, AuthenticationError, type CancelRunRequest, type CancelledEvent, type ChatModel, type ChatRequest, type ChatResult, ChatStream, type ComposeSkillContextRequest, ConflictError, type Connection, ContextItem, ContextItemLookupRow, type ContextValueRow, Conversation, ConversationKind, ConversationListItem, type CreateAgentRunRequest, type DoneEvent, type EditQueuedRunRequest, type ErrorEvent, InternalServerError, type InterruptRunRequest, Modus, type ModusContextComposition, type ModusContextRequest, ModusError, ModusOptions, type ModusRunCreateRequest, NotFoundError, Page, PermissionDeniedError, RateLimitError, type RecordSuggestionEventRequest, type ResumeRunRequest, RunCancelledError, type RunEvent, type RunStatus, type RunTimeframe, Scope, type SkillContextComposition, type SkillRunCreateRequest, StreamTimeoutError, type StreamTimeoutEvent, type SuggestionEventSource, type SuggestionEventType, type SuggestionQuestion, type TokenEvent, UnprocessableError, ValidationError, VariationView, Workflow, type WorkflowActionRequest, WorkflowType, components };
1194
+ export { APIConnectionError, type AgentRun, type AgentRunCreateRequest, type AgentRunListItem, type AgentRunStream, type ApprovalScope, type AssistantContentResetEvent, AuthenticationError, type CancelRunRequest, type CancelledEvent, type ChatModel, type ChatRequest, type ChatResult, ChatStream, type ComposeSkillContextRequest, ConflictError, type Connection, ContextItem, ContextItemLookupRow, type ContextValueRow, Conversation, ConversationKind, ConversationListItem, type CreateAgentRunRequest, type DoneEvent, type EditQueuedRunRequest, type ErrorEvent, type HttpIngestedDataRequest, type IngestedDataRequest, type IngestedDataResponse, type IngestedDataResponseFormat, type IngestedDataUploadResult, InternalServerError, type InterruptRunRequest, Modus, type ModusContextComposition, type ModusContextRequest, ModusError, ModusOptions, type ModusRunCreateRequest, NotFoundError, Page, PermissionDeniedError, RateLimitError, type RecordSuggestionEventRequest, type ResumeRunRequest, RunCancelledError, type RunEvent, type RunStatus, type RunTimeframe, Scope, type SkillContextComposition, type SkillRunCreateRequest, type SqlIngestedDataRequest, StreamTimeoutError, type StreamTimeoutEvent, type SuggestionEventSource, type SuggestionEventType, type SuggestionQuestion, type TokenEvent, UnprocessableError, type UploadIngestedDataOptions, ValidationError, VariationView, Workflow, type WorkflowActionRequest, WorkflowType, components };