@ykurilov/agent-chat-flows 0.65.1 → 0.67.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/CHANGELOG.md +24 -0
- package/agent-flow.schema.json +12 -0
- package/dist/{chunk-L7XNC3RB.js → chunk-2ZHBD7MF.js} +2 -2
- package/dist/{chunk-7VR4YNTJ.js → chunk-C7PMUVRN.js} +23 -5
- package/dist/chunk-C7PMUVRN.js.map +1 -0
- package/dist/{chunk-KRZMJJKG.js → chunk-H2TPYIWU.js} +11 -7
- package/dist/chunk-H2TPYIWU.js.map +1 -0
- package/dist/format.js +2 -2
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/react.js +51 -9
- package/dist/react.js.map +1 -1
- package/dist/types/engine/nudges.d.ts +1 -1
- package/dist/types/format/flow-format.d.ts +10 -0
- package/dist/types/format/flow-schema.d.ts +6 -0
- package/dist/types/labels/editor.d.ts +5 -1
- package/dist/types/react/editor/index.d.ts +1 -1
- package/dist/types/react/editor/schedule-model.d.ts +9 -1
- package/dist/types/react/flow-editor-skin.d.ts +3 -0
- package/dist/types/runtime/first-message-rules.d.ts +2 -0
- package/dist/types/runtime/flow-types.d.ts +2 -0
- package/package.json +4 -4
- package/dist/chunk-7VR4YNTJ.js.map +0 -1
- package/dist/chunk-KRZMJJKG.js.map +0 -1
- /package/dist/{chunk-L7XNC3RB.js.map → chunk-2ZHBD7MF.js.map} +0 -0
package/dist/react.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
FLOW_DEADLINE_NOTICE,
|
|
4
4
|
FLOW_TIMER_NOTICE,
|
|
5
5
|
fieldValueText
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-H2TPYIWU.js";
|
|
7
7
|
import {
|
|
8
8
|
ANY_STATE_LAYOUT_KEY,
|
|
9
9
|
DEFAULT_LATE_START_HOURS,
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
startRun,
|
|
32
32
|
stateById,
|
|
33
33
|
timerDueAt
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-C7PMUVRN.js";
|
|
35
35
|
|
|
36
36
|
// src/react/flow-labels.ts
|
|
37
37
|
import { createContext, createElement, useContext } from "react";
|
|
@@ -130,6 +130,7 @@ var russianFlowEditorLabels = {
|
|
|
130
130
|
nudges: "\u043A\u0430\u0441\u0430\u043D\u0438\u044F",
|
|
131
131
|
noNudges: "\u0431\u0435\u0437 \u043A\u0430\u0441\u0430\u043D\u0438\u0439",
|
|
132
132
|
nudgesDays: (days) => days === 1 ? "\u0432 \u0434\u0435\u043D\u044C \u0432\u0445\u043E\u0434\u0430" : `\u043F\u0435\u0440\u0432\u044B\u0435 ${days} \u0434\u043D.`,
|
|
133
|
+
nudgesUntilProgramDay: (day) => `\u0434\u043E \u0434\u043D\u044F ${day} \u043F\u0440\u043E\u0433\u0440\u0430\u043C\u043C\u044B`,
|
|
133
134
|
space: {
|
|
134
135
|
legend: "\u041B\u0435\u0433\u0435\u043D\u0434\u0430",
|
|
135
136
|
showMinimap: "\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u043C\u0438\u043D\u0438-\u043A\u0430\u0440\u0442\u0443",
|
|
@@ -178,6 +179,8 @@ var russianFlowEditorLabels = {
|
|
|
178
179
|
firstMessages: "\u0421\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u044F \u043F\u0435\u0440\u0432\u044B\u043C",
|
|
179
180
|
maxPerDay: "\u041D\u0435 \u0431\u043E\u043B\u044C\u0448\u0435 \u0432 \u0434\u0435\u043D\u044C",
|
|
180
181
|
maxPerDayHint: "\u041F\u0443\u0441\u0442\u043E \u2014 \u043A\u0430\u043A \u0432 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0430\u0445 \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u044F.",
|
|
182
|
+
maxPerDayByDay: "\u041D\u0435 \u0431\u043E\u043B\u044C\u0448\u0435 \u0432 \u0434\u0435\u043D\u044C \u043F\u043E \u0434\u043D\u044F\u043C \u043F\u0440\u043E\u0433\u0440\u0430\u043C\u043C\u044B",
|
|
183
|
+
maxPerDayByDayHint: "\u0427\u0435\u0440\u0435\u0437 \u0437\u0430\u043F\u044F\u0442\u0443\u044E: \xAB3, 2\xBB \u2014 \u0432 \u0434\u0435\u043D\u044C 1 \u0442\u0440\u0438, \u0441\u043E \u0434\u043D\u044F 2 \u043F\u043E \u0434\u0432\u0430. \u0413\u043B\u0430\u0432\u043D\u0435\u0435 \u043F\u043E\u043B\u044F \u0432\u044B\u0448\u0435. \u041E\u0442\u0432\u0435\u0442 \u0447\u0435\u043B\u043E\u0432\u0435\u043A\u0430 \u0441\u0447\u0451\u0442 \u043D\u0435 \u043E\u0431\u043D\u0443\u043B\u044F\u0435\u0442.",
|
|
181
184
|
morning: "\u0423\u0442\u0440\u0435\u043D\u043D\u0435\u0435 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435",
|
|
182
185
|
skipMorning: "\u041D\u0435 \u043F\u0438\u0441\u0430\u0442\u044C \u0443\u0442\u0440\u043E\u043C, \u0435\u0441\u043B\u0438 \u0447\u0435\u043B\u043E\u0432\u0435\u043A \u043F\u0438\u0441\u0430\u043B \u0437\u0430, \u043C\u0438\u043D",
|
|
183
186
|
nudges: "\u041A\u0430\u0441\u0430\u043D\u0438\u044F \u043F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E",
|
|
@@ -242,8 +245,9 @@ var russianFlowEditorLabels = {
|
|
|
242
245
|
nudgesModes: { inherit: "\u041A\u0430\u043A \u0443 \u0441\u0446\u0435\u043D\u0430\u0440\u0438\u044F", own: "\u0421\u0432\u043E\u0438", off: "\u0412\u044B\u043A\u043B" },
|
|
243
246
|
nudgesHint: "\u0410\u0433\u0435\u043D\u0442 \u043F\u0438\u0448\u0435\u0442 \u0437\u0434\u0435\u0441\u044C \u0441\u0430\u043C, \u043A\u043E\u0433\u0434\u0430 \u0447\u0435\u043B\u043E\u0432\u0435\u043A \u043C\u043E\u043B\u0447\u0438\u0442.",
|
|
244
247
|
nudgesDays: "\u0421\u0432\u043E\u0438 \u043A\u0430\u0441\u0430\u043D\u0438\u044F \u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044E\u0442",
|
|
245
|
-
nudgesDaysModes: { always: "\u0432\u0441\u0451 \u0432\u0440\u0435\u043C\u044F \u0432 \u043D\u043E\u0434\u0435", days: "\u0434\u043D., \u0441\u0447\u0438\u0442\u0430\u044F \u0434\u0435\u043D\u044C \u0432\u0445\u043E\u0434\u0430" },
|
|
246
|
-
nudgesDaysHint: "\u041F\u043E\u0442\u043E\u043C \u2014 \u043A\u0430\u0441\u0430\u043D\u0438\u044F \u0441\u0446\u0435\u043D\u0430\u0440\u0438\u044F: \u0443\u0442\u0440\u0435\u043D\u043D\u0435\u0435 \u0438 \u043E\u0431\u0449\u0438\u0439 \u0440\u044F\u0434 \u0441 \u043D\u0430\u0447\u0430\u043B\u0430."
|
|
248
|
+
nudgesDaysModes: { always: "\u0432\u0441\u0451 \u0432\u0440\u0435\u043C\u044F \u0432 \u043D\u043E\u0434\u0435", days: "\u0434\u043D., \u0441\u0447\u0438\u0442\u0430\u044F \u0434\u0435\u043D\u044C \u0432\u0445\u043E\u0434\u0430", untilProgramDay: "\u0434\u043E \u0434\u043D\u044F \u043F\u0440\u043E\u0433\u0440\u0430\u043C\u043C\u044B \u0432\u043A\u043B\u044E\u0447\u0438\u0442\u0435\u043B\u044C\u043D\u043E" },
|
|
249
|
+
nudgesDaysHint: "\u041F\u043E\u0442\u043E\u043C \u2014 \u043A\u0430\u0441\u0430\u043D\u0438\u044F \u0441\u0446\u0435\u043D\u0430\u0440\u0438\u044F: \u0443\u0442\u0440\u0435\u043D\u043D\u0435\u0435 \u0438 \u043E\u0431\u0449\u0438\u0439 \u0440\u044F\u0434 \u0441 \u043D\u0430\u0447\u0430\u043B\u0430.",
|
|
250
|
+
nudgesUntilProgramDayHint: "\u041F\u0440\u0438\u0448\u0451\u043B \u0432 \u043D\u043E\u0434\u0443 \u043F\u043E\u0437\u0436\u0435 \u2014 \u0441\u0432\u043E\u0438\u0445 \u043A\u0430\u0441\u0430\u043D\u0438\u0439 \u043D\u0435\u0442, \u0441\u0440\u0430\u0437\u0443 \u043A\u0430\u0441\u0430\u043D\u0438\u044F \u0441\u0446\u0435\u043D\u0430\u0440\u0438\u044F."
|
|
247
251
|
},
|
|
248
252
|
exitCard: {
|
|
249
253
|
when: "\u041A\u043E\u0433\u0434\u0430",
|
|
@@ -377,6 +381,7 @@ var englishFlowEditorLabels = {
|
|
|
377
381
|
nudges: "nudges",
|
|
378
382
|
noNudges: "no nudges",
|
|
379
383
|
nudgesDays: (days) => days === 1 ? "on the entry day" : `for the first ${days} days`,
|
|
384
|
+
nudgesUntilProgramDay: (day) => `until program day ${day}`,
|
|
380
385
|
space: {
|
|
381
386
|
legend: "Legend",
|
|
382
387
|
showMinimap: "Show the minimap",
|
|
@@ -425,6 +430,8 @@ var englishFlowEditorLabels = {
|
|
|
425
430
|
firstMessages: "Writing first",
|
|
426
431
|
maxPerDay: "At most per day",
|
|
427
432
|
maxPerDayHint: "Empty \u2014 as in the app settings.",
|
|
433
|
+
maxPerDayByDay: "At most per day, by program day",
|
|
434
|
+
maxPerDayByDayHint: "Comma-separated: \u201C3, 2\u201D \u2014 three on day 1, two from day 2 on. Overrides the field above. A reply doesn't reset the count.",
|
|
428
435
|
morning: "Morning message",
|
|
429
436
|
skipMorning: "Skip the morning if the person wrote within, min",
|
|
430
437
|
nudges: "Default nudges",
|
|
@@ -489,8 +496,9 @@ var englishFlowEditorLabels = {
|
|
|
489
496
|
nudgesModes: { inherit: "As in the flow", own: "Own", off: "Off" },
|
|
490
497
|
nudgesHint: "The agent writes here by itself while the person is silent.",
|
|
491
498
|
nudgesDays: "Own nudges apply",
|
|
492
|
-
nudgesDaysModes: { always: "the whole time in the state", days: "days, counting the entry day" },
|
|
493
|
-
nudgesDaysHint: "Then the flow's nudges: the morning message and the common series from the start."
|
|
499
|
+
nudgesDaysModes: { always: "the whole time in the state", days: "days, counting the entry day", untilProgramDay: "until program day, inclusive" },
|
|
500
|
+
nudgesDaysHint: "Then the flow's nudges: the morning message and the common series from the start.",
|
|
501
|
+
nudgesUntilProgramDayHint: "Reached the state later \u2014 no own nudges, the flow's nudges right away."
|
|
494
502
|
},
|
|
495
503
|
exitCard: {
|
|
496
504
|
when: "When",
|
|
@@ -1241,8 +1249,15 @@ function updateStateNudges(flow, stateId, nudges) {
|
|
|
1241
1249
|
...flow,
|
|
1242
1250
|
states: flow.states.map((state) => {
|
|
1243
1251
|
if (state.id !== stateId) return state;
|
|
1244
|
-
const
|
|
1245
|
-
return {
|
|
1252
|
+
const own = state.nudges && state.nudges !== "off" ? state.nudges : void 0;
|
|
1253
|
+
return {
|
|
1254
|
+
...state,
|
|
1255
|
+
nudges: {
|
|
1256
|
+
...cleanNudges(nudges),
|
|
1257
|
+
...own?.days !== void 0 && { days: own.days },
|
|
1258
|
+
...own?.untilProgramDay !== void 0 && { untilProgramDay: own.untilProgramDay }
|
|
1259
|
+
}
|
|
1260
|
+
};
|
|
1246
1261
|
})
|
|
1247
1262
|
};
|
|
1248
1263
|
}
|
|
@@ -1259,6 +1274,28 @@ function setStateNudgesDays(flow, stateId, days) {
|
|
|
1259
1274
|
function stateNudgesDays(state) {
|
|
1260
1275
|
return state.nudges && state.nudges !== "off" ? state.nudges.days ?? null : null;
|
|
1261
1276
|
}
|
|
1277
|
+
function setStateNudgesUntilProgramDay(flow, stateId, day) {
|
|
1278
|
+
return {
|
|
1279
|
+
...flow,
|
|
1280
|
+
states: flow.states.map((state) => {
|
|
1281
|
+
if (state.id !== stateId || !state.nudges || state.nudges === "off") return state;
|
|
1282
|
+
const { untilProgramDay: _until, ...rest } = state.nudges;
|
|
1283
|
+
return { ...state, nudges: day === null ? rest : { ...rest, untilProgramDay: Math.max(1, Math.round(day) || 1) } };
|
|
1284
|
+
})
|
|
1285
|
+
};
|
|
1286
|
+
}
|
|
1287
|
+
function stateNudgesUntilProgramDay(state) {
|
|
1288
|
+
return state.nudges && state.nudges !== "off" ? state.nudges.untilProgramDay ?? null : null;
|
|
1289
|
+
}
|
|
1290
|
+
function capsByDayText(caps) {
|
|
1291
|
+
return caps?.join(", ") ?? "";
|
|
1292
|
+
}
|
|
1293
|
+
function parseCapsByDay(text) {
|
|
1294
|
+
const parts = text.split(/[,;\s]+/).filter(Boolean);
|
|
1295
|
+
if (parts.length === 0) return void 0;
|
|
1296
|
+
const caps = parts.map(Number);
|
|
1297
|
+
return caps.every((cap) => Number.isInteger(cap) && cap >= 0) ? caps : null;
|
|
1298
|
+
}
|
|
1262
1299
|
function updateScheduleNudges(flow, nudges) {
|
|
1263
1300
|
return updateSchedule(flow, { nudges: nudges === null ? void 0 : cleanNudges(nudges) });
|
|
1264
1301
|
}
|
|
@@ -1282,7 +1319,8 @@ function stateTimingText(flow, state, labels) {
|
|
|
1282
1319
|
const steps = state.nudges.afterSilence.map((step2) => durationText(step2, labels));
|
|
1283
1320
|
const daily = state.nudges.dailyAt ?? [];
|
|
1284
1321
|
const days = state.nudges.days === void 0 ? "" : ` ${labels.board.nudgesDays(state.nudges.days)}`;
|
|
1285
|
-
|
|
1322
|
+
const until = state.nudges.untilProgramDay === void 0 ? "" : ` ${labels.board.nudgesUntilProgramDay(state.nudges.untilProgramDay)}`;
|
|
1323
|
+
if (steps.length + daily.length > 0) parts.push(`${labels.board.nudges} ${[...steps, ...daily].join(" \xB7 ")}${days}${until}`);
|
|
1286
1324
|
}
|
|
1287
1325
|
return parts.join(" \xB7 ");
|
|
1288
1326
|
}
|
|
@@ -2353,6 +2391,8 @@ function StateTiming({ editor, skin, labels, state }) {
|
|
|
2353
2391
|
onNudgesModeChange: (next) => editor.edit((current) => setStateNudges(current, state.id, next)),
|
|
2354
2392
|
nudgesDays: stateNudgesDays(state),
|
|
2355
2393
|
onNudgesDaysChange: (days) => editor.edit((current) => setStateNudgesDays(current, state.id, days)),
|
|
2394
|
+
nudgesUntilProgramDay: stateNudgesUntilProgramDay(state),
|
|
2395
|
+
onNudgesUntilProgramDayChange: (day) => editor.edit((current) => setStateNudgesUntilProgramDay(current, state.id, day)),
|
|
2356
2396
|
nudges: own && /* @__PURE__ */ jsx2(
|
|
2357
2397
|
NudgesEditor,
|
|
2358
2398
|
{
|
|
@@ -2805,6 +2845,7 @@ export {
|
|
|
2805
2845
|
FlowEditor,
|
|
2806
2846
|
FlowLabelsProvider,
|
|
2807
2847
|
FlowTestChat,
|
|
2848
|
+
capsByDayText,
|
|
2808
2849
|
chooseExit,
|
|
2809
2850
|
chooseNothing,
|
|
2810
2851
|
conditionText,
|
|
@@ -2815,6 +2856,7 @@ export {
|
|
|
2815
2856
|
formatDayLine,
|
|
2816
2857
|
formatDuration,
|
|
2817
2858
|
nextQuestionField,
|
|
2859
|
+
parseCapsByDay,
|
|
2818
2860
|
russianFlowLabels,
|
|
2819
2861
|
russianFlowNoticeLabels,
|
|
2820
2862
|
sameFlow,
|