@getmodus/sdk 0.10.0 → 0.12.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 +45 -1
- package/README.md +8 -1
- package/dist/{_client-base-H5rt5EGy.d.cts → _client-base-DvrAQWuU.d.cts} +837 -114
- package/dist/{_client-base-H5rt5EGy.d.ts → _client-base-DvrAQWuU.d.ts} +837 -114
- package/dist/{chunk-BMYCORZF.js → chunk-3CKUUDEJ.js} +75 -12
- package/dist/chunk-3CKUUDEJ.js.map +1 -0
- package/dist/{chunk-NA3ZD35T.cjs → chunk-QHA3LF2Q.cjs} +75 -12
- package/dist/chunk-QHA3LF2Q.cjs.map +1 -0
- package/dist/index.cjs +167 -138
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +47 -17
- package/dist/index.d.ts +47 -17
- package/dist/index.js +47 -18
- package/dist/index.js.map +1 -1
- package/dist/management/index.cjs +274 -263
- package/dist/management/index.cjs.map +1 -1
- package/dist/management/index.d.cts +26 -7
- package/dist/management/index.d.ts +26 -7
- package/dist/management/index.js +18 -7
- package/dist/management/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-BMYCORZF.js.map +0 -1
- package/dist/chunk-NA3ZD35T.cjs.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { H as HttpClient, c as components, M as ModusConfig, P as Page, V as VariationView, S as Scope, a as ScopeConversationsResource, C as Conversation, b as ConversationKind, d as ConversationListItem, W as WorkflowType, e as Workflow, f as
|
|
2
|
-
export { A as Agent,
|
|
1
|
+
import { H as HttpClient, c as components, M as ModusConfig, P as Page, V as VariationView, S as Scope, a as ScopeConversationsResource, C as Conversation, b as ConversationKind, d as ConversationListItem, W as WorkflowType, e as Workflow, f as ContextItemsQuery, g as ContextItemsQueryResult, h as ContextItem, i as ContextItemLookupRow, j as CustomContextItemsResource, k as ModusClientBase, l as ModusOptions } from './_client-base-DvrAQWuU.cjs';
|
|
2
|
+
export { A as Agent, m as AgentType, B as BatchDeleteCustomContextItemsInput, n as BatchDeleteCustomContextItemsResult, o as ContextItemAccessUpdate, p as ContextItemAncestor, q as ContextItemDeletion, r as ContextItemMove, s as ContextType, t as CreateCustomContextItemInput, u as CreatedCustomContextItem, v as CustomAttributeInput, w as CustomContextItemDeletion, x as CustomContextItemKind, y as CustomContextItemRelationInput, z as Message, O as OPERATIONS, D as OperationId, E as OperationSpec, F as ScopeStatus, G as ScopeVariation, I as Skill, J as SkillStatus, K as SkillVariation, L as SupervisionView, U as UpdateContextItemAccessInput, N as UpdateCustomContextItemInput, Q as conversationScopeId, R as conversationSkillId, T as operations, X as paths } from './_client-base-DvrAQWuU.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Base class for all Modus SDK errors.
|
|
@@ -254,6 +254,13 @@ interface ChatOptions {
|
|
|
254
254
|
/** Continue this conversation; omit to start a new one. */
|
|
255
255
|
threadId?: string;
|
|
256
256
|
}
|
|
257
|
+
/** Options for `workflows.chat()`. A workflow's steps run with the models set in the workflow. */
|
|
258
|
+
interface WorkflowChatOptions {
|
|
259
|
+
/** @deprecated Ignored: each step of the workflow uses the model set in the workflow. */
|
|
260
|
+
model?: ChatModel;
|
|
261
|
+
/** Continue this conversation; omit to start a new one. */
|
|
262
|
+
threadId?: string;
|
|
263
|
+
}
|
|
257
264
|
interface ChatRequest {
|
|
258
265
|
readonly path: string;
|
|
259
266
|
readonly body: Record<string, unknown>;
|
|
@@ -356,7 +363,7 @@ type NewRunBody<T extends {
|
|
|
356
363
|
}> = Omit<T, 'sessionId'> & {
|
|
357
364
|
sessionId?: string;
|
|
358
365
|
};
|
|
359
|
-
type AgentRunCreateRequest =
|
|
366
|
+
type AgentRunCreateRequest = components['schemas']['AgentRunDto'];
|
|
360
367
|
type SkillRunCreateRequest = NewRunBody<components['schemas']['SkillRunDto']>;
|
|
361
368
|
type ModusRunCreateRequest = NewRunBody<components['schemas']['ModusRunDto']>;
|
|
362
369
|
type ResumeRunRequest = components['schemas']['ResumeRunDto'];
|
|
@@ -1070,26 +1077,53 @@ declare class WorkflowsResource extends WorkflowsResourceBase {
|
|
|
1070
1077
|
includeVariation?: boolean;
|
|
1071
1078
|
}): Promise<Workflow>;
|
|
1072
1079
|
/**
|
|
1073
|
-
*
|
|
1080
|
+
* Run a published workflow and stream its node output live from the agent
|
|
1074
1081
|
* host: iterate `textStream()` for tokens, or `await` the result for the
|
|
1075
|
-
* workflow's final output.
|
|
1082
|
+
* workflow's final output. Call it with no message to trigger a run with no input.
|
|
1076
1083
|
*
|
|
1077
1084
|
* @param workflowId - Numeric workflow id.
|
|
1078
|
-
* @param message -
|
|
1079
|
-
* @param options.model - Required model id (e.g. `"claude-sonnet-5.5"`).
|
|
1085
|
+
* @param message - The run's input; omit it for a run with no input.
|
|
1080
1086
|
* @param options.threadId - Continue an existing conversation; omit to start new.
|
|
1087
|
+
* @param options.model - Deprecated and ignored: each step uses the model set in the workflow.
|
|
1081
1088
|
* @returns A chat session — iterate it or `await` it for `content`, `threadId`, `runId`.
|
|
1082
1089
|
* @throws {ModusError} When no agent host is known for a custom `baseUrl`.
|
|
1083
1090
|
*
|
|
1084
1091
|
* @example
|
|
1085
1092
|
* ```ts
|
|
1086
|
-
* const { content } = await client.workflows.chat(workflowId
|
|
1087
|
-
*
|
|
1093
|
+
* const { content } = await client.workflows.chat(workflowId)
|
|
1094
|
+
* const digest = await client.workflows.chat(workflowId, "Run this week's digest")
|
|
1095
|
+
* console.log(content, digest.content)
|
|
1096
|
+
* ```
|
|
1097
|
+
*/
|
|
1098
|
+
chat(workflowId: number | string, message?: string, options?: WorkflowChatOptions): ChatSession;
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
/** Generated base for the consumption `context.items` resource. */
|
|
1102
|
+
declare class ContextItemsResourceBase {
|
|
1103
|
+
protected readonly http: HttpClient;
|
|
1104
|
+
protected readonly config: ModusConfig;
|
|
1105
|
+
/** @internal */
|
|
1106
|
+
constructor(http: HttpClient, config: ModusConfig);
|
|
1107
|
+
/**
|
|
1108
|
+
* Query context items with SQL.
|
|
1109
|
+
*
|
|
1110
|
+
* Runs one read-only SQL statement over the `context_items` table and returns its rows. The query
|
|
1111
|
+
* sees only the items you can read. A query that is not read-only or not valid returns 400; one
|
|
1112
|
+
* that runs past 20 s returns 422.
|
|
1113
|
+
*
|
|
1114
|
+
* **Requires:** `context:read`
|
|
1115
|
+
*
|
|
1116
|
+
* @param query - Request body; see `ContextItemsQuery`.
|
|
1117
|
+
*
|
|
1118
|
+
* @example
|
|
1119
|
+
* ```ts
|
|
1120
|
+
* const result = await modus.context.items.query({
|
|
1121
|
+
* sql: 'SELECT context_type, count(*) AS items FROM context_items GROUP BY context_type',
|
|
1088
1122
|
* })
|
|
1089
|
-
*
|
|
1123
|
+
* result.rows
|
|
1090
1124
|
* ```
|
|
1091
1125
|
*/
|
|
1092
|
-
|
|
1126
|
+
query(query: ContextItemsQuery): Promise<ContextItemsQueryResult>;
|
|
1093
1127
|
}
|
|
1094
1128
|
|
|
1095
1129
|
/**
|
|
@@ -1108,11 +1142,7 @@ declare class WorkflowsResource extends WorkflowsResourceBase {
|
|
|
1108
1142
|
* }
|
|
1109
1143
|
* ```
|
|
1110
1144
|
*/
|
|
1111
|
-
declare class ContextItemsResource {
|
|
1112
|
-
private readonly http;
|
|
1113
|
-
private readonly config;
|
|
1114
|
-
/** @internal */
|
|
1115
|
-
constructor(http: HttpClient, config: ModusConfig);
|
|
1145
|
+
declare class ContextItemsResource extends ContextItemsResourceBase {
|
|
1116
1146
|
/**
|
|
1117
1147
|
* List knowledge-base items.
|
|
1118
1148
|
*
|
|
@@ -1437,4 +1467,4 @@ declare class Modus extends ModusClientBase {
|
|
|
1437
1467
|
constructor(options?: ModusOptions);
|
|
1438
1468
|
}
|
|
1439
1469
|
|
|
1440
|
-
export { APIConnectionError, type ActiveConversationRun, type ActiveConversationRunStatus, type AgentRun, type AgentRunCreateRequest, type AgentRunListItem, type AgentRunStream, AgentWorkflowActionsResource, type ApprovalRequiredEvent, type ApprovalScope, type AssistantContentResetEvent, AuthenticationError, BadRequestError, type CancelRunRequest, type CancelledEvent, type ChatModel, type ChatOptions, type ChatResult, ChatSession, type ComposeSkillContextRequest, ConflictError, type Connection, type ConnectionSelection, ConnectionsResource, type ContentProjection, ContextItem, ContextItemLookupRow, ContextItemsResource, ContextResource, type ContextValueRow, Conversation, ConversationKind, ConversationListItem, type CreateAgentRunRequest, CustomContextItemsResource, type DoneEvent, type EditQueuedRunRequest, type ErrorEvent, type FollowUpRunRequest, type HttpIngestedDataRequest, type IngestedDataRequest, IngestedDataResource, type IngestedDataResponse, type IngestedDataResponseFormat, type IngestedDataUploadResult, InternalServerError, type InterruptRunRequest, type JsonObjectInput, Modus, ModusConfig, type ModusContextComposition, type ModusContextRequest, ModusConversationsResource, ModusError, ModusOptions, ModusResource, type ModusRunCreateRequest, NotFoundError, Page, PermissionDeniedError, RateLimitError, type RecordSuggestionEventRequest, type ResumeRunRequest, type RunAdmission, RunCancelledError, type RunEvent, type RunEventBase, type RunEventsPollResponse, type RunStatus, type RunTimeframe, Scope, ScopeConversationsResource, ScopesResource, type SkillContextComposition, type SkillRunCreateRequest, type SqlIngestedDataRequest, StreamTimeoutError, type StreamTimeoutEvent, type SuggestionEventSource, type SuggestionEventType, type SuggestionQuestion, SuggestionsResource, type TokenEvent, UnprocessableError, type UploadIngestedDataOptions, ValidationError, VariationView, Workflow, type WorkflowActionRequest, WorkflowRunsResource, WorkflowType, WorkflowsResource, components };
|
|
1470
|
+
export { APIConnectionError, type ActiveConversationRun, type ActiveConversationRunStatus, type AgentRun, type AgentRunCreateRequest, type AgentRunListItem, type AgentRunStream, AgentWorkflowActionsResource, type ApprovalRequiredEvent, type ApprovalScope, type AssistantContentResetEvent, AuthenticationError, BadRequestError, type CancelRunRequest, type CancelledEvent, type ChatModel, type ChatOptions, type ChatResult, ChatSession, type ComposeSkillContextRequest, ConflictError, type Connection, type ConnectionSelection, ConnectionsResource, type ContentProjection, ContextItem, ContextItemLookupRow, ContextItemsQuery, ContextItemsQueryResult, ContextItemsResource, ContextResource, type ContextValueRow, Conversation, ConversationKind, ConversationListItem, type CreateAgentRunRequest, CustomContextItemsResource, type DoneEvent, type EditQueuedRunRequest, type ErrorEvent, type FollowUpRunRequest, type HttpIngestedDataRequest, type IngestedDataRequest, IngestedDataResource, type IngestedDataResponse, type IngestedDataResponseFormat, type IngestedDataUploadResult, InternalServerError, type InterruptRunRequest, type JsonObjectInput, Modus, ModusConfig, type ModusContextComposition, type ModusContextRequest, ModusConversationsResource, ModusError, ModusOptions, ModusResource, type ModusRunCreateRequest, NotFoundError, Page, PermissionDeniedError, RateLimitError, type RecordSuggestionEventRequest, type ResumeRunRequest, type RunAdmission, RunCancelledError, type RunEvent, type RunEventBase, type RunEventsPollResponse, type RunStatus, type RunTimeframe, Scope, ScopeConversationsResource, ScopesResource, type SkillContextComposition, type SkillRunCreateRequest, type SqlIngestedDataRequest, StreamTimeoutError, type StreamTimeoutEvent, type SuggestionEventSource, type SuggestionEventType, type SuggestionQuestion, SuggestionsResource, type TokenEvent, UnprocessableError, type UploadIngestedDataOptions, ValidationError, VariationView, Workflow, type WorkflowActionRequest, type WorkflowChatOptions, WorkflowRunsResource, WorkflowType, WorkflowsResource, components };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { H as HttpClient, c as components, M as ModusConfig, P as Page, V as VariationView, S as Scope, a as ScopeConversationsResource, C as Conversation, b as ConversationKind, d as ConversationListItem, W as WorkflowType, e as Workflow, f as
|
|
2
|
-
export { A as Agent,
|
|
1
|
+
import { H as HttpClient, c as components, M as ModusConfig, P as Page, V as VariationView, S as Scope, a as ScopeConversationsResource, C as Conversation, b as ConversationKind, d as ConversationListItem, W as WorkflowType, e as Workflow, f as ContextItemsQuery, g as ContextItemsQueryResult, h as ContextItem, i as ContextItemLookupRow, j as CustomContextItemsResource, k as ModusClientBase, l as ModusOptions } from './_client-base-DvrAQWuU.js';
|
|
2
|
+
export { A as Agent, m as AgentType, B as BatchDeleteCustomContextItemsInput, n as BatchDeleteCustomContextItemsResult, o as ContextItemAccessUpdate, p as ContextItemAncestor, q as ContextItemDeletion, r as ContextItemMove, s as ContextType, t as CreateCustomContextItemInput, u as CreatedCustomContextItem, v as CustomAttributeInput, w as CustomContextItemDeletion, x as CustomContextItemKind, y as CustomContextItemRelationInput, z as Message, O as OPERATIONS, D as OperationId, E as OperationSpec, F as ScopeStatus, G as ScopeVariation, I as Skill, J as SkillStatus, K as SkillVariation, L as SupervisionView, U as UpdateContextItemAccessInput, N as UpdateCustomContextItemInput, Q as conversationScopeId, R as conversationSkillId, T as operations, X as paths } from './_client-base-DvrAQWuU.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Base class for all Modus SDK errors.
|
|
@@ -254,6 +254,13 @@ interface ChatOptions {
|
|
|
254
254
|
/** Continue this conversation; omit to start a new one. */
|
|
255
255
|
threadId?: string;
|
|
256
256
|
}
|
|
257
|
+
/** Options for `workflows.chat()`. A workflow's steps run with the models set in the workflow. */
|
|
258
|
+
interface WorkflowChatOptions {
|
|
259
|
+
/** @deprecated Ignored: each step of the workflow uses the model set in the workflow. */
|
|
260
|
+
model?: ChatModel;
|
|
261
|
+
/** Continue this conversation; omit to start a new one. */
|
|
262
|
+
threadId?: string;
|
|
263
|
+
}
|
|
257
264
|
interface ChatRequest {
|
|
258
265
|
readonly path: string;
|
|
259
266
|
readonly body: Record<string, unknown>;
|
|
@@ -356,7 +363,7 @@ type NewRunBody<T extends {
|
|
|
356
363
|
}> = Omit<T, 'sessionId'> & {
|
|
357
364
|
sessionId?: string;
|
|
358
365
|
};
|
|
359
|
-
type AgentRunCreateRequest =
|
|
366
|
+
type AgentRunCreateRequest = components['schemas']['AgentRunDto'];
|
|
360
367
|
type SkillRunCreateRequest = NewRunBody<components['schemas']['SkillRunDto']>;
|
|
361
368
|
type ModusRunCreateRequest = NewRunBody<components['schemas']['ModusRunDto']>;
|
|
362
369
|
type ResumeRunRequest = components['schemas']['ResumeRunDto'];
|
|
@@ -1070,26 +1077,53 @@ declare class WorkflowsResource extends WorkflowsResourceBase {
|
|
|
1070
1077
|
includeVariation?: boolean;
|
|
1071
1078
|
}): Promise<Workflow>;
|
|
1072
1079
|
/**
|
|
1073
|
-
*
|
|
1080
|
+
* Run a published workflow and stream its node output live from the agent
|
|
1074
1081
|
* host: iterate `textStream()` for tokens, or `await` the result for the
|
|
1075
|
-
* workflow's final output.
|
|
1082
|
+
* workflow's final output. Call it with no message to trigger a run with no input.
|
|
1076
1083
|
*
|
|
1077
1084
|
* @param workflowId - Numeric workflow id.
|
|
1078
|
-
* @param message -
|
|
1079
|
-
* @param options.model - Required model id (e.g. `"claude-sonnet-5.5"`).
|
|
1085
|
+
* @param message - The run's input; omit it for a run with no input.
|
|
1080
1086
|
* @param options.threadId - Continue an existing conversation; omit to start new.
|
|
1087
|
+
* @param options.model - Deprecated and ignored: each step uses the model set in the workflow.
|
|
1081
1088
|
* @returns A chat session — iterate it or `await` it for `content`, `threadId`, `runId`.
|
|
1082
1089
|
* @throws {ModusError} When no agent host is known for a custom `baseUrl`.
|
|
1083
1090
|
*
|
|
1084
1091
|
* @example
|
|
1085
1092
|
* ```ts
|
|
1086
|
-
* const { content } = await client.workflows.chat(workflowId
|
|
1087
|
-
*
|
|
1093
|
+
* const { content } = await client.workflows.chat(workflowId)
|
|
1094
|
+
* const digest = await client.workflows.chat(workflowId, "Run this week's digest")
|
|
1095
|
+
* console.log(content, digest.content)
|
|
1096
|
+
* ```
|
|
1097
|
+
*/
|
|
1098
|
+
chat(workflowId: number | string, message?: string, options?: WorkflowChatOptions): ChatSession;
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
/** Generated base for the consumption `context.items` resource. */
|
|
1102
|
+
declare class ContextItemsResourceBase {
|
|
1103
|
+
protected readonly http: HttpClient;
|
|
1104
|
+
protected readonly config: ModusConfig;
|
|
1105
|
+
/** @internal */
|
|
1106
|
+
constructor(http: HttpClient, config: ModusConfig);
|
|
1107
|
+
/**
|
|
1108
|
+
* Query context items with SQL.
|
|
1109
|
+
*
|
|
1110
|
+
* Runs one read-only SQL statement over the `context_items` table and returns its rows. The query
|
|
1111
|
+
* sees only the items you can read. A query that is not read-only or not valid returns 400; one
|
|
1112
|
+
* that runs past 20 s returns 422.
|
|
1113
|
+
*
|
|
1114
|
+
* **Requires:** `context:read`
|
|
1115
|
+
*
|
|
1116
|
+
* @param query - Request body; see `ContextItemsQuery`.
|
|
1117
|
+
*
|
|
1118
|
+
* @example
|
|
1119
|
+
* ```ts
|
|
1120
|
+
* const result = await modus.context.items.query({
|
|
1121
|
+
* sql: 'SELECT context_type, count(*) AS items FROM context_items GROUP BY context_type',
|
|
1088
1122
|
* })
|
|
1089
|
-
*
|
|
1123
|
+
* result.rows
|
|
1090
1124
|
* ```
|
|
1091
1125
|
*/
|
|
1092
|
-
|
|
1126
|
+
query(query: ContextItemsQuery): Promise<ContextItemsQueryResult>;
|
|
1093
1127
|
}
|
|
1094
1128
|
|
|
1095
1129
|
/**
|
|
@@ -1108,11 +1142,7 @@ declare class WorkflowsResource extends WorkflowsResourceBase {
|
|
|
1108
1142
|
* }
|
|
1109
1143
|
* ```
|
|
1110
1144
|
*/
|
|
1111
|
-
declare class ContextItemsResource {
|
|
1112
|
-
private readonly http;
|
|
1113
|
-
private readonly config;
|
|
1114
|
-
/** @internal */
|
|
1115
|
-
constructor(http: HttpClient, config: ModusConfig);
|
|
1145
|
+
declare class ContextItemsResource extends ContextItemsResourceBase {
|
|
1116
1146
|
/**
|
|
1117
1147
|
* List knowledge-base items.
|
|
1118
1148
|
*
|
|
@@ -1437,4 +1467,4 @@ declare class Modus extends ModusClientBase {
|
|
|
1437
1467
|
constructor(options?: ModusOptions);
|
|
1438
1468
|
}
|
|
1439
1469
|
|
|
1440
|
-
export { APIConnectionError, type ActiveConversationRun, type ActiveConversationRunStatus, type AgentRun, type AgentRunCreateRequest, type AgentRunListItem, type AgentRunStream, AgentWorkflowActionsResource, type ApprovalRequiredEvent, type ApprovalScope, type AssistantContentResetEvent, AuthenticationError, BadRequestError, type CancelRunRequest, type CancelledEvent, type ChatModel, type ChatOptions, type ChatResult, ChatSession, type ComposeSkillContextRequest, ConflictError, type Connection, type ConnectionSelection, ConnectionsResource, type ContentProjection, ContextItem, ContextItemLookupRow, ContextItemsResource, ContextResource, type ContextValueRow, Conversation, ConversationKind, ConversationListItem, type CreateAgentRunRequest, CustomContextItemsResource, type DoneEvent, type EditQueuedRunRequest, type ErrorEvent, type FollowUpRunRequest, type HttpIngestedDataRequest, type IngestedDataRequest, IngestedDataResource, type IngestedDataResponse, type IngestedDataResponseFormat, type IngestedDataUploadResult, InternalServerError, type InterruptRunRequest, type JsonObjectInput, Modus, ModusConfig, type ModusContextComposition, type ModusContextRequest, ModusConversationsResource, ModusError, ModusOptions, ModusResource, type ModusRunCreateRequest, NotFoundError, Page, PermissionDeniedError, RateLimitError, type RecordSuggestionEventRequest, type ResumeRunRequest, type RunAdmission, RunCancelledError, type RunEvent, type RunEventBase, type RunEventsPollResponse, type RunStatus, type RunTimeframe, Scope, ScopeConversationsResource, ScopesResource, type SkillContextComposition, type SkillRunCreateRequest, type SqlIngestedDataRequest, StreamTimeoutError, type StreamTimeoutEvent, type SuggestionEventSource, type SuggestionEventType, type SuggestionQuestion, SuggestionsResource, type TokenEvent, UnprocessableError, type UploadIngestedDataOptions, ValidationError, VariationView, Workflow, type WorkflowActionRequest, WorkflowRunsResource, WorkflowType, WorkflowsResource, components };
|
|
1470
|
+
export { APIConnectionError, type ActiveConversationRun, type ActiveConversationRunStatus, type AgentRun, type AgentRunCreateRequest, type AgentRunListItem, type AgentRunStream, AgentWorkflowActionsResource, type ApprovalRequiredEvent, type ApprovalScope, type AssistantContentResetEvent, AuthenticationError, BadRequestError, type CancelRunRequest, type CancelledEvent, type ChatModel, type ChatOptions, type ChatResult, ChatSession, type ComposeSkillContextRequest, ConflictError, type Connection, type ConnectionSelection, ConnectionsResource, type ContentProjection, ContextItem, ContextItemLookupRow, ContextItemsQuery, ContextItemsQueryResult, ContextItemsResource, ContextResource, type ContextValueRow, Conversation, ConversationKind, ConversationListItem, type CreateAgentRunRequest, CustomContextItemsResource, type DoneEvent, type EditQueuedRunRequest, type ErrorEvent, type FollowUpRunRequest, type HttpIngestedDataRequest, type IngestedDataRequest, IngestedDataResource, type IngestedDataResponse, type IngestedDataResponseFormat, type IngestedDataUploadResult, InternalServerError, type InterruptRunRequest, type JsonObjectInput, Modus, ModusConfig, type ModusContextComposition, type ModusContextRequest, ModusConversationsResource, ModusError, ModusOptions, ModusResource, type ModusRunCreateRequest, NotFoundError, Page, PermissionDeniedError, RateLimitError, type RecordSuggestionEventRequest, type ResumeRunRequest, type RunAdmission, RunCancelledError, type RunEvent, type RunEventBase, type RunEventsPollResponse, type RunStatus, type RunTimeframe, Scope, ScopeConversationsResource, ScopesResource, type SkillContextComposition, type SkillRunCreateRequest, type SqlIngestedDataRequest, StreamTimeoutError, type StreamTimeoutEvent, type SuggestionEventSource, type SuggestionEventType, type SuggestionQuestion, SuggestionsResource, type TokenEvent, UnprocessableError, type UploadIngestedDataOptions, ValidationError, VariationView, Workflow, type WorkflowActionRequest, type WorkflowChatOptions, WorkflowRunsResource, WorkflowType, WorkflowsResource, components };
|
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
validateChatModel,
|
|
32
32
|
validateId,
|
|
33
33
|
validatePageSize
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-3CKUUDEJ.js";
|
|
35
35
|
|
|
36
36
|
// src/_agent_run_request.ts
|
|
37
37
|
import { randomUUID } from "crypto";
|
|
@@ -332,14 +332,15 @@ function startChat(http, config, target, message, options) {
|
|
|
332
332
|
}
|
|
333
333
|
function chatRequest(config, target, message, options) {
|
|
334
334
|
if (target.kind !== "modus") validateId(target.id, `${target.kind.slice(0, -1)}_id`);
|
|
335
|
-
|
|
335
|
+
const runsWithOwnModels = target.kind === "workflows";
|
|
336
|
+
if (!runsWithOwnModels) validateChatModel(options.model);
|
|
336
337
|
const baseUrl = requireAgentHost(config);
|
|
337
338
|
const sessionId = resolveAgentRunSessionId(effectiveThreadId(options.threadId));
|
|
338
339
|
return {
|
|
339
340
|
path: runsPath(target),
|
|
340
341
|
body: {
|
|
341
342
|
message,
|
|
342
|
-
config: { model: options.model },
|
|
343
|
+
...runsWithOwnModels ? {} : { config: { model: options.model } },
|
|
343
344
|
sessionId,
|
|
344
345
|
...config.organizationId !== void 0 ? { organizationId: config.organizationId } : {}
|
|
345
346
|
},
|
|
@@ -938,26 +939,25 @@ var WorkflowsResource = class extends WorkflowsResourceBase {
|
|
|
938
939
|
return parseWorkflow(data);
|
|
939
940
|
}
|
|
940
941
|
/**
|
|
941
|
-
*
|
|
942
|
+
* Run a published workflow and stream its node output live from the agent
|
|
942
943
|
* host: iterate `textStream()` for tokens, or `await` the result for the
|
|
943
|
-
* workflow's final output.
|
|
944
|
+
* workflow's final output. Call it with no message to trigger a run with no input.
|
|
944
945
|
*
|
|
945
946
|
* @param workflowId - Numeric workflow id.
|
|
946
|
-
* @param message -
|
|
947
|
-
* @param options.model - Required model id (e.g. `"claude-sonnet-5.5"`).
|
|
947
|
+
* @param message - The run's input; omit it for a run with no input.
|
|
948
948
|
* @param options.threadId - Continue an existing conversation; omit to start new.
|
|
949
|
+
* @param options.model - Deprecated and ignored: each step uses the model set in the workflow.
|
|
949
950
|
* @returns A chat session — iterate it or `await` it for `content`, `threadId`, `runId`.
|
|
950
951
|
* @throws {ModusError} When no agent host is known for a custom `baseUrl`.
|
|
951
952
|
*
|
|
952
953
|
* @example
|
|
953
954
|
* ```ts
|
|
954
|
-
* const { content } = await client.workflows.chat(workflowId
|
|
955
|
-
*
|
|
956
|
-
*
|
|
957
|
-
* console.log(content)
|
|
955
|
+
* const { content } = await client.workflows.chat(workflowId)
|
|
956
|
+
* const digest = await client.workflows.chat(workflowId, "Run this week's digest")
|
|
957
|
+
* console.log(content, digest.content)
|
|
958
958
|
* ```
|
|
959
959
|
*/
|
|
960
|
-
chat(workflowId, message, options) {
|
|
960
|
+
chat(workflowId, message = "", options = {}) {
|
|
961
961
|
return startChat(this.http, this.config, { kind: "workflows", id: workflowId }, message, options);
|
|
962
962
|
}
|
|
963
963
|
};
|
|
@@ -1080,6 +1080,40 @@ var ConnectionsResource = class extends ConnectionsResourceBase {
|
|
|
1080
1080
|
}
|
|
1081
1081
|
};
|
|
1082
1082
|
|
|
1083
|
+
// src/_generated/resources/consumption/context/items.ts
|
|
1084
|
+
var ContextItemsResourceBase = class {
|
|
1085
|
+
/** @internal */
|
|
1086
|
+
constructor(http, config) {
|
|
1087
|
+
this.http = http;
|
|
1088
|
+
this.config = config;
|
|
1089
|
+
}
|
|
1090
|
+
/**
|
|
1091
|
+
* Query context items with SQL.
|
|
1092
|
+
*
|
|
1093
|
+
* Runs one read-only SQL statement over the `context_items` table and returns its rows. The query
|
|
1094
|
+
* sees only the items you can read. A query that is not read-only or not valid returns 400; one
|
|
1095
|
+
* that runs past 20 s returns 422.
|
|
1096
|
+
*
|
|
1097
|
+
* **Requires:** `context:read`
|
|
1098
|
+
*
|
|
1099
|
+
* @param query - Request body; see `ContextItemsQuery`.
|
|
1100
|
+
*
|
|
1101
|
+
* @example
|
|
1102
|
+
* ```ts
|
|
1103
|
+
* const result = await modus.context.items.query({
|
|
1104
|
+
* sql: 'SELECT context_type, count(*) AS items FROM context_items GROUP BY context_type',
|
|
1105
|
+
* })
|
|
1106
|
+
* result.rows
|
|
1107
|
+
* ```
|
|
1108
|
+
*/
|
|
1109
|
+
async query(query) {
|
|
1110
|
+
const data = await invokeWithRetry(this.config, this.http, "ContextItemsQueryController_query", {
|
|
1111
|
+
jsonBody: omitUndefined(query)
|
|
1112
|
+
});
|
|
1113
|
+
return data;
|
|
1114
|
+
}
|
|
1115
|
+
};
|
|
1116
|
+
|
|
1083
1117
|
// src/resources/context/items.ts
|
|
1084
1118
|
function contextListParams(pageSize, pageToken, filters = {}) {
|
|
1085
1119
|
const extra = {};
|
|
@@ -1106,12 +1140,7 @@ function parseLookupResponse(raw) {
|
|
|
1106
1140
|
if (item === null || item === void 0) return void 0;
|
|
1107
1141
|
return item;
|
|
1108
1142
|
}
|
|
1109
|
-
var ContextItemsResource = class {
|
|
1110
|
-
/** @internal */
|
|
1111
|
-
constructor(http, config) {
|
|
1112
|
-
this.http = http;
|
|
1113
|
-
this.config = config;
|
|
1114
|
-
}
|
|
1143
|
+
var ContextItemsResource = class extends ContextItemsResourceBase {
|
|
1115
1144
|
/**
|
|
1116
1145
|
* List knowledge-base items.
|
|
1117
1146
|
*
|