@bigbinary/neeto-assist-frontend 1.2.1 → 1.3.0-beta1
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/README.md +430 -21
- package/app/javascript/src/translations/en.json +39 -2
- package/dist/.ready +1 -1
- package/dist/NeetoAssistButton.js +13 -6
- package/dist/NeetoAssistButton.js.map +1 -1
- package/dist/NeetoAssistPane.js +1469 -166
- package/dist/NeetoAssistPane.js.map +1 -1
- package/dist/cjs/NeetoAssistButton.js +16 -9
- package/dist/cjs/NeetoAssistButton.js.map +1 -1
- package/dist/cjs/NeetoAssistPane.js +1491 -188
- package/dist/cjs/NeetoAssistPane.js.map +1 -1
- package/dist/cjs/index.js +11 -5
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/useNeetoAssistAssistant.js +43 -0
- package/dist/cjs/useNeetoAssistAssistant.js.map +1 -0
- package/dist/cjs/useNeetoAssistStatus.js +3 -1
- package/dist/cjs/useNeetoAssistStatus.js.map +1 -1
- package/dist/index.js +10 -5
- package/dist/index.js.map +1 -1
- package/dist/neeto_assist-COp7BR77.js +249 -0
- package/dist/neeto_assist-COp7BR77.js.map +1 -0
- package/dist/neeto_assist-D1wzZ3ou.js +219 -0
- package/dist/neeto_assist-D1wzZ3ou.js.map +1 -0
- package/dist/useNeetoAssistAssistant.js +41 -0
- package/dist/useNeetoAssistAssistant.js.map +1 -0
- package/dist/useNeetoAssistStatus.js +3 -1
- package/dist/useNeetoAssistStatus.js.map +1 -1
- package/dist/useNeetoAssistStore-Bj6niQdc.js +103 -0
- package/dist/useNeetoAssistStore-Bj6niQdc.js.map +1 -0
- package/dist/useNeetoAssistStore-Dgt8aV52.js +101 -0
- package/dist/useNeetoAssistStore-Dgt8aV52.js.map +1 -0
- package/dist/{useNeetoAssistStore-InICsbe8.js → useRunsApi-BgsICthX.js} +228 -113
- package/dist/useRunsApi-BgsICthX.js.map +1 -0
- package/dist/{useNeetoAssistStore-VaZp3268.js → useRunsApi-Rh6xXOwm.js} +232 -112
- package/dist/useRunsApi-Rh6xXOwm.js.map +1 -0
- package/package.json +4 -4
- package/types.d.ts +81 -8
- package/dist/neeto_assist-CpUBA-3Z.js +0 -135
- package/dist/neeto_assist-CpUBA-3Z.js.map +0 -1
- package/dist/neeto_assist-CznTN_YY.js +0 -157
- package/dist/neeto_assist-CznTN_YY.js.map +0 -1
- package/dist/useNeetoAssistStore-InICsbe8.js.map +0 -1
- package/dist/useNeetoAssistStore-VaZp3268.js.map +0 -1
|
@@ -3,24 +3,26 @@
|
|
|
3
3
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
4
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
|
|
7
|
+
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
8
|
+
var _typeof = require('@babel/runtime/helpers/typeof');
|
|
9
|
+
var _regeneratorRuntime = require('@babel/runtime/regenerator');
|
|
6
10
|
var reactQuery = require('@tanstack/react-query');
|
|
11
|
+
var neetoCist = require('@bigbinary/neeto-cist');
|
|
7
12
|
var reactUtils = require('@bigbinary/neeto-commons-frontend/v2/react-utils');
|
|
8
|
-
var neeto_assist = require('./neeto_assist-
|
|
9
|
-
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
13
|
+
var neeto_assist = require('./neeto_assist-COp7BR77.js');
|
|
10
14
|
var _toArray = require('@babel/runtime/helpers/toArray');
|
|
11
15
|
var ramda = require('ramda');
|
|
12
|
-
var utils = require('@bigbinary/neeto-commons-frontend/v2/utils');
|
|
13
|
-
var zustand = require('zustand');
|
|
14
16
|
|
|
15
17
|
var _excluded = ["size", "className"];
|
|
16
|
-
function ownKeys$
|
|
17
|
-
function _objectSpread$
|
|
18
|
+
function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
19
|
+
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
18
20
|
var Sparkle = function Sparkle(_ref) {
|
|
19
21
|
var _ref$size = _ref.size,
|
|
20
22
|
size = _ref$size === void 0 ? 18 : _ref$size,
|
|
21
23
|
className = _ref.className,
|
|
22
24
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
23
|
-
return /*#__PURE__*/jsxRuntime.jsxs("svg", _objectSpread$
|
|
25
|
+
return /*#__PURE__*/jsxRuntime.jsxs("svg", _objectSpread$1(_objectSpread$1({
|
|
24
26
|
className: className,
|
|
25
27
|
"aria-hidden": "true",
|
|
26
28
|
fill: "none",
|
|
@@ -141,10 +143,29 @@ var withoutReplacedDrafts = function withoutReplacedDrafts(runs) {
|
|
|
141
143
|
}));
|
|
142
144
|
});
|
|
143
145
|
};
|
|
146
|
+
var textOrEmpty = function textOrEmpty(value) {
|
|
147
|
+
return typeof value === "string" ? value.trim() : "";
|
|
148
|
+
};
|
|
144
149
|
var isPending = function isPending(_ref2) {
|
|
145
150
|
var status = _ref2.status;
|
|
146
151
|
return neeto_assist.PENDING_STATUSES.includes(status);
|
|
147
152
|
};
|
|
153
|
+
var isStopped = function isStopped(_ref3) {
|
|
154
|
+
var status = _ref3.status;
|
|
155
|
+
return status === neeto_assist.STOPPED_STATUS;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
// The ask a stop button is for: the newest one still queued or running. The
|
|
159
|
+
// engine lists only the person's own asks, since an answer is built with the
|
|
160
|
+
// asker's access, so every ask in the list is theirs. A reply suggestion being
|
|
161
|
+
// written is nobody's ask. Runs are newest first.
|
|
162
|
+
var stoppableAsk = function stoppableAsk() {
|
|
163
|
+
var _runs$find;
|
|
164
|
+
var runs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
165
|
+
return (_runs$find = runs.find(function (run) {
|
|
166
|
+
return run.kind === "ask" && isPending(run);
|
|
167
|
+
})) !== null && _runs$find !== void 0 ? _runs$find : null;
|
|
168
|
+
};
|
|
148
169
|
var withoutRepeatedQuietSkips = function withoutRepeatedQuietSkips(runs) {
|
|
149
170
|
return collapseRepeatedSkips(runs, neeto_assist.QUIET_SKIPPED_REASONS);
|
|
150
171
|
};
|
|
@@ -158,27 +179,27 @@ var runsInConversationOrder = function runsInConversationOrder(runs) {
|
|
|
158
179
|
|
|
159
180
|
// The newest reply NeetoAssist drafted on its own. Runs are newest first.
|
|
160
181
|
var latestDraftId = function latestDraftId(runs) {
|
|
161
|
-
var _runs$
|
|
162
|
-
return (_runs$
|
|
163
|
-
var kind =
|
|
164
|
-
suggestedReply =
|
|
182
|
+
var _runs$find2;
|
|
183
|
+
return (_runs$find2 = runs.find(function (_ref4) {
|
|
184
|
+
var kind = _ref4.kind,
|
|
185
|
+
suggestedReply = _ref4.suggestedReply;
|
|
165
186
|
return kind === neeto_assist.REPLY_SUGGESTION && !!suggestedReply;
|
|
166
|
-
})) === null || _runs$
|
|
187
|
+
})) === null || _runs$find2 === void 0 ? void 0 : _runs$find2.id;
|
|
167
188
|
};
|
|
168
189
|
|
|
169
190
|
// A hello is skipped, since nothing was looked up, but it still gets a reply.
|
|
170
|
-
var hasWrittenReply = function hasWrittenReply(
|
|
171
|
-
var status =
|
|
172
|
-
answer =
|
|
173
|
-
suggestedReply =
|
|
191
|
+
var hasWrittenReply = function hasWrittenReply(_ref5) {
|
|
192
|
+
var status = _ref5.status,
|
|
193
|
+
answer = _ref5.answer,
|
|
194
|
+
suggestedReply = _ref5.suggestedReply;
|
|
174
195
|
return status === "completed" || status === "skipped" && !!(answer || suggestedReply);
|
|
175
196
|
};
|
|
176
197
|
|
|
177
198
|
// A rep's own hello or thanks got a friendly line, which is nothing to judge.
|
|
178
|
-
var isRateable = function isRateable(
|
|
179
|
-
var kind =
|
|
180
|
-
status =
|
|
181
|
-
skippedReason =
|
|
199
|
+
var isRateable = function isRateable(_ref6) {
|
|
200
|
+
var kind = _ref6.kind,
|
|
201
|
+
status = _ref6.status,
|
|
202
|
+
skippedReason = _ref6.skippedReason;
|
|
182
203
|
return neeto_assist.RATEABLE_STATUSES.includes(status) && !neeto_assist.UNRATEABLE_SKIPPED_REASONS.includes(skippedReason) && !(kind === "ask" && status === "skipped");
|
|
183
204
|
};
|
|
184
205
|
|
|
@@ -193,8 +214,8 @@ var hasPendingRun = function hasPendingRun() {
|
|
|
193
214
|
|
|
194
215
|
// The lookups NeetoAssist made while answering, in the order they started. A
|
|
195
216
|
// run from an older NeetoAssist carries none.
|
|
196
|
-
var stepsOf = function stepsOf(
|
|
197
|
-
var steps =
|
|
217
|
+
var stepsOf = function stepsOf(_ref7) {
|
|
218
|
+
var steps = _ref7.steps;
|
|
198
219
|
return steps !== null && steps !== void 0 ? steps : [];
|
|
199
220
|
};
|
|
200
221
|
var hasRunningStep = function hasRunningStep(run) {
|
|
@@ -203,9 +224,9 @@ var hasRunningStep = function hasRunningStep(run) {
|
|
|
203
224
|
|
|
204
225
|
// A suggested action can only be applied once its run has finished. Until then
|
|
205
226
|
// NeetoAssist may still take it back and start over, so its card waits.
|
|
206
|
-
var actionsOf = function actionsOf(
|
|
207
|
-
var status =
|
|
208
|
-
actions =
|
|
227
|
+
var actionsOf = function actionsOf(_ref8) {
|
|
228
|
+
var status = _ref8.status,
|
|
229
|
+
actions = _ref8.actions;
|
|
209
230
|
return status === "completed" ? actions !== null && actions !== void 0 ? actions : [] : [];
|
|
210
231
|
};
|
|
211
232
|
var skippedReasonMessageKey = function skippedReasonMessageKey(reason) {
|
|
@@ -214,58 +235,208 @@ var skippedReasonMessageKey = function skippedReasonMessageKey(reason) {
|
|
|
214
235
|
|
|
215
236
|
// No answer at all means the request never reached NeetoAssist.
|
|
216
237
|
var errorMessageKey = function errorMessageKey(error) {
|
|
217
|
-
|
|
218
|
-
|
|
238
|
+
var isAssistant = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
239
|
+
var keys = isAssistant ? neeto_assist.ASSISTANT_ERROR_MESSAGE_KEYS : neeto_assist.ERROR_MESSAGE_KEYS;
|
|
240
|
+
if (!(error !== null && error !== void 0 && error.response)) return keys[503];
|
|
241
|
+
return ramda.propOr("neetoAssist.errors.generic", error.response.status, keys);
|
|
219
242
|
};
|
|
220
243
|
|
|
221
|
-
// Sources come from a knowledge base, so only web links become links.
|
|
244
|
+
// Sources come from a knowledge base, so only web links become links. An
|
|
245
|
+
// address with a name or a password before an "@", such as
|
|
246
|
+
// "https://acme.neetochat.com@evil.example/", reads as one site and opens
|
|
247
|
+
// another, so it is none, and so is any "@" before the address's path.
|
|
222
248
|
var isWebUrl = function isWebUrl(url) {
|
|
223
|
-
return /^https
|
|
249
|
+
return /^https?:\/\/[^/?#@]*(?:[/?#]|$)/i.test(url !== null && url !== void 0 ? url : "");
|
|
224
250
|
};
|
|
225
251
|
|
|
226
|
-
|
|
227
|
-
|
|
252
|
+
// The sources of an answer as the pane lists them, in the order NeetoAssist
|
|
253
|
+
// gave. Each has the key of its kind's word, or a lookup's product, its title,
|
|
254
|
+
// and its address when that is a web address. One with neither a title nor
|
|
255
|
+
// such an address says nothing a person can use, so it is left out.
|
|
256
|
+
var shownSources = function shownSources(sources) {
|
|
257
|
+
return (Array.isArray(sources) ? sources : []).flatMap(function (source) {
|
|
258
|
+
var _SOURCE_KIND_KEYS$get;
|
|
259
|
+
var _ref9 = source !== null && source !== void 0 ? source : {},
|
|
260
|
+
kind = _ref9.kind,
|
|
261
|
+
product = _ref9.product,
|
|
262
|
+
title = _ref9.title,
|
|
263
|
+
url = _ref9.url;
|
|
264
|
+
var sourceKind = kind !== null && kind !== void 0 ? kind : neeto_assist.DEFAULT_SOURCE_KIND;
|
|
265
|
+
var shown = {
|
|
266
|
+
kindKey: (_SOURCE_KIND_KEYS$get = neeto_assist.SOURCE_KIND_KEYS.get(sourceKind)) !== null && _SOURCE_KIND_KEYS$get !== void 0 ? _SOURCE_KIND_KEYS$get : null,
|
|
267
|
+
product: sourceKind === neeto_assist.LOOKUP_SOURCE_KIND ? textOrEmpty(product) || null : null,
|
|
268
|
+
title: textOrEmpty(title),
|
|
269
|
+
url: isWebUrl(url) ? url : null
|
|
270
|
+
};
|
|
271
|
+
return shown.title || shown.url ? [shown] : [];
|
|
272
|
+
});
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
276
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
277
|
+
|
|
278
|
+
// Runs live on a conversation or on an assistant thread: { conversationId } or
|
|
279
|
+
// { threadId }. A conversation's id alone, as these hooks were always given,
|
|
280
|
+
// names the conversation, and a conversation's runs keep the query key they
|
|
281
|
+
// always had.
|
|
282
|
+
var whereOf = function whereOf(thread) {
|
|
283
|
+
return _typeof(thread) === "object" && thread !== null ? thread : {
|
|
284
|
+
conversationId: thread
|
|
285
|
+
};
|
|
286
|
+
};
|
|
287
|
+
var runsKey = function runsKey(thread) {
|
|
288
|
+
var _whereOf = whereOf(thread),
|
|
289
|
+
conversationId = _whereOf.conversationId,
|
|
290
|
+
threadId = _whereOf.threadId;
|
|
291
|
+
return threadId ? [neeto_assist.QUERY_KEYS.RUNS, neeto_assist.PANE_MODES.ASSISTANT, threadId] : [neeto_assist.QUERY_KEYS.RUNS, conversationId];
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
// A question asked on an assistant thread, for as long as it is being asked.
|
|
295
|
+
var askKey = function askKey(thread) {
|
|
296
|
+
return ["neeto-assist-ask"].concat(_toConsumableArray(runsKey(thread)));
|
|
297
|
+
};
|
|
228
298
|
|
|
229
299
|
// Fresh on every mount, then polled: quickly while NeetoAssist is working on a
|
|
230
300
|
// run, slowly otherwise. A failed poll is retried by the next one and never
|
|
231
301
|
// shown as a toast. Comes with the workspace's credit state, and with the
|
|
232
|
-
// commands a rep can pick in the box, which an older engine does not list
|
|
233
|
-
|
|
302
|
+
// commands a rep can pick in the box, which an older engine does not list, and
|
|
303
|
+
// whether the engine can stop an ask, which an older one does not say.
|
|
304
|
+
// The assistant turns its thread's runs off while it is closed, so a closed
|
|
305
|
+
// assistant asks for nothing, and they are fetched again when it is opened.
|
|
306
|
+
// A conversation's are always on.
|
|
307
|
+
var useFetchRuns = function useFetchRuns(thread) {
|
|
308
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
309
|
+
_ref$enabled = _ref.enabled,
|
|
310
|
+
enabled = _ref$enabled === void 0 ? true : _ref$enabled;
|
|
311
|
+
var queryClient = reactQuery.useQueryClient();
|
|
312
|
+
var queryKey = runsKey(thread);
|
|
313
|
+
var where = whereOf(thread);
|
|
234
314
|
return reactQuery.useQuery({
|
|
235
|
-
queryKey:
|
|
236
|
-
queryFn: function
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
315
|
+
queryKey: queryKey,
|
|
316
|
+
queryFn: function () {
|
|
317
|
+
var _queryFn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
318
|
+
var _queryClient$getQuery, _queryClient$getQuery2, _listed$runs2;
|
|
319
|
+
var listed, acceptedRuns;
|
|
320
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
321
|
+
while (1) switch (_context.prev = _context.next) {
|
|
322
|
+
case 0:
|
|
323
|
+
_context.next = 2;
|
|
324
|
+
return neeto_assist.neetoAssistApi.fetchRuns(where);
|
|
325
|
+
case 2:
|
|
326
|
+
listed = _context.sent;
|
|
327
|
+
if (where.threadId) {
|
|
328
|
+
_context.next = 5;
|
|
329
|
+
break;
|
|
330
|
+
}
|
|
331
|
+
return _context.abrupt("return", listed);
|
|
332
|
+
case 5:
|
|
333
|
+
// A list can be older than the answer to an ask. Keep each accepted run
|
|
334
|
+
// until a list holds it, then use the list's version from then on.
|
|
335
|
+
acceptedRuns = ((_queryClient$getQuery = (_queryClient$getQuery2 = queryClient.getQueryData(queryKey)) === null || _queryClient$getQuery2 === void 0 ? void 0 : _queryClient$getQuery2.acceptedRuns) !== null && _queryClient$getQuery !== void 0 ? _queryClient$getQuery : []).filter(function (run) {
|
|
336
|
+
var _listed$runs;
|
|
337
|
+
return !neetoCist.existsById(run.id, (_listed$runs = listed.runs) !== null && _listed$runs !== void 0 ? _listed$runs : []);
|
|
338
|
+
});
|
|
339
|
+
return _context.abrupt("return", _objectSpread(_objectSpread({}, listed), {}, {
|
|
340
|
+
runs: [].concat(_toConsumableArray(acceptedRuns), _toConsumableArray((_listed$runs2 = listed.runs) !== null && _listed$runs2 !== void 0 ? _listed$runs2 : [])),
|
|
341
|
+
acceptedRuns: acceptedRuns
|
|
342
|
+
}));
|
|
343
|
+
case 7:
|
|
344
|
+
case "end":
|
|
345
|
+
return _context.stop();
|
|
346
|
+
}
|
|
347
|
+
}, _callee);
|
|
348
|
+
}));
|
|
349
|
+
function queryFn() {
|
|
350
|
+
return _queryFn.apply(this, arguments);
|
|
351
|
+
}
|
|
352
|
+
return queryFn;
|
|
353
|
+
}(),
|
|
354
|
+
enabled: enabled,
|
|
355
|
+
select: function select(_ref2) {
|
|
356
|
+
var _ref2$runs = _ref2.runs,
|
|
357
|
+
runs = _ref2$runs === void 0 ? [] : _ref2$runs,
|
|
358
|
+
_ref2$credits = _ref2.credits,
|
|
359
|
+
credits = _ref2$credits === void 0 ? null : _ref2$credits,
|
|
360
|
+
commands = _ref2.commands,
|
|
361
|
+
canStop = _ref2.canStop;
|
|
245
362
|
return {
|
|
246
363
|
runs: runs,
|
|
247
364
|
credits: credits,
|
|
248
|
-
commands: commandsOf(commands)
|
|
365
|
+
commands: commandsOf(commands),
|
|
366
|
+
canStop: canStop === true
|
|
249
367
|
};
|
|
250
368
|
},
|
|
251
369
|
staleTime: 0,
|
|
252
370
|
retry: false,
|
|
253
|
-
refetchInterval: function refetchInterval(
|
|
254
|
-
var
|
|
255
|
-
data =
|
|
256
|
-
error =
|
|
371
|
+
refetchInterval: function refetchInterval(_ref3) {
|
|
372
|
+
var _ref3$state = _ref3.state,
|
|
373
|
+
data = _ref3$state.data,
|
|
374
|
+
error = _ref3$state.error;
|
|
257
375
|
return !error && hasPendingRun(data === null || data === void 0 ? void 0 : data.runs) ? neeto_assist.PENDING_POLL_INTERVAL : neeto_assist.IDLE_POLL_INTERVAL;
|
|
258
376
|
}
|
|
259
377
|
});
|
|
260
378
|
};
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
379
|
+
|
|
380
|
+
// On a conversation the runs are fetched again once the question is taken, as
|
|
381
|
+
// they always were. On an assistant thread the question is still being asked
|
|
382
|
+
// until the runs that hold it are back, so New chat, which waits for every
|
|
383
|
+
// question on the thread, cannot leave one behind in a thread nobody sees.
|
|
384
|
+
// Keep the accepted run before fetching the list: a failed refresh must not
|
|
385
|
+
// lose the stop button or let New chat leave the question behind.
|
|
386
|
+
var useAskNeetoAssist = function useAskNeetoAssist(thread) {
|
|
387
|
+
var queryClient = reactQuery.useQueryClient();
|
|
388
|
+
var queryKey = runsKey(thread);
|
|
389
|
+
return reactUtils.useMutationWithInvalidation(neeto_assist.neetoAssistApi.createRun, whereOf(thread).threadId ? {
|
|
390
|
+
mutationKey: askKey(thread),
|
|
391
|
+
keysToInvalidate: [],
|
|
392
|
+
onSuccess: function onSuccess(_ref4) {
|
|
393
|
+
var run = _ref4.run;
|
|
394
|
+
if (!(run !== null && run !== void 0 && run.id)) return;
|
|
395
|
+
queryClient.setQueryData(queryKey, function () {
|
|
396
|
+
var _data$runs, _data$runs2, _data$acceptedRuns;
|
|
397
|
+
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
398
|
+
if (neetoCist.existsById(run.id, (_data$runs = data.runs) !== null && _data$runs !== void 0 ? _data$runs : [])) return data;
|
|
399
|
+
return _objectSpread(_objectSpread({}, data), {}, {
|
|
400
|
+
runs: [run].concat(_toConsumableArray((_data$runs2 = data.runs) !== null && _data$runs2 !== void 0 ? _data$runs2 : [])),
|
|
401
|
+
acceptedRuns: [run].concat(_toConsumableArray((_data$acceptedRuns = data.acceptedRuns) !== null && _data$acceptedRuns !== void 0 ? _data$acceptedRuns : []))
|
|
402
|
+
});
|
|
403
|
+
});
|
|
404
|
+
},
|
|
405
|
+
onSettled: function onSettled(_data, error) {
|
|
406
|
+
return error ? undefined : queryClient.refetchQueries({
|
|
407
|
+
queryKey: queryKey
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
} : {
|
|
411
|
+
keysToInvalidate: [queryKey]
|
|
264
412
|
});
|
|
265
413
|
};
|
|
266
|
-
|
|
414
|
+
|
|
415
|
+
// Whether a question on this thread is being asked, from the box or from a
|
|
416
|
+
// suggestion.
|
|
417
|
+
var useIsAsking = function useIsAsking(thread) {
|
|
418
|
+
return reactQuery.useIsMutating({
|
|
419
|
+
mutationKey: askKey(thread)
|
|
420
|
+
}) > 0;
|
|
421
|
+
};
|
|
422
|
+
var useUpdateFeedback = function useUpdateFeedback(thread) {
|
|
267
423
|
return reactUtils.useMutationWithInvalidation(neeto_assist.neetoAssistApi.updateFeedback, {
|
|
268
|
-
keysToInvalidate: [
|
|
424
|
+
keysToInvalidate: [runsKey(thread)]
|
|
425
|
+
});
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
// Whatever the answer to a stop, the run has ended or is about to: stopped, or
|
|
429
|
+
// answered first. So the runs are fetched again either way, and the list says
|
|
430
|
+
// which.
|
|
431
|
+
var useStopRun = function useStopRun(thread) {
|
|
432
|
+
var queryClient = reactQuery.useQueryClient();
|
|
433
|
+
return reactQuery.useMutation({
|
|
434
|
+
mutationFn: neeto_assist.neetoAssistApi.stopRun,
|
|
435
|
+
onSettled: function onSettled() {
|
|
436
|
+
return queryClient.invalidateQueries({
|
|
437
|
+
queryKey: runsKey(thread)
|
|
438
|
+
});
|
|
439
|
+
}
|
|
269
440
|
});
|
|
270
441
|
};
|
|
271
442
|
|
|
@@ -276,7 +447,7 @@ var useUpdateFeedback = function useUpdateFeedback(conversationId) {
|
|
|
276
447
|
var useActOnAction = function useActOnAction(mutationFn, conversationId) {
|
|
277
448
|
var callbacks = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
278
449
|
var queryClient = reactQuery.useQueryClient();
|
|
279
|
-
return reactQuery.useMutation(_objectSpread
|
|
450
|
+
return reactQuery.useMutation(_objectSpread({
|
|
280
451
|
mutationFn: mutationFn,
|
|
281
452
|
onSettled: function onSettled() {
|
|
282
453
|
queryClient.invalidateQueries({
|
|
@@ -302,82 +473,31 @@ var useDismissAction = function useDismissAction(conversationId) {
|
|
|
302
473
|
return useActOnAction(neeto_assist.neetoAssistApi.dismissAction, conversationId);
|
|
303
474
|
};
|
|
304
475
|
|
|
305
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
306
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
307
|
-
|
|
308
|
-
// The pane is mounted once in the host's layout and the button sits on the
|
|
309
|
-
// ticket, so this is how they talk: whether the pane is open and how wide, and
|
|
310
|
-
// which conversation it is about. A reload starts closed, and the width is kept.
|
|
311
|
-
/** @type {import("neetocommons/react-utils").ZustandStoreHook} */
|
|
312
|
-
var useNeetoAssistStore = zustand.create(reactUtils.withImmutableActions(function (set) {
|
|
313
|
-
return {
|
|
314
|
-
isOpen: false,
|
|
315
|
-
isExpanded: utils.getFromLocalStorage(neeto_assist.EXPANDED_STORAGE_KEY) || false,
|
|
316
|
-
conversation: null,
|
|
317
|
-
seenDrafts: {},
|
|
318
|
-
close: function close() {
|
|
319
|
-
return set({
|
|
320
|
-
isOpen: false
|
|
321
|
-
});
|
|
322
|
-
},
|
|
323
|
-
toggle: function toggle() {
|
|
324
|
-
return set(function (state) {
|
|
325
|
-
return {
|
|
326
|
-
isOpen: !state.isOpen
|
|
327
|
-
};
|
|
328
|
-
});
|
|
329
|
-
},
|
|
330
|
-
setExpanded: function setExpanded(value) {
|
|
331
|
-
utils.setToLocalStorage(neeto_assist.EXPANDED_STORAGE_KEY, value);
|
|
332
|
-
set({
|
|
333
|
-
isExpanded: value
|
|
334
|
-
});
|
|
335
|
-
},
|
|
336
|
-
setConversation: function setConversation(conversation) {
|
|
337
|
-
return set({
|
|
338
|
-
conversation: conversation
|
|
339
|
-
});
|
|
340
|
-
},
|
|
341
|
-
// Only the conversation that is leaving: the next one's button may already
|
|
342
|
-
// have taken its place.
|
|
343
|
-
clearConversation: function clearConversation(conversationId) {
|
|
344
|
-
return set(function (state) {
|
|
345
|
-
var _state$conversation;
|
|
346
|
-
return ((_state$conversation = state.conversation) === null || _state$conversation === void 0 ? void 0 : _state$conversation.id) === conversationId ? {
|
|
347
|
-
conversation: null
|
|
348
|
-
} : {};
|
|
349
|
-
});
|
|
350
|
-
},
|
|
351
|
-
markDraftSeen: function markDraftSeen(conversationId, runId) {
|
|
352
|
-
return set(function (state) {
|
|
353
|
-
return {
|
|
354
|
-
seenDrafts: _objectSpread(_objectSpread({}, state.seenDrafts), {}, _defineProperty({}, conversationId, runId))
|
|
355
|
-
};
|
|
356
|
-
});
|
|
357
|
-
}
|
|
358
|
-
};
|
|
359
|
-
}));
|
|
360
|
-
|
|
361
476
|
exports.Sparkle = Sparkle;
|
|
362
477
|
exports.actionsOf = actionsOf;
|
|
363
478
|
exports.commandPart = commandPart;
|
|
364
479
|
exports.errorMessageKey = errorMessageKey;
|
|
480
|
+
exports.hasPendingRun = hasPendingRun;
|
|
365
481
|
exports.hasRunningStep = hasRunningStep;
|
|
366
482
|
exports.hasWrittenReply = hasWrittenReply;
|
|
367
483
|
exports.isPending = isPending;
|
|
368
484
|
exports.isRateable = isRateable;
|
|
485
|
+
exports.isStopped = isStopped;
|
|
369
486
|
exports.isWebUrl = isWebUrl;
|
|
370
487
|
exports.latestDraftId = latestDraftId;
|
|
371
488
|
exports.matchingCommands = matchingCommands;
|
|
372
489
|
exports.optionId = optionId;
|
|
373
490
|
exports.pickedCommand = pickedCommand;
|
|
374
491
|
exports.runsInConversationOrder = runsInConversationOrder;
|
|
492
|
+
exports.shownSources = shownSources;
|
|
375
493
|
exports.skippedReasonMessageKey = skippedReasonMessageKey;
|
|
376
494
|
exports.stepsOf = stepsOf;
|
|
495
|
+
exports.stoppableAsk = stoppableAsk;
|
|
377
496
|
exports.useApplyAction = useApplyAction;
|
|
378
497
|
exports.useAskNeetoAssist = useAskNeetoAssist;
|
|
379
498
|
exports.useDismissAction = useDismissAction;
|
|
380
499
|
exports.useFetchRuns = useFetchRuns;
|
|
381
|
-
exports.
|
|
500
|
+
exports.useIsAsking = useIsAsking;
|
|
501
|
+
exports.useStopRun = useStopRun;
|
|
382
502
|
exports.useUpdateFeedback = useUpdateFeedback;
|
|
383
|
-
//# sourceMappingURL=
|
|
503
|
+
//# sourceMappingURL=useRunsApi-Rh6xXOwm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRunsApi-Rh6xXOwm.js","sources":["../app/javascript/src/components/commons/Sparkle.jsx","../app/javascript/src/utils/commands.js","../app/javascript/src/utils/collapseRepeatedSkips.js","../app/javascript/src/utils/runs.js","../app/javascript/src/hooks/reactQuery/useRunsApi.js"],"sourcesContent":["const Sparkle = ({ size = 18, className, ...otherProps }) => (\n <svg\n {...{ className }}\n aria-hidden=\"true\"\n fill=\"none\"\n height={size}\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"1.5\"\n viewBox=\"0 0 18 18\"\n width={size}\n xmlns=\"http://www.w3.org/2000/svg\"\n {...otherProps}\n >\n <path\n d=\"M5.658 2.99L4.395 2.569L3.974 1.306C3.837 0.898 3.162 0.898 3.025 1.306L2.604 2.569L1.341 2.99C1.137 3.058 0.999 3.249 0.999 3.464C0.999 3.679 1.137 3.87 1.341 3.938L2.604 4.359L3.025 5.622C3.093 5.826 3.285 5.964 3.5 5.964C3.715 5.964 3.906 5.826 3.975 5.622L4.396 4.359L5.659 3.938C5.863 3.87 6.001 3.679 6.001 3.464C6.001 3.249 5.862 3.058 5.658 2.99Z\"\n fill=\"currentColor\"\n stroke=\"none\"\n />\n <path d=\"M9.5 2.75L11.412 7.587L16.25 9.5L11.412 11.413L9.5 16.25L7.587 11.413L2.75 9.5L7.587 7.587L9.5 2.75Z\" />\n </svg>\n);\n\nexport default Sparkle;\n","// A command is a named way to ask NeetoAssist for one of the things it can do\n// here. A rep types \"/\" in the box, picks a command from the menu and may add\n// a few words. The engine lists the commands with the runs: NeetoAssist's own,\n// then those of the host's actions this rep is offered.\nimport { any, isEmpty, propEq } from \"ramda\";\n\nconst wordsOf = text => text.toLowerCase().split(/\\s+/).filter(Boolean);\n\n// The commands as the engine listed them with the runs. It lists only what has\n// a name, a title and a description, and an older engine lists none. Anything\n// else that turns up is left out here, so a menu never has a row it cannot\n// show.\nexport const commandsOf = commands =>\n (Array.isArray(commands) ? commands : []).filter(command =>\n [command?.name, command?.title, command?.description].every(\n text => typeof text === \"string\"\n )\n );\n\n// What a rep has typed of a command so far: the text after the \"/\", in lower\n// case, or null when the box holds no command being typed. That is so once\n// the text runs on to another line, and once a full name has a space after\n// it: the command is chosen then, and what follows are the rep's own words.\nexport const typedCommand = (text, commands) => {\n if (!text.startsWith(\"/\") || text.includes(\"\\n\")) return null;\n\n const typed = text.slice(1).toLowerCase();\n const [name, ...rest] = typed.split(/\\s/);\n const isChosen = !isEmpty(rest) && any(propEq(name, \"name\"), commands);\n\n return isChosen ? null : typed;\n};\n\n// The commands that fit what was typed, as the menu lists them: all of them\n// after a bare \"/\", otherwise those whose name starts with what was typed,\n// then those whose title has a word that starts with each word typed.\nexport const matchingCommands = (text, commands) => {\n const typed = typedCommand(text, commands);\n if (typed === null) return [];\n\n const words = wordsOf(typed);\n if (isEmpty(words)) return commands;\n\n const fitsName = ({ name }) =>\n words.length === 1 && name.startsWith(words[0]);\n\n const fitsTitle = ({ title }) =>\n words.every(word =>\n wordsOf(title).some(titleWord => titleWord.startsWith(word))\n );\n\n return [\n ...commands.filter(fitsName),\n ...commands.filter(command => !fitsName(command) && fitsTitle(command)),\n ];\n};\n\n// What the box holds once a command is picked: the command and a space, for\n// the rep to add words after or to send as it is.\nexport const pickedCommand = ({ name }) => `/${name} `;\n\n// The id of a command's row in the menu, which the box points at while the\n// row is the marked one.\nexport const optionId = (menuId, { name }) => `${menuId}-${name}`;\n\n// The command at the start of a question, as the rep typed it, or null for a\n// question that NeetoAssist did not read as a command.\nexport const commandPart = (question, command) => {\n if (!command || typeof question !== \"string\") return null;\n\n const typed = question.slice(0, command.length + 1);\n\n return typed.toLowerCase() === `/${command}`.toLowerCase() ? typed : null;\n};\n","// While a quiet rule holds, NeetoAssist skips every visitor message for the\n// same reason. One note says it, so of skips in a row for one of these\n// reasons, only the latest stays. Runs are in conversation order.\nexport const collapseRepeatedSkips = (runs, reasons) =>\n runs.filter((run, index) => {\n const next = runs[index + 1];\n\n return !(\n reasons.includes(run.skippedReason) &&\n next?.skippedReason === run.skippedReason\n );\n });\n","import { any, propEq, propOr, reverse } from \"ramda\";\n\nimport {\n ASSISTANT_ERROR_MESSAGE_KEYS,\n DEFAULT_SOURCE_KIND,\n ERROR_MESSAGE_KEYS,\n LOOKUP_SOURCE_KIND,\n PENDING_STATUSES,\n QUIET_SKIPPED_REASONS,\n RATEABLE_STATUSES,\n REPLY_SUGGESTION,\n SKIPPED_REASON_MESSAGE_KEYS,\n SOURCE_KIND_KEYS,\n STOPPED_STATUS,\n UNRATEABLE_SKIPPED_REASONS,\n} from \"common/constants\";\nimport { collapseRepeatedSkips } from \"utils/collapseRepeatedSkips\";\n\n// A reply suggestion that is still waiting gets replaced by a newer one, which\n// answers its messages too, so only the newest shows as being worked on.\nconst withoutReplacedDrafts = runs =>\n runs.filter(\n (run, index) =>\n !(\n run.kind === REPLY_SUGGESTION &&\n run.status === \"queued\" &&\n runs.slice(index + 1).some(({ kind }) => kind === REPLY_SUGGESTION)\n )\n );\n\nconst textOrEmpty = value => (typeof value === \"string\" ? value.trim() : \"\");\n\nexport const isPending = ({ status }) => PENDING_STATUSES.includes(status);\n\nexport const isStopped = ({ status }) => status === STOPPED_STATUS;\n\n// The ask a stop button is for: the newest one still queued or running. The\n// engine lists only the person's own asks, since an answer is built with the\n// asker's access, so every ask in the list is theirs. A reply suggestion being\n// written is nobody's ask. Runs are newest first.\nexport const stoppableAsk = (runs = []) =>\n runs.find(run => run.kind === \"ask\" && isPending(run)) ?? null;\n\nexport const withoutRepeatedQuietSkips = runs =>\n collapseRepeatedSkips(runs, QUIET_SKIPPED_REASONS);\n\n// NeetoAssist lists the newest run first. The pane reads like the conversation\n// instead: oldest at the top, the latest at the bottom. A quiet rule skips every\n// message while it holds, and one note says so.\nexport const runsInConversationOrder = runs =>\n withoutRepeatedQuietSkips(withoutReplacedDrafts(reverse(runs)));\n\n// The newest reply NeetoAssist drafted on its own. Runs are newest first.\nexport const latestDraftId = runs =>\n runs.find(\n ({ kind, suggestedReply }) => kind === REPLY_SUGGESTION && !!suggestedReply\n )?.id;\n\n// A hello is skipped, since nothing was looked up, but it still gets a reply.\nexport const hasWrittenReply = ({ status, answer, suggestedReply }) =>\n status === \"completed\" ||\n (status === \"skipped\" && !!(answer || suggestedReply));\n\n// A rep's own hello or thanks got a friendly line, which is nothing to judge.\nexport const isRateable = ({ kind, status, skippedReason }) =>\n RATEABLE_STATUSES.includes(status) &&\n !UNRATEABLE_SKIPPED_REASONS.includes(skippedReason) &&\n !(kind === \"ask\" && status === \"skipped\");\n\n// What the pane polls quickly for: a run NeetoAssist is still working on. An\n// action someone is applying is not one. The rep who clicked has the answer\n// to the click, and an action whose end NeetoAssist never hears of would keep\n// every open pane polling quickly until NeetoAssist gives up on it.\nexport const hasPendingRun = (runs = []) => runs.some(isPending);\n\n// The lookups NeetoAssist made while answering, in the order they started. A\n// run from an older NeetoAssist carries none.\nexport const stepsOf = ({ steps }) => steps ?? [];\n\nexport const hasRunningStep = run =>\n any(propEq(\"running\", \"status\"), stepsOf(run));\n\n// A suggested action can only be applied once its run has finished. Until then\n// NeetoAssist may still take it back and start over, so its card waits.\nexport const actionsOf = ({ status, actions }) =>\n status === \"completed\" ? (actions ?? []) : [];\n\nexport const skippedReasonMessageKey = reason =>\n propOr(\"neetoAssist.run.skipped\", reason, SKIPPED_REASON_MESSAGE_KEYS);\n\n// No answer at all means the request never reached NeetoAssist.\nexport const errorMessageKey = (error, isAssistant = false) => {\n const keys = isAssistant ? ASSISTANT_ERROR_MESSAGE_KEYS : ERROR_MESSAGE_KEYS;\n if (!error?.response) return keys[503];\n\n return propOr(\"neetoAssist.errors.generic\", error.response.status, keys);\n};\n\n// Sources come from a knowledge base, so only web links become links. An\n// address with a name or a password before an \"@\", such as\n// \"https://acme.neetochat.com@evil.example/\", reads as one site and opens\n// another, so it is none, and so is any \"@\" before the address's path.\nexport const isWebUrl = url =>\n /^https?:\\/\\/[^/?#@]*(?:[/?#]|$)/i.test(url ?? \"\");\n\n// The sources of an answer as the pane lists them, in the order NeetoAssist\n// gave. Each has the key of its kind's word, or a lookup's product, its title,\n// and its address when that is a web address. One with neither a title nor\n// such an address says nothing a person can use, so it is left out.\nexport const shownSources = sources =>\n (Array.isArray(sources) ? sources : []).flatMap(source => {\n const { kind, product, title, url } = source ?? {};\n const sourceKind = kind ?? DEFAULT_SOURCE_KIND;\n const shown = {\n kindKey: SOURCE_KIND_KEYS.get(sourceKind) ?? null,\n product:\n sourceKind === LOOKUP_SOURCE_KIND ? textOrEmpty(product) || null : null,\n title: textOrEmpty(title),\n url: isWebUrl(url) ? url : null,\n };\n\n return shown.title || shown.url ? [shown] : [];\n });\n","import {\n useIsMutating,\n useMutation,\n useQuery,\n useQueryClient,\n} from \"@tanstack/react-query\";\nimport { existsById } from \"neetocist\";\nimport { useMutationWithInvalidation } from \"neetocommons/v2/react-utils\";\n\nimport neetoAssistApi from \"apis/neeto_assist\";\nimport {\n IDLE_POLL_INTERVAL,\n PANE_MODES,\n PENDING_POLL_INTERVAL,\n QUERY_KEYS,\n} from \"common/constants\";\nimport { commandsOf } from \"utils/commands\";\nimport { hasPendingRun } from \"utils/runs\";\n\n// Runs live on a conversation or on an assistant thread: { conversationId } or\n// { threadId }. A conversation's id alone, as these hooks were always given,\n// names the conversation, and a conversation's runs keep the query key they\n// always had.\nconst whereOf = thread =>\n typeof thread === \"object\" && thread !== null\n ? thread\n : { conversationId: thread };\n\nconst runsKey = thread => {\n const { conversationId, threadId } = whereOf(thread);\n\n return threadId\n ? [QUERY_KEYS.RUNS, PANE_MODES.ASSISTANT, threadId]\n : [QUERY_KEYS.RUNS, conversationId];\n};\n\n// A question asked on an assistant thread, for as long as it is being asked.\nconst askKey = thread => [\"neeto-assist-ask\", ...runsKey(thread)];\n\n// Fresh on every mount, then polled: quickly while NeetoAssist is working on a\n// run, slowly otherwise. A failed poll is retried by the next one and never\n// shown as a toast. Comes with the workspace's credit state, and with the\n// commands a rep can pick in the box, which an older engine does not list, and\n// whether the engine can stop an ask, which an older one does not say.\n// The assistant turns its thread's runs off while it is closed, so a closed\n// assistant asks for nothing, and they are fetched again when it is opened.\n// A conversation's are always on.\nconst useFetchRuns = (thread, { enabled = true } = {}) => {\n const queryClient = useQueryClient();\n const queryKey = runsKey(thread);\n const where = whereOf(thread);\n\n return useQuery({\n queryKey,\n queryFn: async () => {\n const listed = await neetoAssistApi.fetchRuns(where);\n if (!where.threadId) return listed;\n\n // A list can be older than the answer to an ask. Keep each accepted run\n // until a list holds it, then use the list's version from then on.\n const acceptedRuns = (\n queryClient.getQueryData(queryKey)?.acceptedRuns ?? []\n ).filter(run => !existsById(run.id, listed.runs ?? []));\n\n return {\n ...listed,\n runs: [...acceptedRuns, ...(listed.runs ?? [])],\n acceptedRuns,\n };\n },\n enabled,\n select: ({ runs = [], credits = null, commands, canStop }) => ({\n runs,\n credits,\n commands: commandsOf(commands),\n canStop: canStop === true,\n }),\n staleTime: 0,\n retry: false,\n refetchInterval: ({ state: { data, error } }) =>\n !error && hasPendingRun(data?.runs)\n ? PENDING_POLL_INTERVAL\n : IDLE_POLL_INTERVAL,\n });\n};\n\n// On a conversation the runs are fetched again once the question is taken, as\n// they always were. On an assistant thread the question is still being asked\n// until the runs that hold it are back, so New chat, which waits for every\n// question on the thread, cannot leave one behind in a thread nobody sees.\n// Keep the accepted run before fetching the list: a failed refresh must not\n// lose the stop button or let New chat leave the question behind.\nconst useAskNeetoAssist = thread => {\n const queryClient = useQueryClient();\n const queryKey = runsKey(thread);\n\n return useMutationWithInvalidation(\n neetoAssistApi.createRun,\n whereOf(thread).threadId\n ? {\n mutationKey: askKey(thread),\n keysToInvalidate: [],\n onSuccess: ({ run }) => {\n if (!run?.id) return;\n\n queryClient.setQueryData(queryKey, (data = {}) => {\n if (existsById(run.id, data.runs ?? [])) return data;\n\n return {\n ...data,\n runs: [run, ...(data.runs ?? [])],\n acceptedRuns: [run, ...(data.acceptedRuns ?? [])],\n };\n });\n },\n onSettled: (_data, error) =>\n error ? undefined : queryClient.refetchQueries({ queryKey }),\n }\n : { keysToInvalidate: [queryKey] }\n );\n};\n\n// Whether a question on this thread is being asked, from the box or from a\n// suggestion.\nconst useIsAsking = thread =>\n useIsMutating({ mutationKey: askKey(thread) }) > 0;\n\nconst useUpdateFeedback = thread =>\n useMutationWithInvalidation(neetoAssistApi.updateFeedback, {\n keysToInvalidate: [runsKey(thread)],\n });\n\n// Whatever the answer to a stop, the run has ended or is about to: stopped, or\n// answered first. So the runs are fetched again either way, and the list says\n// which.\nconst useStopRun = thread => {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: neetoAssistApi.stopRun,\n onSettled: () =>\n queryClient.invalidateQueries({ queryKey: runsKey(thread) }),\n });\n};\n\n// A click on a card changes what its run shows whether it worked or not: the\n// action was applied, or someone else got to it first, or it expired. So the\n// runs are fetched again either way. The card does not wait for them: the\n// answer to the click already says what happened.\nconst useActOnAction = (mutationFn, conversationId, callbacks = {}) => {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn,\n onSettled: () => {\n queryClient.invalidateQueries({\n queryKey: [QUERY_KEYS.RUNS, conversationId],\n });\n },\n ...callbacks,\n });\n};\n\n// The host hears of an applied action from here and not from the card that\n// was clicked. React Query drops what a card hands to mutate once the card is\n// off the screen, as when the rep opens another conversation before the answer\n// arrives, and the change was made all the same. The click does not wait for\n// the host's handler, so what the handler returns is left alone.\nconst useApplyAction = (conversationId, onApplied) =>\n useActOnAction(neetoAssistApi.applyAction, conversationId, {\n onSuccess: data => {\n onApplied?.(data?.action);\n },\n });\n\nconst useDismissAction = conversationId =>\n useActOnAction(neetoAssistApi.dismissAction, conversationId);\n\nexport {\n useFetchRuns,\n useAskNeetoAssist,\n useIsAsking,\n useUpdateFeedback,\n useStopRun,\n useApplyAction,\n useDismissAction,\n};\n"],"names":["Sparkle","_ref","_ref$size","size","className","otherProps","_objectWithoutProperties","_excluded","_jsxs","_objectSpread","fill","height","stroke","strokeLinecap","strokeLinejoin","strokeWidth","viewBox","width","xmlns","children","_jsx","d","wordsOf","text","toLowerCase","split","filter","Boolean","commandsOf","commands","Array","isArray","command","name","title","description","every","typedCommand","startsWith","includes","typed","slice","_typed$split","_typed$split2","_toArray","rest","isChosen","isEmpty","any","propEq","matchingCommands","words","fitsName","length","fitsTitle","_ref2","word","some","titleWord","concat","_toConsumableArray","pickedCommand","_ref3","optionId","menuId","_ref4","commandPart","question","collapseRepeatedSkips","runs","reasons","run","index","next","skippedReason","withoutReplacedDrafts","kind","REPLY_SUGGESTION","status","textOrEmpty","value","trim","isPending","PENDING_STATUSES","isStopped","STOPPED_STATUS","stoppableAsk","_runs$find","arguments","undefined","find","withoutRepeatedQuietSkips","QUIET_SKIPPED_REASONS","runsInConversationOrder","reverse","latestDraftId","_runs$find2","suggestedReply","id","hasWrittenReply","_ref5","answer","isRateable","_ref6","RATEABLE_STATUSES","UNRATEABLE_SKIPPED_REASONS","hasPendingRun","stepsOf","_ref7","steps","hasRunningStep","actionsOf","_ref8","actions","skippedReasonMessageKey","reason","propOr","SKIPPED_REASON_MESSAGE_KEYS","errorMessageKey","error","isAssistant","keys","ASSISTANT_ERROR_MESSAGE_KEYS","ERROR_MESSAGE_KEYS","response","isWebUrl","url","test","shownSources","sources","flatMap","source","_SOURCE_KIND_KEYS$get","_ref9","product","sourceKind","DEFAULT_SOURCE_KIND","shown","kindKey","SOURCE_KIND_KEYS","get","LOOKUP_SOURCE_KIND","whereOf","thread","_typeof","conversationId","runsKey","_whereOf","threadId","QUERY_KEYS","RUNS","PANE_MODES","ASSISTANT","askKey","useFetchRuns","_ref$enabled","enabled","queryClient","useQueryClient","queryKey","where","useQuery","queryFn","_queryFn","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_queryClient$getQuery","_queryClient$getQuery2","_listed$runs2","listed","acceptedRuns","wrap","_callee$","_context","prev","neetoAssistApi","fetchRuns","sent","abrupt","getQueryData","_listed$runs","existsById","stop","apply","select","_ref2$runs","_ref2$credits","credits","canStop","staleTime","retry","refetchInterval","_ref3$state","state","data","PENDING_POLL_INTERVAL","IDLE_POLL_INTERVAL","useAskNeetoAssist","useMutationWithInvalidation","createRun","mutationKey","keysToInvalidate","onSuccess","setQueryData","_data$runs","_data$runs2","_data$acceptedRuns","onSettled","_data","refetchQueries","useIsAsking","useIsMutating","useUpdateFeedback","updateFeedback","useStopRun","useMutation","mutationFn","stopRun","invalidateQueries","useActOnAction","callbacks","useApplyAction","onApplied","applyAction","action","useDismissAction","dismissAction"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAMA,OAAO,GAAG,SAAVA,OAAOA,CAAAC,IAAA,EAAA;AAAA,EAAA,IAAAC,SAAA,GAAAD,IAAA,CAAME,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,SAAA;IAAEE,SAAS,GAAAH,IAAA,CAATG,SAAS;AAAKC,IAAAA,UAAU,GAAAC,wBAAA,CAAAL,IAAA,EAAAM,SAAA,CAAA;AAAA,EAAA,oBACpDC,eAAA,CAAA,KAAA,EAAAC,eAAA,CAAAA,eAAA,CAAA;AACQL,IAAAA,SAAS,EAATA,SAAS;AACf,IAAA,aAAA,EAAY,MAAM;AAClBM,IAAAA,IAAI,EAAC,MAAM;AACXC,IAAAA,MAAM,EAAER,IAAK;AACbS,IAAAA,MAAM,EAAC,cAAc;AACrBC,IAAAA,aAAa,EAAC,OAAO;AACrBC,IAAAA,cAAc,EAAC,OAAO;AACtBC,IAAAA,WAAW,EAAC,KAAK;AACjBC,IA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,GAAC,CAAC;AAAA;AAEJ,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAGlF,cAAc,EAAA;AAAA,EAAA,OACrC4E,cAAc,CAAC5C,2BAAc,CAACmD,aAAa,EAAEnF,cAAc,CAAC;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigbinary/neeto-assist-frontend",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0-beta1",
|
|
4
4
|
"description": "NeetoAssist pane and helpers for Neeto products",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"homepage": "https://github.com/bigbinary/neeto-assist-nano",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"scripts": {
|
|
33
33
|
"build": "NODE_ENV=production rollup --bundleConfigAsCjs -c --environment production",
|
|
34
34
|
"build-preview": "NODE_ENV=production webpack",
|
|
35
|
-
"
|
|
35
|
+
"postinstall": "test -d .git && husky install || true",
|
|
36
36
|
"release": "yarn build && yalc push --sig",
|
|
37
37
|
"test": "node --import ./test/javascript/setup.mjs --test test/javascript/*.test.mjs"
|
|
38
38
|
},
|
|
@@ -211,13 +211,13 @@
|
|
|
211
211
|
"zustand": "4.4.2"
|
|
212
212
|
},
|
|
213
213
|
"resolutions": {
|
|
214
|
-
"postcss": "
|
|
214
|
+
"postcss": "8.5.29",
|
|
215
215
|
"wrap-ansi": "7.0.0",
|
|
216
216
|
"string-width": "4.1.0",
|
|
217
217
|
"pbkdf2": "^3.1.3",
|
|
218
218
|
"sha.js": "^2.4.12",
|
|
219
219
|
"node-forge": "^1.3.2",
|
|
220
|
-
"qs": "6.
|
|
220
|
+
"qs": "6.16.2"
|
|
221
221
|
},
|
|
222
222
|
"engines": {
|
|
223
223
|
"node": ">=22.13",
|