@unboundcx/sdk 4.13.75 → 4.13.76

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/index.js CHANGED
@@ -297,6 +297,7 @@ export { MessagingService } from './services/messaging.js';
297
297
  export { VideoService } from './services/video.js';
298
298
  export { VoiceService } from './services/voice.js';
299
299
  export { AIService } from './services/ai.js';
300
+ export { PlaybooksService } from './services/ai/playbooks.js';
300
301
  export { LookupService } from './services/lookup.js';
301
302
  export { LayoutsService } from './services/layouts.js';
302
303
  export { SubscriptionsService } from './services/subscriptions.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unboundcx/sdk",
3
- "version": "4.13.75",
3
+ "version": "4.13.76",
4
4
  "description": "Official JavaScript SDK for the Unbound API - A comprehensive toolkit for integrating with Unbound's communication, AI, and data management services",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -186,6 +186,7 @@ export class PlaybooksService {
186
186
  * @param {string} [options.scoreType='boolean'] - Score type ('boolean' or 'scale')
187
187
  * @param {number} [options.weight=0] - Goal weight (0-100)
188
188
  * @param {boolean} [options.requiredForPass=false] - Whether required for pass
189
+ * @param {string} [options.visibility] - 'live' or 'reviewOnly'
189
190
  * @param {string} [options.recordTypeId] - Record type ID
190
191
  * @returns {Promise<Object>} Created goal with id
191
192
  *
@@ -211,6 +212,7 @@ export class PlaybooksService {
211
212
  signal,
212
213
  window,
213
214
  windowTurns,
215
+ visibility,
214
216
  recordTypeId,
215
217
  }) {
216
218
  this.sdk.validateParams(
@@ -240,6 +242,7 @@ export class PlaybooksService {
240
242
  signal: { type: 'string', required: false },
241
243
  window: { type: 'string', required: false },
242
244
  windowTurns: { type: 'number', required: false },
245
+ visibility: { type: 'string', required: false },
243
246
  recordTypeId: { type: 'string', required: false },
244
247
  },
245
248
  );
@@ -257,6 +260,7 @@ export class PlaybooksService {
257
260
  signal,
258
261
  window,
259
262
  windowTurns,
263
+ visibility,
260
264
  recordTypeId,
261
265
  },
262
266
  };
@@ -337,6 +341,7 @@ export class PlaybooksService {
337
341
  * @param {string} [options.scoreType] - Score type ('boolean' or 'scale')
338
342
  * @param {number} [options.weight] - Goal weight (0-100)
339
343
  * @param {boolean} [options.requiredForPass] - Whether required for pass
344
+ * @param {string} [options.visibility] - 'live' or 'reviewOnly'
340
345
  * @param {string} [options.recordTypeId] - Record type ID
341
346
  * @returns {Promise<Object>} Updated goal object
342
347
  *
@@ -360,6 +365,7 @@ export class PlaybooksService {
360
365
  signal,
361
366
  window,
362
367
  windowTurns,
368
+ visibility,
363
369
  recordTypeId,
364
370
  }) {
365
371
  this.sdk.validateParams(
@@ -389,6 +395,7 @@ export class PlaybooksService {
389
395
  signal: { type: 'string', required: false },
390
396
  window: { type: 'string', required: false },
391
397
  windowTurns: { type: 'number', required: false },
398
+ visibility: { type: 'string', required: false },
392
399
  recordTypeId: { type: 'string', required: false },
393
400
  },
394
401
  );
@@ -406,6 +413,7 @@ export class PlaybooksService {
406
413
  signal,
407
414
  window,
408
415
  windowTurns,
416
+ visibility,
409
417
  recordTypeId,
410
418
  },
411
419
  };
@@ -808,6 +816,7 @@ export class PlaybooksService {
808
816
  * @param {string} [options.taskId] - The task ID (used with workerId or userId)
809
817
  * @param {string} [options.workerId] - The worker ID (used with taskId)
810
818
  * @param {string} [options.userId] - The user ID (used with taskId)
819
+ * @param {boolean} [options.includeQa] - Include review-only goals and qaReview
811
820
  * @returns {Promise<Object>} Session object with playbookName and goals array
812
821
  *
813
822
  * @example
@@ -830,7 +839,7 @@ export class PlaybooksService {
830
839
  * userId: 'user_789'
831
840
  * });
832
841
  */
833
- async getSession({ sessionId, taskId, workerId, userId }) {
842
+ async getSession({ sessionId, taskId, workerId, userId, includeQa }) {
834
843
  this.sdk.validateParams(
835
844
  { sessionId, taskId, workerId, userId },
836
845
  {
@@ -838,13 +847,17 @@ export class PlaybooksService {
838
847
  taskId: { type: 'string', required: false },
839
848
  workerId: { type: 'string', required: false },
840
849
  userId: { type: 'string', required: false },
850
+ includeQa: { type: 'boolean', required: false },
841
851
  },
842
852
  );
843
853
 
844
854
  if (sessionId) {
855
+ const query = {};
856
+ if (includeQa) query.includeQa = 1;
845
857
  const result = await internalRequest(this.sdk,
846
858
  `/ai/playbooks/sessions/${sessionId}`,
847
859
  'GET',
860
+ { query },
848
861
  );
849
862
  return result;
850
863
  }
@@ -853,6 +866,7 @@ export class PlaybooksService {
853
866
  if (taskId) query.taskId = taskId;
854
867
  if (workerId) query.workerId = workerId;
855
868
  if (userId) query.userId = userId;
869
+ if (includeQa) query.includeQa = 1;
856
870
 
857
871
  const result = await internalRequest(this.sdk,
858
872
  `/ai/playbooks/sessions`,
@@ -1044,4 +1058,167 @@ export class PlaybooksService {
1044
1058
  );
1045
1059
  return result;
1046
1060
  }
1061
+
1062
+ /**
1063
+ * Submit a human QA review for an AI playbook session (replace-semantics).
1064
+ *
1065
+ * @param {Object} options
1066
+ * @param {string} options.sessionId
1067
+ * @param {Array} options.goals
1068
+ * @returns {Promise<Object>} QA review
1069
+ */
1070
+ async submitQaReview({ sessionId, goals }) {
1071
+ this.sdk.validateParams(
1072
+ { sessionId, goals },
1073
+ {
1074
+ sessionId: { type: 'string', required: true },
1075
+ goals: { type: 'array', required: true },
1076
+ },
1077
+ );
1078
+
1079
+ const result = await internalRequest(
1080
+ this.sdk,
1081
+ `/ai/playbooks/sessions/${sessionId}/qa`,
1082
+ 'PUT',
1083
+ { body: { goals } },
1084
+ );
1085
+ return result;
1086
+ }
1087
+
1088
+ /**
1089
+ * Get the primary QA review for an AI playbook session.
1090
+ *
1091
+ * @param {Object} options
1092
+ * @param {string} options.sessionId
1093
+ * @returns {Promise<Object>} QA review
1094
+ */
1095
+ async getQaReview({ sessionId }) {
1096
+ this.sdk.validateParams(
1097
+ { sessionId },
1098
+ {
1099
+ sessionId: { type: 'string', required: true },
1100
+ },
1101
+ );
1102
+
1103
+ const result = await internalRequest(
1104
+ this.sdk,
1105
+ `/ai/playbooks/sessions/${sessionId}/qa`,
1106
+ 'GET',
1107
+ );
1108
+ return result;
1109
+ }
1110
+
1111
+ /**
1112
+ * List QA disagreements for a playbook goal (keyset on reviewedAt, id).
1113
+ *
1114
+ * @param {Object} options
1115
+ * @param {string} options.playbookGoalId
1116
+ * @param {number} [options.limit]
1117
+ * @param {string} [options.beforeReviewedAt]
1118
+ * @param {string} [options.beforeId]
1119
+ * @returns {Promise<Object>} { results, agreeRate, reviewedCount, disagreeCount, next }
1120
+ */
1121
+ async listQaDisagreements({
1122
+ playbookGoalId,
1123
+ limit,
1124
+ beforeReviewedAt,
1125
+ beforeId,
1126
+ }) {
1127
+ this.sdk.validateParams(
1128
+ { playbookGoalId },
1129
+ {
1130
+ playbookGoalId: { type: 'string', required: true },
1131
+ limit: { type: 'number', required: false },
1132
+ beforeReviewedAt: { type: 'string', required: false },
1133
+ beforeId: { type: 'string', required: false },
1134
+ },
1135
+ );
1136
+
1137
+ const query = {};
1138
+ if (limit != null) query.limit = limit;
1139
+ if (beforeReviewedAt) query.beforeReviewedAt = beforeReviewedAt;
1140
+ if (beforeId) query.beforeId = beforeId;
1141
+
1142
+ const result = await internalRequest(
1143
+ this.sdk,
1144
+ `/ai/playbooks/goals/${playbookGoalId}/disagreements`,
1145
+ 'GET',
1146
+ { query },
1147
+ );
1148
+ return result;
1149
+ }
1150
+
1151
+ /**
1152
+ * Playbook-level QA agree-rate (exact integer match).
1153
+ *
1154
+ * @param {Object} options
1155
+ * @param {string} options.playbookId
1156
+ * @returns {Promise<Object>} agree-rate payload
1157
+ */
1158
+ async getQaAgreeRate({ playbookId }) {
1159
+ this.sdk.validateParams(
1160
+ { playbookId },
1161
+ {
1162
+ playbookId: { type: 'string', required: true },
1163
+ },
1164
+ );
1165
+
1166
+ const result = await internalRequest(
1167
+ this.sdk,
1168
+ `/ai/playbooks/${playbookId}/qa/agree-rate`,
1169
+ 'GET',
1170
+ );
1171
+ return result;
1172
+ }
1173
+
1174
+ /**
1175
+ * Suggest a criteria/window rewrite from QA disagreements. Never auto-applies.
1176
+ *
1177
+ * @param {Object} options
1178
+ * @param {string} options.playbookGoalId
1179
+ * @returns {Promise<Object>} { suggestionId, status, current, proposed, rationale }
1180
+ */
1181
+ async suggestGoalDefinition({ playbookGoalId }) {
1182
+ this.sdk.validateParams(
1183
+ { playbookGoalId },
1184
+ {
1185
+ playbookGoalId: { type: 'string', required: true },
1186
+ },
1187
+ );
1188
+
1189
+ const result = await internalRequest(
1190
+ this.sdk,
1191
+ `/ai/playbooks/goals/${playbookGoalId}/suggest`,
1192
+ 'POST',
1193
+ { body: {} },
1194
+ );
1195
+ return result;
1196
+ }
1197
+
1198
+ /**
1199
+ * Accept, edit, or reject a pending goal-definition suggestion.
1200
+ *
1201
+ * @param {Object} options
1202
+ * @param {string} options.suggestionId
1203
+ * @param {string} options.action - accept | reject | edit
1204
+ * @param {Object} [options.proposed]
1205
+ * @returns {Promise<Object>}
1206
+ */
1207
+ async resolveGoalSuggestion({ suggestionId, action, proposed }) {
1208
+ this.sdk.validateParams(
1209
+ { suggestionId, action },
1210
+ {
1211
+ suggestionId: { type: 'string', required: true },
1212
+ action: { type: 'string', required: true },
1213
+ },
1214
+ );
1215
+
1216
+ const result = await internalRequest(
1217
+ this.sdk,
1218
+ `/ai/playbooks/suggestions/${suggestionId}/resolve`,
1219
+ 'POST',
1220
+ { body: { action, proposed } },
1221
+ );
1222
+ return result;
1223
+ }
1047
1224
  }