@breign/db-schemas 0.1.83 → 0.1.85

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.
@@ -1,9 +1,9 @@
1
1
  import type { ActorRef } from './project';
2
2
  /**
3
- * `question`, `ticket_proposal`, `review` et `go_ahead` sont des actions (onglet « À traiter ») ;
4
- * `mention` a son propre onglet.
3
+ * `question`, `ticket_proposal`, `review`, `go_ahead` et `approval` sont des actions (onglet
4
+ * « À traiter ») ; `mention` a son propre onglet.
5
5
  */
6
- export type InboxItemKind = 'question' | 'ticket_proposal' | 'review' | 'go_ahead' | 'mention';
6
+ export type InboxItemKind = 'question' | 'ticket_proposal' | 'review' | 'go_ahead' | 'approval' | 'mention';
7
7
  /** Ce qui attend un humain : écrit quand l'action naît, résolu quand elle est faite. */
8
8
  export type InboxItem = {
9
9
  id: string;
@@ -15,7 +15,8 @@ export type InboxItem = {
15
15
  ticketId: string | null;
16
16
  /**
17
17
  * Objet visé : `callId` d'une question, `proposalId` d'une proposition, événement d'une mention,
18
- * ticket d'une relecture, ticket d'un feu vert (avec l'agent dans `data.agentId`).
18
+ * ticket d'une relecture, ticket d'un feu vert (avec l'agent dans `data.agentId`), événement
19
+ * d'une demande d'approbation.
19
20
  */
20
21
  refId: string;
21
22
  summary: string;
@@ -28,6 +28,8 @@ export type Knowledge = {
28
28
  isFAQ?: boolean;
29
29
  /** Run the OCR pre-pass before parsing this document to Markdown */
30
30
  ocr?: boolean;
31
+ /** Path of the document where it comes from, shown to the agent next to its name. */
32
+ sourcePath?: string;
31
33
  uploadId?: string;
32
34
  postURL?: string;
33
35
  formData?: object;
@@ -45,9 +45,10 @@ export type TicketAssignee = {
45
45
  };
46
46
  /**
47
47
  * `comment` et `report` sont écrits par un humain ou un agent, `question` porte une question
48
- * d'agent à un humain, `event` est une trace (création, statut, assignation…).
48
+ * d'agent à un humain, `approval` une demande d'approbation d'un agent, `event` est une trace
49
+ * (création, statut, assignation…).
49
50
  */
50
- export type TicketEventKind = 'comment' | 'report' | 'question' | 'event';
51
+ export type TicketEventKind = 'comment' | 'report' | 'question' | 'approval' | 'event';
51
52
  export type TicketEvent = {
52
53
  id: string;
53
54
  ticketId: string;
@@ -57,7 +58,8 @@ export type TicketEvent = {
57
58
  body: string | null;
58
59
  /**
59
60
  * Selon le type : `event` → `{ action, from?, to?, member? }`, `report` → `{ title }`,
60
- * `question` → `{ humanRequest: TicketQuestion }` ; les mentions dans `{ mentions: MemberRef[] }`.
61
+ * `question` → `{ humanRequest: TicketQuestion }`, `approval` → `{ approval: TicketApproval }` ;
62
+ * les mentions dans `{ mentions: MemberRef[] }`.
61
63
  */
62
64
  data: Record<string, unknown>;
63
65
  artifactIds: string[];
@@ -129,6 +131,26 @@ export type TicketQuestion = {
129
131
  answeredBy?: string | null;
130
132
  answeredAt?: string | null;
131
133
  };
134
+ export type TicketApprovalStatus = 'pending' | 'approved' | 'changes_requested' | 'rejected'
135
+ /** Le ticket a été terminé, ou l'agent a quitté le ticket, avant la réponse. */
136
+ | 'cancelled';
137
+ /**
138
+ * Une demande d'approbation d'un agent : un signal attendu d'un humain, qui ne change pas le
139
+ * statut du ticket. L'objet à approuver est dans le corps de l'événement et ses artefacts ;
140
+ * la réponse réveille l'agent.
141
+ */
142
+ export type TicketApproval = {
143
+ status: TicketApprovalStatus;
144
+ /** L'agent qui demande. */
145
+ agentId: string;
146
+ /** L'humain qui doit répondre. */
147
+ approverUserId: string;
148
+ title: string;
149
+ decidedBy?: string | null;
150
+ decidedAt?: string | null;
151
+ /** Le commentaire joint à la réponse (changements demandés, raison d'un refus). */
152
+ comment?: string | null;
153
+ };
132
154
  export type TicketPlanStepStatus = 'todo' | 'doing' | 'done';
133
155
  export type TicketAgentPlan = {
134
156
  steps: {
@@ -162,7 +184,7 @@ export type TicketAgentSession = {
162
184
  createdAt: string;
163
185
  lastRunAt: string | null;
164
186
  };
165
- export type TicketWakeupReasonKind = 'assigned' | 'go_ahead' | 'reopened' | 'changes_requested' | 'comment' | 'mention';
187
+ export type TicketWakeupReasonKind = 'assigned' | 'go_ahead' | 'reopened' | 'changes_requested' | 'comment' | 'mention' | 'approved' | 'approval_changes_requested' | 'approval_rejected';
166
188
  export type TicketWakeupReason = {
167
189
  kind: TicketWakeupReasonKind;
168
190
  eventId?: string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@breign/db-schemas",
3
- "version": "0.1.83",
3
+ "version": "0.1.85",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -1,10 +1,16 @@
1
1
  import type { ActorRef } from './project';
2
2
 
3
3
  /**
4
- * `question`, `ticket_proposal`, `review` et `go_ahead` sont des actions (onglet « À traiter ») ;
5
- * `mention` a son propre onglet.
4
+ * `question`, `ticket_proposal`, `review`, `go_ahead` et `approval` sont des actions (onglet
5
+ * « À traiter ») ; `mention` a son propre onglet.
6
6
  */
7
- export type InboxItemKind = 'question' | 'ticket_proposal' | 'review' | 'go_ahead' | 'mention';
7
+ export type InboxItemKind =
8
+ | 'question'
9
+ | 'ticket_proposal'
10
+ | 'review'
11
+ | 'go_ahead'
12
+ | 'approval'
13
+ | 'mention';
8
14
 
9
15
  /** Ce qui attend un humain : écrit quand l'action naît, résolu quand elle est faite. */
10
16
  export type InboxItem = {
@@ -17,7 +23,8 @@ export type InboxItem = {
17
23
  ticketId: string | null;
18
24
  /**
19
25
  * Objet visé : `callId` d'une question, `proposalId` d'une proposition, événement d'une mention,
20
- * ticket d'une relecture, ticket d'un feu vert (avec l'agent dans `data.agentId`).
26
+ * ticket d'une relecture, ticket d'un feu vert (avec l'agent dans `data.agentId`), événement
27
+ * d'une demande d'approbation.
21
28
  */
22
29
  refId: string;
23
30
  summary: string;
@@ -27,6 +27,8 @@ export type Knowledge = {
27
27
  isFAQ?: boolean;
28
28
  /** Run the OCR pre-pass before parsing this document to Markdown */
29
29
  ocr?: boolean;
30
+ /** Path of the document where it comes from, shown to the agent next to its name. */
31
+ sourcePath?: string;
30
32
  uploadId?: string;
31
33
  postURL?: string;
32
34
  formData?: object;
@@ -57,9 +57,10 @@ export type TicketAssignee = {
57
57
 
58
58
  /**
59
59
  * `comment` et `report` sont écrits par un humain ou un agent, `question` porte une question
60
- * d'agent à un humain, `event` est une trace (création, statut, assignation…).
60
+ * d'agent à un humain, `approval` une demande d'approbation d'un agent, `event` est une trace
61
+ * (création, statut, assignation…).
61
62
  */
62
- export type TicketEventKind = 'comment' | 'report' | 'question' | 'event';
63
+ export type TicketEventKind = 'comment' | 'report' | 'question' | 'approval' | 'event';
63
64
 
64
65
  export type TicketEvent = {
65
66
  id: string;
@@ -70,7 +71,8 @@ export type TicketEvent = {
70
71
  body: string | null;
71
72
  /**
72
73
  * Selon le type : `event` → `{ action, from?, to?, member? }`, `report` → `{ title }`,
73
- * `question` → `{ humanRequest: TicketQuestion }` ; les mentions dans `{ mentions: MemberRef[] }`.
74
+ * `question` → `{ humanRequest: TicketQuestion }`, `approval` → `{ approval: TicketApproval }` ;
75
+ * les mentions dans `{ mentions: MemberRef[] }`.
74
76
  */
75
77
  data: Record<string, unknown>;
76
78
  artifactIds: string[];
@@ -146,6 +148,32 @@ export type TicketQuestion = {
146
148
  answeredAt?: string | null;
147
149
  };
148
150
 
151
+ export type TicketApprovalStatus =
152
+ | 'pending'
153
+ | 'approved'
154
+ | 'changes_requested'
155
+ | 'rejected'
156
+ /** Le ticket a été terminé, ou l'agent a quitté le ticket, avant la réponse. */
157
+ | 'cancelled';
158
+
159
+ /**
160
+ * Une demande d'approbation d'un agent : un signal attendu d'un humain, qui ne change pas le
161
+ * statut du ticket. L'objet à approuver est dans le corps de l'événement et ses artefacts ;
162
+ * la réponse réveille l'agent.
163
+ */
164
+ export type TicketApproval = {
165
+ status: TicketApprovalStatus;
166
+ /** L'agent qui demande. */
167
+ agentId: string;
168
+ /** L'humain qui doit répondre. */
169
+ approverUserId: string;
170
+ title: string;
171
+ decidedBy?: string | null;
172
+ decidedAt?: string | null;
173
+ /** Le commentaire joint à la réponse (changements demandés, raison d'un refus). */
174
+ comment?: string | null;
175
+ };
176
+
149
177
  export type TicketPlanStepStatus = 'todo' | 'doing' | 'done';
150
178
 
151
179
  export type TicketAgentPlan = {
@@ -185,7 +213,10 @@ export type TicketWakeupReasonKind =
185
213
  | 'reopened'
186
214
  | 'changes_requested'
187
215
  | 'comment'
188
- | 'mention';
216
+ | 'mention'
217
+ | 'approved'
218
+ | 'approval_changes_requested'
219
+ | 'approval_rejected';
189
220
 
190
221
  export type TicketWakeupReason = {
191
222
  kind: TicketWakeupReasonKind;