@getmodus/sdk 0.11.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/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 ContextItemsQuery, g as ContextItemsQueryResult, h as ContextItem, i as ContextItemLookupRow, j as CustomContextItemsResource, k as ModusClientBase, l as ModusOptions } from './_client-base-DdnxB9JA.cjs';
2
- export { A as Agent, m as AgentType, n as ContextItemAccessUpdate, o as ContextItemAncestor, p as ContextItemDeletion, q as ContextItemMove, r as ContextType, s as CreateCustomContextItemInput, t as CreatedCustomContextItem, u as CustomAttributeInput, v as CustomContextItemDeletion, w as CustomContextItemKind, x as CustomContextItemRelationInput, y as Message, O as OPERATIONS, z as OperationId, B as OperationSpec, D as ScopeStatus, E as ScopeVariation, F as Skill, G as SkillStatus, I as SkillVariation, J as SupervisionView, U as UpdateContextItemAccessInput, K as UpdateCustomContextItemInput, L as conversationScopeId, N as conversationSkillId, Q as operations, R as paths } from './_client-base-DdnxB9JA.cjs';
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 = NewRunBody<components['schemas']['AgentRunDto']>;
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,25 @@ declare class WorkflowsResource extends WorkflowsResourceBase {
1070
1077
  includeVariation?: boolean;
1071
1078
  }): Promise<Workflow>;
1072
1079
  /**
1073
- * Chat with a published workflow. Node output streams live from the agent
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 - User message text.
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, 'Run this week\'s digest', {
1087
- * model: 'claude-sonnet-5.5',
1088
- * })
1089
- * console.log(content)
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)
1090
1096
  * ```
1091
1097
  */
1092
- chat(workflowId: number | string, message: string, options: ChatOptions): ChatSession;
1098
+ chat(workflowId: number | string, message?: string, options?: WorkflowChatOptions): ChatSession;
1093
1099
  }
1094
1100
 
1095
1101
  /** Generated base for the consumption `context.items` resource. */
@@ -1461,4 +1467,4 @@ declare class Modus extends ModusClientBase {
1461
1467
  constructor(options?: ModusOptions);
1462
1468
  }
1463
1469
 
1464
- 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, 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 ContextItemsQuery, g as ContextItemsQueryResult, h as ContextItem, i as ContextItemLookupRow, j as CustomContextItemsResource, k as ModusClientBase, l as ModusOptions } from './_client-base-DdnxB9JA.js';
2
- export { A as Agent, m as AgentType, n as ContextItemAccessUpdate, o as ContextItemAncestor, p as ContextItemDeletion, q as ContextItemMove, r as ContextType, s as CreateCustomContextItemInput, t as CreatedCustomContextItem, u as CustomAttributeInput, v as CustomContextItemDeletion, w as CustomContextItemKind, x as CustomContextItemRelationInput, y as Message, O as OPERATIONS, z as OperationId, B as OperationSpec, D as ScopeStatus, E as ScopeVariation, F as Skill, G as SkillStatus, I as SkillVariation, J as SupervisionView, U as UpdateContextItemAccessInput, K as UpdateCustomContextItemInput, L as conversationScopeId, N as conversationSkillId, Q as operations, R as paths } from './_client-base-DdnxB9JA.js';
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 = NewRunBody<components['schemas']['AgentRunDto']>;
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,25 @@ declare class WorkflowsResource extends WorkflowsResourceBase {
1070
1077
  includeVariation?: boolean;
1071
1078
  }): Promise<Workflow>;
1072
1079
  /**
1073
- * Chat with a published workflow. Node output streams live from the agent
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 - User message text.
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, 'Run this week\'s digest', {
1087
- * model: 'claude-sonnet-5.5',
1088
- * })
1089
- * console.log(content)
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)
1090
1096
  * ```
1091
1097
  */
1092
- chat(workflowId: number | string, message: string, options: ChatOptions): ChatSession;
1098
+ chat(workflowId: number | string, message?: string, options?: WorkflowChatOptions): ChatSession;
1093
1099
  }
1094
1100
 
1095
1101
  /** Generated base for the consumption `context.items` resource. */
@@ -1461,4 +1467,4 @@ declare class Modus extends ModusClientBase {
1461
1467
  constructor(options?: ModusOptions);
1462
1468
  }
1463
1469
 
1464
- 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, 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-JVTQBBMZ.js";
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
- validateChatModel(options.model);
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
- * Chat with a published workflow. Node output streams live from the agent
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 - User message text.
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, 'Run this week\'s digest', {
955
- * model: 'claude-sonnet-5.5',
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
  };