@breign/db-schemas 0.1.76 → 0.1.78
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/types/project.d.ts +12 -0
- package/dist/types/ticket.d.ts +77 -1
- package/package.json +1 -1
- package/src/types/project.ts +13 -0
- package/src/types/ticket.ts +89 -1
package/dist/types/project.d.ts
CHANGED
|
@@ -16,11 +16,23 @@ export type MemberRef = {
|
|
|
16
16
|
* `direct`, le ticket est créé tout de suite et la création reste annulable.
|
|
17
17
|
*/
|
|
18
18
|
export type AgentTicketCreation = 'confirm' | 'direct';
|
|
19
|
+
/**
|
|
20
|
+
* Ce qui se passe quand un agent assigne un autre agent du projet à un ticket : `confirm`, l'agent
|
|
21
|
+
* assigné attend le feu vert d'un responsable humain ; `direct`, il se met au travail tout de suite.
|
|
22
|
+
*/
|
|
23
|
+
export type AgentAssignment = 'confirm' | 'direct';
|
|
19
24
|
/** `now` : les agents assignés commencent dès l'assignation ; `hold` : ils attendent un feu vert. */
|
|
20
25
|
export type TicketStartMode = 'now' | 'hold';
|
|
21
26
|
export type ProjectSettings = {
|
|
22
27
|
agentTicketCreation: AgentTicketCreation;
|
|
23
28
|
defaultStartMode: TicketStartMode;
|
|
29
|
+
/**
|
|
30
|
+
* Les agents assignés se mettent au travail d'eux-mêmes quand on leur confie le ticket ou qu'on
|
|
31
|
+
* leur parle. Absent = activé.
|
|
32
|
+
*/
|
|
33
|
+
agentsAutoWork?: boolean;
|
|
34
|
+
/** Assignation d'un agent par un autre agent. Absent = `confirm`. */
|
|
35
|
+
agentAssignment?: AgentAssignment;
|
|
24
36
|
};
|
|
25
37
|
export type Project = {
|
|
26
38
|
id: string;
|
package/dist/types/ticket.d.ts
CHANGED
|
@@ -57,7 +57,7 @@ export type TicketEvent = {
|
|
|
57
57
|
body: string | null;
|
|
58
58
|
/**
|
|
59
59
|
* Selon le type : `event` → `{ action, from?, to?, member? }`, `report` → `{ title }`,
|
|
60
|
-
* `question` → `{ humanRequest }` ; les mentions dans `{ mentions: MemberRef[] }`.
|
|
60
|
+
* `question` → `{ humanRequest: TicketQuestion }` ; les mentions dans `{ mentions: MemberRef[] }`.
|
|
61
61
|
*/
|
|
62
62
|
data: Record<string, unknown>;
|
|
63
63
|
artifactIds: string[];
|
|
@@ -114,3 +114,79 @@ export type TicketProposal = {
|
|
|
114
114
|
decidedAt: string | null;
|
|
115
115
|
createdAt: string;
|
|
116
116
|
};
|
|
117
|
+
export type TicketQuestionStatus = 'pending' | 'answered' | 'declined' | 'expired';
|
|
118
|
+
/** Question posée par un agent pendant son travail sur un ticket (Human_ask), dans `data.humanRequest`. */
|
|
119
|
+
export type TicketQuestion = {
|
|
120
|
+
callId: string;
|
|
121
|
+
status: TicketQuestionStatus;
|
|
122
|
+
/** L'humain à qui la question est posée ; lui seul y répond. */
|
|
123
|
+
targetUserId: string;
|
|
124
|
+
options?: string[];
|
|
125
|
+
context?: string | null;
|
|
126
|
+
expiresAt?: string | null;
|
|
127
|
+
answer?: string | null;
|
|
128
|
+
/** Nom ou adresse de qui a tranché, tel qu'il était à ce moment. */
|
|
129
|
+
answeredBy?: string | null;
|
|
130
|
+
answeredAt?: string | null;
|
|
131
|
+
};
|
|
132
|
+
export type TicketPlanStepStatus = 'todo' | 'doing' | 'done';
|
|
133
|
+
export type TicketAgentPlan = {
|
|
134
|
+
steps: {
|
|
135
|
+
title: string;
|
|
136
|
+
status: TicketPlanStepStatus;
|
|
137
|
+
}[];
|
|
138
|
+
updatedAt: string;
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* La session de travail d'un agent sur un ticket : une conversation de type `task`, reprise à
|
|
142
|
+
* chaque réveil. Une seule par ticket et par agent.
|
|
143
|
+
*/
|
|
144
|
+
export type TicketAgentSession = {
|
|
145
|
+
ticketId: string;
|
|
146
|
+
agentId: string;
|
|
147
|
+
organizationId: string;
|
|
148
|
+
projectId: string;
|
|
149
|
+
conversationId: string;
|
|
150
|
+
/** L'humain au nom duquel l'agent travaille : celui qui a lancé le travail. */
|
|
151
|
+
userId: string | null;
|
|
152
|
+
plan: TicketAgentPlan | null;
|
|
153
|
+
/** Date du dernier événement du ticket transmis à l'agent : les suivants sont nouveaux pour lui. */
|
|
154
|
+
eventCursor: string | null;
|
|
155
|
+
/**
|
|
156
|
+
* Réponse de l'agent au dernier réveil : une question y suspend le tour, et la réponse de
|
|
157
|
+
* l'humain le reprend sur ce même message. Son statut dit si l'agent travaille encore.
|
|
158
|
+
*/
|
|
159
|
+
lastMessageId: string | null;
|
|
160
|
+
/** Taille du prompt au dernier réveil, pour l'occupation du contexte sans relire la conversation. */
|
|
161
|
+
lastPromptTokens: number | null;
|
|
162
|
+
createdAt: string;
|
|
163
|
+
lastRunAt: string | null;
|
|
164
|
+
};
|
|
165
|
+
export type TicketWakeupReasonKind = 'assigned' | 'go_ahead' | 'reopened' | 'changes_requested' | 'comment' | 'mention';
|
|
166
|
+
export type TicketWakeupReason = {
|
|
167
|
+
kind: TicketWakeupReasonKind;
|
|
168
|
+
eventId?: string | null;
|
|
169
|
+
by: ActorRef;
|
|
170
|
+
at: string;
|
|
171
|
+
};
|
|
172
|
+
export type TicketWakeupStatus = 'pending' | 'running' | 'done' | 'skipped' | 'error';
|
|
173
|
+
/** Un réveil d'agent : les raisons de se remettre au travail, regroupées tant qu'il attend. */
|
|
174
|
+
export type TicketWakeup = {
|
|
175
|
+
id: string;
|
|
176
|
+
organizationId: string;
|
|
177
|
+
projectId: string;
|
|
178
|
+
ticketId: string;
|
|
179
|
+
agentId: string;
|
|
180
|
+
/** L'humain qui a lancé le travail ; il devient l'utilisateur d'une nouvelle session. */
|
|
181
|
+
userId: string | null;
|
|
182
|
+
reasons: TicketWakeupReason[];
|
|
183
|
+
status: TicketWakeupStatus;
|
|
184
|
+
/** Pas avant cette date : le délai de regroupement, puis les reports. */
|
|
185
|
+
queuedAt: string;
|
|
186
|
+
attempts: number;
|
|
187
|
+
claimedAt: string | null;
|
|
188
|
+
claimedBy: string | null;
|
|
189
|
+
error: string | null;
|
|
190
|
+
createdAt: string;
|
|
191
|
+
updatedAt: string;
|
|
192
|
+
};
|
package/package.json
CHANGED
package/src/types/project.ts
CHANGED
|
@@ -21,12 +21,25 @@ export type MemberRef = {
|
|
|
21
21
|
*/
|
|
22
22
|
export type AgentTicketCreation = 'confirm' | 'direct';
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Ce qui se passe quand un agent assigne un autre agent du projet à un ticket : `confirm`, l'agent
|
|
26
|
+
* assigné attend le feu vert d'un responsable humain ; `direct`, il se met au travail tout de suite.
|
|
27
|
+
*/
|
|
28
|
+
export type AgentAssignment = 'confirm' | 'direct';
|
|
29
|
+
|
|
24
30
|
/** `now` : les agents assignés commencent dès l'assignation ; `hold` : ils attendent un feu vert. */
|
|
25
31
|
export type TicketStartMode = 'now' | 'hold';
|
|
26
32
|
|
|
27
33
|
export type ProjectSettings = {
|
|
28
34
|
agentTicketCreation: AgentTicketCreation;
|
|
29
35
|
defaultStartMode: TicketStartMode;
|
|
36
|
+
/**
|
|
37
|
+
* Les agents assignés se mettent au travail d'eux-mêmes quand on leur confie le ticket ou qu'on
|
|
38
|
+
* leur parle. Absent = activé.
|
|
39
|
+
*/
|
|
40
|
+
agentsAutoWork?: boolean;
|
|
41
|
+
/** Assignation d'un agent par un autre agent. Absent = `confirm`. */
|
|
42
|
+
agentAssignment?: AgentAssignment;
|
|
30
43
|
};
|
|
31
44
|
|
|
32
45
|
export type Project = {
|
package/src/types/ticket.ts
CHANGED
|
@@ -70,7 +70,7 @@ export type TicketEvent = {
|
|
|
70
70
|
body: string | null;
|
|
71
71
|
/**
|
|
72
72
|
* Selon le type : `event` → `{ action, from?, to?, member? }`, `report` → `{ title }`,
|
|
73
|
-
* `question` → `{ humanRequest }` ; les mentions dans `{ mentions: MemberRef[] }`.
|
|
73
|
+
* `question` → `{ humanRequest: TicketQuestion }` ; les mentions dans `{ mentions: MemberRef[] }`.
|
|
74
74
|
*/
|
|
75
75
|
data: Record<string, unknown>;
|
|
76
76
|
artifactIds: string[];
|
|
@@ -128,3 +128,91 @@ export type TicketProposal = {
|
|
|
128
128
|
decidedAt: string | null;
|
|
129
129
|
createdAt: string;
|
|
130
130
|
};
|
|
131
|
+
|
|
132
|
+
export type TicketQuestionStatus = 'pending' | 'answered' | 'declined' | 'expired';
|
|
133
|
+
|
|
134
|
+
/** Question posée par un agent pendant son travail sur un ticket (Human_ask), dans `data.humanRequest`. */
|
|
135
|
+
export type TicketQuestion = {
|
|
136
|
+
callId: string;
|
|
137
|
+
status: TicketQuestionStatus;
|
|
138
|
+
/** L'humain à qui la question est posée ; lui seul y répond. */
|
|
139
|
+
targetUserId: string;
|
|
140
|
+
options?: string[];
|
|
141
|
+
context?: string | null;
|
|
142
|
+
expiresAt?: string | null;
|
|
143
|
+
answer?: string | null;
|
|
144
|
+
/** Nom ou adresse de qui a tranché, tel qu'il était à ce moment. */
|
|
145
|
+
answeredBy?: string | null;
|
|
146
|
+
answeredAt?: string | null;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export type TicketPlanStepStatus = 'todo' | 'doing' | 'done';
|
|
150
|
+
|
|
151
|
+
export type TicketAgentPlan = {
|
|
152
|
+
steps: { title: string; status: TicketPlanStepStatus }[];
|
|
153
|
+
updatedAt: string;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* La session de travail d'un agent sur un ticket : une conversation de type `task`, reprise à
|
|
158
|
+
* chaque réveil. Une seule par ticket et par agent.
|
|
159
|
+
*/
|
|
160
|
+
export type TicketAgentSession = {
|
|
161
|
+
ticketId: string;
|
|
162
|
+
agentId: string;
|
|
163
|
+
organizationId: string;
|
|
164
|
+
projectId: string;
|
|
165
|
+
conversationId: string;
|
|
166
|
+
/** L'humain au nom duquel l'agent travaille : celui qui a lancé le travail. */
|
|
167
|
+
userId: string | null;
|
|
168
|
+
plan: TicketAgentPlan | null;
|
|
169
|
+
/** Date du dernier événement du ticket transmis à l'agent : les suivants sont nouveaux pour lui. */
|
|
170
|
+
eventCursor: string | null;
|
|
171
|
+
/**
|
|
172
|
+
* Réponse de l'agent au dernier réveil : une question y suspend le tour, et la réponse de
|
|
173
|
+
* l'humain le reprend sur ce même message. Son statut dit si l'agent travaille encore.
|
|
174
|
+
*/
|
|
175
|
+
lastMessageId: string | null;
|
|
176
|
+
/** Taille du prompt au dernier réveil, pour l'occupation du contexte sans relire la conversation. */
|
|
177
|
+
lastPromptTokens: number | null;
|
|
178
|
+
createdAt: string;
|
|
179
|
+
lastRunAt: string | null;
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
export type TicketWakeupReasonKind =
|
|
183
|
+
| 'assigned'
|
|
184
|
+
| 'go_ahead'
|
|
185
|
+
| 'reopened'
|
|
186
|
+
| 'changes_requested'
|
|
187
|
+
| 'comment'
|
|
188
|
+
| 'mention';
|
|
189
|
+
|
|
190
|
+
export type TicketWakeupReason = {
|
|
191
|
+
kind: TicketWakeupReasonKind;
|
|
192
|
+
eventId?: string | null;
|
|
193
|
+
by: ActorRef;
|
|
194
|
+
at: string;
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
export type TicketWakeupStatus = 'pending' | 'running' | 'done' | 'skipped' | 'error';
|
|
198
|
+
|
|
199
|
+
/** Un réveil d'agent : les raisons de se remettre au travail, regroupées tant qu'il attend. */
|
|
200
|
+
export type TicketWakeup = {
|
|
201
|
+
id: string;
|
|
202
|
+
organizationId: string;
|
|
203
|
+
projectId: string;
|
|
204
|
+
ticketId: string;
|
|
205
|
+
agentId: string;
|
|
206
|
+
/** L'humain qui a lancé le travail ; il devient l'utilisateur d'une nouvelle session. */
|
|
207
|
+
userId: string | null;
|
|
208
|
+
reasons: TicketWakeupReason[];
|
|
209
|
+
status: TicketWakeupStatus;
|
|
210
|
+
/** Pas avant cette date : le délai de regroupement, puis les reports. */
|
|
211
|
+
queuedAt: string;
|
|
212
|
+
attempts: number;
|
|
213
|
+
claimedAt: string | null;
|
|
214
|
+
claimedBy: string | null;
|
|
215
|
+
error: string | null;
|
|
216
|
+
createdAt: string;
|
|
217
|
+
updatedAt: string;
|
|
218
|
+
};
|