@getmodus/sdk 0.6.0 → 0.7.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/CHANGELOG.md +84 -4
- package/README.md +9 -1
- package/dist/{chunk-HEHHN4D6.js → chunk-JMFT5KO5.js} +330 -11
- package/dist/chunk-JMFT5KO5.js.map +1 -0
- package/dist/{conversations-BRg8gEKX.d.cts → conversations-B0_jmEuT.d.cts} +10469 -3196
- package/dist/{conversations-BRg8gEKX.d.ts → conversations-B0_jmEuT.d.ts} +10469 -3196
- package/dist/index.cjs +618 -58
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +372 -54
- package/dist/index.d.ts +372 -54
- package/dist/index.js +290 -49
- package/dist/index.js.map +1 -1
- package/dist/management/index.cjs +1134 -44
- package/dist/management/index.cjs.map +1 -1
- package/dist/management/index.d.cts +600 -9
- package/dist/management/index.d.ts +600 -9
- package/dist/management/index.js +807 -36
- package/dist/management/index.js.map +1 -1
- package/package.json +2 -3
- package/dist/chunk-HEHHN4D6.js.map +0 -1
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-
|
|
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-
|
|
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-B0_jmEuT.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-B0_jmEuT.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
|
-
*
|
|
52
|
-
*
|
|
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]);
|
|
@@ -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:
|
|
296
|
-
*
|
|
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
|
-
* -
|
|
450
|
-
* - {@link
|
|
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 -
|
|
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
|
|
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,8 +672,16 @@ 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
|
+
* @returns A page of context items — use `.autoPagingIter()` for all pages.
|
|
677
|
+
*
|
|
678
|
+
* @example
|
|
679
|
+
* ```ts
|
|
680
|
+
* const notes = await client.context.items.list({ contextType: 'note', pageSize: 50 })
|
|
681
|
+
* for (const item of notes.items) {
|
|
682
|
+
* console.log(item.description ?? item.uid, item.uid)
|
|
683
|
+
* }
|
|
684
|
+
* ```
|
|
551
685
|
*/
|
|
552
686
|
list(options?: {
|
|
553
687
|
pageSize?: number;
|
|
@@ -559,17 +693,32 @@ declare class ContextItemsResource {
|
|
|
559
693
|
* Retrieve a knowledge-base item by uid.
|
|
560
694
|
*
|
|
561
695
|
* @param uid - Item uid.
|
|
562
|
-
* @returns The context item.
|
|
696
|
+
* @returns The context item (`uid`, `contextType`, `content`, …).
|
|
563
697
|
* @throws {NotFoundError} When no item matches the uid.
|
|
698
|
+
*
|
|
699
|
+
* @example
|
|
700
|
+
* ```ts
|
|
701
|
+
* const item = await client.context.items.get(uid)
|
|
702
|
+
* console.log(item.contextType, item.description ?? item.uid)
|
|
703
|
+
* ```
|
|
564
704
|
*/
|
|
565
705
|
get(uid: string): Promise<ContextItem>;
|
|
566
706
|
/**
|
|
567
707
|
* Look up a knowledge-base item by type and data path.
|
|
568
708
|
*
|
|
569
|
-
* @param options.contextType - Context type to match.
|
|
709
|
+
* @param options.contextType - Context type to match (e.g. `"note"`).
|
|
570
710
|
* @param options.dataPath - Hierarchical path segments that identify the item.
|
|
571
711
|
* @param options.contentProjection - Optional fields to include from item content.
|
|
572
712
|
* @returns The matching row, or `undefined` when no item is found (404).
|
|
713
|
+
*
|
|
714
|
+
* @example
|
|
715
|
+
* ```ts
|
|
716
|
+
* const found = await client.context.items.lookup({
|
|
717
|
+
* contextType: 'note',
|
|
718
|
+
* dataPath: ['finance', 'arr-definition'],
|
|
719
|
+
* })
|
|
720
|
+
* if (found) console.log(found.uid, found.description ?? found.uid)
|
|
721
|
+
* ```
|
|
573
722
|
*/
|
|
574
723
|
lookup(options: {
|
|
575
724
|
contextType: string;
|
|
@@ -581,10 +730,22 @@ declare class ContextItemsResource {
|
|
|
581
730
|
*
|
|
582
731
|
* @param uid - Item uid.
|
|
583
732
|
* @param contextType - Context type of the item.
|
|
584
|
-
* @param contentKeyPath - Dot path to the value field inside item content.
|
|
733
|
+
* @param contentKeyPath - Dot path to the value field inside item content (e.g. `"enumValues"`).
|
|
585
734
|
* @param options.pageSize - Maximum items per page (default 25).
|
|
586
735
|
* @param options.pageToken - Opaque token from a previous page.
|
|
587
736
|
* @returns A page of value rows.
|
|
737
|
+
*
|
|
738
|
+
* @example
|
|
739
|
+
* ```ts
|
|
740
|
+
* // Replace PLACEHOLDER_UID with a real uid whose content has enumValues.
|
|
741
|
+
* const page = await client.context.items.listValues(
|
|
742
|
+
* 'PLACEHOLDER_UID',
|
|
743
|
+
* 'table_column',
|
|
744
|
+
* 'enumValues',
|
|
745
|
+
* { pageSize: 25 },
|
|
746
|
+
* )
|
|
747
|
+
* for (const row of page.items) console.log(row)
|
|
748
|
+
* ```
|
|
588
749
|
*/
|
|
589
750
|
listValues(uid: string, contextType: string, contentKeyPath: string, options?: {
|
|
590
751
|
pageSize?: number;
|
|
@@ -598,6 +759,14 @@ declare class ContextItemsResource {
|
|
|
598
759
|
* @param options.pageSize - Maximum items per page (default 25).
|
|
599
760
|
* @param options.pageToken - Opaque token from a previous page.
|
|
600
761
|
* @returns A page of value rows.
|
|
762
|
+
*
|
|
763
|
+
* @example
|
|
764
|
+
* ```ts
|
|
765
|
+
* // Replace PLACEHOLDER_UID with a real uid that has enumValues in content.
|
|
766
|
+
* const item = await client.context.items.get('PLACEHOLDER_UID')
|
|
767
|
+
* const page = await client.context.items.listValuesFor(item, 'enumValues')
|
|
768
|
+
* for (const row of page.items) console.log(row)
|
|
769
|
+
* ```
|
|
601
770
|
*/
|
|
602
771
|
listValuesFor(item: ContextItem, contentKeyPath: string, options?: {
|
|
603
772
|
pageSize?: number;
|
|
@@ -621,6 +790,38 @@ declare class ContextResource {
|
|
|
621
790
|
constructor(http: HttpClient, config: ModusConfig);
|
|
622
791
|
}
|
|
623
792
|
|
|
793
|
+
/** Store exact integration requests and responses as immutable ingested data. */
|
|
794
|
+
declare class IngestedDataResource {
|
|
795
|
+
private readonly http;
|
|
796
|
+
private readonly config;
|
|
797
|
+
/** @internal */
|
|
798
|
+
constructor(http: HttpClient, config: ModusConfig);
|
|
799
|
+
/**
|
|
800
|
+
* Store a complete SQL or HTTP request and response exactly once.
|
|
801
|
+
*
|
|
802
|
+
* Identity covers the complete organization, integration, request, and response
|
|
803
|
+
* content. A duplicate raises `ConflictError`, which means the identical payload
|
|
804
|
+
* is already stored and may be treated as a safe retry outcome.
|
|
805
|
+
*
|
|
806
|
+
* @param options.integrationType - Canonical Modus integration identifier.
|
|
807
|
+
* @param options.request - Exact SQL or HTTP request that produced the response.
|
|
808
|
+
* @param options.response - Response format, optional source HTTP status, and exact string content. SQL requires CSV.
|
|
809
|
+
* @returns The checksum of the stored envelope.
|
|
810
|
+
* @throws {ConflictError} When the complete payload is already stored.
|
|
811
|
+
*
|
|
812
|
+
* @example
|
|
813
|
+
* ```ts
|
|
814
|
+
* const stored = await client.ingestedData.upload({
|
|
815
|
+
* integrationType: 'generic',
|
|
816
|
+
* request: { type: 'sql', query: 'SELECT id, total FROM orders' },
|
|
817
|
+
* response: { format: 'csv', content: 'id,total\n1,42.00\n' },
|
|
818
|
+
* })
|
|
819
|
+
* console.log(stored.checksum)
|
|
820
|
+
* ```
|
|
821
|
+
*/
|
|
822
|
+
upload(options: UploadIngestedDataOptions): Promise<IngestedDataUploadResult>;
|
|
823
|
+
}
|
|
824
|
+
|
|
624
825
|
/** List and retrieve Modus / scope conversations. */
|
|
625
826
|
declare class ModusConversationsResource {
|
|
626
827
|
private readonly http;
|
|
@@ -632,12 +833,22 @@ declare class ModusConversationsResource {
|
|
|
632
833
|
* @param options.pageSize - Items per page (default 25).
|
|
633
834
|
* @param options.pageToken - Opaque token from a previous page.
|
|
634
835
|
* @param options.kind - `"modus"`, `"scopes"`, or `"all"`.
|
|
836
|
+
* @param options.source - Restrict to conversations started from this UI surface
|
|
837
|
+
* (e.g. `"context_chat"`, `"dashboard_copilot"`, `"slack"`). Only valid with an
|
|
838
|
+
* omitted `kind` or `kind: "all"`; the API throws an `UnprocessableError` (422)
|
|
839
|
+
* if combined with `kind: "modus"` or `kind: "scopes"`.
|
|
840
|
+
* @param options.sourceRef - Narrow `source` to one instance of that surface — for
|
|
841
|
+
* `"dashboard_copilot"`, a dashboard id. Requires `source`; the API throws an
|
|
842
|
+
* `UnprocessableError` (422) if sent on its own. Conversations recorded before
|
|
843
|
+
* this filter shipped carry no instance key and never match it.
|
|
635
844
|
* @returns Page of conversation list items.
|
|
636
845
|
*/
|
|
637
846
|
list(options?: {
|
|
638
847
|
pageSize?: number;
|
|
639
848
|
pageToken?: string;
|
|
640
849
|
kind?: ConversationKind;
|
|
850
|
+
source?: string;
|
|
851
|
+
sourceRef?: string;
|
|
641
852
|
}): Promise<Page<ConversationListItem>>;
|
|
642
853
|
private listPage;
|
|
643
854
|
/**
|
|
@@ -649,34 +860,66 @@ declare class ModusConversationsResource {
|
|
|
649
860
|
get(threadId: string): Promise<Conversation>;
|
|
650
861
|
}
|
|
651
862
|
|
|
652
|
-
/**
|
|
863
|
+
/**
|
|
864
|
+
* Org-wide Modus assistant (full environment context and tools).
|
|
865
|
+
*
|
|
866
|
+
* Prefer `client.modus` over `client.scopes` when the question is not tied to one
|
|
867
|
+
* published scope. Construct with `new Modus()` (reads `MODUS_API_KEY`).
|
|
868
|
+
*
|
|
869
|
+
* - `chat` — one complete reply
|
|
870
|
+
* - `chatStream` — print tokens as they arrive (consume `textStream()`)
|
|
871
|
+
* - `getContext` — preview composed context without a chat turn
|
|
872
|
+
* - `conversations` — list/get prior Modus threads
|
|
873
|
+
*
|
|
874
|
+
* @example
|
|
875
|
+
* ```ts
|
|
876
|
+
* import { Modus } from '@getmodus/sdk'
|
|
877
|
+
* const client = new Modus()
|
|
878
|
+
* const result = await client.modus.chat('What tables describe revenue?', {
|
|
879
|
+
* model: 'claude-sonnet-5',
|
|
880
|
+
* })
|
|
881
|
+
* console.log(result.content, result.threadId)
|
|
882
|
+
* ```
|
|
883
|
+
*/
|
|
653
884
|
declare class ModusResource {
|
|
654
885
|
private readonly http;
|
|
655
886
|
private readonly config;
|
|
656
887
|
readonly conversations: ModusConversationsResource;
|
|
657
888
|
constructor(http: HttpClient, config: ModusConfig);
|
|
658
889
|
/**
|
|
659
|
-
*
|
|
890
|
+
* Compose full-environment context for an intent without running chat.
|
|
660
891
|
*
|
|
661
|
-
* @param message -
|
|
662
|
-
* @param options.limit -
|
|
663
|
-
* @returns
|
|
892
|
+
* @param message - Natural-language intent used to select context.
|
|
893
|
+
* @param options.limit - Maximum context items to return. Omit to return all selected items.
|
|
894
|
+
* @returns Composition metadata (counts / session id). Use `chat` for a reply.
|
|
895
|
+
*
|
|
896
|
+
* @example
|
|
897
|
+
* ```ts
|
|
898
|
+
* const ctx = await client.modus.getContext('What tables describe revenue?', { limit: 5 })
|
|
899
|
+
* console.log(ctx.originalCount, ctx.sessionId)
|
|
900
|
+
* ```
|
|
664
901
|
*/
|
|
665
902
|
getContext(message: string, options?: {
|
|
666
903
|
limit?: number;
|
|
667
904
|
}): Promise<ModusContextComposition>;
|
|
668
905
|
/**
|
|
669
|
-
* Send a message to Modus
|
|
906
|
+
* Send a message to Modus and wait for the complete reply.
|
|
670
907
|
*
|
|
671
|
-
* @param message -
|
|
908
|
+
* @param message - User message text.
|
|
672
909
|
* @param options.model - Required model id (e.g. `"claude-sonnet-5"`).
|
|
673
|
-
* @param options.threadId - Continue an existing conversation.
|
|
674
|
-
* @returns Chat result
|
|
910
|
+
* @param options.threadId - Continue an existing conversation; omit to start new.
|
|
911
|
+
* @returns Chat result: `content`, `threadId` (for follow-ups), `runId`.
|
|
675
912
|
*
|
|
676
913
|
* @example
|
|
677
914
|
* ```ts
|
|
678
|
-
* const result = await client.modus.chat('What tables describe revenue?', {
|
|
915
|
+
* const result = await client.modus.chat('What tables describe revenue?', {
|
|
916
|
+
* model: 'claude-sonnet-5',
|
|
917
|
+
* })
|
|
679
918
|
* console.log(result.content, result.threadId)
|
|
919
|
+
* const follow = await client.modus.chat('Break that down by region.', {
|
|
920
|
+
* model: 'claude-sonnet-5',
|
|
921
|
+
* threadId: result.threadId,
|
|
922
|
+
* })
|
|
680
923
|
* ```
|
|
681
924
|
*/
|
|
682
925
|
chat(message: string, options: {
|
|
@@ -684,12 +927,25 @@ declare class ModusResource {
|
|
|
684
927
|
threadId?: string;
|
|
685
928
|
}): Promise<ChatResult>;
|
|
686
929
|
/**
|
|
687
|
-
* Stream a Modus reply token by token.
|
|
930
|
+
* Stream a Modus reply token by token (SSE).
|
|
931
|
+
*
|
|
932
|
+
* The request starts when you consume `textStream()` or `eventStream()`.
|
|
688
933
|
*
|
|
689
|
-
* @param message -
|
|
934
|
+
* @param message - User message text.
|
|
690
935
|
* @param options.model - Required model id (e.g. `"claude-sonnet-5"`).
|
|
691
|
-
* @param options.threadId - Continue an existing conversation.
|
|
692
|
-
* @returns Chat stream.
|
|
936
|
+
* @param options.threadId - Continue an existing conversation; omit to start new.
|
|
937
|
+
* @returns Chat stream — iterate `textStream()` for tokens.
|
|
938
|
+
*
|
|
939
|
+
* @example
|
|
940
|
+
* ```ts
|
|
941
|
+
* const stream = client.modus.chatStream('Summarize ARR in three bullets.', {
|
|
942
|
+
* model: 'claude-sonnet-5',
|
|
943
|
+
* })
|
|
944
|
+
* for await (const token of stream.textStream()) {
|
|
945
|
+
* process.stdout.write(token)
|
|
946
|
+
* }
|
|
947
|
+
* console.log(stream.getFinalResult().threadId)
|
|
948
|
+
* ```
|
|
693
949
|
*/
|
|
694
950
|
chatStream(message: string, options: {
|
|
695
951
|
model: ChatModel;
|
|
@@ -698,9 +954,19 @@ declare class ModusResource {
|
|
|
698
954
|
}
|
|
699
955
|
|
|
700
956
|
/**
|
|
701
|
-
* Read / chat with scopes.
|
|
957
|
+
* Read / chat with published scopes.
|
|
702
958
|
*
|
|
703
|
-
* Call path: `client.scopes` after `new Modus(...)`.
|
|
959
|
+
* Call path: `client.scopes` after `new Modus(...)`. Prefer `client.modus` for
|
|
960
|
+
* the org-wide assistant. Create/deploy via `ModusManagement`.
|
|
961
|
+
*
|
|
962
|
+
* @example
|
|
963
|
+
* ```ts
|
|
964
|
+
* const scope = await client.scopes.get('revenue-analysis')
|
|
965
|
+
* const result = await client.scopes.chat(scope.id, 'What is our ARR trend?', {
|
|
966
|
+
* model: 'claude-sonnet-5',
|
|
967
|
+
* })
|
|
968
|
+
* console.log(result.content, result.threadId)
|
|
969
|
+
* ```
|
|
704
970
|
*/
|
|
705
971
|
declare class ScopesResource {
|
|
706
972
|
private readonly http;
|
|
@@ -712,6 +978,15 @@ declare class ScopesResource {
|
|
|
712
978
|
*
|
|
713
979
|
* @param scopeId - Scope numeric id or slug.
|
|
714
980
|
* @returns Conversations resource for the scope.
|
|
981
|
+
*
|
|
982
|
+
* @example
|
|
983
|
+
* ```ts
|
|
984
|
+
* for await (const row of (
|
|
985
|
+
* await client.scopes.conversations(scopeId).list({ pageSize: 10 })
|
|
986
|
+
* ).autoPagingIter()) {
|
|
987
|
+
* console.log(row.threadId, row.firstMessage)
|
|
988
|
+
* }
|
|
989
|
+
* ```
|
|
715
990
|
*/
|
|
716
991
|
conversations(scopeId: number | string): ScopeConversationsResource;
|
|
717
992
|
/**
|
|
@@ -722,7 +997,14 @@ declare class ScopesResource {
|
|
|
722
997
|
* @param options.search - Case-insensitive substring filter on the scope name.
|
|
723
998
|
* @param options.view - `"active"` (deployed) or `"draft"`.
|
|
724
999
|
* @param options.managerId - Only scopes supervised by this manager scope id.
|
|
725
|
-
* @returns Page of scopes.
|
|
1000
|
+
* @returns Page of scopes — use `.autoPagingIter()` for all pages.
|
|
1001
|
+
*
|
|
1002
|
+
* @example
|
|
1003
|
+
* ```ts
|
|
1004
|
+
* for await (const scope of (await client.scopes.list()).autoPagingIter()) {
|
|
1005
|
+
* console.log(scope.id, scope.name, scope.status)
|
|
1006
|
+
* }
|
|
1007
|
+
* ```
|
|
726
1008
|
*/
|
|
727
1009
|
list(options?: {
|
|
728
1010
|
pageSize?: number;
|
|
@@ -738,35 +1020,57 @@ declare class ScopesResource {
|
|
|
738
1020
|
* @param scopeId - Scope numeric id or slug.
|
|
739
1021
|
* @param options.view - `"active"` (deployed) or `"draft"`.
|
|
740
1022
|
* @throws {NotFoundError} When no scope matches the id or slug.
|
|
741
|
-
* @returns Scope.
|
|
1023
|
+
* @returns Scope (`id`, `name`, `status`, …).
|
|
1024
|
+
*
|
|
1025
|
+
* @example
|
|
1026
|
+
* ```ts
|
|
1027
|
+
* const scope = await client.scopes.get('revenue-analysis')
|
|
1028
|
+
* console.log(scope.name, scope.status)
|
|
1029
|
+
* ```
|
|
742
1030
|
*/
|
|
743
1031
|
get(scopeId: number | string, options?: {
|
|
744
1032
|
view?: VariationView;
|
|
745
1033
|
}): Promise<Scope>;
|
|
746
1034
|
/**
|
|
747
|
-
*
|
|
1035
|
+
* Compose context this scope would use for an intent, without running chat.
|
|
748
1036
|
*
|
|
749
1037
|
* @param scopeId - Scope numeric id or slug.
|
|
750
|
-
* @param message -
|
|
751
|
-
* @param options.limit -
|
|
752
|
-
* @returns
|
|
1038
|
+
* @param message - Natural-language intent used to select context.
|
|
1039
|
+
* @param options.limit - Maximum context items to return. Omit to return all selected items.
|
|
1040
|
+
* @returns Composition metadata. Use `chat` when you need an assistant reply.
|
|
1041
|
+
*
|
|
1042
|
+
* @example
|
|
1043
|
+
* ```ts
|
|
1044
|
+
* const ctx = await client.scopes.getContext(scopeId, 'Which tables describe churn?', {
|
|
1045
|
+
* limit: 5,
|
|
1046
|
+
* })
|
|
1047
|
+
* console.log(ctx.originalCount, ctx.sessionId)
|
|
1048
|
+
* ```
|
|
753
1049
|
*/
|
|
754
1050
|
getContext(scopeId: number | string, message: string, options?: {
|
|
755
1051
|
limit?: number;
|
|
756
1052
|
}): Promise<SkillContextComposition>;
|
|
757
1053
|
/**
|
|
758
|
-
* Send a message to a scope and
|
|
1054
|
+
* Send a message to a published scope and wait for the complete reply.
|
|
759
1055
|
*
|
|
760
|
-
*
|
|
761
|
-
*
|
|
1056
|
+
* For the org-wide assistant use `client.modus.chat` instead.
|
|
1057
|
+
*
|
|
1058
|
+
* @param scopeId - Scope numeric id or slug (must be active for chat).
|
|
1059
|
+
* @param message - User message text.
|
|
762
1060
|
* @param options.model - Required model id (e.g. `"claude-sonnet-5"`).
|
|
763
|
-
* @param options.threadId - Continue an existing conversation.
|
|
764
|
-
* @returns Chat result
|
|
1061
|
+
* @param options.threadId - Continue an existing conversation; omit to start new.
|
|
1062
|
+
* @returns Chat result: `content`, `threadId`, `runId`.
|
|
765
1063
|
*
|
|
766
1064
|
* @example
|
|
767
1065
|
* ```ts
|
|
768
|
-
* const result = await client.scopes.chat(scopeId, '
|
|
1066
|
+
* const result = await client.scopes.chat(scopeId, 'What is our ARR trend?', {
|
|
1067
|
+
* model: 'claude-sonnet-5',
|
|
1068
|
+
* })
|
|
769
1069
|
* console.log(result.content, result.threadId)
|
|
1070
|
+
* const follow = await client.scopes.chat(scopeId, 'Break that down by segment.', {
|
|
1071
|
+
* model: 'claude-sonnet-5',
|
|
1072
|
+
* threadId: result.threadId,
|
|
1073
|
+
* })
|
|
770
1074
|
* ```
|
|
771
1075
|
*/
|
|
772
1076
|
chat(scopeId: number | string, message: string, options: {
|
|
@@ -774,14 +1078,27 @@ declare class ScopesResource {
|
|
|
774
1078
|
threadId?: string;
|
|
775
1079
|
}): Promise<ChatResult>;
|
|
776
1080
|
/**
|
|
777
|
-
* Stream a scope reply token by token.
|
|
1081
|
+
* Stream a scope reply token by token (SSE).
|
|
1082
|
+
*
|
|
1083
|
+
* The request starts when you consume `textStream()` or `eventStream()`.
|
|
778
1084
|
*
|
|
779
1085
|
* @param scopeId - Scope numeric id or slug.
|
|
780
|
-
* @param message -
|
|
1086
|
+
* @param message - User message text.
|
|
781
1087
|
* @param options.model - Required model id (e.g. `"claude-sonnet-5"`).
|
|
782
|
-
* @param options.threadId - Continue an existing conversation.
|
|
1088
|
+
* @param options.threadId - Continue an existing conversation; omit to start new.
|
|
783
1089
|
* @param options.version - `"published"` or `"draft"`.
|
|
784
|
-
* @returns Chat stream.
|
|
1090
|
+
* @returns Chat stream — iterate `textStream()` for tokens.
|
|
1091
|
+
*
|
|
1092
|
+
* @example
|
|
1093
|
+
* ```ts
|
|
1094
|
+
* const stream = client.scopes.chatStream(scopeId, 'Summarize in three bullets.', {
|
|
1095
|
+
* model: 'claude-sonnet-5',
|
|
1096
|
+
* })
|
|
1097
|
+
* for await (const token of stream.textStream()) {
|
|
1098
|
+
* process.stdout.write(token)
|
|
1099
|
+
* }
|
|
1100
|
+
* console.log(stream.getFinalResult().threadId)
|
|
1101
|
+
* ```
|
|
785
1102
|
*/
|
|
786
1103
|
chatStream(scopeId: number | string, message: string, options: {
|
|
787
1104
|
model: ChatModel;
|
|
@@ -837,7 +1154,8 @@ declare class Modus extends ModusClientBase {
|
|
|
837
1154
|
readonly context: ContextResource;
|
|
838
1155
|
readonly connections: ConnectionsResource;
|
|
839
1156
|
readonly suggestions: SuggestionsResource;
|
|
1157
|
+
readonly ingestedData: IngestedDataResource;
|
|
840
1158
|
constructor(options?: ModusOptions);
|
|
841
1159
|
}
|
|
842
1160
|
|
|
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 };
|
|
1161
|
+
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 };
|