@getmodus/sdk 0.2.3 → 0.3.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 { 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-BP2sI3Q5.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-BP2sI3Q5.cjs';
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-GNBMPpyr.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-GNBMPpyr.cjs';
3
3
 
4
4
  declare class ModusError extends Error {
5
5
  readonly statusCode?: number;
@@ -187,12 +187,8 @@ type ModusContextRequest = components['schemas']['ModusContextRequestDto'];
187
187
  type SuggestionQuestion = components['schemas']['SuggestionQuestionDto'];
188
188
  type SuggestionEventType = components['schemas']['SuggestionEventType'];
189
189
  type SuggestionEventSource = components['schemas']['SuggestionEventSource'];
190
- /** Wire format (snake_case) plus camelCase aliases for DX. */
191
- type RecordSuggestionEventRequest = components['schemas']['RecordSuggestionEventDto'] & {
192
- eventType?: components['schemas']['SuggestionEventType'];
193
- skillId?: number;
194
- threadId?: string;
195
- };
190
+ /** Request body for recording a suggestion event (camelCase, matches the wire). */
191
+ type RecordSuggestionEventRequest = components['schemas']['RecordSuggestionEventDto'];
196
192
 
197
193
  declare class AgentWorkflowActionsResource {
198
194
  private readonly http;
@@ -216,24 +212,15 @@ declare class WorkflowsResource {
216
212
  pageSize?: number;
217
213
  pageToken?: string;
218
214
  search?: string;
219
- type?: AgentType;
215
+ type?: WorkflowType;
220
216
  view?: VariationView;
221
217
  includeVariation?: boolean;
222
- }): Promise<Page<Agent>>;
218
+ }): Promise<Page<Workflow>>;
223
219
  private listPage;
224
220
  get(workflowId: number | string, options?: {
225
221
  view?: VariationView;
226
222
  includeVariation?: boolean;
227
- }): Promise<Agent>;
228
- chat(workflowId: number | string, message: string, options: {
229
- model: ChatModel;
230
- threadId?: string;
231
- }): Promise<ChatResult>;
232
- chatStream(workflowId: number | string, message: string, options: {
233
- model: ChatModel;
234
- threadId?: string;
235
- version?: string;
236
- }): ChatStream;
223
+ }): Promise<Workflow>;
237
224
  }
238
225
 
239
226
  declare class ConnectionsResource {
@@ -334,11 +321,11 @@ declare class ScopesResource {
334
321
  search?: string;
335
322
  view?: VariationView;
336
323
  managerId?: number;
337
- }): Promise<Page<Skill>>;
324
+ }): Promise<Page<Scope>>;
338
325
  private listPage;
339
326
  get(scopeId: number | string, options?: {
340
327
  view?: VariationView;
341
- }): Promise<Skill>;
328
+ }): Promise<Scope>;
342
329
  getContext(scopeId: number | string, message: string, options?: {
343
330
  limit?: number;
344
331
  }): Promise<SkillContextComposition>;
@@ -360,8 +347,8 @@ declare class SuggestionsResource {
360
347
  list(options?: {
361
348
  pageSize?: number;
362
349
  pageToken?: string;
363
- skillId?: number;
364
- skillIds?: readonly number[];
350
+ scopeId?: number;
351
+ scopeIds?: readonly number[];
365
352
  }): Promise<Page<SuggestionQuestion>>;
366
353
  private listPage;
367
354
  recordEvent(id: string, event: RecordSuggestionEventRequest): Promise<void>;
@@ -378,4 +365,4 @@ declare class Modus extends ModusClientBase {
378
365
  constructor(options?: ModusOptions);
379
366
  }
380
367
 
381
- 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 };
368
+ export { APIConnectionError, type AgentRun, type AgentRunCreateRequest, type AgentRunListItem, type AgentRunStream, type ApprovalScope, type AssistantContentResetEvent, AuthenticationError, type CancelRunRequest, type CancelledEvent, type ChatModel, type ChatRequest, type ChatResult, ChatStream, type ComposeSkillContextRequest, ConflictError, type Connection, ContextItem, ContextItemLookupRow, type ContextValueRow, Conversation, ConversationKind, ConversationListItem, type CreateAgentRunRequest, type DoneEvent, type EditQueuedRunRequest, type ErrorEvent, InternalServerError, type InterruptRunRequest, Modus, type ModusContextComposition, type ModusContextRequest, ModusError, ModusOptions, type ModusRunCreateRequest, NotFoundError, Page, PermissionDeniedError, RateLimitError, type RecordSuggestionEventRequest, type ResumeRunRequest, RunCancelledError, type RunEvent, type RunStatus, type RunTimeframe, Scope, type SkillContextComposition, type SkillRunCreateRequest, StreamTimeoutError, type StreamTimeoutEvent, type SuggestionEventSource, type SuggestionEventType, type SuggestionQuestion, type TokenEvent, UnprocessableError, ValidationError, VariationView, Workflow, type WorkflowActionRequest, WorkflowType, components };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
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-BP2sI3Q5.js';
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-BP2sI3Q5.js';
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-GNBMPpyr.js';
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-GNBMPpyr.js';
3
3
 
4
4
  declare class ModusError extends Error {
5
5
  readonly statusCode?: number;
@@ -187,12 +187,8 @@ type ModusContextRequest = components['schemas']['ModusContextRequestDto'];
187
187
  type SuggestionQuestion = components['schemas']['SuggestionQuestionDto'];
188
188
  type SuggestionEventType = components['schemas']['SuggestionEventType'];
189
189
  type SuggestionEventSource = components['schemas']['SuggestionEventSource'];
190
- /** Wire format (snake_case) plus camelCase aliases for DX. */
191
- type RecordSuggestionEventRequest = components['schemas']['RecordSuggestionEventDto'] & {
192
- eventType?: components['schemas']['SuggestionEventType'];
193
- skillId?: number;
194
- threadId?: string;
195
- };
190
+ /** Request body for recording a suggestion event (camelCase, matches the wire). */
191
+ type RecordSuggestionEventRequest = components['schemas']['RecordSuggestionEventDto'];
196
192
 
197
193
  declare class AgentWorkflowActionsResource {
198
194
  private readonly http;
@@ -216,24 +212,15 @@ declare class WorkflowsResource {
216
212
  pageSize?: number;
217
213
  pageToken?: string;
218
214
  search?: string;
219
- type?: AgentType;
215
+ type?: WorkflowType;
220
216
  view?: VariationView;
221
217
  includeVariation?: boolean;
222
- }): Promise<Page<Agent>>;
218
+ }): Promise<Page<Workflow>>;
223
219
  private listPage;
224
220
  get(workflowId: number | string, options?: {
225
221
  view?: VariationView;
226
222
  includeVariation?: boolean;
227
- }): Promise<Agent>;
228
- chat(workflowId: number | string, message: string, options: {
229
- model: ChatModel;
230
- threadId?: string;
231
- }): Promise<ChatResult>;
232
- chatStream(workflowId: number | string, message: string, options: {
233
- model: ChatModel;
234
- threadId?: string;
235
- version?: string;
236
- }): ChatStream;
223
+ }): Promise<Workflow>;
237
224
  }
238
225
 
239
226
  declare class ConnectionsResource {
@@ -334,11 +321,11 @@ declare class ScopesResource {
334
321
  search?: string;
335
322
  view?: VariationView;
336
323
  managerId?: number;
337
- }): Promise<Page<Skill>>;
324
+ }): Promise<Page<Scope>>;
338
325
  private listPage;
339
326
  get(scopeId: number | string, options?: {
340
327
  view?: VariationView;
341
- }): Promise<Skill>;
328
+ }): Promise<Scope>;
342
329
  getContext(scopeId: number | string, message: string, options?: {
343
330
  limit?: number;
344
331
  }): Promise<SkillContextComposition>;
@@ -360,8 +347,8 @@ declare class SuggestionsResource {
360
347
  list(options?: {
361
348
  pageSize?: number;
362
349
  pageToken?: string;
363
- skillId?: number;
364
- skillIds?: readonly number[];
350
+ scopeId?: number;
351
+ scopeIds?: readonly number[];
365
352
  }): Promise<Page<SuggestionQuestion>>;
366
353
  private listPage;
367
354
  recordEvent(id: string, event: RecordSuggestionEventRequest): Promise<void>;
@@ -378,4 +365,4 @@ declare class Modus extends ModusClientBase {
378
365
  constructor(options?: ModusOptions);
379
366
  }
380
367
 
381
- 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 };
368
+ export { APIConnectionError, type AgentRun, type AgentRunCreateRequest, type AgentRunListItem, type AgentRunStream, type ApprovalScope, type AssistantContentResetEvent, AuthenticationError, type CancelRunRequest, type CancelledEvent, type ChatModel, type ChatRequest, type ChatResult, ChatStream, type ComposeSkillContextRequest, ConflictError, type Connection, ContextItem, ContextItemLookupRow, type ContextValueRow, Conversation, ConversationKind, ConversationListItem, type CreateAgentRunRequest, type DoneEvent, type EditQueuedRunRequest, type ErrorEvent, InternalServerError, type InterruptRunRequest, Modus, type ModusContextComposition, type ModusContextRequest, ModusError, ModusOptions, type ModusRunCreateRequest, NotFoundError, Page, PermissionDeniedError, RateLimitError, type RecordSuggestionEventRequest, type ResumeRunRequest, RunCancelledError, type RunEvent, type RunStatus, type RunTimeframe, Scope, type SkillContextComposition, type SkillRunCreateRequest, StreamTimeoutError, type StreamTimeoutEvent, type SuggestionEventSource, type SuggestionEventType, type SuggestionQuestion, type TokenEvent, UnprocessableError, ValidationError, VariationView, Workflow, type WorkflowActionRequest, WorkflowType, components };
package/dist/index.js CHANGED
@@ -29,7 +29,7 @@ import {
29
29
  validateChatModel,
30
30
  validateId,
31
31
  validatePageSize
32
- } from "./chunk-ZFZQ2UMA.js";
32
+ } from "./chunk-D3NU2M6B.js";
33
33
 
34
34
  // src/_agent_run_request.ts
35
35
  import { randomUUID } from "crypto";
@@ -269,18 +269,22 @@ function modusChatStreamSession(http, config, message, options) {
269
269
  );
270
270
  }
271
271
 
272
- // src/types/agents.ts
273
- var AgentType = {
272
+ // src/types/workflows.ts
273
+ var WorkflowType = {
274
274
  task: "task",
275
275
  workflow: "workflow"
276
276
  };
277
+ var AgentType = WorkflowType;
277
278
 
278
279
  // src/types/conversations.ts
280
+ function conversationScopeId(item) {
281
+ return item.scopeId === 0 ? void 0 : item.scopeId;
282
+ }
279
283
  function conversationSkillId(item) {
280
- return item.skillId === 0 ? void 0 : item.skillId;
284
+ return item.scopeId;
281
285
  }
282
286
 
283
- // src/resources/agents/runs.ts
287
+ // src/resources/workflows/runs.ts
284
288
  import { randomUUID as randomUUID2 } from "crypto";
285
289
  var RUNS_MAX_PAGE_SIZE = 100;
286
290
  function runsListParams(pageSize, pageToken, status, timeframe, approvalScope, search) {
@@ -488,7 +492,7 @@ var WorkflowRunsResource = class {
488
492
  }
489
493
  };
490
494
 
491
- // src/resources/agents/workflow-actions.ts
495
+ // src/resources/workflows/workflow-actions.ts
492
496
  import { randomUUID as randomUUID3 } from "crypto";
493
497
  function randomRunId2() {
494
498
  return randomUUID3();
@@ -520,7 +524,7 @@ var AgentWorkflowActionsResource = class {
520
524
  }
521
525
  };
522
526
 
523
- // src/resources/agents.ts
527
+ // src/resources/workflows.ts
524
528
  function workflowsListParams(pageSize, pageToken, search, type, view, includeVariation) {
525
529
  const extra = {};
526
530
  if (search !== void 0) extra.search = search;
@@ -566,7 +570,7 @@ var WorkflowsResource = class {
566
570
  );
567
571
  return buildAipPage(
568
572
  data,
569
- "agents",
573
+ "workflows",
570
574
  parseWorkflow,
571
575
  (token) => this.listPage(pageSize, token, search, type, view, includeVariation)
572
576
  );
@@ -584,12 +588,6 @@ var WorkflowsResource = class {
584
588
  });
585
589
  return parseWorkflow(data);
586
590
  }
587
- chat(workflowId, message, options) {
588
- return chatBuffered(this.http, "workflows", workflowId, message, options);
589
- }
590
- chatStream(workflowId, message, options) {
591
- return chatStreamSession(this.http, this.config, "workflows", workflowId, message, options);
592
- }
593
591
  };
594
592
 
595
593
  // src/resources/connections.ts
@@ -740,7 +738,7 @@ var ContextResource = class {
740
738
  };
741
739
 
742
740
  // src/resources/modus/conversations.ts
743
- var ALLOWED_KINDS = /* @__PURE__ */ new Set(["all", "modus", "skills"]);
741
+ var ALLOWED_KINDS = /* @__PURE__ */ new Set(["all", "modus", "scopes"]);
744
742
  function listParams(pageSize, pageToken, kind) {
745
743
  if (kind !== void 0 && !ALLOWED_KINDS.has(kind)) {
746
744
  throw new Error(
@@ -810,7 +808,7 @@ var ModusResource = class {
810
808
  }
811
809
  };
812
810
 
813
- // src/resources/skills.ts
811
+ // src/resources/scopes.ts
814
812
  function scopesListParams(pageSize, pageToken, search, view, managerId) {
815
813
  const extra = {};
816
814
  if (search !== void 0) extra.search = search;
@@ -848,7 +846,7 @@ var ScopesResource = class {
848
846
  );
849
847
  return buildAipPage(
850
848
  data,
851
- "skills",
849
+ "scopes",
852
850
  parseScope,
853
851
  (token) => this.listPage(pageSize, token, search, view, managerId)
854
852
  );
@@ -878,24 +876,6 @@ var ScopesResource = class {
878
876
  }
879
877
  };
880
878
 
881
- // src/types/suggestions.ts
882
- function normalizeRecordSuggestionEvent(event) {
883
- const eventType = event.event_type ?? event.eventType;
884
- if (eventType === void 0) {
885
- throw new Error("recordEvent requires event_type (or eventType)");
886
- }
887
- const body = {
888
- event_type: eventType,
889
- source: event.source
890
- };
891
- const skillId = event.skill_id ?? event.skillId;
892
- if (skillId !== void 0) body.skill_id = skillId;
893
- const threadId = event.thread_id ?? event.threadId;
894
- if (threadId !== void 0) body.thread_id = threadId;
895
- if (event.metadata !== void 0) body.metadata = event.metadata;
896
- return body;
897
- }
898
-
899
879
  // src/resources/suggestions.ts
900
880
  var DEFAULT_SUGGESTIONS_PAGE_SIZE = 5;
901
881
  var MAX_SUGGESTIONS_PAGE_SIZE = 12;
@@ -906,8 +886,8 @@ function suggestionListParams(options) {
906
886
  return {
907
887
  pageSize: options.pageSize,
908
888
  pageToken: options.pageToken,
909
- skill_id: options.skillId,
910
- skill_ids: options.skillIds?.join(",")
889
+ scopeId: options.scopeId,
890
+ scopeIds: options.scopeIds?.join(",")
911
891
  };
912
892
  }
913
893
  var SuggestionsResource = class {
@@ -918,26 +898,26 @@ var SuggestionsResource = class {
918
898
  list(options = {}) {
919
899
  const pageSize = options.pageSize ?? DEFAULT_SUGGESTIONS_PAGE_SIZE;
920
900
  validatePageSize(pageSize, MAX_SUGGESTIONS_PAGE_SIZE);
921
- return this.listPage(pageSize, options.pageToken, options.skillId, options.skillIds);
901
+ return this.listPage(pageSize, options.pageToken, options.scopeId, options.scopeIds);
922
902
  }
923
- async listPage(pageSize, pageToken, skillId, skillIds) {
903
+ async listPage(pageSize, pageToken, scopeId, scopeIds) {
924
904
  const data = asRecord(
925
905
  await invokeWithRetry(this.config, this.http, "SuggestionsController_listApproved", {
926
- query: suggestionListParams({ pageSize, pageToken, skillId, skillIds })
906
+ query: suggestionListParams({ pageSize, pageToken, scopeId, scopeIds })
927
907
  })
928
908
  );
929
909
  return buildAipPage(
930
910
  data,
931
911
  "suggestions",
932
912
  parseSuggestion,
933
- (token) => this.listPage(pageSize, token, skillId, skillIds)
913
+ (token) => this.listPage(pageSize, token, scopeId, scopeIds)
934
914
  );
935
915
  }
936
916
  async recordEvent(id, event) {
937
917
  validateId(id, "id");
938
918
  await invokeWithRetry(this.config, this.http, "SuggestionsController_recordEvent", {
939
919
  pathParams: { id },
940
- jsonBody: normalizeRecordSuggestionEvent(event)
920
+ jsonBody: event
941
921
  });
942
922
  }
943
923
  };
@@ -972,6 +952,8 @@ export {
972
952
  StreamTimeoutError,
973
953
  UnprocessableError,
974
954
  ValidationError,
955
+ WorkflowType,
956
+ conversationScopeId,
975
957
  conversationSkillId
976
958
  };
977
959
  //# sourceMappingURL=index.js.map