orchestrator-client 5.8.3 → 5.9.2

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.cjs CHANGED
@@ -148,6 +148,27 @@ function buildPagination(data) {
148
148
  hasPrev: p.hasPrev ?? false
149
149
  };
150
150
  }
151
+ function buildSkillMapping(m) {
152
+ return {
153
+ id: m.id ?? 0,
154
+ workflowId: m.workflowId ?? m.workflow_id ?? "",
155
+ variant: m.variant ?? null,
156
+ requiredTool: m.requiredTool ?? m.required_tool ?? null
157
+ };
158
+ }
159
+ function buildSkill(s) {
160
+ return {
161
+ id: s.id ?? 0,
162
+ name: s.name ?? "",
163
+ description: s.description ?? "",
164
+ content: s.content ?? "",
165
+ createdAt: s.createdAt ?? s.created_at ?? "",
166
+ updatedAt: s.updatedAt ?? s.updated_at ?? "",
167
+ mappings: (s.mappings ?? []).map(
168
+ (m) => buildSkillMapping(m)
169
+ )
170
+ };
171
+ }
151
172
  function buildTaskSummary(t) {
152
173
  return {
153
174
  id: t.id ?? "",
@@ -161,11 +182,23 @@ function buildTaskSummary(t) {
161
182
  approvalReason: t.approvalReason ?? "",
162
183
  ticketId: t.ticketId ?? null,
163
184
  availableTools: t.availableTools ?? null,
185
+ skills: t.skills ?? null,
164
186
  insight: t.insight ?? null,
165
187
  insightLocalized: t.insightLocalized ?? null,
166
188
  createdAt: t.createdAt ?? "",
167
189
  updatedAt: t.updatedAt ?? "",
168
- pendingTranslationsForLocales: t.pendingTranslationsForLocales ?? null
190
+ pendingTranslationsForLocales: t.pendingTranslationsForLocales ?? null,
191
+ workflowData: t.workflowData ?? null
192
+ };
193
+ }
194
+ function buildVsaTaskList(data) {
195
+ const raw = Array.isArray(data) ? data : data.tasks ?? [];
196
+ const tasks = raw.map(
197
+ (item) => typeof item === "string" ? { id: item } : buildTaskSummary(item)
198
+ );
199
+ return {
200
+ tasks,
201
+ pagination: buildPagination(data ?? {})
169
202
  };
170
203
  }
171
204
  function parseApiErrorBody(body, fallbackMessage) {
@@ -763,6 +796,7 @@ var OrchestratorAsync = class {
763
796
  title: params.title,
764
797
  agent_model_id: params.agentModelId,
765
798
  orchestrator_model_id: params.orchestratorModelId,
799
+ available_tools: params.availableTools,
766
800
  attachment_ids: params.attachmentIds,
767
801
  options: params.options
768
802
  };
@@ -839,10 +873,7 @@ var OrchestratorAsync = class {
839
873
  limit: params?.limit,
840
874
  offset: params?.offset
841
875
  });
842
- const tasks = (data.tasks ?? []).map(
843
- buildTaskSummary
844
- );
845
- return { tasks, pagination: buildPagination(data) };
876
+ return buildVsaTaskList(data);
846
877
  }
847
878
  async searchVSATasks(userId, query, limit) {
848
879
  const data = await this._get("/task/vsa/search", {
@@ -850,10 +881,7 @@ var OrchestratorAsync = class {
850
881
  query,
851
882
  limit
852
883
  });
853
- const tasks = (data.tasks ?? []).map(
854
- buildTaskSummary
855
- );
856
- return { tasks, pagination: buildPagination(data) };
884
+ return buildVsaTaskList(data);
857
885
  }
858
886
  async deleteVSATasksBulk(taskIds) {
859
887
  const data = await this._post(
@@ -959,6 +987,25 @@ var OrchestratorAsync = class {
959
987
  servers: data.servers ?? []
960
988
  };
961
989
  }
990
+ /**
991
+ * Default toolset every workflow uses when `availableTools` is omitted.
992
+ *
993
+ * Resolved against the live catalog, so it only names tools that are
994
+ * reachable right now -- the same list a task created at this moment
995
+ * would receive.
996
+ */
997
+ async getToolDefaults() {
998
+ const data = await this._get("/tools/defaults");
999
+ return {
1000
+ workflows: (data.workflows ?? []).map(
1001
+ (w) => ({
1002
+ workflowId: w.workflowId ?? w.workflow_id ?? "",
1003
+ variant: w.variant ?? null,
1004
+ tools: w.tools ?? []
1005
+ })
1006
+ )
1007
+ };
1008
+ }
962
1009
  async getToolCatalog() {
963
1010
  return this._get("/tools/catalog");
964
1011
  }
@@ -969,6 +1016,63 @@ var OrchestratorAsync = class {
969
1016
  return this._get("/tools/validate");
970
1017
  }
971
1018
  // ------------------------------------------------------------------
1019
+ // Skills
1020
+ // ------------------------------------------------------------------
1021
+ async listSkills() {
1022
+ const data = await this._get("/skills");
1023
+ const skills = (data.skills ?? []).map(
1024
+ (s) => buildSkill(s)
1025
+ );
1026
+ return {
1027
+ skills,
1028
+ total: data.total ?? skills.length
1029
+ };
1030
+ }
1031
+ async getSkill(skillId) {
1032
+ const data = await this._get(`/skills/${skillId}`);
1033
+ return buildSkill(data);
1034
+ }
1035
+ async createSkill(payload) {
1036
+ const data = await this._post("/skills", payload);
1037
+ return buildSkill(data);
1038
+ }
1039
+ async updateSkill(skillId, payload) {
1040
+ const data = await this._put(
1041
+ `/skills/${skillId}`,
1042
+ payload
1043
+ );
1044
+ return buildSkill(data);
1045
+ }
1046
+ async deleteSkill(skillId) {
1047
+ const data = await this._delete(
1048
+ `/skills/${skillId}`
1049
+ );
1050
+ return {
1051
+ deleted: data.deleted ?? false,
1052
+ skillId: data.skillId ?? data.skill_id ?? 0
1053
+ };
1054
+ }
1055
+ async addSkillMapping(skillId, payload) {
1056
+ const data = await this._post(
1057
+ `/skills/${skillId}/mappings`,
1058
+ {
1059
+ workflow_id: payload.workflowId,
1060
+ ...payload.variant ? { variant: payload.variant } : {},
1061
+ ...payload.requiredTool ? { required_tool: payload.requiredTool } : {}
1062
+ }
1063
+ );
1064
+ return buildSkillMapping(data);
1065
+ }
1066
+ async deleteSkillMapping(skillId, mappingId) {
1067
+ const data = await this._delete(
1068
+ `/skills/${skillId}/mappings/${mappingId}`
1069
+ );
1070
+ return {
1071
+ deleted: data.deleted ?? false,
1072
+ mappingId: data.mappingId ?? data.mapping_id ?? 0
1073
+ };
1074
+ }
1075
+ // ------------------------------------------------------------------
972
1076
  // Debug / Admin
973
1077
  // ------------------------------------------------------------------
974
1078
  async getWorkflowStates() {
@@ -1557,6 +1661,9 @@ var Orchestrator = class {
1557
1661
  listTools() {
1558
1662
  return runSync(this._async.listTools());
1559
1663
  }
1664
+ getToolDefaults() {
1665
+ return runSync(this._async.getToolDefaults());
1666
+ }
1560
1667
  getToolCatalog() {
1561
1668
  return runSync(this._async.getToolCatalog());
1562
1669
  }
@@ -1566,6 +1673,27 @@ var Orchestrator = class {
1566
1673
  validateToolCatalog() {
1567
1674
  return runSync(this._async.validateToolCatalog());
1568
1675
  }
1676
+ listSkills() {
1677
+ return runSync(this._async.listSkills());
1678
+ }
1679
+ getSkill(skillId) {
1680
+ return runSync(this._async.getSkill(skillId));
1681
+ }
1682
+ createSkill(payload) {
1683
+ return runSync(this._async.createSkill(payload));
1684
+ }
1685
+ updateSkill(skillId, payload) {
1686
+ return runSync(this._async.updateSkill(skillId, payload));
1687
+ }
1688
+ deleteSkill(skillId) {
1689
+ return runSync(this._async.deleteSkill(skillId));
1690
+ }
1691
+ addSkillMapping(skillId, payload) {
1692
+ return runSync(this._async.addSkillMapping(skillId, payload));
1693
+ }
1694
+ deleteSkillMapping(skillId, mappingId) {
1695
+ return runSync(this._async.deleteSkillMapping(skillId, mappingId));
1696
+ }
1569
1697
  // ------------------------------------------------------------------
1570
1698
  // Debug / Admin
1571
1699
  // ------------------------------------------------------------------