@getmodus/sdk 0.3.0 → 0.5.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 +6 -89
- package/README.md +4 -0
- package/dist/{chunk-D3NU2M6B.js → chunk-H76PTY5G.js} +123 -3
- package/dist/chunk-H76PTY5G.js.map +1 -0
- package/dist/{conversations-GNBMPpyr.d.cts → conversations-Pe3kNikF.d.cts} +375 -18
- package/dist/{conversations-GNBMPpyr.d.ts → conversations-Pe3kNikF.d.ts} +375 -18
- package/dist/index.cjs +476 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +484 -9
- package/dist/index.d.ts +484 -9
- package/dist/index.js +355 -1
- package/dist/index.js.map +1 -1
- package/dist/management/index.cjs +568 -8
- package/dist/management/index.cjs.map +1 -1
- package/dist/management/index.d.cts +450 -6
- package/dist/management/index.d.ts +450 -6
- package/dist/management/index.js +447 -7
- package/dist/management/index.js.map +1 -1
- package/package.json +3 -1
- package/dist/chunk-D3NU2M6B.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
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-Pe3kNikF.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-Pe3kNikF.cjs';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Base class for all Modus SDK errors.
|
|
6
|
+
*
|
|
7
|
+
* HTTP failures map to subclasses by status code. Streaming run failures map
|
|
8
|
+
* from event types (`error`, `cancelled`, `stream_timeout`).
|
|
9
|
+
*/
|
|
4
10
|
declare class ModusError extends Error {
|
|
5
11
|
readonly statusCode?: number;
|
|
6
12
|
readonly requestId?: string;
|
|
@@ -15,49 +21,128 @@ declare class ModusError extends Error {
|
|
|
15
21
|
code?: string;
|
|
16
22
|
});
|
|
17
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Network-level failure (connection error, read timeout, etc.) after all
|
|
26
|
+
* automatic retries are exhausted.
|
|
27
|
+
*/
|
|
18
28
|
declare class APIConnectionError extends ModusError {
|
|
19
29
|
constructor(message: string);
|
|
20
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* The API key is missing, invalid, or expired (HTTP 401).
|
|
33
|
+
*
|
|
34
|
+
* Check that `MODUS_API_KEY` is set correctly, or pass `apiKey` explicitly.
|
|
35
|
+
* Create a token at app.getmodus.com → Settings → API Tokens.
|
|
36
|
+
*/
|
|
21
37
|
declare class AuthenticationError extends ModusError {
|
|
22
38
|
constructor(message: string, options?: ConstructorParameters<typeof ModusError>[1]);
|
|
23
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* The API key does not have permission for the requested operation (HTTP 403).
|
|
42
|
+
*/
|
|
24
43
|
declare class PermissionDeniedError extends ModusError {
|
|
25
44
|
constructor(message: string, options?: ConstructorParameters<typeof ModusError>[1]);
|
|
26
45
|
}
|
|
46
|
+
/** The requested resource does not exist (HTTP 404). */
|
|
27
47
|
declare class NotFoundError extends ModusError {
|
|
28
48
|
constructor(message: string, options?: ConstructorParameters<typeof ModusError>[1]);
|
|
29
49
|
}
|
|
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.
|
|
53
|
+
*/
|
|
30
54
|
declare class ConflictError extends ModusError {
|
|
31
55
|
constructor(message: string, options?: ConstructorParameters<typeof ModusError>[1]);
|
|
32
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Request validation failed (HTTP 422).
|
|
59
|
+
*
|
|
60
|
+
* Inspect `errors` when present for field-level details.
|
|
61
|
+
*/
|
|
33
62
|
declare class UnprocessableError extends ModusError {
|
|
34
63
|
readonly errors?: unknown;
|
|
35
64
|
constructor(message: string, options?: ConstructorParameters<typeof ModusError>[1] & {
|
|
36
65
|
errors?: unknown;
|
|
37
66
|
});
|
|
38
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Too many requests (HTTP 429).
|
|
70
|
+
*
|
|
71
|
+
* When present, `retryAfter` is the suggested wait in seconds.
|
|
72
|
+
*/
|
|
39
73
|
declare class RateLimitError extends ModusError {
|
|
40
74
|
readonly retryAfter?: number;
|
|
41
75
|
constructor(message: string, options?: ConstructorParameters<typeof ModusError>[1] & {
|
|
42
76
|
retryAfter?: number;
|
|
43
77
|
});
|
|
44
78
|
}
|
|
79
|
+
/** Unexpected server failure (HTTP 5xx). */
|
|
45
80
|
declare class InternalServerError extends ModusError {
|
|
46
81
|
constructor(message: string, statusCode: number, options?: ConstructorParameters<typeof ModusError>[1]);
|
|
47
82
|
}
|
|
83
|
+
/** The run was cancelled before it finished. */
|
|
48
84
|
declare class RunCancelledError extends ModusError {
|
|
49
85
|
constructor(message?: string);
|
|
50
86
|
}
|
|
87
|
+
/** The streaming connection timed out before a final result arrived. */
|
|
51
88
|
declare class StreamTimeoutError extends ModusError {
|
|
52
89
|
constructor(message?: string);
|
|
53
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* Client-side argument validation failed before a request was sent
|
|
93
|
+
* (for example an unsupported chat model id).
|
|
94
|
+
*/
|
|
54
95
|
declare class ValidationError extends ModusError {
|
|
55
96
|
constructor(message: string);
|
|
56
97
|
}
|
|
57
98
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
99
|
+
/**
|
|
100
|
+
* Canonical model id accepted by Modus chat APIs.
|
|
101
|
+
*
|
|
102
|
+
* Pass as `model` to `client.modus.chat(...)`, `client.scopes.chat(...)`,
|
|
103
|
+
* and the matching stream methods. An unsupported value fails client-side
|
|
104
|
+
* validation before the request is sent.
|
|
105
|
+
*
|
|
106
|
+
* 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`
|
|
109
|
+
* - `qwen3-235b-a22b-2507`, `qwen3-coder`, `qwen3-32b`
|
|
110
|
+
* - `deepseek-chat-v3.1`, `minimax-m2.7`
|
|
111
|
+
* - `llama-4-maverick`, `llama-4-scout`, `llama-3.3-70b-instruct`
|
|
112
|
+
* - `gemini-3.1-pro-preview`, `gemini-3-flash-preview`
|
|
113
|
+
* - `grok-4.3-fast`, `grok-4.3`
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```ts
|
|
117
|
+
* const result = await client.modus.chat('Summarize open tickets', {
|
|
118
|
+
* model: 'claude-sonnet-4.6',
|
|
119
|
+
* })
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
type ChatModel = components['schemas']['SkillChatRequestDto']['model'];
|
|
123
|
+
/**
|
|
124
|
+
* Chat request body (`message` + required `model`).
|
|
125
|
+
*
|
|
126
|
+
* Prefer `client.modus.chat(...)` / `client.scopes.chat(...)` — they take these
|
|
127
|
+
* fields as method arguments so you rarely construct this type yourself.
|
|
128
|
+
*/
|
|
129
|
+
interface ChatRequest {
|
|
130
|
+
/** User message sent to the skill / Modus. */
|
|
131
|
+
message: string;
|
|
132
|
+
/** Canonical model id for this run (required). See {@link ChatModel}. */
|
|
133
|
+
model: ChatModel;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Chat response: final assistant text plus `threadId` for follow-ups.
|
|
137
|
+
*/
|
|
138
|
+
interface ChatResult {
|
|
139
|
+
/** Final assistant text for the run. */
|
|
140
|
+
content: string;
|
|
141
|
+
/** Conversation thread id for follow-up messages. */
|
|
142
|
+
threadId: string;
|
|
143
|
+
/** Opaque run id for logging / correlation. */
|
|
144
|
+
runId: string;
|
|
145
|
+
}
|
|
61
146
|
|
|
62
147
|
interface TokenEvent {
|
|
63
148
|
readonly type: 'token';
|
|
@@ -96,6 +181,10 @@ interface ActiveConversationRun {
|
|
|
96
181
|
}
|
|
97
182
|
type RunEvent = TokenEvent | DoneEvent | ErrorEvent | CancelledEvent | StreamTimeoutEvent | AssistantContentResetEvent;
|
|
98
183
|
|
|
184
|
+
/**
|
|
185
|
+
* Streaming chat session. Iterate {@link ChatStream.textStream} or
|
|
186
|
+
* {@link ChatStream.eventStream}, then call {@link ChatStream.getFinalResult}.
|
|
187
|
+
*/
|
|
99
188
|
declare class ChatStream {
|
|
100
189
|
private readonly http;
|
|
101
190
|
private readonly path;
|
|
@@ -104,9 +193,34 @@ declare class ChatStream {
|
|
|
104
193
|
private final?;
|
|
105
194
|
private readonly textParts;
|
|
106
195
|
constructor(http: HttpClient, path: string, body: Record<string, unknown>, baseUrl?: string | undefined);
|
|
196
|
+
/**
|
|
197
|
+
* Async iterable of assistant text token chunks as they arrive.
|
|
198
|
+
*
|
|
199
|
+
* @returns An async generator yielding partial text strings.
|
|
200
|
+
* @throws {ModusError} When the stream emits an error event.
|
|
201
|
+
* @throws {RunCancelledError} When the run is cancelled.
|
|
202
|
+
* @throws {StreamTimeoutError} When the stream times out.
|
|
203
|
+
*/
|
|
107
204
|
textStream(): AsyncGenerator<string>;
|
|
205
|
+
/**
|
|
206
|
+
* Async iterable of structured run events (tokens, tool calls, done, and so on).
|
|
207
|
+
*
|
|
208
|
+
* @returns An async generator yielding {@link RunEvent} objects.
|
|
209
|
+
* @throws {ModusError} When the stream emits an error event.
|
|
210
|
+
* @throws {RunCancelledError} When the run is cancelled.
|
|
211
|
+
* @throws {StreamTimeoutError} When the stream times out.
|
|
212
|
+
*/
|
|
108
213
|
eventStream(): AsyncGenerator<RunEvent>;
|
|
109
214
|
private events;
|
|
215
|
+
/**
|
|
216
|
+
* Final chat result after the stream completes.
|
|
217
|
+
*
|
|
218
|
+
* Call only after fully consuming {@link ChatStream.textStream} or
|
|
219
|
+
* {@link ChatStream.eventStream}.
|
|
220
|
+
*
|
|
221
|
+
* @returns The assembled assistant reply, thread id, and run id.
|
|
222
|
+
* @throws {ModusError} When called before the stream finishes with a done event.
|
|
223
|
+
*/
|
|
110
224
|
getFinalResult(): ChatResult;
|
|
111
225
|
}
|
|
112
226
|
|
|
@@ -132,7 +246,20 @@ interface AgentRunStream extends AsyncIterable<RunEvent> {
|
|
|
132
246
|
declare class WorkflowRunsResource {
|
|
133
247
|
private readonly http;
|
|
134
248
|
private readonly config;
|
|
249
|
+
/** @internal */
|
|
135
250
|
constructor(http: HttpClient, config: ModusConfig);
|
|
251
|
+
/**
|
|
252
|
+
* List runs for a workflow.
|
|
253
|
+
*
|
|
254
|
+
* @param workflowId - Workflow id or slug.
|
|
255
|
+
* @param options.pageSize - Maximum items per page (default 25, max 100).
|
|
256
|
+
* @param options.pageToken - Opaque token from a previous page.
|
|
257
|
+
* @param options.status - Filter by run status.
|
|
258
|
+
* @param options.timeframe - Filter by recency (`last_hour`, `last_day`, or `last_week`).
|
|
259
|
+
* @param options.approvalScope - Filter approval-related runs (`mine` or `all`).
|
|
260
|
+
* @param options.search - Free-text search filter.
|
|
261
|
+
* @returns A page of run summaries.
|
|
262
|
+
*/
|
|
136
263
|
list(workflowId: number | string, options?: {
|
|
137
264
|
pageSize?: number;
|
|
138
265
|
pageToken?: string;
|
|
@@ -142,31 +269,133 @@ declare class WorkflowRunsResource {
|
|
|
142
269
|
search?: string;
|
|
143
270
|
}): Promise<Page<AgentRunListItem>>;
|
|
144
271
|
private listPage;
|
|
272
|
+
/**
|
|
273
|
+
* Retrieve a workflow run by id.
|
|
274
|
+
*
|
|
275
|
+
* @param workflowId - Workflow id or slug the run belongs to.
|
|
276
|
+
* @param runId - Run id.
|
|
277
|
+
* @param options.temporalRunId - Optional internal execution id when disambiguating retries.
|
|
278
|
+
* @returns Run details including status and output.
|
|
279
|
+
* @throws {NotFoundError} When the run does not exist.
|
|
280
|
+
*/
|
|
145
281
|
get(workflowId: number | string, runId: string, options?: {
|
|
146
282
|
temporalRunId?: string;
|
|
147
283
|
}): Promise<AgentRun>;
|
|
284
|
+
/**
|
|
285
|
+
* Start a workflow run and stream run events.
|
|
286
|
+
*
|
|
287
|
+
* @param workflowId - Workflow id or slug to run.
|
|
288
|
+
* @param body - Run body (`message`, optional `sessionId`, optional `version` as `published` or `draft`).
|
|
289
|
+
* @param options.idempotencyKey - Client-supplied idempotency key; defaults to `body.runId` or a new uuid.
|
|
290
|
+
* @returns A stream of run events (tokens, completion, errors, and related signals).
|
|
291
|
+
*
|
|
292
|
+
* @example
|
|
293
|
+
* ```ts
|
|
294
|
+
* const stream = client.workflows.runs.create(workflowId, {
|
|
295
|
+
* message: 'Summarize yesterday\'s sales',
|
|
296
|
+
* sessionId: 'conv-abc',
|
|
297
|
+
* })
|
|
298
|
+
* for await (const event of stream) {
|
|
299
|
+
* if (event.type === 'token') process.stdout.write(event.content)
|
|
300
|
+
* if (event.type === 'done') break
|
|
301
|
+
* }
|
|
302
|
+
* ```
|
|
303
|
+
*/
|
|
148
304
|
create(workflowId: number | string, body: CreateAgentRunRequest, options?: {
|
|
149
305
|
idempotencyKey?: string;
|
|
150
306
|
}): AgentRunStream;
|
|
307
|
+
/**
|
|
308
|
+
* Start a scope run and stream run events.
|
|
309
|
+
*
|
|
310
|
+
* @param scopeId - Scope id to run.
|
|
311
|
+
* @param body - Run body (`message`, optional `sessionId`, optional `version` as `published` or `draft`).
|
|
312
|
+
* @param options.idempotencyKey - Client-supplied idempotency key; defaults to `body.runId` or a new uuid.
|
|
313
|
+
* @returns A stream of run events.
|
|
314
|
+
*/
|
|
151
315
|
createScope(scopeId: number | string, body: SkillRunCreateRequest, options?: {
|
|
152
316
|
idempotencyKey?: string;
|
|
153
317
|
}): AgentRunStream;
|
|
318
|
+
/**
|
|
319
|
+
* Start a Modus assistant run and stream run events.
|
|
320
|
+
*
|
|
321
|
+
* @param body - Run body (`message`, optional `sessionId`, optional `subordinateSkillIds` to narrow context).
|
|
322
|
+
* @param options.idempotencyKey - Client-supplied idempotency key; defaults to `body.runId` or a new uuid.
|
|
323
|
+
* @returns A stream of run events.
|
|
324
|
+
*/
|
|
154
325
|
createModus(body: ModusRunCreateRequest, options?: {
|
|
155
326
|
idempotencyKey?: string;
|
|
156
327
|
}): AgentRunStream;
|
|
328
|
+
/**
|
|
329
|
+
* Resume an interrupted run and stream run events.
|
|
330
|
+
*
|
|
331
|
+
* @param runId - Run id to resume.
|
|
332
|
+
* @param body - Resume body (`message`, `sessionId`, and `decision`: `approve` / `deny` / `connected` / `cancelled`).
|
|
333
|
+
* @param options.idempotencyKey - Client-supplied idempotency key; defaults to `body.runId` or a new uuid.
|
|
334
|
+
* @returns A stream of run events.
|
|
335
|
+
*/
|
|
157
336
|
resume(runId: string, body: ResumeRunRequest, options?: {
|
|
158
337
|
idempotencyKey?: string;
|
|
159
338
|
}): AgentRunStream;
|
|
339
|
+
/**
|
|
340
|
+
* Cancel a run that is still in progress.
|
|
341
|
+
*
|
|
342
|
+
* @param runId - Run id to cancel.
|
|
343
|
+
*/
|
|
160
344
|
cancel(runId: string): Promise<void>;
|
|
345
|
+
/**
|
|
346
|
+
* Fetch stored run events for a run.
|
|
347
|
+
*
|
|
348
|
+
* @param runId - Run id.
|
|
349
|
+
* @returns Run event history for replay or inspection.
|
|
350
|
+
*/
|
|
161
351
|
events(runId: string): Promise<unknown>;
|
|
352
|
+
/**
|
|
353
|
+
* Request a graceful stop for a running execution.
|
|
354
|
+
*
|
|
355
|
+
* @param runId - Run id to interrupt.
|
|
356
|
+
*/
|
|
162
357
|
interrupt(runId: string): Promise<void>;
|
|
358
|
+
/**
|
|
359
|
+
* Move a queued run back into an editable state before it starts.
|
|
360
|
+
*
|
|
361
|
+
* @param runId - Queued run id.
|
|
362
|
+
*/
|
|
163
363
|
editQueued(runId: string): Promise<void>;
|
|
364
|
+
/**
|
|
365
|
+
* List active conversation runs across the organization.
|
|
366
|
+
*
|
|
367
|
+
* @param options.pageSize - Maximum items per page (default 50, max 100).
|
|
368
|
+
* @param options.pageToken - Opaque token from a previous page.
|
|
369
|
+
* @returns A page of active runs with session and status metadata.
|
|
370
|
+
*/
|
|
164
371
|
active(options?: {
|
|
165
372
|
pageSize?: number;
|
|
166
373
|
pageToken?: string;
|
|
167
374
|
}): Promise<Page<ActiveConversationRun>>;
|
|
168
375
|
private activePage;
|
|
376
|
+
/**
|
|
377
|
+
* Look up active runs for specific conversation sessions.
|
|
378
|
+
*
|
|
379
|
+
* @param sessionIds - Up to 100 session ids.
|
|
380
|
+
* @returns Active runs matching any of the given sessions.
|
|
381
|
+
* @throws {Error} When more than 100 session ids are provided.
|
|
382
|
+
*/
|
|
169
383
|
activeBySession(sessionIds: readonly string[]): Promise<ActiveConversationRun[]>;
|
|
384
|
+
/**
|
|
385
|
+
* Reconnect to an in-progress run and stream run events.
|
|
386
|
+
*
|
|
387
|
+
* @param runId - Run id to follow.
|
|
388
|
+
* @param options.lastEventId - Resume after this event id when catching up.
|
|
389
|
+
* @returns A stream of run events from the current execution point.
|
|
390
|
+
*
|
|
391
|
+
* @example
|
|
392
|
+
* ```ts
|
|
393
|
+
* const stream = client.workflows.runs.stream(runId, { lastEventId: checkpoint })
|
|
394
|
+
* for await (const event of stream) {
|
|
395
|
+
* if (event.type === 'token') process.stdout.write(event.content)
|
|
396
|
+
* }
|
|
397
|
+
* ```
|
|
398
|
+
*/
|
|
170
399
|
stream(runId: string, options?: {
|
|
171
400
|
lastEventId?: string;
|
|
172
401
|
}): AgentRunStream;
|
|
@@ -193,21 +422,51 @@ type RecordSuggestionEventRequest = components['schemas']['RecordSuggestionEvent
|
|
|
193
422
|
declare class AgentWorkflowActionsResource {
|
|
194
423
|
private readonly http;
|
|
195
424
|
private readonly config;
|
|
425
|
+
/** @internal */
|
|
196
426
|
constructor(http: HttpClient, config: ModusConfig);
|
|
427
|
+
/**
|
|
428
|
+
* Execute a workflow action and stream run events.
|
|
429
|
+
*
|
|
430
|
+
* @param body - Action body (`organizationId`, `sessionId`, `workflowAction`, optional `previousOutputs`).
|
|
431
|
+
* @param options.idempotencyKey - Client-supplied idempotency key; defaults to `body.runId` or a new uuid.
|
|
432
|
+
* @returns A stream of run events for the action execution.
|
|
433
|
+
*/
|
|
197
434
|
execute(body: WorkflowActionRequest, options?: {
|
|
198
435
|
idempotencyKey?: string;
|
|
199
436
|
}): AgentRunStream;
|
|
437
|
+
/**
|
|
438
|
+
* Cancel a workflow action run.
|
|
439
|
+
*
|
|
440
|
+
* @param runId - Action run id to cancel.
|
|
441
|
+
*/
|
|
200
442
|
cancel(runId: string): Promise<void>;
|
|
201
443
|
private parseEvents;
|
|
202
444
|
}
|
|
203
445
|
|
|
204
|
-
/**
|
|
446
|
+
/**
|
|
447
|
+
* Read and run access to Modus workflows.
|
|
448
|
+
*
|
|
449
|
+
* - {@link WorkflowRunsResource runs} — start, monitor, and control workflow runs.
|
|
450
|
+
* - {@link AgentWorkflowActionsResource workflowActions} — execute workflow actions.
|
|
451
|
+
*/
|
|
205
452
|
declare class WorkflowsResource {
|
|
206
453
|
private readonly http;
|
|
207
454
|
private readonly config;
|
|
208
455
|
readonly runs: WorkflowRunsResource;
|
|
209
456
|
readonly workflowActions: AgentWorkflowActionsResource;
|
|
457
|
+
/** @internal */
|
|
210
458
|
constructor(http: HttpClient, config: ModusConfig);
|
|
459
|
+
/**
|
|
460
|
+
* List workflows.
|
|
461
|
+
*
|
|
462
|
+
* @param options.pageSize - Maximum items per page (default 25).
|
|
463
|
+
* @param options.pageToken - Opaque token from a previous page.
|
|
464
|
+
* @param options.search - Free-text search filter.
|
|
465
|
+
* @param options.type - Workflow kind: `"task"` or `"workflow"`.
|
|
466
|
+
* @param options.view - Which saved version to return (`active` or `draft`).
|
|
467
|
+
* @param options.includeVariation - Include variation metadata when supported.
|
|
468
|
+
* @returns A page of workflows.
|
|
469
|
+
*/
|
|
211
470
|
list(options?: {
|
|
212
471
|
pageSize?: number;
|
|
213
472
|
pageToken?: string;
|
|
@@ -217,22 +476,53 @@ declare class WorkflowsResource {
|
|
|
217
476
|
includeVariation?: boolean;
|
|
218
477
|
}): Promise<Page<Workflow>>;
|
|
219
478
|
private listPage;
|
|
479
|
+
/**
|
|
480
|
+
* Retrieve a workflow by ID or slug.
|
|
481
|
+
*
|
|
482
|
+
* @param workflowId - Numeric id or slug.
|
|
483
|
+
* @param options.view - Which saved version to return (`active` or `draft`).
|
|
484
|
+
* @param options.includeVariation - Include variation metadata when supported.
|
|
485
|
+
* @returns The workflow.
|
|
486
|
+
* @throws {NotFoundError} When no workflow matches the id or slug.
|
|
487
|
+
*/
|
|
220
488
|
get(workflowId: number | string, options?: {
|
|
221
489
|
view?: VariationView;
|
|
222
490
|
includeVariation?: boolean;
|
|
223
491
|
}): Promise<Workflow>;
|
|
224
492
|
}
|
|
225
493
|
|
|
494
|
+
/**
|
|
495
|
+
* Read access to integration connections.
|
|
496
|
+
*/
|
|
226
497
|
declare class ConnectionsResource {
|
|
227
498
|
private readonly http;
|
|
228
499
|
private readonly config;
|
|
500
|
+
/** @internal */
|
|
229
501
|
constructor(http: HttpClient, config: ModusConfig);
|
|
502
|
+
/**
|
|
503
|
+
* List integration connections.
|
|
504
|
+
*
|
|
505
|
+
* @param options.pageSize - Maximum items per page (default 25).
|
|
506
|
+
* @param options.pageToken - Opaque token from a previous page.
|
|
507
|
+
* @param options.type - Integration category; exact match filter.
|
|
508
|
+
* @returns A page of connections.
|
|
509
|
+
*/
|
|
230
510
|
list(options?: {
|
|
231
511
|
pageSize?: number;
|
|
232
512
|
pageToken?: string;
|
|
233
513
|
type?: string;
|
|
234
514
|
}): Promise<Page<Connection>>;
|
|
235
515
|
private listPage;
|
|
516
|
+
/**
|
|
517
|
+
* Find the first connection whose name matches (case-insensitive).
|
|
518
|
+
*
|
|
519
|
+
* Pages through {@link ConnectionsResource.list} until a match is found.
|
|
520
|
+
*
|
|
521
|
+
* @param options.name - Connection name to search for.
|
|
522
|
+
* @param options.type - Optional integration category filter.
|
|
523
|
+
* @param options.pageSize - Page size when scanning (default 25).
|
|
524
|
+
* @returns The matching connection, or `undefined` if none is found.
|
|
525
|
+
*/
|
|
236
526
|
find(options: {
|
|
237
527
|
name: string;
|
|
238
528
|
type?: string;
|
|
@@ -243,26 +533,72 @@ declare class ConnectionsResource {
|
|
|
243
533
|
type JsonObjectInput = Record<string, unknown>;
|
|
244
534
|
type ContentProjection = components['schemas']['ContentProjectionDto'];
|
|
245
535
|
|
|
536
|
+
/**
|
|
537
|
+
* Read access to Modus knowledge-base items.
|
|
538
|
+
*/
|
|
246
539
|
declare class ContextItemsResource {
|
|
247
540
|
private readonly http;
|
|
248
541
|
private readonly config;
|
|
542
|
+
/** @internal */
|
|
249
543
|
constructor(http: HttpClient, config: ModusConfig);
|
|
544
|
+
/**
|
|
545
|
+
* List knowledge-base items.
|
|
546
|
+
*
|
|
547
|
+
* @param options.pageSize - Maximum items per page (default 25).
|
|
548
|
+
* @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.
|
|
551
|
+
*/
|
|
250
552
|
list(options?: {
|
|
251
553
|
pageSize?: number;
|
|
252
554
|
pageToken?: string;
|
|
253
555
|
contextType?: string;
|
|
254
556
|
}): Promise<Page<ContextItem>>;
|
|
255
557
|
private listPage;
|
|
558
|
+
/**
|
|
559
|
+
* Retrieve a knowledge-base item by uid.
|
|
560
|
+
*
|
|
561
|
+
* @param uid - Item uid.
|
|
562
|
+
* @returns The context item.
|
|
563
|
+
* @throws {NotFoundError} When no item matches the uid.
|
|
564
|
+
*/
|
|
256
565
|
get(uid: string): Promise<ContextItem>;
|
|
566
|
+
/**
|
|
567
|
+
* Look up a knowledge-base item by type and data path.
|
|
568
|
+
*
|
|
569
|
+
* @param options.contextType - Context type to match.
|
|
570
|
+
* @param options.dataPath - Hierarchical path segments that identify the item.
|
|
571
|
+
* @param options.contentProjection - Optional fields to include from item content.
|
|
572
|
+
* @returns The matching row, or `undefined` when no item is found (404).
|
|
573
|
+
*/
|
|
257
574
|
lookup(options: {
|
|
258
575
|
contextType: string;
|
|
259
576
|
dataPath: string[];
|
|
260
577
|
contentProjection?: JsonObjectInput | ContentProjection;
|
|
261
578
|
}): Promise<ContextItemLookupRow | undefined>;
|
|
579
|
+
/**
|
|
580
|
+
* List values stored under a content key on a context item.
|
|
581
|
+
*
|
|
582
|
+
* @param uid - Item uid.
|
|
583
|
+
* @param contextType - Context type of the item.
|
|
584
|
+
* @param contentKeyPath - Dot path to the value field inside item content.
|
|
585
|
+
* @param options.pageSize - Maximum items per page (default 25).
|
|
586
|
+
* @param options.pageToken - Opaque token from a previous page.
|
|
587
|
+
* @returns A page of value rows.
|
|
588
|
+
*/
|
|
262
589
|
listValues(uid: string, contextType: string, contentKeyPath: string, options?: {
|
|
263
590
|
pageSize?: number;
|
|
264
591
|
pageToken?: string;
|
|
265
592
|
}): Promise<Page<ContextValueRow>>;
|
|
593
|
+
/**
|
|
594
|
+
* List values for a context item already loaded via {@link ContextItemsResource.list} or {@link ContextItemsResource.get}.
|
|
595
|
+
*
|
|
596
|
+
* @param item - Context item (uses `item.uid` and `item.contextType`).
|
|
597
|
+
* @param contentKeyPath - Dot path to the value field inside item content.
|
|
598
|
+
* @param options.pageSize - Maximum items per page (default 25).
|
|
599
|
+
* @param options.pageToken - Opaque token from a previous page.
|
|
600
|
+
* @returns A page of value rows.
|
|
601
|
+
*/
|
|
266
602
|
listValuesFor(item: ContextItem, contentKeyPath: string, options?: {
|
|
267
603
|
pageSize?: number;
|
|
268
604
|
pageToken?: string;
|
|
@@ -270,23 +606,46 @@ declare class ContextItemsResource {
|
|
|
270
606
|
private listValuesPage;
|
|
271
607
|
}
|
|
272
608
|
|
|
273
|
-
/**
|
|
609
|
+
/**
|
|
610
|
+
* Read access to the Modus knowledge base.
|
|
611
|
+
*
|
|
612
|
+
* - {@link ContextItemsResource items} — list and look up indexed knowledge-base items.
|
|
613
|
+
* - {@link CustomContextItemsResource customItems} — create and manage custom context items.
|
|
614
|
+
*
|
|
615
|
+
* Call path: `client.context` after `new Modus(...)`.
|
|
616
|
+
*/
|
|
274
617
|
declare class ContextResource {
|
|
275
618
|
readonly items: ContextItemsResource;
|
|
276
619
|
readonly customItems: CustomContextItemsResource;
|
|
620
|
+
/** @internal */
|
|
277
621
|
constructor(http: HttpClient, config: ModusConfig);
|
|
278
622
|
}
|
|
279
623
|
|
|
624
|
+
/** List and retrieve Modus / scope conversations. */
|
|
280
625
|
declare class ModusConversationsResource {
|
|
281
626
|
private readonly http;
|
|
282
627
|
private readonly config;
|
|
283
628
|
constructor(http: HttpClient, config: ModusConfig);
|
|
629
|
+
/**
|
|
630
|
+
* List conversations.
|
|
631
|
+
*
|
|
632
|
+
* @param options.pageSize - Items per page (default 25).
|
|
633
|
+
* @param options.pageToken - Opaque token from a previous page.
|
|
634
|
+
* @param options.kind - `"modus"`, `"scopes"`, or `"all"`.
|
|
635
|
+
* @returns Page of conversation list items.
|
|
636
|
+
*/
|
|
284
637
|
list(options?: {
|
|
285
638
|
pageSize?: number;
|
|
286
639
|
pageToken?: string;
|
|
287
640
|
kind?: ConversationKind;
|
|
288
641
|
}): Promise<Page<ConversationListItem>>;
|
|
289
642
|
private listPage;
|
|
643
|
+
/**
|
|
644
|
+
* Retrieve a conversation thread with full message history.
|
|
645
|
+
*
|
|
646
|
+
* @param threadId - Conversation thread id.
|
|
647
|
+
* @returns Conversation with messages.
|
|
648
|
+
*/
|
|
290
649
|
get(threadId: string): Promise<Conversation>;
|
|
291
650
|
}
|
|
292
651
|
|
|
@@ -296,25 +655,75 @@ declare class ModusResource {
|
|
|
296
655
|
private readonly config;
|
|
297
656
|
readonly conversations: ModusConversationsResource;
|
|
298
657
|
constructor(http: HttpClient, config: ModusConfig);
|
|
658
|
+
/**
|
|
659
|
+
* Return composed full-environment context for an intent, without running chat.
|
|
660
|
+
*
|
|
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.
|
|
664
|
+
*/
|
|
299
665
|
getContext(message: string, options?: {
|
|
300
666
|
limit?: number;
|
|
301
667
|
}): Promise<ModusContextComposition>;
|
|
668
|
+
/**
|
|
669
|
+
* Send a message to Modus (org-wide assistant) and get the complete reply.
|
|
670
|
+
*
|
|
671
|
+
* @param message - Message to send.
|
|
672
|
+
* @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.
|
|
675
|
+
*
|
|
676
|
+
* @example
|
|
677
|
+
* ```ts
|
|
678
|
+
* const result = await client.modus.chat('What tables describe revenue?', { model: 'claude-sonnet-5' })
|
|
679
|
+
* console.log(result.content, result.threadId)
|
|
680
|
+
* ```
|
|
681
|
+
*/
|
|
302
682
|
chat(message: string, options: {
|
|
303
683
|
model: ChatModel;
|
|
304
684
|
threadId?: string;
|
|
305
685
|
}): Promise<ChatResult>;
|
|
686
|
+
/**
|
|
687
|
+
* Stream a Modus reply token by token.
|
|
688
|
+
*
|
|
689
|
+
* @param message - Message to send.
|
|
690
|
+
* @param options.model - Required model id (e.g. `"claude-sonnet-5"`).
|
|
691
|
+
* @param options.threadId - Continue an existing conversation.
|
|
692
|
+
* @returns Chat stream.
|
|
693
|
+
*/
|
|
306
694
|
chatStream(message: string, options: {
|
|
307
695
|
model: ChatModel;
|
|
308
696
|
threadId?: string;
|
|
309
697
|
}): ChatStream;
|
|
310
698
|
}
|
|
311
699
|
|
|
312
|
-
/**
|
|
700
|
+
/**
|
|
701
|
+
* Read / chat with scopes.
|
|
702
|
+
*
|
|
703
|
+
* Call path: `client.scopes` after `new Modus(...)`.
|
|
704
|
+
*/
|
|
313
705
|
declare class ScopesResource {
|
|
314
706
|
private readonly http;
|
|
315
707
|
private readonly config;
|
|
708
|
+
/** @internal */
|
|
316
709
|
constructor(http: HttpClient, config: ModusConfig);
|
|
710
|
+
/**
|
|
711
|
+
* Return the conversations sub-resource scoped to `scopeId`.
|
|
712
|
+
*
|
|
713
|
+
* @param scopeId - Scope numeric id or slug.
|
|
714
|
+
* @returns Conversations resource for the scope.
|
|
715
|
+
*/
|
|
317
716
|
conversations(scopeId: number | string): ScopeConversationsResource;
|
|
717
|
+
/**
|
|
718
|
+
* List scopes in the organisation.
|
|
719
|
+
*
|
|
720
|
+
* @param options.pageSize - Items per page (default 25).
|
|
721
|
+
* @param options.pageToken - Opaque token from a previous page.
|
|
722
|
+
* @param options.search - Case-insensitive substring filter on the scope name.
|
|
723
|
+
* @param options.view - `"active"` (deployed) or `"draft"`.
|
|
724
|
+
* @param options.managerId - Only scopes supervised by this manager scope id.
|
|
725
|
+
* @returns Page of scopes.
|
|
726
|
+
*/
|
|
318
727
|
list(options?: {
|
|
319
728
|
pageSize?: number;
|
|
320
729
|
pageToken?: string;
|
|
@@ -323,16 +732,57 @@ declare class ScopesResource {
|
|
|
323
732
|
managerId?: number;
|
|
324
733
|
}): Promise<Page<Scope>>;
|
|
325
734
|
private listPage;
|
|
735
|
+
/**
|
|
736
|
+
* Retrieve a scope by ID or slug.
|
|
737
|
+
*
|
|
738
|
+
* @param scopeId - Scope numeric id or slug.
|
|
739
|
+
* @param options.view - `"active"` (deployed) or `"draft"`.
|
|
740
|
+
* @throws {NotFoundError} When no scope matches the id or slug.
|
|
741
|
+
* @returns Scope.
|
|
742
|
+
*/
|
|
326
743
|
get(scopeId: number | string, options?: {
|
|
327
744
|
view?: VariationView;
|
|
328
745
|
}): Promise<Scope>;
|
|
746
|
+
/**
|
|
747
|
+
* Return composed context Modus would use for a scope query, without running chat.
|
|
748
|
+
*
|
|
749
|
+
* @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.
|
|
753
|
+
*/
|
|
329
754
|
getContext(scopeId: number | string, message: string, options?: {
|
|
330
755
|
limit?: number;
|
|
331
756
|
}): Promise<SkillContextComposition>;
|
|
757
|
+
/**
|
|
758
|
+
* Send a message to a scope and get the complete reply.
|
|
759
|
+
*
|
|
760
|
+
* @param scopeId - Scope numeric id or slug.
|
|
761
|
+
* @param message - Message to send.
|
|
762
|
+
* @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.
|
|
765
|
+
*
|
|
766
|
+
* @example
|
|
767
|
+
* ```ts
|
|
768
|
+
* const result = await client.scopes.chat(scopeId, 'Hello', { model: 'claude-sonnet-5' })
|
|
769
|
+
* console.log(result.content, result.threadId)
|
|
770
|
+
* ```
|
|
771
|
+
*/
|
|
332
772
|
chat(scopeId: number | string, message: string, options: {
|
|
333
773
|
model: ChatModel;
|
|
334
774
|
threadId?: string;
|
|
335
775
|
}): Promise<ChatResult>;
|
|
776
|
+
/**
|
|
777
|
+
* Stream a scope reply token by token.
|
|
778
|
+
*
|
|
779
|
+
* @param scopeId - Scope numeric id or slug.
|
|
780
|
+
* @param message - Message to send.
|
|
781
|
+
* @param options.model - Required model id (e.g. `"claude-sonnet-5"`).
|
|
782
|
+
* @param options.threadId - Continue an existing conversation.
|
|
783
|
+
* @param options.version - `"published"` or `"draft"`.
|
|
784
|
+
* @returns Chat stream.
|
|
785
|
+
*/
|
|
336
786
|
chatStream(scopeId: number | string, message: string, options: {
|
|
337
787
|
model: ChatModel;
|
|
338
788
|
threadId?: string;
|
|
@@ -340,10 +790,23 @@ declare class ScopesResource {
|
|
|
340
790
|
}): ChatStream;
|
|
341
791
|
}
|
|
342
792
|
|
|
793
|
+
/**
|
|
794
|
+
* List suggested questions and record suggestion events.
|
|
795
|
+
*/
|
|
343
796
|
declare class SuggestionsResource {
|
|
344
797
|
private readonly http;
|
|
345
798
|
private readonly config;
|
|
799
|
+
/** @internal */
|
|
346
800
|
constructor(http: HttpClient, config: ModusConfig);
|
|
801
|
+
/**
|
|
802
|
+
* List approved suggested questions.
|
|
803
|
+
*
|
|
804
|
+
* @param options.pageSize - Maximum items per page (default 5, max 12).
|
|
805
|
+
* @param options.pageToken - Opaque token from a previous page.
|
|
806
|
+
* @param options.scopeId - Filter to a single scope.
|
|
807
|
+
* @param options.scopeIds - Filter to one or more scopes.
|
|
808
|
+
* @returns A page of suggested questions.
|
|
809
|
+
*/
|
|
347
810
|
list(options?: {
|
|
348
811
|
pageSize?: number;
|
|
349
812
|
pageToken?: string;
|
|
@@ -351,10 +814,22 @@ declare class SuggestionsResource {
|
|
|
351
814
|
scopeIds?: readonly number[];
|
|
352
815
|
}): Promise<Page<SuggestionQuestion>>;
|
|
353
816
|
private listPage;
|
|
817
|
+
/**
|
|
818
|
+
* Record that a suggested question was shown, clicked, dismissed, or submitted.
|
|
819
|
+
*
|
|
820
|
+
* @param id - Suggestion id.
|
|
821
|
+
* @param event - Event details, including `eventType` (`shown`, `clicked`, `dismissed`, or `submitted`).
|
|
822
|
+
*/
|
|
354
823
|
recordEvent(id: string, event: RecordSuggestionEventRequest): Promise<void>;
|
|
355
824
|
}
|
|
356
825
|
|
|
357
|
-
/**
|
|
826
|
+
/**
|
|
827
|
+
* Read / invoke client for Modus scopes, workflows, connections, and more.
|
|
828
|
+
*
|
|
829
|
+
* Call path: `const client = new Modus(...)` then `client.scopes`, `client.context`, …
|
|
830
|
+
*
|
|
831
|
+
* @param options - Client configuration (`apiKey`, `baseUrl`, `timeoutMs`, `maxRetries`).
|
|
832
|
+
*/
|
|
358
833
|
declare class Modus extends ModusClientBase {
|
|
359
834
|
readonly scopes: ScopesResource;
|
|
360
835
|
readonly modus: ModusResource;
|