orchestrator-client 5.9.0 → 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) {
@@ -840,10 +873,7 @@ var OrchestratorAsync = class {
840
873
  limit: params?.limit,
841
874
  offset: params?.offset
842
875
  });
843
- const tasks = (data.tasks ?? []).map(
844
- buildTaskSummary
845
- );
846
- return { tasks, pagination: buildPagination(data) };
876
+ return buildVsaTaskList(data);
847
877
  }
848
878
  async searchVSATasks(userId, query, limit) {
849
879
  const data = await this._get("/task/vsa/search", {
@@ -851,10 +881,7 @@ var OrchestratorAsync = class {
851
881
  query,
852
882
  limit
853
883
  });
854
- const tasks = (data.tasks ?? []).map(
855
- buildTaskSummary
856
- );
857
- return { tasks, pagination: buildPagination(data) };
884
+ return buildVsaTaskList(data);
858
885
  }
859
886
  async deleteVSATasksBulk(taskIds) {
860
887
  const data = await this._post(
@@ -989,6 +1016,63 @@ var OrchestratorAsync = class {
989
1016
  return this._get("/tools/validate");
990
1017
  }
991
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
+ // ------------------------------------------------------------------
992
1076
  // Debug / Admin
993
1077
  // ------------------------------------------------------------------
994
1078
  async getWorkflowStates() {
@@ -1589,6 +1673,27 @@ var Orchestrator = class {
1589
1673
  validateToolCatalog() {
1590
1674
  return runSync(this._async.validateToolCatalog());
1591
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
+ }
1592
1697
  // ------------------------------------------------------------------
1593
1698
  // Debug / Admin
1594
1699
  // ------------------------------------------------------------------