@ykurilov/agent-chat-flows 0.66.0 → 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 +16 -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
|
@@ -36,7 +36,7 @@ export interface NudgeDue {
|
|
|
36
36
|
reason: FlowFirstReason | {
|
|
37
37
|
kind: "give_up";
|
|
38
38
|
};
|
|
39
|
-
/** Касание своего ряда
|
|
39
|
+
/** Касание своего ряда ноды, ограниченного днями (`nudges.days`, `nudges.untilProgramDay`): его шаг не идёт в счёт общего ряда. */
|
|
40
40
|
own?: boolean;
|
|
41
41
|
}
|
|
42
42
|
/** Касания ноды: свои, «off», общие из «Дней и времени», общие сценария. Нет ни тех, ни других — `null`. */
|
|
@@ -147,6 +147,11 @@ export interface FlowStateNudges extends FlowNudges {
|
|
|
147
147
|
* (`schedule.nudges`, затем `nudges` сценария), их ряд с начала. Нет — всё время в ноде. С 0.55.
|
|
148
148
|
*/
|
|
149
149
|
days?: number;
|
|
150
|
+
/**
|
|
151
|
+
* Свой ряд действует, пока идёт день программы не позже этого (1 — только первый день программы). Человек дошёл до
|
|
152
|
+
* ноды позже — своего ряда нет, сразу общие касания. Вместе с `days` — что наступит раньше. С 0.67.
|
|
153
|
+
*/
|
|
154
|
+
untilProgramDay?: number;
|
|
150
155
|
}
|
|
151
156
|
/** Порог позднего старта по умолчанию: до ночи меньше 3 ч — первым днём считается завтра. */
|
|
152
157
|
export declare const DEFAULT_LATE_START_HOURS = 3;
|
|
@@ -169,6 +174,11 @@ export interface FlowSchedule {
|
|
|
169
174
|
firstMessages?: {
|
|
170
175
|
/** Нет — из настроек приложения. */
|
|
171
176
|
maxPerDay?: number;
|
|
177
|
+
/**
|
|
178
|
+
* Потолок по дням программы: `[3, 2]` — в день 1 не больше трёх, со дня 2 — не больше двух (последнее значение — на
|
|
179
|
+
* все следующие дни). Главнее `maxPerDay`. Счёт идёт по дням программы, ответ человека его не обнуляет. С 0.67.
|
|
180
|
+
*/
|
|
181
|
+
maxPerDayByDay?: number[];
|
|
172
182
|
/** Писать в начале дня; нет — да, если задан `lengthDays`. */
|
|
173
183
|
morning?: boolean;
|
|
174
184
|
/** Утреннее пропускается, если человек писал за столько минут до него; нет — 180. */
|
|
@@ -178,6 +178,7 @@ export declare const agentFlowSchema: z.ZodPipe<z.ZodObject<{
|
|
|
178
178
|
}>;
|
|
179
179
|
}, z.core.$strict>>;
|
|
180
180
|
days: z.ZodOptional<z.ZodNumber>;
|
|
181
|
+
untilProgramDay: z.ZodOptional<z.ZodNumber>;
|
|
181
182
|
}, z.core.$strict>, z.ZodLiteral<"off">]>>;
|
|
182
183
|
}, z.core.$strict>>;
|
|
183
184
|
layout: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
@@ -194,6 +195,7 @@ export declare const agentFlowSchema: z.ZodPipe<z.ZodObject<{
|
|
|
194
195
|
farewellText: z.ZodOptional<z.ZodString>;
|
|
195
196
|
firstMessages: z.ZodOptional<z.ZodObject<{
|
|
196
197
|
maxPerDay: z.ZodOptional<z.ZodInt>;
|
|
198
|
+
maxPerDayByDay: z.ZodOptional<z.ZodArray<z.ZodInt>>;
|
|
197
199
|
morning: z.ZodOptional<z.ZodBoolean>;
|
|
198
200
|
skipMorningIfHumanWithinMin: z.ZodOptional<z.ZodInt>;
|
|
199
201
|
}, z.core.$strict>>;
|
|
@@ -371,6 +373,7 @@ export declare const agentFlowSchema: z.ZodPipe<z.ZodObject<{
|
|
|
371
373
|
unit: "d" | "h" | "min";
|
|
372
374
|
} | undefined;
|
|
373
375
|
days?: number | undefined;
|
|
376
|
+
untilProgramDay?: number | undefined;
|
|
374
377
|
} | undefined;
|
|
375
378
|
}[];
|
|
376
379
|
layout: Record<string, {
|
|
@@ -387,6 +390,7 @@ export declare const agentFlowSchema: z.ZodPipe<z.ZodObject<{
|
|
|
387
390
|
farewellText?: string | undefined;
|
|
388
391
|
firstMessages?: {
|
|
389
392
|
maxPerDay?: number | undefined;
|
|
393
|
+
maxPerDayByDay?: number[] | undefined;
|
|
390
394
|
morning?: boolean | undefined;
|
|
391
395
|
skipMorningIfHumanWithinMin?: number | undefined;
|
|
392
396
|
} | undefined;
|
|
@@ -546,6 +550,7 @@ export declare const agentFlowSchema: z.ZodPipe<z.ZodObject<{
|
|
|
546
550
|
unit: "d" | "h" | "min";
|
|
547
551
|
} | undefined;
|
|
548
552
|
days?: number | undefined;
|
|
553
|
+
untilProgramDay?: number | undefined;
|
|
549
554
|
} | undefined;
|
|
550
555
|
}[];
|
|
551
556
|
layout: Record<string, {
|
|
@@ -562,6 +567,7 @@ export declare const agentFlowSchema: z.ZodPipe<z.ZodObject<{
|
|
|
562
567
|
farewellText?: string | undefined;
|
|
563
568
|
firstMessages?: {
|
|
564
569
|
maxPerDay?: number | undefined;
|
|
570
|
+
maxPerDayByDay?: number[] | undefined;
|
|
565
571
|
morning?: boolean | undefined;
|
|
566
572
|
skipMorningIfHumanWithinMin?: number | undefined;
|
|
567
573
|
} | undefined;
|
|
@@ -58,6 +58,7 @@ export interface FlowEditorLabels {
|
|
|
58
58
|
noNudges: string;
|
|
59
59
|
/** Срок своих касаний на карточке: «в день входа», «первые 2 дн.». */
|
|
60
60
|
nudgesDays: (days: number) => string;
|
|
61
|
+
nudgesUntilProgramDay: (day: number) => string;
|
|
61
62
|
/** Кнопки места на доске: легенда, мини-карта, панель «Сценарий», полный экран. */
|
|
62
63
|
space: {
|
|
63
64
|
legend: string;
|
|
@@ -106,6 +107,8 @@ export interface FlowEditorLabels {
|
|
|
106
107
|
firstMessages: string;
|
|
107
108
|
maxPerDay: string;
|
|
108
109
|
maxPerDayHint: string;
|
|
110
|
+
maxPerDayByDay: string;
|
|
111
|
+
maxPerDayByDayHint: string;
|
|
109
112
|
morning: string;
|
|
110
113
|
skipMorning: string;
|
|
111
114
|
nudges: string;
|
|
@@ -172,8 +175,9 @@ export interface FlowEditorLabels {
|
|
|
172
175
|
nudgesHint: string;
|
|
173
176
|
/** Сколько действуют свои касания: всё время в ноде или N дней с дня входа. */
|
|
174
177
|
nudgesDays: string;
|
|
175
|
-
nudgesDaysModes: Record<"always" | "days", string>;
|
|
178
|
+
nudgesDaysModes: Record<"always" | "days" | "untilProgramDay", string>;
|
|
176
179
|
nudgesDaysHint: string;
|
|
180
|
+
nudgesUntilProgramDayHint: string;
|
|
177
181
|
};
|
|
178
182
|
exitCard: {
|
|
179
183
|
when: string;
|
|
@@ -2,6 +2,6 @@ export { FlowEditor, type FlowEditorProps } from "./flow-editor.js";
|
|
|
2
2
|
export { useFlowEditor, type FlowDialog, type FlowEditorController, type FlowMigrateController, type FlowMigrateRow, type FlowMigration, type FlowSaveResult, type FlowSelection, type UseFlowEditorOptions, } from "./use-flow-editor.js";
|
|
3
3
|
export { conditionText } from "./exit-text.js";
|
|
4
4
|
export { chooseExit, chooseNothing, nextQuestionField, setKnownValue, simulationChoices, startSimulation, stepBack, type Simulation, type SimulationChoice, type SimulationStep, } from "./flow-simulation.js";
|
|
5
|
-
export { DEFAULT_NUDGES, DEFAULT_SCHEDULE } from "./schedule-model.js";
|
|
5
|
+
export { capsByDayText, DEFAULT_NUDGES, DEFAULT_SCHEDULE, parseCapsByDay } from "./schedule-model.js";
|
|
6
6
|
export type { FlowBoardSpaceProps, FlowHeaderMode, FlowInspectorMode, FlowLegendMode, FlowMinimapMode } from "./board-space.js";
|
|
7
7
|
export { sameFlow } from "./editor-model.js";
|
|
@@ -33,12 +33,20 @@ export type NudgesMode = "inherit" | "own" | "off";
|
|
|
33
33
|
export declare function nudgesMode(state: FlowState): NudgesMode;
|
|
34
34
|
/** Касания ноды: как у сценария (поля нет), свои (образец — общие или 15 мин · 1 ч · 4 ч), выкл. */
|
|
35
35
|
export declare function setStateNudges(flow: AgentFlow, stateId: string, mode: NudgesMode): AgentFlow;
|
|
36
|
-
/** Своё расписание касаний ноды: пустые части убираются,
|
|
36
|
+
/** Своё расписание касаний ноды: пустые части убираются, сроки в днях остаются. */
|
|
37
37
|
export declare function updateStateNudges(flow: AgentFlow, stateId: string, nudges: FlowNudges): AgentFlow;
|
|
38
38
|
/** Сколько дней действуют свои касания ноды, считая день входа; `null` — всё время в ноде. */
|
|
39
39
|
export declare function setStateNudgesDays(flow: AgentFlow, stateId: string, days: number | null): AgentFlow;
|
|
40
40
|
/** Срок своих касаний ноды в днях; всё время в ноде или касания не свои — `null`. */
|
|
41
41
|
export declare function stateNudgesDays(state: FlowState): number | null;
|
|
42
|
+
/** Свои касания ноды действуют до этого дня программы включительно; `null` — без такого предела. С 0.67. */
|
|
43
|
+
export declare function setStateNudgesUntilProgramDay(flow: AgentFlow, stateId: string, day: number | null): AgentFlow;
|
|
44
|
+
/** До какого дня программы действуют свои касания ноды; предела нет или касания не свои — `null`. */
|
|
45
|
+
export declare function stateNudgesUntilProgramDay(state: FlowState): number | null;
|
|
46
|
+
/** Потолок «пишет первым» по дням программы текстом: `[3, 2]` → «3, 2». */
|
|
47
|
+
export declare function capsByDayText(caps: number[] | undefined): string;
|
|
48
|
+
/** «3, 2» → `[3, 2]`; пусто — `undefined` (потолок без дней); не числа — `null`. */
|
|
49
|
+
export declare function parseCapsByDay(text: string): number[] | undefined | null;
|
|
42
50
|
/** Касания по умолчанию в «Днях и времени»; `null` — без общих касаний. */
|
|
43
51
|
export declare function updateScheduleNudges(flow: AgentFlow, nudges: FlowNudges | null): AgentFlow;
|
|
44
52
|
/** «15 мин», «4 ч», «3 дн.». */
|
|
@@ -203,6 +203,9 @@ export interface FlowStateTimingProps {
|
|
|
203
203
|
/** Свои касания действуют столько дней, считая день входа; `null` — всё время в ноде. С 0.55. */
|
|
204
204
|
nudgesDays: number | null;
|
|
205
205
|
onNudgesDaysChange(days: number | null): void;
|
|
206
|
+
/** Свои касания действуют до этого дня программы включительно; `null` — без такого предела. С 0.67. */
|
|
207
|
+
nudgesUntilProgramDay: number | null;
|
|
208
|
+
onNudgesUntilProgramDayChange(day: number | null): void;
|
|
206
209
|
}
|
|
207
210
|
/** Цель перехода в списке «Куда»: состояние или «назад». */
|
|
208
211
|
export interface FlowTargetOption {
|
|
@@ -11,6 +11,8 @@ export type FlowChatWriteState = Pick<FlowChatRecord, "dayClosedOn" | "pausedUnt
|
|
|
11
11
|
export declare function chatWriteBlock(chat: FlowChatWriteState, at: number, timeZone: string, schedule: FlowSchedule | undefined): {
|
|
12
12
|
retryAt: number | null;
|
|
13
13
|
} | null;
|
|
14
|
+
/** Потолок дня программы из `maxPerDayByDay`: вечер до первого дня — как день 1, после списка — его последнее значение. */
|
|
15
|
+
export declare function capOfProgramDay(byDay: number[] | undefined, programDay: number | undefined): number | undefined;
|
|
14
16
|
/** Правила «писать первым» на хранилище счётчиков; `false` в настройках — `null`, агент пишет первым без ограничений. */
|
|
15
17
|
export declare function createFirstMessageRules(setting: FirstMessagesSetting | undefined, store: FlowStore): FirstMessageRules | null;
|
|
16
18
|
/** Пояс чата ещё не известен: страница его не присылала. */
|
|
@@ -214,6 +214,8 @@ export interface FirstMessageRules {
|
|
|
214
214
|
timeZone: string;
|
|
215
215
|
/** «Дни и время» сценария: его ночь и потолок главнее настроек приложения, закрытый день — до следующего. */
|
|
216
216
|
schedule?: FlowSchedule;
|
|
217
|
+
/** День программы этого чата (как `flowDay`): по нему потолок `maxPerDayByDay`. */
|
|
218
|
+
programDay?: number;
|
|
217
219
|
/** Запись чата: окно канала, пауза сотрудника, закрытый день — запрет до правил приложения. */
|
|
218
220
|
chat?: Pick<FlowChatRecord, "dayClosedOn" | "pausedUntil" | "windowClosed">;
|
|
219
221
|
}): Promise<{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ykurilov/agent-chat-flows",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.67.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -56,13 +56,13 @@
|
|
|
56
56
|
"ai": "7.0.122",
|
|
57
57
|
"drizzle-orm": "^0.45.3",
|
|
58
58
|
"zod": "^4.6.5",
|
|
59
|
-
"@ykurilov/agent-chat-core": "0.
|
|
59
|
+
"@ykurilov/agent-chat-core": "0.67.0"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
62
|
"better-sqlite3": "^13.0.3",
|
|
63
63
|
"pg": "^8.23.0",
|
|
64
64
|
"react": "^19.3.0",
|
|
65
|
-
"@ykurilov/agent-chat-react": "^0.
|
|
65
|
+
"@ykurilov/agent-chat-react": "^0.67.0"
|
|
66
66
|
},
|
|
67
67
|
"peerDependenciesMeta": {
|
|
68
68
|
"@ykurilov/agent-chat-react": {
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"pg": "^8.23.0",
|
|
91
91
|
"react": "^19.3.0",
|
|
92
92
|
"tsx": "4.23.15",
|
|
93
|
-
"@ykurilov/agent-chat-react": "0.
|
|
93
|
+
"@ykurilov/agent-chat-react": "0.67.0"
|
|
94
94
|
},
|
|
95
95
|
"scripts": {
|
|
96
96
|
"build": "node ../../scripts/build-package.mjs",
|