@breign/db-schemas 0.1.76 → 0.1.77

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.
@@ -21,6 +21,11 @@ export type TicketStartMode = 'now' | 'hold';
21
21
  export type ProjectSettings = {
22
22
  agentTicketCreation: AgentTicketCreation;
23
23
  defaultStartMode: TicketStartMode;
24
+ /**
25
+ * Les agents assignés se mettent au travail d'eux-mêmes quand on leur confie le ticket ou qu'on
26
+ * leur parle. Absent = activé.
27
+ */
28
+ agentsAutoWork?: boolean;
24
29
  };
25
30
  export type Project = {
26
31
  id: string;
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@breign/db-schemas",
3
- "version": "0.1.76",
3
+ "version": "0.1.77",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -27,6 +27,11 @@ export type TicketStartMode = 'now' | 'hold';
27
27
  export type ProjectSettings = {
28
28
  agentTicketCreation: AgentTicketCreation;
29
29
  defaultStartMode: TicketStartMode;
30
+ /**
31
+ * Les agents assignés se mettent au travail d'eux-mêmes quand on leur confie le ticket ou qu'on
32
+ * leur parle. Absent = activé.
33
+ */
34
+ agentsAutoWork?: boolean;
30
35
  };
31
36
 
32
37
  export type Project = {
@@ -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
+ };