@getmodus/sdk 0.1.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 +48 -0
- package/LICENSE +21 -0
- package/README.md +79 -0
- package/dist/chunk-VLHNZJBG.js +1681 -0
- package/dist/chunk-VLHNZJBG.js.map +1 -0
- package/dist/conversations-nx1ujbiv.d.cts +19329 -0
- package/dist/conversations-nx1ujbiv.d.ts +19329 -0
- package/dist/index.cjs +2546 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +365 -0
- package/dist/index.d.ts +365 -0
- package/dist/index.js +888 -0
- package/dist/index.js.map +1 -0
- package/dist/management/index.cjs +2514 -0
- package/dist/management/index.cjs.map +1 -0
- package/dist/management/index.d.cts +351 -0
- package/dist/management/index.d.ts +351 -0
- package/dist/management/index.js +896 -0
- package/dist/management/index.js.map +1 -0
- package/package.json +71 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
import { c as components, H as HttpClient, M as ModusConfig, P as Page, A as AgentType, V as VariationView, a as Agent, C as ContextItem, b as ContextItemLookupRow, d as CustomContextItemsResource, e as ConversationKind, f as ConversationListItem, g as Conversation, S as ScopeConversationsResource, h as Skill, i as ModusClientBase, j as ModusOptions } from './conversations-nx1ujbiv.cjs';
|
|
2
|
+
export { k as ContextType, l as Message, O as OPERATIONS, m as OperationId, n as OperationSpec, o as SkillStatus, p as SkillVariation, q as conversationSkillId, r as operations, s as paths } from './conversations-nx1ujbiv.cjs';
|
|
3
|
+
|
|
4
|
+
declare class ModusError extends Error {
|
|
5
|
+
readonly statusCode?: number;
|
|
6
|
+
readonly requestId?: string;
|
|
7
|
+
readonly responseHeaders?: Record<string, string>;
|
|
8
|
+
readonly body?: string;
|
|
9
|
+
readonly code?: string;
|
|
10
|
+
constructor(message: string, options?: {
|
|
11
|
+
statusCode?: number;
|
|
12
|
+
requestId?: string;
|
|
13
|
+
responseHeaders?: Record<string, string>;
|
|
14
|
+
body?: string;
|
|
15
|
+
code?: string;
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
declare class APIConnectionError extends ModusError {
|
|
19
|
+
constructor(message: string);
|
|
20
|
+
}
|
|
21
|
+
declare class AuthenticationError extends ModusError {
|
|
22
|
+
constructor(message: string, options?: ConstructorParameters<typeof ModusError>[1]);
|
|
23
|
+
}
|
|
24
|
+
declare class PermissionDeniedError extends ModusError {
|
|
25
|
+
constructor(message: string, options?: ConstructorParameters<typeof ModusError>[1]);
|
|
26
|
+
}
|
|
27
|
+
declare class NotFoundError extends ModusError {
|
|
28
|
+
constructor(message: string, options?: ConstructorParameters<typeof ModusError>[1]);
|
|
29
|
+
}
|
|
30
|
+
declare class ConflictError extends ModusError {
|
|
31
|
+
constructor(message: string, options?: ConstructorParameters<typeof ModusError>[1]);
|
|
32
|
+
}
|
|
33
|
+
declare class UnprocessableError extends ModusError {
|
|
34
|
+
readonly errors?: unknown;
|
|
35
|
+
constructor(message: string, options?: ConstructorParameters<typeof ModusError>[1] & {
|
|
36
|
+
errors?: unknown;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
declare class RateLimitError extends ModusError {
|
|
40
|
+
readonly retryAfter?: number;
|
|
41
|
+
constructor(message: string, options?: ConstructorParameters<typeof ModusError>[1] & {
|
|
42
|
+
retryAfter?: number;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
declare class InternalServerError extends ModusError {
|
|
46
|
+
constructor(message: string, statusCode: number, options?: ConstructorParameters<typeof ModusError>[1]);
|
|
47
|
+
}
|
|
48
|
+
declare class RunCancelledError extends ModusError {
|
|
49
|
+
constructor(message?: string);
|
|
50
|
+
}
|
|
51
|
+
declare class StreamTimeoutError extends ModusError {
|
|
52
|
+
constructor(message?: string);
|
|
53
|
+
}
|
|
54
|
+
declare class ValidationError extends ModusError {
|
|
55
|
+
constructor(message: string);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
type ChatResult = components['schemas']['SkillChatResponseDto'];
|
|
59
|
+
type ChatRequest = components['schemas']['SkillChatRequestDto'];
|
|
60
|
+
type ChatModel = ChatRequest['model'];
|
|
61
|
+
|
|
62
|
+
interface TokenEvent {
|
|
63
|
+
readonly type: 'token';
|
|
64
|
+
content: string;
|
|
65
|
+
}
|
|
66
|
+
interface DoneEvent {
|
|
67
|
+
readonly type: 'done';
|
|
68
|
+
runId: string;
|
|
69
|
+
threadId: string;
|
|
70
|
+
}
|
|
71
|
+
interface ErrorEvent {
|
|
72
|
+
readonly type: 'error';
|
|
73
|
+
message: string;
|
|
74
|
+
}
|
|
75
|
+
interface CancelledEvent {
|
|
76
|
+
readonly type: 'cancelled';
|
|
77
|
+
}
|
|
78
|
+
interface StreamTimeoutEvent {
|
|
79
|
+
readonly type: 'stream_timeout';
|
|
80
|
+
}
|
|
81
|
+
interface AssistantContentResetEvent {
|
|
82
|
+
readonly type: 'assistant_content_reset';
|
|
83
|
+
content: string;
|
|
84
|
+
visibleContent?: string;
|
|
85
|
+
attempt: number;
|
|
86
|
+
reason: 'provider_stream_failed';
|
|
87
|
+
}
|
|
88
|
+
type ActiveConversationRunStatus = 'queued' | 'pending' | 'running';
|
|
89
|
+
interface ActiveConversationRun {
|
|
90
|
+
readonly runId: string;
|
|
91
|
+
readonly sessionId: string;
|
|
92
|
+
readonly status: ActiveConversationRunStatus;
|
|
93
|
+
readonly message?: string;
|
|
94
|
+
readonly createdAt: string;
|
|
95
|
+
readonly updatedAt: string;
|
|
96
|
+
}
|
|
97
|
+
type RunEvent = TokenEvent | DoneEvent | ErrorEvent | CancelledEvent | StreamTimeoutEvent | AssistantContentResetEvent;
|
|
98
|
+
|
|
99
|
+
declare class ChatStream {
|
|
100
|
+
private readonly http;
|
|
101
|
+
private readonly path;
|
|
102
|
+
private readonly body;
|
|
103
|
+
private final?;
|
|
104
|
+
private readonly textParts;
|
|
105
|
+
constructor(http: HttpClient, path: string, body: Record<string, unknown>);
|
|
106
|
+
textStream(): AsyncGenerator<string>;
|
|
107
|
+
eventStream(): AsyncGenerator<RunEvent>;
|
|
108
|
+
private events;
|
|
109
|
+
getFinalResult(): ChatResult;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
type AgentRunListItem = components['schemas']['AutomationRunListItemDto'];
|
|
113
|
+
type AgentRun = components['schemas']['GetAutomationRunResponseDto'];
|
|
114
|
+
type AgentRunCreateRequest = components['schemas']['AgentRunDto'];
|
|
115
|
+
type SkillRunCreateRequest = components['schemas']['SkillRunDto'];
|
|
116
|
+
type ModusRunCreateRequest = components['schemas']['ModusRunDto'];
|
|
117
|
+
type ResumeRunRequest = components['schemas']['ResumeRunDto'];
|
|
118
|
+
type CreateAgentRunRequest = AgentRunCreateRequest;
|
|
119
|
+
type CancelRunRequest = components['schemas']['CancelRunDto'];
|
|
120
|
+
type InterruptRunRequest = components['schemas']['InterruptRunDto'];
|
|
121
|
+
type EditQueuedRunRequest = components['schemas']['EditQueuedRunDto'];
|
|
122
|
+
type WorkflowActionRequest = components['schemas']['WorkflowActionDto'];
|
|
123
|
+
type RunStatus = 'running' | 'awaiting_human' | 'completed' | 'error' | 'cancelled' | 'all_executions' | (string & {});
|
|
124
|
+
type RunTimeframe = 'last_hour' | 'last_day' | 'last_week' | (string & {});
|
|
125
|
+
type ApprovalScope = 'mine' | 'all' | (string & {});
|
|
126
|
+
|
|
127
|
+
interface AgentRunStream {
|
|
128
|
+
readonly runId: string;
|
|
129
|
+
readonly events: AsyncIterable<RunEvent>;
|
|
130
|
+
}
|
|
131
|
+
declare class WorkflowRunsResource {
|
|
132
|
+
private readonly http;
|
|
133
|
+
private readonly config;
|
|
134
|
+
constructor(http: HttpClient, config: ModusConfig);
|
|
135
|
+
list(workflowId: number | string, options?: {
|
|
136
|
+
pageSize?: number;
|
|
137
|
+
pageToken?: string;
|
|
138
|
+
status?: RunStatus;
|
|
139
|
+
timeframe?: RunTimeframe;
|
|
140
|
+
approvalScope?: ApprovalScope;
|
|
141
|
+
search?: string;
|
|
142
|
+
}): Promise<Page<AgentRunListItem>>;
|
|
143
|
+
private listPage;
|
|
144
|
+
get(workflowId: number | string, runId: string, options?: {
|
|
145
|
+
temporalRunId?: string;
|
|
146
|
+
}): Promise<AgentRun>;
|
|
147
|
+
create(workflowId: number | string, body: CreateAgentRunRequest, options?: {
|
|
148
|
+
idempotencyKey?: string;
|
|
149
|
+
}): Promise<AgentRunStream>;
|
|
150
|
+
createScope(scopeId: number | string, body: SkillRunCreateRequest, options?: {
|
|
151
|
+
idempotencyKey?: string;
|
|
152
|
+
}): Promise<AgentRunStream>;
|
|
153
|
+
createModus(body: ModusRunCreateRequest, options?: {
|
|
154
|
+
idempotencyKey?: string;
|
|
155
|
+
}): Promise<AgentRunStream>;
|
|
156
|
+
resume(runId: string, body: ResumeRunRequest, options?: {
|
|
157
|
+
idempotencyKey?: string;
|
|
158
|
+
}): Promise<AgentRunStream>;
|
|
159
|
+
cancel(runId: string): Promise<void>;
|
|
160
|
+
events(runId: string): Promise<unknown>;
|
|
161
|
+
interrupt(runId: string): Promise<void>;
|
|
162
|
+
editQueued(runId: string): Promise<void>;
|
|
163
|
+
active(options?: {
|
|
164
|
+
pageSize?: number;
|
|
165
|
+
pageToken?: string;
|
|
166
|
+
}): Promise<Page<ActiveConversationRun>>;
|
|
167
|
+
private activePage;
|
|
168
|
+
activeBySession(sessionIds: readonly string[]): Promise<ActiveConversationRun[]>;
|
|
169
|
+
stream(runId: string, options?: {
|
|
170
|
+
lastEventId?: string;
|
|
171
|
+
}): AgentRunStream;
|
|
172
|
+
private createRun;
|
|
173
|
+
private parseEvents;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
type Connection = components['schemas']['ConnectionDto'];
|
|
177
|
+
|
|
178
|
+
/** One value entry from context item listValues (shape varies by context type). */
|
|
179
|
+
type ContextValueRow = Record<string, unknown>;
|
|
180
|
+
|
|
181
|
+
type SkillContextComposition = components['schemas']['ComposeSkillContextResponseDto'];
|
|
182
|
+
type ModusContextComposition = components['schemas']['ModusContextResponseDto'];
|
|
183
|
+
type ComposeSkillContextRequest = components['schemas']['ComposeSkillContextRequestDto'];
|
|
184
|
+
type ModusContextRequest = components['schemas']['ModusContextRequestDto'];
|
|
185
|
+
|
|
186
|
+
type SuggestionQuestion = components['schemas']['SuggestionQuestionDto'];
|
|
187
|
+
type SuggestionEventType = components['schemas']['SuggestionEventType'];
|
|
188
|
+
type SuggestionEventSource = components['schemas']['SuggestionEventSource'];
|
|
189
|
+
type RecordSuggestionEventRequest = components['schemas']['RecordSuggestionEventDto'];
|
|
190
|
+
|
|
191
|
+
declare class AgentWorkflowActionsResource {
|
|
192
|
+
private readonly http;
|
|
193
|
+
private readonly config;
|
|
194
|
+
constructor(http: HttpClient, config: ModusConfig);
|
|
195
|
+
execute(body: WorkflowActionRequest, options?: {
|
|
196
|
+
idempotencyKey?: string;
|
|
197
|
+
}): Promise<AgentRunStream>;
|
|
198
|
+
cancel(runId: string): Promise<void>;
|
|
199
|
+
private parseEvents;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/** Read / invoke access to Modus workflows (`/api/v1/workflows`). */
|
|
203
|
+
declare class WorkflowsResource {
|
|
204
|
+
private readonly http;
|
|
205
|
+
private readonly config;
|
|
206
|
+
readonly runs: WorkflowRunsResource;
|
|
207
|
+
readonly workflowActions: AgentWorkflowActionsResource;
|
|
208
|
+
constructor(http: HttpClient, config: ModusConfig);
|
|
209
|
+
list(options?: {
|
|
210
|
+
pageSize?: number;
|
|
211
|
+
pageToken?: string;
|
|
212
|
+
search?: string;
|
|
213
|
+
type?: AgentType;
|
|
214
|
+
view?: VariationView;
|
|
215
|
+
includeVariation?: boolean;
|
|
216
|
+
}): Promise<Page<Agent>>;
|
|
217
|
+
private listPage;
|
|
218
|
+
get(workflowId: number | string, options?: {
|
|
219
|
+
view?: VariationView;
|
|
220
|
+
includeVariation?: boolean;
|
|
221
|
+
}): Promise<Agent>;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
declare class ConnectionsResource {
|
|
225
|
+
private readonly http;
|
|
226
|
+
private readonly config;
|
|
227
|
+
constructor(http: HttpClient, config: ModusConfig);
|
|
228
|
+
list(options?: {
|
|
229
|
+
pageSize?: number;
|
|
230
|
+
pageToken?: string;
|
|
231
|
+
type?: string;
|
|
232
|
+
}): Promise<Page<Connection>>;
|
|
233
|
+
private listPage;
|
|
234
|
+
find(options: {
|
|
235
|
+
name: string;
|
|
236
|
+
type?: string;
|
|
237
|
+
pageSize?: number;
|
|
238
|
+
}): Promise<Connection | undefined>;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
type JsonObjectInput = Record<string, unknown>;
|
|
242
|
+
type ContentProjection = components['schemas']['ContentProjectionDto'];
|
|
243
|
+
|
|
244
|
+
declare class ContextItemsResource {
|
|
245
|
+
private readonly http;
|
|
246
|
+
private readonly config;
|
|
247
|
+
constructor(http: HttpClient, config: ModusConfig);
|
|
248
|
+
list(options?: {
|
|
249
|
+
pageSize?: number;
|
|
250
|
+
pageToken?: string;
|
|
251
|
+
contextType?: string;
|
|
252
|
+
}): Promise<Page<ContextItem>>;
|
|
253
|
+
private listPage;
|
|
254
|
+
get(uid: string): Promise<ContextItem>;
|
|
255
|
+
lookup(options: {
|
|
256
|
+
contextType: string;
|
|
257
|
+
dataPath: string[];
|
|
258
|
+
contentProjection?: JsonObjectInput | ContentProjection;
|
|
259
|
+
}): Promise<ContextItemLookupRow | undefined>;
|
|
260
|
+
listValues(uid: string, contextType: string, contentKeyPath: string, options?: {
|
|
261
|
+
pageSize?: number;
|
|
262
|
+
pageToken?: string;
|
|
263
|
+
}): Promise<Page<ContextValueRow>>;
|
|
264
|
+
listValuesFor(item: ContextItem, contentKeyPath: string, options?: {
|
|
265
|
+
pageSize?: number;
|
|
266
|
+
pageToken?: string;
|
|
267
|
+
}): Promise<Page<ContextValueRow>>;
|
|
268
|
+
private listValuesPage;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/** Read access to the Modus knowledge base. */
|
|
272
|
+
declare class ContextResource {
|
|
273
|
+
readonly items: ContextItemsResource;
|
|
274
|
+
readonly customItems: CustomContextItemsResource;
|
|
275
|
+
constructor(http: HttpClient, config: ModusConfig);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
declare class ModusConversationsResource {
|
|
279
|
+
private readonly http;
|
|
280
|
+
private readonly config;
|
|
281
|
+
constructor(http: HttpClient, config: ModusConfig);
|
|
282
|
+
list(options?: {
|
|
283
|
+
pageSize?: number;
|
|
284
|
+
pageToken?: string;
|
|
285
|
+
kind?: ConversationKind;
|
|
286
|
+
}): Promise<Page<ConversationListItem>>;
|
|
287
|
+
private listPage;
|
|
288
|
+
get(threadId: string): Promise<Conversation>;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/** Org-wide Modus assistant. */
|
|
292
|
+
declare class ModusResource {
|
|
293
|
+
private readonly http;
|
|
294
|
+
private readonly config;
|
|
295
|
+
readonly conversations: ModusConversationsResource;
|
|
296
|
+
constructor(http: HttpClient, config: ModusConfig);
|
|
297
|
+
getContext(message: string, options?: {
|
|
298
|
+
limit?: number;
|
|
299
|
+
}): Promise<ModusContextComposition>;
|
|
300
|
+
chat(message: string, options: {
|
|
301
|
+
model: ChatModel;
|
|
302
|
+
threadId?: string;
|
|
303
|
+
}): Promise<ChatResult>;
|
|
304
|
+
chatStream(message: string, options: {
|
|
305
|
+
model: ChatModel;
|
|
306
|
+
threadId?: string;
|
|
307
|
+
}): ChatStream;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/** Read / invoke access to Modus scopes (`/api/v1/scopes`). */
|
|
311
|
+
declare class ScopesResource {
|
|
312
|
+
private readonly http;
|
|
313
|
+
private readonly config;
|
|
314
|
+
constructor(http: HttpClient, config: ModusConfig);
|
|
315
|
+
conversations(scopeId: number | string): ScopeConversationsResource;
|
|
316
|
+
list(options?: {
|
|
317
|
+
pageSize?: number;
|
|
318
|
+
pageToken?: string;
|
|
319
|
+
search?: string;
|
|
320
|
+
view?: VariationView;
|
|
321
|
+
managerId?: number;
|
|
322
|
+
}): Promise<Page<Skill>>;
|
|
323
|
+
private listPage;
|
|
324
|
+
get(scopeId: number | string, options?: {
|
|
325
|
+
view?: VariationView;
|
|
326
|
+
}): Promise<Skill>;
|
|
327
|
+
getContext(scopeId: number | string, message: string, options?: {
|
|
328
|
+
limit?: number;
|
|
329
|
+
}): Promise<SkillContextComposition>;
|
|
330
|
+
chat(scopeId: number | string, message: string, options: {
|
|
331
|
+
model: ChatModel;
|
|
332
|
+
threadId?: string;
|
|
333
|
+
}): Promise<ChatResult>;
|
|
334
|
+
chatStream(scopeId: number | string, message: string, options: {
|
|
335
|
+
model: ChatModel;
|
|
336
|
+
threadId?: string;
|
|
337
|
+
}): ChatStream;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
declare class SuggestionsResource {
|
|
341
|
+
private readonly http;
|
|
342
|
+
private readonly config;
|
|
343
|
+
constructor(http: HttpClient, config: ModusConfig);
|
|
344
|
+
list(options?: {
|
|
345
|
+
pageSize?: number;
|
|
346
|
+
pageToken?: string;
|
|
347
|
+
skillId?: number;
|
|
348
|
+
skillIds?: readonly number[];
|
|
349
|
+
}): Promise<Page<SuggestionQuestion>>;
|
|
350
|
+
private listPage;
|
|
351
|
+
recordEvent(id: string, event: RecordSuggestionEventRequest): Promise<void>;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/** Read / invoke client for Modus scopes, workflows, connections, and more. */
|
|
355
|
+
declare class Modus extends ModusClientBase {
|
|
356
|
+
readonly scopes: ScopesResource;
|
|
357
|
+
readonly modus: ModusResource;
|
|
358
|
+
readonly workflows: WorkflowsResource;
|
|
359
|
+
readonly context: ContextResource;
|
|
360
|
+
readonly connections: ConnectionsResource;
|
|
361
|
+
readonly suggestions: SuggestionsResource;
|
|
362
|
+
constructor(options?: ModusOptions);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
export { APIConnectionError, Agent, type AgentRun, type AgentRunCreateRequest, type AgentRunListItem, type AgentRunStream, AgentType, 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, Skill, type SkillContextComposition, type SkillRunCreateRequest, StreamTimeoutError, type StreamTimeoutEvent, type SuggestionEventSource, type SuggestionEventType, type SuggestionQuestion, type TokenEvent, UnprocessableError, ValidationError, VariationView, type WorkflowActionRequest, components };
|