@getmodus/sdk 0.8.0 → 0.9.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-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';
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 Conversation, f as ConversationKind, g as ConversationListItem, S as Scope, h as ScopeConversationsResource, i as ModusClientBase, j as ModusOptions } from './conversations-D7ffhHIh.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-D7ffhHIh.cjs';
3
3
 
4
4
  /**
5
5
  * Base class for all Modus SDK errors.
@@ -480,6 +480,7 @@ declare class WorkflowRunsResource {
480
480
  }
481
481
 
482
482
  type Connection = components['schemas']['ConnectionDto'];
483
+ type ConnectionSelection = components['schemas']['ConnectionSelectionDto'];
483
484
 
484
485
  /** One value entry from context item listValues (shape varies by context type). */
485
486
  type ContextValueRow = Record<string, unknown>;
@@ -509,6 +510,49 @@ interface UploadIngestedDataOptions {
509
510
  /** Location and identity of a newly stored ingested-data envelope. */
510
511
  type IngestedDataUploadResult = components['schemas']['CreatedIngestedDataResponseDto'];
511
512
 
513
+ /** Generated base for the consumption `workflows` resource. */
514
+ declare class WorkflowsResourceBase {
515
+ protected readonly http: HttpClient;
516
+ protected readonly config: ModusConfig;
517
+ /** @internal */
518
+ constructor(http: HttpClient, config: ModusConfig);
519
+ /**
520
+ * List workflows.
521
+ *
522
+ * Returns a paginated page of workflows the caller can at least `use`. Workflows the caller
523
+ * cannot see are filtered out. Pagination uses an opaque token returned in `nextPageToken`.
524
+ *
525
+ * **Requires:** `workflows:read`
526
+ *
527
+ * @param options.pageSize - Items per page. Defaults to 25.
528
+ * @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit
529
+ * for the first page.
530
+ * @param options.search - Case-insensitive substring filter on workflow name.
531
+ * @param options.type - Filter by workflow type.
532
+ * @param options.view - Variation view. `active` reads deployed; `draft` reads the latest builder
533
+ * snapshot.
534
+ * @param options.includeVariation - Include the requested variation payload (`trigger`,
535
+ * `workflowStructure`, `agentSelection`) on list rows.
536
+ * @returns A page of workflows.
537
+ *
538
+ * @example
539
+ * ```ts
540
+ * for await (const wf of (await client.workflows.list({ search: 'digest' })).autoPagingIter()) {
541
+ * console.log(wf.id, wf.name, wf.status)
542
+ * }
543
+ * ```
544
+ */
545
+ list(options?: {
546
+ pageSize?: number;
547
+ pageToken?: string;
548
+ search?: string;
549
+ type?: WorkflowType;
550
+ view?: VariationView;
551
+ includeVariation?: boolean;
552
+ }): Promise<Page<Workflow>>;
553
+ protected listPage(pageSize: number, pageToken: string | undefined, search?: string, type?: WorkflowType, view?: VariationView, includeVariation?: boolean): Promise<Page<Workflow>>;
554
+ }
555
+
512
556
  declare class AgentWorkflowActionsResource {
513
557
  private readonly http;
514
558
  private readonly config;
@@ -549,40 +593,11 @@ declare class AgentWorkflowActionsResource {
549
593
  * }
550
594
  * ```
551
595
  */
552
- declare class WorkflowsResource {
553
- private readonly http;
554
- private readonly config;
596
+ declare class WorkflowsResource extends WorkflowsResourceBase {
555
597
  readonly runs: WorkflowRunsResource;
556
598
  readonly workflowActions: AgentWorkflowActionsResource;
557
599
  /** @internal */
558
600
  constructor(http: HttpClient, config: ModusConfig);
559
- /**
560
- * List workflows in the organisation.
561
- *
562
- * @param options.pageSize - Maximum items per page (default 25).
563
- * @param options.pageToken - Opaque token from a previous page.
564
- * @param options.search - Case-insensitive substring filter on the workflow name.
565
- * @param options.type - Workflow kind: `"task"` or `"workflow"`.
566
- * @param options.view - Which saved version to return (`active` or `draft`).
567
- * @param options.includeVariation - Include variation metadata when supported.
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
- * ```
576
- */
577
- list(options?: {
578
- pageSize?: number;
579
- pageToken?: string;
580
- search?: string;
581
- type?: WorkflowType;
582
- view?: VariationView;
583
- includeVariation?: boolean;
584
- }): Promise<Page<Workflow>>;
585
- private listPage;
586
601
  /**
587
602
  * Retrieve a workflow by ID or slug.
588
603
  *
@@ -604,20 +619,25 @@ declare class WorkflowsResource {
604
619
  }): Promise<Workflow>;
605
620
  }
606
621
 
607
- /**
608
- * Read access to integration connections.
609
- */
610
- declare class ConnectionsResource {
611
- private readonly http;
612
- private readonly config;
622
+ /** Generated base for the consumption `connections` resource. */
623
+ declare class ConnectionsResourceBase {
624
+ protected readonly http: HttpClient;
625
+ protected readonly config: ModusConfig;
613
626
  /** @internal */
614
627
  constructor(http: HttpClient, config: ModusConfig);
615
628
  /**
616
- * List integration connections.
629
+ * List connections.
617
630
  *
618
- * @param options.pageSize - Maximum items per page (default 25).
619
- * @param options.pageToken - Opaque token from a previous page.
620
- * @param options.type - Integration category; exact match filter.
631
+ * Returns a paginated page of warehouse and SaaS integration connections the caller can `use`.
632
+ * Connections the caller cannot access are filtered out. Use the returned `id` when creating
633
+ * saved-query context items. Pagination uses an opaque token returned in `nextPageToken`.
634
+ *
635
+ * **Requires:** `context:read`
636
+ *
637
+ * @param options.pageSize - Items per page. Defaults to 25.
638
+ * @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit
639
+ * for the first page.
640
+ * @param options.type - Filter by effective integration category (case-sensitive exact match).
621
641
  * @returns A page of connections.
622
642
  */
623
643
  list(options?: {
@@ -625,7 +645,13 @@ declare class ConnectionsResource {
625
645
  pageToken?: string;
626
646
  type?: string;
627
647
  }): Promise<Page<Connection>>;
628
- private listPage;
648
+ protected listPage(pageSize: number, pageToken: string | undefined, type?: string): Promise<Page<Connection>>;
649
+ }
650
+
651
+ /**
652
+ * Read access to integration connections.
653
+ */
654
+ declare class ConnectionsResource extends ConnectionsResourceBase {
629
655
  /**
630
656
  * Find the first connection whose name matches (case-insensitive).
631
657
  *
@@ -641,6 +667,36 @@ declare class ConnectionsResource {
641
667
  type?: string;
642
668
  pageSize?: number;
643
669
  }): Promise<Connection | undefined>;
670
+ /**
671
+ * List the selectable units on a connection (a repository, a schema, a project).
672
+ *
673
+ * @param connectionId - Connection id.
674
+ * @param options.pageSize - Maximum items per page (default 25).
675
+ * @param options.pageToken - Opaque token from a previous page.
676
+ * @returns A page of selectable units — use {@link iterSelections} or `.autoPagingIter()` for every page.
677
+ * @example
678
+ * for await (const unit of client.connections.iterSelections('7a3f9d2c-1111-4000-a000-000000000abc')) {
679
+ * console.log(unit.objectType, unit.path)
680
+ * }
681
+ */
682
+ listSelections(connectionId: string, options?: {
683
+ pageSize?: number;
684
+ pageToken?: string;
685
+ }): Promise<Page<ConnectionSelection>>;
686
+ private listSelectionsPage;
687
+ /**
688
+ * Yield every selectable unit on a connection, following pages.
689
+ *
690
+ * @param connectionId - Connection id.
691
+ * @param options.pageSize - Maximum items per page (default 25).
692
+ * @example
693
+ * for await (const unit of client.connections.iterSelections('7a3f9d2c-1111-4000-a000-000000000abc')) {
694
+ * console.log(unit.objectType, unit.displayName)
695
+ * }
696
+ */
697
+ iterSelections(connectionId: string, options?: {
698
+ pageSize?: number;
699
+ }): AsyncGenerator<ConnectionSelection>;
644
700
  }
645
701
 
646
702
  type JsonObjectInput = Record<string, unknown>;
@@ -855,10 +911,26 @@ declare class IngestedDataResource {
855
911
  upload(options: UploadIngestedDataOptions): Promise<IngestedDataUploadResult>;
856
912
  }
857
913
 
914
+ /** Generated base for the consumption `modus.conversations` resource. */
915
+ declare class ModusConversationsResourceBase {
916
+ protected readonly http: HttpClient;
917
+ protected readonly config: ModusConfig;
918
+ /** @internal */
919
+ constructor(http: HttpClient, config: ModusConfig);
920
+ /**
921
+ * Get a Modus conversation.
922
+ *
923
+ * Returns the full message history for a conversation thread.
924
+ *
925
+ * **Requires:** `scopes:read`
926
+ *
927
+ * @param threadId - Thread id from a conversation list or chat response.
928
+ */
929
+ get(threadId: string): Promise<Conversation>;
930
+ }
931
+
858
932
  /** List and retrieve Modus / scope conversations. */
859
- declare class ModusConversationsResource {
860
- private readonly http;
861
- private readonly config;
933
+ declare class ModusConversationsResource extends ModusConversationsResourceBase {
862
934
  constructor(http: HttpClient, config: ModusConfig);
863
935
  /**
864
936
  * List conversations.
@@ -884,13 +956,6 @@ declare class ModusConversationsResource {
884
956
  sourceRef?: string;
885
957
  }): Promise<Page<ConversationListItem>>;
886
958
  private listPage;
887
- /**
888
- * Retrieve a conversation thread with full message history.
889
- *
890
- * @param threadId - Conversation thread id.
891
- * @returns Conversation with messages.
892
- */
893
- get(threadId: string): Promise<Conversation>;
894
959
  }
895
960
 
896
961
  /**
@@ -986,51 +1051,28 @@ declare class ModusResource {
986
1051
  }): ChatStream;
987
1052
  }
988
1053
 
989
- /**
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`.
994
- *
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
- * ```
1003
- */
1004
- declare class ScopesResource {
1005
- private readonly http;
1006
- private readonly config;
1054
+ /** Generated base for the consumption `scopes` resource. */
1055
+ declare class ScopesResourceBase {
1056
+ protected readonly http: HttpClient;
1057
+ protected readonly config: ModusConfig;
1007
1058
  /** @internal */
1008
1059
  constructor(http: HttpClient, config: ModusConfig);
1009
1060
  /**
1010
- * Return the conversations sub-resource scoped to `scopeId`.
1061
+ * List scopes.
1011
1062
  *
1012
- * @param scopeId - Scope numeric id or slug.
1013
- * @returns Conversations resource for the scope.
1063
+ * Returns a paginated page of scopes the caller can at least `use`. Scopes the caller cannot see
1064
+ * are filtered out. Pagination uses an opaque token returned in `nextPageToken`.
1014
1065
  *
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
- * ```
1023
- */
1024
- conversations(scopeId: number | string): ScopeConversationsResource;
1025
- /**
1026
- * List scopes in the organisation.
1066
+ * **Requires:** `scopes:read`
1027
1067
  *
1028
- * @param options.pageSize - Items per page (default 25).
1029
- * @param options.pageToken - Opaque token from a previous page.
1030
- * @param options.search - Case-insensitive substring filter on the scope name.
1031
- * @param options.view - `"active"` (deployed) or `"draft"`.
1032
- * @param options.managerId - Only scopes supervised by this manager scope id.
1033
- * @returns Page of scopes — use `.autoPagingIter()` for all pages.
1068
+ * @param options.pageSize - Items per page. Defaults to 25.
1069
+ * @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit
1070
+ * for the first page.
1071
+ * @param options.search - Case-insensitive substring filter on scope name.
1072
+ * @param options.view - Variation view. `active` reads deployed; `draft` reads the latest builder
1073
+ * snapshot.
1074
+ * @param options.managerId - Return only scopes supervised by this manager scope id.
1075
+ * @returns A page of scopes.
1034
1076
  *
1035
1077
  * @example
1036
1078
  * ```ts
@@ -1046,14 +1088,17 @@ declare class ScopesResource {
1046
1088
  view?: VariationView;
1047
1089
  managerId?: number;
1048
1090
  }): Promise<Page<Scope>>;
1049
- private listPage;
1091
+ protected listPage(pageSize: number, pageToken: string | undefined, search?: string, view?: VariationView, managerId?: number): Promise<Page<Scope>>;
1050
1092
  /**
1051
- * Retrieve a scope by ID or slug.
1093
+ * Get a scope.
1052
1094
  *
1053
- * @param scopeId - Scope numeric id or slug.
1054
- * @param options.view - `"active"` (deployed) or `"draft"`.
1055
- * @throws {NotFoundError} When no scope matches the id or slug.
1056
- * @returns Scope (`id`, `name`, `status`, …).
1095
+ * Returns a scope. `view=active` (default) returns the deployed version; `view=draft` returns the
1096
+ * latest unpublished edits. Returns 404 if you cannot access the scope.
1097
+ *
1098
+ * **Requires:** `scopes:read`
1099
+ *
1100
+ * @param scopeId - Numeric scope id.
1101
+ * @param options.view - Which variation snapshot to read. Defaults to `active`.
1057
1102
  *
1058
1103
  * @example
1059
1104
  * ```ts
@@ -1064,13 +1109,50 @@ declare class ScopesResource {
1064
1109
  get(scopeId: number | string, options?: {
1065
1110
  view?: VariationView;
1066
1111
  }): Promise<Scope>;
1112
+ }
1113
+
1114
+ /**
1115
+ * Read / chat with published scopes.
1116
+ *
1117
+ * Call path: `client.scopes` after `new Modus(...)`. Prefer `client.modus` for
1118
+ * the org-wide assistant. Create/deploy via `ModusManagement`.
1119
+ *
1120
+ * @example
1121
+ * ```ts
1122
+ * const scope = await client.scopes.get('revenue-analysis')
1123
+ * const result = await client.scopes.chat(scope.id, 'What is our ARR trend?', {
1124
+ * model: 'claude-sonnet-5',
1125
+ * })
1126
+ * console.log(result.content, result.threadId)
1127
+ * ```
1128
+ */
1129
+ declare class ScopesResource extends ScopesResourceBase {
1130
+ /**
1131
+ * Return the conversations sub-resource scoped to `scopeId`.
1132
+ *
1133
+ * @param scopeId - Scope numeric id or slug.
1134
+ * @returns Conversations resource for the scope.
1135
+ *
1136
+ * @example
1137
+ * ```ts
1138
+ * for await (const row of (
1139
+ * await client.scopes.conversations(scopeId).list({ pageSize: 10 })
1140
+ * ).autoPagingIter()) {
1141
+ * console.log(row.threadId, row.firstMessage)
1142
+ * }
1143
+ * ```
1144
+ */
1145
+ conversations(scopeId: number | string): ScopeConversationsResource;
1067
1146
  /**
1068
1147
  * Compose context this scope would use for an intent, without running chat.
1069
1148
  *
1149
+ * Large bodies are bounded inline previews. This REST method does not expose file references
1150
+ * or a full-content fetch operation.
1151
+ *
1070
1152
  * @param scopeId - Scope numeric id or slug.
1071
1153
  * @param message - Natural-language intent used to select context.
1072
1154
  * @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.
1155
+ * @returns Composed context text plus selection counts, item UIDs, and correlation session id.
1074
1156
  *
1075
1157
  * @example
1076
1158
  * ```ts
@@ -1191,4 +1273,4 @@ declare class Modus extends ModusClientBase {
1191
1273
  constructor(options?: ModusOptions);
1192
1274
  }
1193
1275
 
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 };
1276
+ 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, type ConnectionSelection, 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 };