@breign/db-schemas 0.1.74 → 0.1.76
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/conversation.d.ts +23 -0
- package/dist/types/inbox.d.ts +27 -0
- package/dist/types/inbox.js +2 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.js +3 -0
- package/dist/types/knowledge.d.ts +2 -0
- package/dist/types/project.d.ts +51 -0
- package/dist/types/project.js +2 -0
- package/dist/types/ticket.d.ts +116 -0
- package/dist/types/ticket.js +2 -0
- package/package.json +1 -1
- package/src/types/conversation.ts +21 -0
- package/src/types/inbox.ts +29 -0
- package/src/types/index.ts +3 -0
- package/src/types/knowledge.ts +2 -0
- package/src/types/project.ts +60 -0
- package/src/types/ticket.ts +130 -0
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ChatMessageRoleUio } from '@breign/client';
|
|
2
2
|
import type { ToolCallApprovalScope } from './pending-tool-call';
|
|
3
|
+
import type { AgentTicketCreation } from './project';
|
|
4
|
+
import type { TicketProposalPayload, TicketProposalStatus } from './ticket';
|
|
3
5
|
import type { ToolAction, ToolResult } from './tool-result';
|
|
4
6
|
export type ConversationMessageReaction = 'positive' | 'negative';
|
|
5
7
|
export type ConversationAttachmentStatus = 'TO_UPLOAD' | 'PROCESSING' | 'PROCESSED' | 'ERROR';
|
|
@@ -112,6 +114,20 @@ export type ConversationHumanRequest = {
|
|
|
112
114
|
answeredAt?: string;
|
|
113
115
|
expiresAt?: string;
|
|
114
116
|
};
|
|
117
|
+
/**
|
|
118
|
+
* Un ticket qu'un agent propose depuis cette conversation (outil `Ticket_create`). La carte affichée
|
|
119
|
+
* sous le message se met à jour quand la proposition est acceptée, écartée ou annulée.
|
|
120
|
+
*/
|
|
121
|
+
export type ConversationTicketProposal = {
|
|
122
|
+
proposalId: string;
|
|
123
|
+
status: TicketProposalStatus;
|
|
124
|
+
mode: AgentTicketCreation;
|
|
125
|
+
/** Projet proposé par l'agent ; null = l'humain doit en choisir un. */
|
|
126
|
+
projectId: string | null;
|
|
127
|
+
payload: TicketProposalPayload;
|
|
128
|
+
ticketId: string | null;
|
|
129
|
+
ticketKey: string | null;
|
|
130
|
+
};
|
|
115
131
|
export type ConversationMessage = {
|
|
116
132
|
id: string;
|
|
117
133
|
role: ChatMessageRoleUio;
|
|
@@ -133,6 +149,8 @@ export type ConversationMessage = {
|
|
|
133
149
|
approvals?: ConversationMessageApproval[];
|
|
134
150
|
/** Question posée à l'humain par une tâche. Voir ConversationHumanRequest. */
|
|
135
151
|
humanRequest?: ConversationHumanRequest;
|
|
152
|
+
/** Ticket proposé par l'agent dans ce message. Voir ConversationTicketProposal. */
|
|
153
|
+
ticketProposal?: ConversationTicketProposal;
|
|
136
154
|
suggestions?: {
|
|
137
155
|
id: string;
|
|
138
156
|
text: string;
|
|
@@ -175,6 +193,11 @@ export type ConversationContext = {
|
|
|
175
193
|
lastActivityAt?: string;
|
|
176
194
|
/** Tâche ouverte par un agent local via le serveur MCP de Breign. */
|
|
177
195
|
externalCaller?: ConversationExternalCaller;
|
|
196
|
+
/** Ticket auquel cette conversation est liée (proposition acceptée, session de travail). */
|
|
197
|
+
ticket?: {
|
|
198
|
+
ticketId: string;
|
|
199
|
+
projectId: string;
|
|
200
|
+
};
|
|
178
201
|
};
|
|
179
202
|
export type ConversationExternalCaller = {
|
|
180
203
|
kind: 'local_agent';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ActorRef } from './project';
|
|
2
|
+
/**
|
|
3
|
+
* `question`, `ticket_proposal`, `review` et `go_ahead` sont des actions (onglet « À traiter ») ;
|
|
4
|
+
* `mention` a son propre onglet.
|
|
5
|
+
*/
|
|
6
|
+
export type InboxItemKind = 'question' | 'ticket_proposal' | 'review' | 'go_ahead' | 'mention';
|
|
7
|
+
/** Ce qui attend un humain : écrit quand l'action naît, résolu quand elle est faite. */
|
|
8
|
+
export type InboxItem = {
|
|
9
|
+
id: string;
|
|
10
|
+
organizationId: string;
|
|
11
|
+
userId: string;
|
|
12
|
+
kind: InboxItemKind;
|
|
13
|
+
requestedBy: ActorRef;
|
|
14
|
+
projectId: string | null;
|
|
15
|
+
ticketId: string | null;
|
|
16
|
+
/**
|
|
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`).
|
|
19
|
+
*/
|
|
20
|
+
refId: string;
|
|
21
|
+
summary: string;
|
|
22
|
+
data: Record<string, unknown>;
|
|
23
|
+
status: 'pending' | 'done';
|
|
24
|
+
resolution: Record<string, unknown> | null;
|
|
25
|
+
createdAt: string;
|
|
26
|
+
resolvedAt: string | null;
|
|
27
|
+
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -8,16 +8,19 @@ export * from './engine';
|
|
|
8
8
|
export * from './file';
|
|
9
9
|
export * from './flow';
|
|
10
10
|
export * from './flow-editor';
|
|
11
|
+
export * from './inbox';
|
|
11
12
|
export * from './knowledge';
|
|
12
13
|
export * from './ocr';
|
|
13
14
|
export * from './organization';
|
|
14
15
|
export * from './pending-tool-call';
|
|
16
|
+
export * from './project';
|
|
15
17
|
export * from './permissions';
|
|
16
18
|
export * from './role';
|
|
17
19
|
export * from './scheduled-task';
|
|
18
20
|
export * from './scheduled-task-run';
|
|
19
21
|
export * from './skill';
|
|
20
22
|
export * from './speech-to-text';
|
|
23
|
+
export * from './ticket';
|
|
21
24
|
export * from './tool';
|
|
22
25
|
export * from './tool-approval';
|
|
23
26
|
export * from './tool-result';
|
package/dist/types/index.js
CHANGED
|
@@ -24,16 +24,19 @@ __exportStar(require("./engine"), exports);
|
|
|
24
24
|
__exportStar(require("./file"), exports);
|
|
25
25
|
__exportStar(require("./flow"), exports);
|
|
26
26
|
__exportStar(require("./flow-editor"), exports);
|
|
27
|
+
__exportStar(require("./inbox"), exports);
|
|
27
28
|
__exportStar(require("./knowledge"), exports);
|
|
28
29
|
__exportStar(require("./ocr"), exports);
|
|
29
30
|
__exportStar(require("./organization"), exports);
|
|
30
31
|
__exportStar(require("./pending-tool-call"), exports);
|
|
32
|
+
__exportStar(require("./project"), exports);
|
|
31
33
|
__exportStar(require("./permissions"), exports);
|
|
32
34
|
__exportStar(require("./role"), exports);
|
|
33
35
|
__exportStar(require("./scheduled-task"), exports);
|
|
34
36
|
__exportStar(require("./scheduled-task-run"), exports);
|
|
35
37
|
__exportStar(require("./skill"), exports);
|
|
36
38
|
__exportStar(require("./speech-to-text"), exports);
|
|
39
|
+
__exportStar(require("./ticket"), exports);
|
|
37
40
|
__exportStar(require("./tool"), exports);
|
|
38
41
|
__exportStar(require("./tool-approval"), exports);
|
|
39
42
|
__exportStar(require("./tool-result"), exports);
|
|
@@ -35,6 +35,8 @@ export type Knowledge = {
|
|
|
35
35
|
ext?: string;
|
|
36
36
|
size?: number;
|
|
37
37
|
hash?: string;
|
|
38
|
+
/** Websites only: URLs never scraped, each one along with everything below it. */
|
|
39
|
+
scrapingExclusions?: string[];
|
|
38
40
|
status: FileStatusUio;
|
|
39
41
|
error?: string | null;
|
|
40
42
|
createdAt: string;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/** Auteur ou destinataire d'une action : un humain, un agent ou le système. */
|
|
2
|
+
export type ActorType = 'user' | 'agent' | 'system';
|
|
3
|
+
/** Membre d'un projet ou assigné d'un ticket : un humain ou un agent. */
|
|
4
|
+
export type MemberType = 'user' | 'agent';
|
|
5
|
+
export type ActorRef = {
|
|
6
|
+
type: ActorType;
|
|
7
|
+
/** Identifiant de l'utilisateur ou de l'agent ; null pour le système. */
|
|
8
|
+
id: string | null;
|
|
9
|
+
};
|
|
10
|
+
export type MemberRef = {
|
|
11
|
+
type: MemberType;
|
|
12
|
+
id: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Ce qui se passe quand un agent crée un ticket : `confirm`, l'agent propose et un humain confirme ;
|
|
16
|
+
* `direct`, le ticket est créé tout de suite et la création reste annulable.
|
|
17
|
+
*/
|
|
18
|
+
export type AgentTicketCreation = 'confirm' | 'direct';
|
|
19
|
+
/** `now` : les agents assignés commencent dès l'assignation ; `hold` : ils attendent un feu vert. */
|
|
20
|
+
export type TicketStartMode = 'now' | 'hold';
|
|
21
|
+
export type ProjectSettings = {
|
|
22
|
+
agentTicketCreation: AgentTicketCreation;
|
|
23
|
+
defaultStartMode: TicketStartMode;
|
|
24
|
+
};
|
|
25
|
+
export type Project = {
|
|
26
|
+
id: string;
|
|
27
|
+
organizationId: string;
|
|
28
|
+
/** Préfixe des identifiants de tickets (BRN donne BRN-142), unique dans l'organisation. */
|
|
29
|
+
key: string;
|
|
30
|
+
name: string;
|
|
31
|
+
description: string | null;
|
|
32
|
+
color: string | null;
|
|
33
|
+
dueDate: string | null;
|
|
34
|
+
settings: ProjectSettings;
|
|
35
|
+
/** Dernier numéro de ticket attribué ; incrémenté à chaque création. */
|
|
36
|
+
ticketSeq: number;
|
|
37
|
+
archivedAt: string | null;
|
|
38
|
+
createdBy: ActorRef;
|
|
39
|
+
createdAt: string;
|
|
40
|
+
updatedAt: string;
|
|
41
|
+
};
|
|
42
|
+
export type ProjectMemberRole = 'owner' | 'member';
|
|
43
|
+
export type ProjectMember = {
|
|
44
|
+
projectId: string;
|
|
45
|
+
type: MemberType;
|
|
46
|
+
id: string;
|
|
47
|
+
role: ProjectMemberRole;
|
|
48
|
+
/** Pour un agent, surcharge `ProjectSettings.agentTicketCreation` ; null = réglage du projet. */
|
|
49
|
+
agentTicketCreation: AgentTicketCreation | null;
|
|
50
|
+
createdAt: string;
|
|
51
|
+
};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import type { ActorRef, AgentTicketCreation, MemberRef, MemberType, TicketStartMode } from './project';
|
|
2
|
+
export type TicketStatus = 'backlog' | 'todo' | 'doing' | 'review' | 'done';
|
|
3
|
+
export type TicketPriority = 'low' | 'medium' | 'high';
|
|
4
|
+
export type Ticket = {
|
|
5
|
+
id: string;
|
|
6
|
+
organizationId: string;
|
|
7
|
+
projectId: string;
|
|
8
|
+
number: number;
|
|
9
|
+
/** Clé du projet suivie du numéro (BRN-142), unique dans l'organisation. */
|
|
10
|
+
key: string;
|
|
11
|
+
title: string;
|
|
12
|
+
description: string | null;
|
|
13
|
+
status: TicketStatus;
|
|
14
|
+
priority: TicketPriority;
|
|
15
|
+
labels: string[];
|
|
16
|
+
dueDate: string | null;
|
|
17
|
+
/** Relecteur optionnel : avec lui, le ticket passe par `review` avant `done`. */
|
|
18
|
+
reviewer: MemberRef | null;
|
|
19
|
+
createdBy: ActorRef;
|
|
20
|
+
/** Conversation dont le ticket est issu, quand un agent l'a proposé. */
|
|
21
|
+
sourceConversationId: string | null;
|
|
22
|
+
/** Ordre dans la colonne, croissant. */
|
|
23
|
+
position: number;
|
|
24
|
+
/** Compteurs entretenus à l'écriture, pour ne pas compter à chaque lecture du board. */
|
|
25
|
+
commentCount: number;
|
|
26
|
+
artifactCount: number;
|
|
27
|
+
doneAt: string | null;
|
|
28
|
+
/** Dernier commentaire, changement de statut ou d'assignation ; sert au tri de la liste. */
|
|
29
|
+
lastActivityAt: string;
|
|
30
|
+
createdAt: string;
|
|
31
|
+
updatedAt: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Où en est un assigné : `assigned` (pas commencé), `held` (attend le feu vert), `working`,
|
|
35
|
+
* `waiting` (attend une réponse humaine), `blocked`, `done`.
|
|
36
|
+
*/
|
|
37
|
+
export type TicketAssigneeState = 'assigned' | 'held' | 'working' | 'waiting' | 'blocked' | 'done';
|
|
38
|
+
export type TicketAssignee = {
|
|
39
|
+
ticketId: string;
|
|
40
|
+
type: MemberType;
|
|
41
|
+
id: string;
|
|
42
|
+
state: TicketAssigneeState;
|
|
43
|
+
stateNote: string | null;
|
|
44
|
+
updatedAt: string;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
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…).
|
|
49
|
+
*/
|
|
50
|
+
export type TicketEventKind = 'comment' | 'report' | 'question' | 'event';
|
|
51
|
+
export type TicketEvent = {
|
|
52
|
+
id: string;
|
|
53
|
+
ticketId: string;
|
|
54
|
+
organizationId: string;
|
|
55
|
+
author: ActorRef;
|
|
56
|
+
kind: TicketEventKind;
|
|
57
|
+
body: string | null;
|
|
58
|
+
/**
|
|
59
|
+
* Selon le type : `event` → `{ action, from?, to?, member? }`, `report` → `{ title }`,
|
|
60
|
+
* `question` → `{ humanRequest }` ; les mentions dans `{ mentions: MemberRef[] }`.
|
|
61
|
+
*/
|
|
62
|
+
data: Record<string, unknown>;
|
|
63
|
+
artifactIds: string[];
|
|
64
|
+
createdAt: string;
|
|
65
|
+
};
|
|
66
|
+
export type TicketArtifact = {
|
|
67
|
+
id: string;
|
|
68
|
+
ticketId: string;
|
|
69
|
+
organizationId: string;
|
|
70
|
+
name: string;
|
|
71
|
+
mimeType: string;
|
|
72
|
+
size: number | null;
|
|
73
|
+
/** `file` : téléversé dans le stockage de fichiers ; `workspace` : fichier du workspace d'un agent. */
|
|
74
|
+
source: 'file' | 'workspace';
|
|
75
|
+
status: 'uploading' | 'ready';
|
|
76
|
+
/**
|
|
77
|
+
* Clé dans le stockage de fichiers. Un fichier du workspace d'un agent y est recopié au moment
|
|
78
|
+
* où il est joint : l'artefact reste tel qu'il était, même si l'agent réécrit le fichier ensuite.
|
|
79
|
+
*/
|
|
80
|
+
fileKey: string;
|
|
81
|
+
/** D'où vient un artefact `workspace` : la conversation de l'agent et le chemin du fichier. */
|
|
82
|
+
workspaceRef: {
|
|
83
|
+
conversationId: string | null;
|
|
84
|
+
path: string;
|
|
85
|
+
} | null;
|
|
86
|
+
addedBy: ActorRef;
|
|
87
|
+
createdAt: string;
|
|
88
|
+
};
|
|
89
|
+
export type TicketProposalStatus = 'pending' | 'accepted' | 'rejected' | 'cancelled';
|
|
90
|
+
export type TicketProposalPayload = {
|
|
91
|
+
title: string;
|
|
92
|
+
description: string | null;
|
|
93
|
+
assignees: MemberRef[];
|
|
94
|
+
reviewer: MemberRef | null;
|
|
95
|
+
priority: TicketPriority;
|
|
96
|
+
startMode: TicketStartMode;
|
|
97
|
+
/** Fichiers du workspace de la session à joindre comme artefacts. */
|
|
98
|
+
workspacePaths: string[];
|
|
99
|
+
};
|
|
100
|
+
/** Un ticket qu'un agent propose (ou crée directement) depuis une conversation. */
|
|
101
|
+
export type TicketProposal = {
|
|
102
|
+
id: string;
|
|
103
|
+
organizationId: string;
|
|
104
|
+
conversationId: string;
|
|
105
|
+
messageId: string;
|
|
106
|
+
agentId: string;
|
|
107
|
+
/** Projet proposé par l'agent ; null = l'humain doit en choisir un. */
|
|
108
|
+
projectId: string | null;
|
|
109
|
+
mode: AgentTicketCreation;
|
|
110
|
+
payload: TicketProposalPayload;
|
|
111
|
+
status: TicketProposalStatus;
|
|
112
|
+
ticketId: string | null;
|
|
113
|
+
decidedBy: string | null;
|
|
114
|
+
decidedAt: string | null;
|
|
115
|
+
createdAt: string;
|
|
116
|
+
};
|
package/package.json
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ChatMessageRoleUio } from '@breign/client';
|
|
2
2
|
import type { ToolCallApprovalScope } from './pending-tool-call';
|
|
3
|
+
import type { AgentTicketCreation } from './project';
|
|
4
|
+
import type { TicketProposalPayload, TicketProposalStatus } from './ticket';
|
|
3
5
|
import type { ToolAction, ToolResult } from './tool-result';
|
|
4
6
|
|
|
5
7
|
export type ConversationMessageReaction = 'positive' | 'negative';
|
|
@@ -120,6 +122,21 @@ export type ConversationHumanRequest = {
|
|
|
120
122
|
expiresAt?: string;
|
|
121
123
|
};
|
|
122
124
|
|
|
125
|
+
/**
|
|
126
|
+
* Un ticket qu'un agent propose depuis cette conversation (outil `Ticket_create`). La carte affichée
|
|
127
|
+
* sous le message se met à jour quand la proposition est acceptée, écartée ou annulée.
|
|
128
|
+
*/
|
|
129
|
+
export type ConversationTicketProposal = {
|
|
130
|
+
proposalId: string;
|
|
131
|
+
status: TicketProposalStatus;
|
|
132
|
+
mode: AgentTicketCreation;
|
|
133
|
+
/** Projet proposé par l'agent ; null = l'humain doit en choisir un. */
|
|
134
|
+
projectId: string | null;
|
|
135
|
+
payload: TicketProposalPayload;
|
|
136
|
+
ticketId: string | null;
|
|
137
|
+
ticketKey: string | null;
|
|
138
|
+
};
|
|
139
|
+
|
|
123
140
|
export type ConversationMessage = {
|
|
124
141
|
id: string;
|
|
125
142
|
role: ChatMessageRoleUio;
|
|
@@ -136,6 +153,8 @@ export type ConversationMessage = {
|
|
|
136
153
|
approvals?: ConversationMessageApproval[];
|
|
137
154
|
/** Question posée à l'humain par une tâche. Voir ConversationHumanRequest. */
|
|
138
155
|
humanRequest?: ConversationHumanRequest;
|
|
156
|
+
/** Ticket proposé par l'agent dans ce message. Voir ConversationTicketProposal. */
|
|
157
|
+
ticketProposal?: ConversationTicketProposal;
|
|
139
158
|
suggestions?: {
|
|
140
159
|
id: string;
|
|
141
160
|
text: string;
|
|
@@ -176,6 +195,8 @@ export type ConversationContext = {
|
|
|
176
195
|
lastActivityAt?: string;
|
|
177
196
|
/** Tâche ouverte par un agent local via le serveur MCP de Breign. */
|
|
178
197
|
externalCaller?: ConversationExternalCaller;
|
|
198
|
+
/** Ticket auquel cette conversation est liée (proposition acceptée, session de travail). */
|
|
199
|
+
ticket?: { ticketId: string; projectId: string };
|
|
179
200
|
};
|
|
180
201
|
|
|
181
202
|
export type ConversationExternalCaller = {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ActorRef } from './project';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `question`, `ticket_proposal`, `review` et `go_ahead` sont des actions (onglet « À traiter ») ;
|
|
5
|
+
* `mention` a son propre onglet.
|
|
6
|
+
*/
|
|
7
|
+
export type InboxItemKind = 'question' | 'ticket_proposal' | 'review' | 'go_ahead' | 'mention';
|
|
8
|
+
|
|
9
|
+
/** Ce qui attend un humain : écrit quand l'action naît, résolu quand elle est faite. */
|
|
10
|
+
export type InboxItem = {
|
|
11
|
+
id: string;
|
|
12
|
+
organizationId: string;
|
|
13
|
+
userId: string;
|
|
14
|
+
kind: InboxItemKind;
|
|
15
|
+
requestedBy: ActorRef;
|
|
16
|
+
projectId: string | null;
|
|
17
|
+
ticketId: string | null;
|
|
18
|
+
/**
|
|
19
|
+
* 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`).
|
|
21
|
+
*/
|
|
22
|
+
refId: string;
|
|
23
|
+
summary: string;
|
|
24
|
+
data: Record<string, unknown>;
|
|
25
|
+
status: 'pending' | 'done';
|
|
26
|
+
resolution: Record<string, unknown> | null;
|
|
27
|
+
createdAt: string;
|
|
28
|
+
resolvedAt: string | null;
|
|
29
|
+
};
|
package/src/types/index.ts
CHANGED
|
@@ -8,16 +8,19 @@ export * from './engine';
|
|
|
8
8
|
export * from './file';
|
|
9
9
|
export * from './flow';
|
|
10
10
|
export * from './flow-editor';
|
|
11
|
+
export * from './inbox';
|
|
11
12
|
export * from './knowledge';
|
|
12
13
|
export * from './ocr';
|
|
13
14
|
export * from './organization';
|
|
14
15
|
export * from './pending-tool-call';
|
|
16
|
+
export * from './project';
|
|
15
17
|
export * from './permissions';
|
|
16
18
|
export * from './role';
|
|
17
19
|
export * from './scheduled-task';
|
|
18
20
|
export * from './scheduled-task-run';
|
|
19
21
|
export * from './skill';
|
|
20
22
|
export * from './speech-to-text';
|
|
23
|
+
export * from './ticket';
|
|
21
24
|
export * from './tool';
|
|
22
25
|
export * from './tool-approval';
|
|
23
26
|
export * from './tool-result';
|
package/src/types/knowledge.ts
CHANGED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/** Auteur ou destinataire d'une action : un humain, un agent ou le système. */
|
|
2
|
+
export type ActorType = 'user' | 'agent' | 'system';
|
|
3
|
+
|
|
4
|
+
/** Membre d'un projet ou assigné d'un ticket : un humain ou un agent. */
|
|
5
|
+
export type MemberType = 'user' | 'agent';
|
|
6
|
+
|
|
7
|
+
export type ActorRef = {
|
|
8
|
+
type: ActorType;
|
|
9
|
+
/** Identifiant de l'utilisateur ou de l'agent ; null pour le système. */
|
|
10
|
+
id: string | null;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type MemberRef = {
|
|
14
|
+
type: MemberType;
|
|
15
|
+
id: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Ce qui se passe quand un agent crée un ticket : `confirm`, l'agent propose et un humain confirme ;
|
|
20
|
+
* `direct`, le ticket est créé tout de suite et la création reste annulable.
|
|
21
|
+
*/
|
|
22
|
+
export type AgentTicketCreation = 'confirm' | 'direct';
|
|
23
|
+
|
|
24
|
+
/** `now` : les agents assignés commencent dès l'assignation ; `hold` : ils attendent un feu vert. */
|
|
25
|
+
export type TicketStartMode = 'now' | 'hold';
|
|
26
|
+
|
|
27
|
+
export type ProjectSettings = {
|
|
28
|
+
agentTicketCreation: AgentTicketCreation;
|
|
29
|
+
defaultStartMode: TicketStartMode;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type Project = {
|
|
33
|
+
id: string;
|
|
34
|
+
organizationId: string;
|
|
35
|
+
/** Préfixe des identifiants de tickets (BRN donne BRN-142), unique dans l'organisation. */
|
|
36
|
+
key: string;
|
|
37
|
+
name: string;
|
|
38
|
+
description: string | null;
|
|
39
|
+
color: string | null;
|
|
40
|
+
dueDate: string | null;
|
|
41
|
+
settings: ProjectSettings;
|
|
42
|
+
/** Dernier numéro de ticket attribué ; incrémenté à chaque création. */
|
|
43
|
+
ticketSeq: number;
|
|
44
|
+
archivedAt: string | null;
|
|
45
|
+
createdBy: ActorRef;
|
|
46
|
+
createdAt: string;
|
|
47
|
+
updatedAt: string;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export type ProjectMemberRole = 'owner' | 'member';
|
|
51
|
+
|
|
52
|
+
export type ProjectMember = {
|
|
53
|
+
projectId: string;
|
|
54
|
+
type: MemberType;
|
|
55
|
+
id: string;
|
|
56
|
+
role: ProjectMemberRole;
|
|
57
|
+
/** Pour un agent, surcharge `ProjectSettings.agentTicketCreation` ; null = réglage du projet. */
|
|
58
|
+
agentTicketCreation: AgentTicketCreation | null;
|
|
59
|
+
createdAt: string;
|
|
60
|
+
};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ActorRef,
|
|
3
|
+
AgentTicketCreation,
|
|
4
|
+
MemberRef,
|
|
5
|
+
MemberType,
|
|
6
|
+
TicketStartMode,
|
|
7
|
+
} from './project';
|
|
8
|
+
|
|
9
|
+
export type TicketStatus = 'backlog' | 'todo' | 'doing' | 'review' | 'done';
|
|
10
|
+
|
|
11
|
+
export type TicketPriority = 'low' | 'medium' | 'high';
|
|
12
|
+
|
|
13
|
+
export type Ticket = {
|
|
14
|
+
id: string;
|
|
15
|
+
organizationId: string;
|
|
16
|
+
projectId: string;
|
|
17
|
+
number: number;
|
|
18
|
+
/** Clé du projet suivie du numéro (BRN-142), unique dans l'organisation. */
|
|
19
|
+
key: string;
|
|
20
|
+
title: string;
|
|
21
|
+
description: string | null;
|
|
22
|
+
status: TicketStatus;
|
|
23
|
+
priority: TicketPriority;
|
|
24
|
+
labels: string[];
|
|
25
|
+
dueDate: string | null;
|
|
26
|
+
/** Relecteur optionnel : avec lui, le ticket passe par `review` avant `done`. */
|
|
27
|
+
reviewer: MemberRef | null;
|
|
28
|
+
createdBy: ActorRef;
|
|
29
|
+
/** Conversation dont le ticket est issu, quand un agent l'a proposé. */
|
|
30
|
+
sourceConversationId: string | null;
|
|
31
|
+
/** Ordre dans la colonne, croissant. */
|
|
32
|
+
position: number;
|
|
33
|
+
/** Compteurs entretenus à l'écriture, pour ne pas compter à chaque lecture du board. */
|
|
34
|
+
commentCount: number;
|
|
35
|
+
artifactCount: number;
|
|
36
|
+
doneAt: string | null;
|
|
37
|
+
/** Dernier commentaire, changement de statut ou d'assignation ; sert au tri de la liste. */
|
|
38
|
+
lastActivityAt: string;
|
|
39
|
+
createdAt: string;
|
|
40
|
+
updatedAt: string;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Où en est un assigné : `assigned` (pas commencé), `held` (attend le feu vert), `working`,
|
|
45
|
+
* `waiting` (attend une réponse humaine), `blocked`, `done`.
|
|
46
|
+
*/
|
|
47
|
+
export type TicketAssigneeState = 'assigned' | 'held' | 'working' | 'waiting' | 'blocked' | 'done';
|
|
48
|
+
|
|
49
|
+
export type TicketAssignee = {
|
|
50
|
+
ticketId: string;
|
|
51
|
+
type: MemberType;
|
|
52
|
+
id: string;
|
|
53
|
+
state: TicketAssigneeState;
|
|
54
|
+
stateNote: string | null;
|
|
55
|
+
updatedAt: string;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/**
|
|
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…).
|
|
61
|
+
*/
|
|
62
|
+
export type TicketEventKind = 'comment' | 'report' | 'question' | 'event';
|
|
63
|
+
|
|
64
|
+
export type TicketEvent = {
|
|
65
|
+
id: string;
|
|
66
|
+
ticketId: string;
|
|
67
|
+
organizationId: string;
|
|
68
|
+
author: ActorRef;
|
|
69
|
+
kind: TicketEventKind;
|
|
70
|
+
body: string | null;
|
|
71
|
+
/**
|
|
72
|
+
* Selon le type : `event` → `{ action, from?, to?, member? }`, `report` → `{ title }`,
|
|
73
|
+
* `question` → `{ humanRequest }` ; les mentions dans `{ mentions: MemberRef[] }`.
|
|
74
|
+
*/
|
|
75
|
+
data: Record<string, unknown>;
|
|
76
|
+
artifactIds: string[];
|
|
77
|
+
createdAt: string;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export type TicketArtifact = {
|
|
81
|
+
id: string;
|
|
82
|
+
ticketId: string;
|
|
83
|
+
organizationId: string;
|
|
84
|
+
name: string;
|
|
85
|
+
mimeType: string;
|
|
86
|
+
size: number | null;
|
|
87
|
+
/** `file` : téléversé dans le stockage de fichiers ; `workspace` : fichier du workspace d'un agent. */
|
|
88
|
+
source: 'file' | 'workspace';
|
|
89
|
+
status: 'uploading' | 'ready';
|
|
90
|
+
/**
|
|
91
|
+
* Clé dans le stockage de fichiers. Un fichier du workspace d'un agent y est recopié au moment
|
|
92
|
+
* où il est joint : l'artefact reste tel qu'il était, même si l'agent réécrit le fichier ensuite.
|
|
93
|
+
*/
|
|
94
|
+
fileKey: string;
|
|
95
|
+
/** D'où vient un artefact `workspace` : la conversation de l'agent et le chemin du fichier. */
|
|
96
|
+
workspaceRef: { conversationId: string | null; path: string } | null;
|
|
97
|
+
addedBy: ActorRef;
|
|
98
|
+
createdAt: string;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export type TicketProposalStatus = 'pending' | 'accepted' | 'rejected' | 'cancelled';
|
|
102
|
+
|
|
103
|
+
export type TicketProposalPayload = {
|
|
104
|
+
title: string;
|
|
105
|
+
description: string | null;
|
|
106
|
+
assignees: MemberRef[];
|
|
107
|
+
reviewer: MemberRef | null;
|
|
108
|
+
priority: TicketPriority;
|
|
109
|
+
startMode: TicketStartMode;
|
|
110
|
+
/** Fichiers du workspace de la session à joindre comme artefacts. */
|
|
111
|
+
workspacePaths: string[];
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
/** Un ticket qu'un agent propose (ou crée directement) depuis une conversation. */
|
|
115
|
+
export type TicketProposal = {
|
|
116
|
+
id: string;
|
|
117
|
+
organizationId: string;
|
|
118
|
+
conversationId: string;
|
|
119
|
+
messageId: string;
|
|
120
|
+
agentId: string;
|
|
121
|
+
/** Projet proposé par l'agent ; null = l'humain doit en choisir un. */
|
|
122
|
+
projectId: string | null;
|
|
123
|
+
mode: AgentTicketCreation;
|
|
124
|
+
payload: TicketProposalPayload;
|
|
125
|
+
status: TicketProposalStatus;
|
|
126
|
+
ticketId: string | null;
|
|
127
|
+
decidedBy: string | null;
|
|
128
|
+
decidedAt: string | null;
|
|
129
|
+
createdAt: string;
|
|
130
|
+
};
|