@imenam/mcp-organizer 1.0.3 → 1.0.8
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/README.md +154 -26
- package/dist/shared/schemas/admin-api.schema.d.ts +193 -0
- package/dist/shared/schemas/admin-api.schema.js +84 -0
- package/dist/shared/schemas/agent-api.schema.d.ts +27 -0
- package/dist/shared/schemas/agent-api.schema.js +14 -0
- package/dist/shared/schemas/agent-tools.schema.d.ts +48 -0
- package/dist/shared/schemas/agent-tools.schema.js +14 -1
- package/dist/shared/schemas/api.schema.d.ts +2 -0
- package/dist/shared/schemas/api.schema.js +2 -0
- package/dist/shared/schemas/entities.schema.d.ts +88 -1
- package/dist/shared/schemas/entities.schema.js +65 -3
- package/dist/shared/schemas/enums.schema.d.ts +19 -1
- package/dist/shared/schemas/enums.schema.js +8 -0
- package/dist/shared/schemas/instructions-api.schema.d.ts +42 -0
- package/dist/shared/schemas/instructions-api.schema.js +25 -0
- package/dist/shared/schemas/notifications-api.schema.d.ts +31 -0
- package/dist/shared/schemas/notifications-api.schema.js +22 -1
- package/dist/shared/schemas/tasks-api.schema.d.ts +2 -0
- package/dist/shared/schemas/views-api.schema.d.ts +139 -0
- package/dist/shared/schemas/views-api.schema.js +33 -0
- package/dist/src/agent-api/requests.js +6 -3
- package/dist/src/cli/set-admin.d.ts +1 -0
- package/dist/src/cli/set-admin.js +45 -0
- package/dist/src/cli/setup.d.ts +9 -6
- package/dist/src/cli/setup.js +108 -35
- package/dist/src/core/accounts.js +2 -1
- package/dist/src/core/admin.d.ts +38 -0
- package/dist/src/core/admin.js +130 -0
- package/dist/src/core/agent-instructions.d.ts +6 -0
- package/dist/src/core/agent-instructions.js +43 -0
- package/dist/src/core/agent-tokens.d.ts +9 -1
- package/dist/src/core/agent-tokens.js +25 -2
- package/dist/src/core/agent.d.ts +7 -0
- package/dist/src/core/agent.js +38 -1
- package/dist/src/core/board-views.d.ts +12 -0
- package/dist/src/core/board-views.js +84 -0
- package/dist/src/core/migrations.js +435 -344
- package/dist/src/core/notifications.d.ts +7 -1
- package/dist/src/core/notifications.js +32 -1
- package/dist/src/core/requests.d.ts +8 -2
- package/dist/src/core/requests.js +6 -5
- package/dist/src/core/store.d.ts +77 -5
- package/dist/src/core/store.js +340 -46
- package/dist/src/deploy/env-render.d.ts +1 -1
- package/dist/src/deploy/env-render.js +2 -0
- package/dist/src/gui-api.d.ts +17 -0
- package/dist/src/gui-api.js +73 -4
- package/dist/src/index.js +8 -1
- package/dist/src/mcp/start.d.ts +1 -1
- package/dist/src/mcp/start.js +4 -4
- package/dist/src/mcp/tools.js +14 -4
- package/dist/src/server/claude-processes.d.ts +26 -0
- package/dist/src/server/claude-processes.js +72 -0
- package/dist/src/server/claude-stream.d.ts +39 -0
- package/dist/src/server/claude-stream.js +111 -0
- package/dist/src/server/runner.d.ts +91 -0
- package/dist/src/server/runner.js +355 -0
- package/dist/src/server/start.js +26 -0
- package/gui/dist/assets/index-BX6iBj41.js +70 -0
- package/gui/dist/assets/index-CXzkYy4P.css +1 -0
- package/gui/dist/index.html +2 -2
- package/package.json +3 -2
- package/gui/dist/assets/index-BVN0agCc.css +0 -1
- package/gui/dist/assets/index-DI1_kr81.js +0 -70
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { SpaceKindSchema, UserStatusSchema } from "./enums.schema.js";
|
|
3
|
+
import { EmailSchema, IdSchema, TimestampSchema } from "./entities.schema.js";
|
|
4
|
+
/**
|
|
5
|
+
* API d'administration (`/api/admin/*`), réservée aux administrateurs du
|
|
6
|
+
* site : tous les comptes avec leurs espaces, et l'autorisation du runner par
|
|
7
|
+
* espace.
|
|
8
|
+
*/
|
|
9
|
+
export const AdminSpaceViewSchema = z.object({
|
|
10
|
+
id: IdSchema,
|
|
11
|
+
name: z.string(),
|
|
12
|
+
kind: SpaceKindSchema,
|
|
13
|
+
keyPrefix: z.string(),
|
|
14
|
+
runnerAllowed: z.boolean(),
|
|
15
|
+
/** L'espace a ses propres instructions de l'agent. */
|
|
16
|
+
hasInstructions: z.boolean(),
|
|
17
|
+
/** Membres de l'espace, propriétaire compris, dans l'ordre d'arrivée. */
|
|
18
|
+
members: z.array(z.object({ id: IdSchema, name: z.string(), email: EmailSchema })),
|
|
19
|
+
});
|
|
20
|
+
export const AdminUserViewSchema = z.object({
|
|
21
|
+
id: IdSchema,
|
|
22
|
+
email: EmailSchema,
|
|
23
|
+
displayName: z.string().nullable(),
|
|
24
|
+
status: UserStatusSchema,
|
|
25
|
+
isAdmin: z.boolean(),
|
|
26
|
+
/** Espaces dont le compte est propriétaire : son espace personnel d'abord, puis ses espaces communs par nom. */
|
|
27
|
+
spaces: z.array(AdminSpaceViewSchema),
|
|
28
|
+
});
|
|
29
|
+
/** État du runner du site : actif, ou désactivé avec la raison (en français). */
|
|
30
|
+
export const RunnerStatusSchema = z.object({ enabled: z.boolean(), disabledReason: z.string().nullable() });
|
|
31
|
+
/** `GET /admin/spaces` : comptes du plus ancien au plus récent, décompte des espaces autorisés et état du runner. */
|
|
32
|
+
export const AdminSpacesResponseSchema = z.object({
|
|
33
|
+
users: z.array(AdminUserViewSchema),
|
|
34
|
+
allowedCount: z.number().int().min(0),
|
|
35
|
+
spaceCount: z.number().int().min(0),
|
|
36
|
+
runner: RunnerStatusSchema,
|
|
37
|
+
});
|
|
38
|
+
/** `POST /spaces/:spaceId/runner/run` : session lancée pour traiter les demandes en attente. */
|
|
39
|
+
export const RunQueueResponseSchema = z.object({ pendingCount: z.number().int().min(1) });
|
|
40
|
+
/** `POST /spaces/:spaceId/runner/stop` : session de l'espace arrêtée, et demandes qu'elle avait prises passées en échec. */
|
|
41
|
+
export const StopSessionResponseSchema = z.object({ abortedRequests: z.number().int().min(0) });
|
|
42
|
+
/**
|
|
43
|
+
* `POST /admin/runner/kill-all` : arrêt d'urgence. Processus Claude Code tués
|
|
44
|
+
* sur la machine du site, ceux qui tournent encore après (0 attendu), et
|
|
45
|
+
* demandes du runner passées en échec.
|
|
46
|
+
*/
|
|
47
|
+
export const KillAllResponseSchema = z.object({
|
|
48
|
+
killed: z.number().int().min(0),
|
|
49
|
+
remaining: z.number().int().min(0),
|
|
50
|
+
abortedRequests: z.number().int().min(0),
|
|
51
|
+
});
|
|
52
|
+
/** `PUT /admin/spaces/:spaceId/runner` */
|
|
53
|
+
export const SetRunnerAllowedRequestSchema = z.object({ allowed: z.boolean() }).strict();
|
|
54
|
+
/** Limites d'une session du runner : tours (appliqués par Claude Code), minutes (appliquées par le site), budget estimé facultatif. */
|
|
55
|
+
export const RunnerSettingsSchema = z
|
|
56
|
+
.object({
|
|
57
|
+
maxTurns: z.number().int().min(1).max(500),
|
|
58
|
+
maxMinutes: z.number().int().min(1).max(120),
|
|
59
|
+
maxBudgetUsd: z.number().positive().max(1000).nullable(),
|
|
60
|
+
})
|
|
61
|
+
.strict();
|
|
62
|
+
/** Issue d'une session du runner. */
|
|
63
|
+
export const RUNNER_OUTCOMES = ["completed", "failed", "stopped", "timeout", "max_turns", "max_budget"];
|
|
64
|
+
export const RunnerOutcomeSchema = z.enum(RUNNER_OUTCOMES);
|
|
65
|
+
/** Relevé d'une session du runner ; le coût est celui qu'annonce Claude Code, null quand la session n'a pas pu le donner. */
|
|
66
|
+
export const RunnerSessionRecordSchema = z.object({
|
|
67
|
+
id: IdSchema,
|
|
68
|
+
spaceId: IdSchema.nullable(),
|
|
69
|
+
spaceName: z.string(),
|
|
70
|
+
startedAt: TimestampSchema,
|
|
71
|
+
endedAt: TimestampSchema,
|
|
72
|
+
outcome: RunnerOutcomeSchema,
|
|
73
|
+
model: z.string().nullable(),
|
|
74
|
+
turns: z.number().int().min(0).nullable(),
|
|
75
|
+
costUsd: z.number().min(0).nullable(),
|
|
76
|
+
inputTokens: z.number().int().min(0),
|
|
77
|
+
outputTokens: z.number().int().min(0),
|
|
78
|
+
cacheReadTokens: z.number().int().min(0),
|
|
79
|
+
cacheCreationTokens: z.number().int().min(0),
|
|
80
|
+
});
|
|
81
|
+
/** Requête de `GET /admin/runner/usage` : nombre de jours relevés, 14 par défaut. */
|
|
82
|
+
export const RunnerUsageQuerySchema = z.object({ days: z.coerce.number().int().min(1).max(90).default(14) });
|
|
83
|
+
/** `GET /admin/runner/usage` : sessions des `days` derniers jours, de la plus récente à la plus ancienne. */
|
|
84
|
+
export const RunnerUsageResponseSchema = z.object({ days: z.number().int().min(1), sessions: z.array(RunnerSessionRecordSchema) });
|
|
@@ -24,9 +24,11 @@ export declare const AgentActionViewSchema: z.ZodObject<{
|
|
|
24
24
|
seq: z.ZodNumber;
|
|
25
25
|
entityType: z.ZodEnum<{
|
|
26
26
|
agent_action: "agent_action";
|
|
27
|
+
agent_instructions: "agent_instructions";
|
|
27
28
|
agent_request: "agent_request";
|
|
28
29
|
agent_token: "agent_token";
|
|
29
30
|
attachment: "attachment";
|
|
31
|
+
board_view: "board_view";
|
|
30
32
|
checklist_item: "checklist_item";
|
|
31
33
|
comment: "comment";
|
|
32
34
|
idea: "idea";
|
|
@@ -62,6 +64,7 @@ export declare const AgentRefSchema: z.ZodObject<{
|
|
|
62
64
|
tokenId: z.ZodString;
|
|
63
65
|
name: z.ZodString;
|
|
64
66
|
ownerName: z.ZodString;
|
|
67
|
+
isRunner: z.ZodBoolean;
|
|
65
68
|
}, z.core.$strip>;
|
|
66
69
|
export type AgentRef = z.infer<typeof AgentRefSchema>;
|
|
67
70
|
export declare const RequestViewSchema: z.ZodObject<{
|
|
@@ -93,6 +96,7 @@ export declare const RequestViewSchema: z.ZodObject<{
|
|
|
93
96
|
title: z.ZodString;
|
|
94
97
|
}, z.core.$strip>>;
|
|
95
98
|
reply: z.ZodNullable<z.ZodString>;
|
|
99
|
+
followUps: z.ZodArray<z.ZodString>;
|
|
96
100
|
failureReason: z.ZodNullable<z.ZodString>;
|
|
97
101
|
createdAt: z.ZodISODateTime;
|
|
98
102
|
updatedAt: z.ZodISODateTime;
|
|
@@ -101,6 +105,7 @@ export declare const RequestViewSchema: z.ZodObject<{
|
|
|
101
105
|
tokenId: z.ZodString;
|
|
102
106
|
name: z.ZodString;
|
|
103
107
|
ownerName: z.ZodString;
|
|
108
|
+
isRunner: z.ZodBoolean;
|
|
104
109
|
}, z.core.$strip>>;
|
|
105
110
|
completedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
106
111
|
cancelledByName: z.ZodNullable<z.ZodString>;
|
|
@@ -112,9 +117,11 @@ export declare const RequestViewSchema: z.ZodObject<{
|
|
|
112
117
|
seq: z.ZodNumber;
|
|
113
118
|
entityType: z.ZodEnum<{
|
|
114
119
|
agent_action: "agent_action";
|
|
120
|
+
agent_instructions: "agent_instructions";
|
|
115
121
|
agent_request: "agent_request";
|
|
116
122
|
agent_token: "agent_token";
|
|
117
123
|
attachment: "attachment";
|
|
124
|
+
board_view: "board_view";
|
|
118
125
|
checklist_item: "checklist_item";
|
|
119
126
|
comment: "comment";
|
|
120
127
|
idea: "idea";
|
|
@@ -146,6 +153,12 @@ export declare const RequestViewSchema: z.ZodObject<{
|
|
|
146
153
|
}, z.core.$strip>>;
|
|
147
154
|
}, z.core.$strip>;
|
|
148
155
|
export type RequestView = z.infer<typeof RequestViewSchema>;
|
|
156
|
+
/** Dernière session du runner terminée en échec dans un espace : quand, et pourquoi. */
|
|
157
|
+
export declare const RunnerFailureSchema: z.ZodObject<{
|
|
158
|
+
at: z.ZodISODateTime;
|
|
159
|
+
message: z.ZodString;
|
|
160
|
+
}, z.core.$strip>;
|
|
161
|
+
export type RunnerFailure = z.infer<typeof RunnerFailureSchema>;
|
|
149
162
|
export declare const RequestListResponseSchema: z.ZodObject<{
|
|
150
163
|
requests: z.ZodArray<z.ZodObject<{
|
|
151
164
|
id: z.ZodString;
|
|
@@ -176,6 +189,7 @@ export declare const RequestListResponseSchema: z.ZodObject<{
|
|
|
176
189
|
title: z.ZodString;
|
|
177
190
|
}, z.core.$strip>>;
|
|
178
191
|
reply: z.ZodNullable<z.ZodString>;
|
|
192
|
+
followUps: z.ZodArray<z.ZodString>;
|
|
179
193
|
failureReason: z.ZodNullable<z.ZodString>;
|
|
180
194
|
createdAt: z.ZodISODateTime;
|
|
181
195
|
updatedAt: z.ZodISODateTime;
|
|
@@ -184,6 +198,7 @@ export declare const RequestListResponseSchema: z.ZodObject<{
|
|
|
184
198
|
tokenId: z.ZodString;
|
|
185
199
|
name: z.ZodString;
|
|
186
200
|
ownerName: z.ZodString;
|
|
201
|
+
isRunner: z.ZodBoolean;
|
|
187
202
|
}, z.core.$strip>>;
|
|
188
203
|
completedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
189
204
|
cancelledByName: z.ZodNullable<z.ZodString>;
|
|
@@ -195,9 +210,11 @@ export declare const RequestListResponseSchema: z.ZodObject<{
|
|
|
195
210
|
seq: z.ZodNumber;
|
|
196
211
|
entityType: z.ZodEnum<{
|
|
197
212
|
agent_action: "agent_action";
|
|
213
|
+
agent_instructions: "agent_instructions";
|
|
198
214
|
agent_request: "agent_request";
|
|
199
215
|
agent_token: "agent_token";
|
|
200
216
|
attachment: "attachment";
|
|
217
|
+
board_view: "board_view";
|
|
201
218
|
checklist_item: "checklist_item";
|
|
202
219
|
comment: "comment";
|
|
203
220
|
idea: "idea";
|
|
@@ -233,9 +250,19 @@ export declare const RequestListResponseSchema: z.ZodObject<{
|
|
|
233
250
|
tokenId: z.ZodString;
|
|
234
251
|
name: z.ZodString;
|
|
235
252
|
ownerName: z.ZodString;
|
|
253
|
+
isRunner: z.ZodBoolean;
|
|
236
254
|
lastUsedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
237
255
|
listening: z.ZodBoolean;
|
|
238
256
|
}, z.core.$strip>>;
|
|
257
|
+
runnerAllowed: z.ZodBoolean;
|
|
258
|
+
runnerDisabledReason: z.ZodNullable<z.ZodString>;
|
|
259
|
+
runnerFailure: z.ZodNullable<z.ZodObject<{
|
|
260
|
+
at: z.ZodISODateTime;
|
|
261
|
+
message: z.ZodString;
|
|
262
|
+
}, z.core.$strip>>;
|
|
263
|
+
runnerSession: z.ZodNullable<z.ZodObject<{
|
|
264
|
+
startedAt: z.ZodISODateTime;
|
|
265
|
+
}, z.core.$strip>>;
|
|
239
266
|
}, z.core.$strip>;
|
|
240
267
|
export type RequestListResponse = z.infer<typeof RequestListResponseSchema>;
|
|
241
268
|
/** Version d'une tâche dans son historique. */
|
|
@@ -39,6 +39,8 @@ export const AgentRefSchema = z.object({
|
|
|
39
39
|
tokenId: IdSchema,
|
|
40
40
|
name: z.string(),
|
|
41
41
|
ownerName: z.string(),
|
|
42
|
+
/** Jeton du runner du site. */
|
|
43
|
+
isRunner: z.boolean(),
|
|
42
44
|
});
|
|
43
45
|
export const RequestViewSchema = z.object({
|
|
44
46
|
id: IdSchema,
|
|
@@ -54,6 +56,8 @@ export const RequestViewSchema = z.object({
|
|
|
54
56
|
targetSpaceName: z.string(),
|
|
55
57
|
contextTask: TaskRefSchema.nullable(),
|
|
56
58
|
reply: z.string().nullable(),
|
|
59
|
+
/** Points que l'auteur doit encore régler, laissés par l'agent ; vide quand tout est traité. */
|
|
60
|
+
followUps: z.array(z.string()),
|
|
57
61
|
failureReason: z.string().nullable(),
|
|
58
62
|
createdAt: TimestampSchema,
|
|
59
63
|
updatedAt: TimestampSchema,
|
|
@@ -71,6 +75,8 @@ export const RequestViewSchema = z.object({
|
|
|
71
75
|
/** Actions du lot, dans l'ordre ; vide pour qui n'est pas membre de son espace. */
|
|
72
76
|
actions: z.array(AgentActionViewSchema),
|
|
73
77
|
});
|
|
78
|
+
/** Dernière session du runner terminée en échec dans un espace : quand, et pourquoi. */
|
|
79
|
+
export const RunnerFailureSchema = z.object({ at: TimestampSchema, message: z.string() });
|
|
74
80
|
export const RequestListResponseSchema = z.object({
|
|
75
81
|
/** Demandes de l'espace, de la plus récente à la plus ancienne. */
|
|
76
82
|
requests: z.array(RequestViewSchema),
|
|
@@ -80,6 +86,14 @@ export const RequestListResponseSchema = z.object({
|
|
|
80
86
|
* récemment ; `listening` : un veilleur de notifications de ce jeton est armé.
|
|
81
87
|
*/
|
|
82
88
|
agents: z.array(AgentRefSchema.extend({ lastUsedAt: TimestampSchema.nullable(), listening: z.boolean() })),
|
|
89
|
+
/** Le runner traite les demandes de l'espace (décidé par un administrateur). */
|
|
90
|
+
runnerAllowed: z.boolean(),
|
|
91
|
+
/** Raison pour laquelle le runner du site est désactivé (en français), null quand il est actif. */
|
|
92
|
+
runnerDisabledReason: z.string().nullable(),
|
|
93
|
+
/** Dernière session du runner dans l'espace, quand elle a échoué ; null dès qu'une nouvelle session démarre. */
|
|
94
|
+
runnerFailure: RunnerFailureSchema.nullable(),
|
|
95
|
+
/** Session du runner en cours dans l'espace, null quand aucune ne tourne. */
|
|
96
|
+
runnerSession: z.object({ startedAt: TimestampSchema }).nullable(),
|
|
83
97
|
});
|
|
84
98
|
/** Version d'une tâche dans son historique. */
|
|
85
99
|
export const TaskVersionViewSchema = z.object({
|
|
@@ -9,6 +9,8 @@ export declare const MAX_REQUEST_LIST_LIMIT = 100;
|
|
|
9
9
|
export declare const MAX_SEARCH_LIMIT = 100;
|
|
10
10
|
export declare const MAX_REPLY_LENGTH = 5000;
|
|
11
11
|
export declare const MAX_REASON_LENGTH = 2000;
|
|
12
|
+
export declare const MAX_FOLLOW_UPS = 10;
|
|
13
|
+
export declare const MAX_FOLLOW_UP_LENGTH = 500;
|
|
12
14
|
export declare const MAX_COMMENT_LENGTH = 10000;
|
|
13
15
|
export declare const MAX_IDEA_LENGTH = 5000;
|
|
14
16
|
export declare const MAX_CHECKLIST_ITEM_LENGTH = 500;
|
|
@@ -41,8 +43,10 @@ export declare const WaitRequestsQuerySchema: z.ZodObject<{
|
|
|
41
43
|
}, z.core.$strict>;
|
|
42
44
|
/** `POST requests/:id/claim` : sans corps. */
|
|
43
45
|
export declare const ClaimRequestBodySchema: z.ZodObject<{}, z.core.$strict>;
|
|
46
|
+
/** `POST requests/:id/complete` : réponse à l'auteur, et points qu'il doit encore régler (aucun quand tout est traité). */
|
|
44
47
|
export declare const CompleteRequestBodySchema: z.ZodObject<{
|
|
45
48
|
reply: z.ZodString;
|
|
49
|
+
follow_ups: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
46
50
|
}, z.core.$strict>;
|
|
47
51
|
export declare const FailRequestBodySchema: z.ZodObject<{
|
|
48
52
|
reason: z.ZodString;
|
|
@@ -270,6 +274,7 @@ export declare const AgentRequestSummarySchema: z.ZodObject<{
|
|
|
270
274
|
claimedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
271
275
|
claimedByThisToken: z.ZodBoolean;
|
|
272
276
|
reply: z.ZodNullable<z.ZodString>;
|
|
277
|
+
followUps: z.ZodArray<z.ZodString>;
|
|
273
278
|
failureReason: z.ZodNullable<z.ZodString>;
|
|
274
279
|
}, z.core.$strip>;
|
|
275
280
|
export type AgentRequestSummary = z.infer<typeof AgentRequestSummarySchema>;
|
|
@@ -323,6 +328,7 @@ export declare const ListRequestsDataSchema: z.ZodObject<{
|
|
|
323
328
|
claimedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
324
329
|
claimedByThisToken: z.ZodBoolean;
|
|
325
330
|
reply: z.ZodNullable<z.ZodString>;
|
|
331
|
+
followUps: z.ZodArray<z.ZodString>;
|
|
326
332
|
failureReason: z.ZodNullable<z.ZodString>;
|
|
327
333
|
}, z.core.$strip>>;
|
|
328
334
|
}, z.core.$strip>;
|
|
@@ -359,8 +365,48 @@ export declare const ClaimRequestDataSchema: z.ZodObject<{
|
|
|
359
365
|
claimedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
360
366
|
claimedByThisToken: z.ZodBoolean;
|
|
361
367
|
reply: z.ZodNullable<z.ZodString>;
|
|
368
|
+
followUps: z.ZodArray<z.ZodString>;
|
|
362
369
|
failureReason: z.ZodNullable<z.ZodString>;
|
|
363
370
|
}, z.core.$strip>;
|
|
371
|
+
history: z.ZodArray<z.ZodObject<{
|
|
372
|
+
id: z.ZodString;
|
|
373
|
+
kind: z.ZodEnum<{
|
|
374
|
+
idea: "idea";
|
|
375
|
+
idea_promotion: "idea_promotion";
|
|
376
|
+
message: "message";
|
|
377
|
+
remark: "remark";
|
|
378
|
+
test_review: "test_review";
|
|
379
|
+
}>;
|
|
380
|
+
status: z.ZodEnum<{
|
|
381
|
+
cancelled: "cancelled";
|
|
382
|
+
done: "done";
|
|
383
|
+
failed: "failed";
|
|
384
|
+
pending: "pending";
|
|
385
|
+
processing: "processing";
|
|
386
|
+
}>;
|
|
387
|
+
text: z.ZodString;
|
|
388
|
+
author: z.ZodObject<{
|
|
389
|
+
id: z.ZodString;
|
|
390
|
+
name: z.ZodString;
|
|
391
|
+
email: z.ZodString;
|
|
392
|
+
}, z.core.$strip>;
|
|
393
|
+
contextTask: z.ZodNullable<z.ZodObject<{
|
|
394
|
+
id: z.ZodString;
|
|
395
|
+
key: z.ZodString;
|
|
396
|
+
title: z.ZodString;
|
|
397
|
+
}, z.core.$strip>>;
|
|
398
|
+
contextIdeaId: z.ZodNullable<z.ZodString>;
|
|
399
|
+
createdAt: z.ZodISODateTime;
|
|
400
|
+
claimedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
401
|
+
claimedByThisToken: z.ZodBoolean;
|
|
402
|
+
reply: z.ZodNullable<z.ZodString>;
|
|
403
|
+
followUps: z.ZodArray<z.ZodString>;
|
|
404
|
+
failureReason: z.ZodNullable<z.ZodString>;
|
|
405
|
+
}, z.core.$strip>>;
|
|
406
|
+
instructions: z.ZodObject<{
|
|
407
|
+
site: z.ZodNullable<z.ZodString>;
|
|
408
|
+
space: z.ZodNullable<z.ZodString>;
|
|
409
|
+
}, z.core.$strip>;
|
|
364
410
|
space: z.ZodObject<{
|
|
365
411
|
id: z.ZodString;
|
|
366
412
|
name: z.ZodString;
|
|
@@ -445,6 +491,7 @@ export declare const FinishRequestDataSchema: z.ZodObject<{
|
|
|
445
491
|
claimedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
446
492
|
claimedByThisToken: z.ZodBoolean;
|
|
447
493
|
reply: z.ZodNullable<z.ZodString>;
|
|
494
|
+
followUps: z.ZodArray<z.ZodString>;
|
|
448
495
|
failureReason: z.ZodNullable<z.ZodString>;
|
|
449
496
|
}, z.core.$strip>;
|
|
450
497
|
actionCount: z.ZodNumber;
|
|
@@ -815,6 +862,7 @@ export declare const WaitRequestsDataSchema: z.ZodObject<{
|
|
|
815
862
|
claimedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
816
863
|
claimedByThisToken: z.ZodBoolean;
|
|
817
864
|
reply: z.ZodNullable<z.ZodString>;
|
|
865
|
+
followUps: z.ZodArray<z.ZodString>;
|
|
818
866
|
failureReason: z.ZodNullable<z.ZodString>;
|
|
819
867
|
}, z.core.$strip>>;
|
|
820
868
|
cursor: z.ZodISODateTime;
|
|
@@ -12,6 +12,8 @@ export const MAX_REQUEST_LIST_LIMIT = 100;
|
|
|
12
12
|
export const MAX_SEARCH_LIMIT = 100;
|
|
13
13
|
export const MAX_REPLY_LENGTH = 5_000;
|
|
14
14
|
export const MAX_REASON_LENGTH = 2_000;
|
|
15
|
+
export const MAX_FOLLOW_UPS = 10;
|
|
16
|
+
export const MAX_FOLLOW_UP_LENGTH = 500;
|
|
15
17
|
export const MAX_COMMENT_LENGTH = 10_000;
|
|
16
18
|
export const MAX_IDEA_LENGTH = 5_000;
|
|
17
19
|
export const MAX_CHECKLIST_ITEM_LENGTH = 500;
|
|
@@ -42,7 +44,13 @@ export const WaitRequestsQuerySchema = z
|
|
|
42
44
|
.strict();
|
|
43
45
|
/** `POST requests/:id/claim` : sans corps. */
|
|
44
46
|
export const ClaimRequestBodySchema = z.object({}).strict();
|
|
45
|
-
|
|
47
|
+
/** `POST requests/:id/complete` : réponse à l'auteur, et points qu'il doit encore régler (aucun quand tout est traité). */
|
|
48
|
+
export const CompleteRequestBodySchema = z
|
|
49
|
+
.object({
|
|
50
|
+
reply: z.string().max(MAX_REPLY_LENGTH),
|
|
51
|
+
follow_ups: z.array(z.string().trim().min(1).max(MAX_FOLLOW_UP_LENGTH)).max(MAX_FOLLOW_UPS).default([]),
|
|
52
|
+
})
|
|
53
|
+
.strict();
|
|
46
54
|
export const FailRequestBodySchema = z.object({ reason: z.string().max(MAX_REASON_LENGTH) }).strict();
|
|
47
55
|
/** `GET tasks` : recherche par mots et filtres. */
|
|
48
56
|
export const SearchTasksQuerySchema = z
|
|
@@ -139,12 +147,17 @@ export const AgentRequestSummarySchema = z.object({
|
|
|
139
147
|
/** Vrai si la demande est prise par le jeton qui appelle. */
|
|
140
148
|
claimedByThisToken: z.boolean(),
|
|
141
149
|
reply: z.string().nullable(),
|
|
150
|
+
followUps: z.array(z.string()),
|
|
142
151
|
failureReason: z.string().nullable(),
|
|
143
152
|
});
|
|
144
153
|
export const AgentIdeaSchema = z.object({ id: IdSchema, text: z.string(), archived: z.boolean(), promotedTaskKey: z.string().nullable(), createdAt: TimestampSchema });
|
|
145
154
|
export const ListRequestsDataSchema = z.object({ space: AgentSpaceSchema, requests: z.array(AgentRequestSummarySchema) });
|
|
146
155
|
export const ClaimRequestDataSchema = z.object({
|
|
147
156
|
request: AgentRequestSummarySchema,
|
|
157
|
+
/** Échanges précédents de l'auteur dans l'espace, du plus ancien au plus récent, pour une demande de type message. */
|
|
158
|
+
history: z.array(AgentRequestSummarySchema),
|
|
159
|
+
/** Instructions personnalisées à suivre : celles du site, puis celles de l'espace ; null quand il n'y en a pas. */
|
|
160
|
+
instructions: z.object({ site: z.string().nullable(), space: z.string().nullable() }),
|
|
148
161
|
space: AgentSpaceSchema,
|
|
149
162
|
members: z.array(AgentMemberSchema),
|
|
150
163
|
tasks: z.array(AgentTaskSummarySchema),
|
|
@@ -17,6 +17,7 @@ export declare const PublicUserSchema: z.ZodObject<{
|
|
|
17
17
|
disabled: "disabled";
|
|
18
18
|
invited: "invited";
|
|
19
19
|
}>;
|
|
20
|
+
isAdmin: z.ZodBoolean;
|
|
20
21
|
}, z.core.$strip>;
|
|
21
22
|
export type PublicUser = z.infer<typeof PublicUserSchema>;
|
|
22
23
|
export declare const LoginRequestSchema: z.ZodObject<{
|
|
@@ -34,6 +35,7 @@ export declare const MeResponseSchema: z.ZodObject<{
|
|
|
34
35
|
disabled: "disabled";
|
|
35
36
|
invited: "invited";
|
|
36
37
|
}>;
|
|
38
|
+
isAdmin: z.ZodBoolean;
|
|
37
39
|
}, z.core.$strip>;
|
|
38
40
|
}, z.core.$strip>;
|
|
39
41
|
export type MeResponse = z.infer<typeof MeResponseSchema>;
|
|
@@ -15,6 +15,8 @@ export const PublicUserSchema = z.object({
|
|
|
15
15
|
email: EmailSchema,
|
|
16
16
|
displayName: z.string().nullable(),
|
|
17
17
|
status: UserStatusSchema,
|
|
18
|
+
/** Administrateur du site : voit la page Administration. */
|
|
19
|
+
isAdmin: z.boolean(),
|
|
18
20
|
});
|
|
19
21
|
// --- Authentification ---
|
|
20
22
|
export const LoginRequestSchema = z.object({
|
|
@@ -18,6 +18,7 @@ export declare const UserSchema: z.ZodObject<{
|
|
|
18
18
|
disabled: "disabled";
|
|
19
19
|
invited: "invited";
|
|
20
20
|
}>;
|
|
21
|
+
isAdmin: z.ZodBoolean;
|
|
21
22
|
createdAt: z.ZodISODateTime;
|
|
22
23
|
}, z.core.$strip>;
|
|
23
24
|
export type User = z.infer<typeof UserSchema>;
|
|
@@ -58,16 +59,40 @@ export declare const AgentTokenSchema: z.ZodObject<{
|
|
|
58
59
|
lastUsedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
59
60
|
expiresAt: z.ZodNullable<z.ZodISODateTime>;
|
|
60
61
|
revokedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
62
|
+
isRunner: z.ZodBoolean;
|
|
61
63
|
}, z.core.$strip>;
|
|
62
64
|
export type AgentToken = z.infer<typeof AgentTokenSchema>;
|
|
65
|
+
/** Bornes du nombre d'échanges précédents de l'auteur transmis à l'agent avec un message. */
|
|
66
|
+
export declare const MIN_ASSISTANT_HISTORY = 5;
|
|
67
|
+
export declare const MAX_ASSISTANT_HISTORY = 20;
|
|
68
|
+
export declare const AssistantHistorySchema: z.ZodNumber;
|
|
69
|
+
/** Préférences de notification : assignation et commentaire, dans l'application et par e-mail. */
|
|
70
|
+
export declare const NotificationPreferencesSchema: z.ZodObject<{
|
|
71
|
+
notifyAssignApp: z.ZodBoolean;
|
|
72
|
+
notifyAssignEmail: z.ZodBoolean;
|
|
73
|
+
notifyCommentApp: z.ZodBoolean;
|
|
74
|
+
notifyCommentEmail: z.ZodBoolean;
|
|
75
|
+
}, z.core.$strip>;
|
|
76
|
+
export type NotificationPreferences = z.infer<typeof NotificationPreferencesSchema>;
|
|
63
77
|
export declare const UserSettingsSchema: z.ZodObject<{
|
|
64
|
-
userId: z.ZodString;
|
|
65
78
|
notifyAssignApp: z.ZodBoolean;
|
|
66
79
|
notifyAssignEmail: z.ZodBoolean;
|
|
67
80
|
notifyCommentApp: z.ZodBoolean;
|
|
68
81
|
notifyCommentEmail: z.ZodBoolean;
|
|
82
|
+
userId: z.ZodString;
|
|
83
|
+
assistantHistory: z.ZodNumber;
|
|
69
84
|
}, z.core.$strip>;
|
|
70
85
|
export type UserSettings = z.infer<typeof UserSettingsSchema>;
|
|
86
|
+
/** Préférences de notification d'un utilisateur propres à un espace ; elles remplacent celles du compte dans cet espace. */
|
|
87
|
+
export declare const SpaceNotificationSettingsSchema: z.ZodObject<{
|
|
88
|
+
notifyAssignApp: z.ZodBoolean;
|
|
89
|
+
notifyAssignEmail: z.ZodBoolean;
|
|
90
|
+
notifyCommentApp: z.ZodBoolean;
|
|
91
|
+
notifyCommentEmail: z.ZodBoolean;
|
|
92
|
+
userId: z.ZodString;
|
|
93
|
+
spaceId: z.ZodString;
|
|
94
|
+
}, z.core.$strip>;
|
|
95
|
+
export type SpaceNotificationSettings = z.infer<typeof SpaceNotificationSettingsSchema>;
|
|
71
96
|
export declare const SpaceSchema: z.ZodObject<{
|
|
72
97
|
id: z.ZodString;
|
|
73
98
|
name: z.ZodString;
|
|
@@ -78,9 +103,20 @@ export declare const SpaceSchema: z.ZodObject<{
|
|
|
78
103
|
ownerId: z.ZodString;
|
|
79
104
|
keyPrefix: z.ZodString;
|
|
80
105
|
nextTaskNumber: z.ZodNumber;
|
|
106
|
+
runnerAllowed: z.ZodBoolean;
|
|
81
107
|
createdAt: z.ZodISODateTime;
|
|
82
108
|
}, z.core.$strip>;
|
|
83
109
|
export type Space = z.infer<typeof SpaceSchema>;
|
|
110
|
+
/** Longueur maximale d'un texte d'instructions de l'agent. */
|
|
111
|
+
export declare const AGENT_INSTRUCTIONS_MAX = 4000;
|
|
112
|
+
/** Instructions personnalisées données à l'agent : celles du site (`spaceId` null) ou celles d'un espace. */
|
|
113
|
+
export declare const AgentInstructionsSchema: z.ZodObject<{
|
|
114
|
+
spaceId: z.ZodNullable<z.ZodString>;
|
|
115
|
+
text: z.ZodString;
|
|
116
|
+
updatedAt: z.ZodISODateTime;
|
|
117
|
+
updatedBy: z.ZodNullable<z.ZodString>;
|
|
118
|
+
}, z.core.$strip>;
|
|
119
|
+
export type AgentInstructions = z.infer<typeof AgentInstructionsSchema>;
|
|
84
120
|
export declare const MembershipSchema: z.ZodObject<{
|
|
85
121
|
spaceId: z.ZodString;
|
|
86
122
|
userId: z.ZodString;
|
|
@@ -224,6 +260,52 @@ export declare const IdeaSchema: z.ZodObject<{
|
|
|
224
260
|
createdAt: z.ZodISODateTime;
|
|
225
261
|
}, z.core.$strip>;
|
|
226
262
|
export type Idea = z.infer<typeof IdeaSchema>;
|
|
263
|
+
export declare const MAX_BOARD_VIEW_NAME_LENGTH = 40;
|
|
264
|
+
/**
|
|
265
|
+
* Vue du tableau de bord d'un membre dans un espace : disposition, regroupements
|
|
266
|
+
* et filtres sur le statut et la priorité des tâches de premier niveau. Un
|
|
267
|
+
* filtre vide garde toutes les valeurs. `groupBy` forme les colonnes d'un Kanban
|
|
268
|
+
* ou d'une matrice et les sections d'une liste ; `thenBy` forme les lignes d'une
|
|
269
|
+
* matrice et les sous-sections d'une liste.
|
|
270
|
+
*/
|
|
271
|
+
export declare const BoardViewSchema: z.ZodObject<{
|
|
272
|
+
id: z.ZodString;
|
|
273
|
+
spaceId: z.ZodString;
|
|
274
|
+
userId: z.ZodString;
|
|
275
|
+
name: z.ZodString;
|
|
276
|
+
layout: z.ZodEnum<{
|
|
277
|
+
kanban: "kanban";
|
|
278
|
+
list: "list";
|
|
279
|
+
matrix: "matrix";
|
|
280
|
+
}>;
|
|
281
|
+
groupBy: z.ZodEnum<{
|
|
282
|
+
none: "none";
|
|
283
|
+
priority: "priority";
|
|
284
|
+
status: "status";
|
|
285
|
+
}>;
|
|
286
|
+
thenBy: z.ZodEnum<{
|
|
287
|
+
none: "none";
|
|
288
|
+
priority: "priority";
|
|
289
|
+
status: "status";
|
|
290
|
+
}>;
|
|
291
|
+
showEmptyGroups: z.ZodBoolean;
|
|
292
|
+
statuses: z.ZodArray<z.ZodEnum<{
|
|
293
|
+
doing: "doing";
|
|
294
|
+
done: "done";
|
|
295
|
+
review: "review";
|
|
296
|
+
todo: "todo";
|
|
297
|
+
}>>;
|
|
298
|
+
priorities: z.ZodArray<z.ZodEnum<{
|
|
299
|
+
critical: "critical";
|
|
300
|
+
high: "high";
|
|
301
|
+
low: "low";
|
|
302
|
+
medium: "medium";
|
|
303
|
+
}>>;
|
|
304
|
+
position: z.ZodNumber;
|
|
305
|
+
createdAt: z.ZodISODateTime;
|
|
306
|
+
updatedAt: z.ZodISODateTime;
|
|
307
|
+
}, z.core.$strip>;
|
|
308
|
+
export type BoardView = z.infer<typeof BoardViewSchema>;
|
|
227
309
|
export declare const AgentRequestSchema: z.ZodObject<{
|
|
228
310
|
id: z.ZodString;
|
|
229
311
|
authorId: z.ZodString;
|
|
@@ -246,6 +328,7 @@ export declare const AgentRequestSchema: z.ZodObject<{
|
|
|
246
328
|
processing: "processing";
|
|
247
329
|
}>;
|
|
248
330
|
reply: z.ZodNullable<z.ZodString>;
|
|
331
|
+
followUps: z.ZodArray<z.ZodString>;
|
|
249
332
|
failureReason: z.ZodNullable<z.ZodString>;
|
|
250
333
|
createdAt: z.ZodISODateTime;
|
|
251
334
|
updatedAt: z.ZodISODateTime;
|
|
@@ -261,9 +344,11 @@ export declare const AgentActionSchema: z.ZodObject<{
|
|
|
261
344
|
seq: z.ZodNumber;
|
|
262
345
|
entityType: z.ZodEnum<{
|
|
263
346
|
agent_action: "agent_action";
|
|
347
|
+
agent_instructions: "agent_instructions";
|
|
264
348
|
agent_request: "agent_request";
|
|
265
349
|
agent_token: "agent_token";
|
|
266
350
|
attachment: "attachment";
|
|
351
|
+
board_view: "board_view";
|
|
267
352
|
checklist_item: "checklist_item";
|
|
268
353
|
comment: "comment";
|
|
269
354
|
idea: "idea";
|
|
@@ -447,9 +532,11 @@ export declare const ChangeSchema: z.ZodObject<{
|
|
|
447
532
|
userId: z.ZodNullable<z.ZodString>;
|
|
448
533
|
entityType: z.ZodEnum<{
|
|
449
534
|
agent_action: "agent_action";
|
|
535
|
+
agent_instructions: "agent_instructions";
|
|
450
536
|
agent_request: "agent_request";
|
|
451
537
|
agent_token: "agent_token";
|
|
452
538
|
attachment: "attachment";
|
|
539
|
+
board_view: "board_view";
|
|
453
540
|
checklist_item: "checklist_item";
|
|
454
541
|
comment: "comment";
|
|
455
542
|
idea: "idea";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { AccessLinkPurposeSchema, ActorTypeSchema, AgentOperationSchema, EntityTypeSchema, IdeaOriginSchema, MAX_TASK_DEPTH, MemberRoleSchema, NotificationTypeSchema, RequestKindSchema, RequestStatusSchema, SpaceKindSchema, TaskPrioritySchema, TaskStatusSchema, TaskTypeSchema, TestResultValueSchema, UserStatusSchema, VersionedEntityTypeSchema, } from "./enums.schema.js";
|
|
2
|
+
import { AccessLinkPurposeSchema, ActorTypeSchema, AgentOperationSchema, BoardGroupingSchema, BoardLayoutSchema, EntityTypeSchema, IdeaOriginSchema, MAX_TASK_DEPTH, MemberRoleSchema, NotificationTypeSchema, RequestKindSchema, RequestStatusSchema, SpaceKindSchema, TaskPrioritySchema, TaskStatusSchema, TaskTypeSchema, TestResultValueSchema, UserStatusSchema, VersionedEntityTypeSchema, } from "./enums.schema.js";
|
|
3
3
|
/** Entités du modèle de données, telles que lues et écrites par le store. */
|
|
4
4
|
export const IdSchema = z.string().min(1);
|
|
5
5
|
export const TimestampSchema = z.iso.datetime();
|
|
@@ -20,6 +20,8 @@ export const UserSchema = z.object({
|
|
|
20
20
|
displayName: z.string().min(1).nullable(),
|
|
21
21
|
passwordHash: z.string().min(1).nullable(),
|
|
22
22
|
status: UserStatusSchema,
|
|
23
|
+
/** Administrateur du site : accède à la page Administration. */
|
|
24
|
+
isAdmin: z.boolean(),
|
|
23
25
|
createdAt: TimestampSchema,
|
|
24
26
|
});
|
|
25
27
|
export const AccessLinkSchema = z.object({
|
|
@@ -55,14 +57,29 @@ export const AgentTokenSchema = z.object({
|
|
|
55
57
|
lastUsedAt: TimestampSchema.nullable(),
|
|
56
58
|
expiresAt: TimestampSchema.nullable(),
|
|
57
59
|
revokedAt: TimestampSchema.nullable(),
|
|
60
|
+
/** Jeton du runner de l'espace : absent des Paramètres, sa valeur change à chaque session. */
|
|
61
|
+
isRunner: z.boolean(),
|
|
58
62
|
});
|
|
59
|
-
|
|
60
|
-
|
|
63
|
+
/** Bornes du nombre d'échanges précédents de l'auteur transmis à l'agent avec un message. */
|
|
64
|
+
export const MIN_ASSISTANT_HISTORY = 5;
|
|
65
|
+
export const MAX_ASSISTANT_HISTORY = 20;
|
|
66
|
+
export const AssistantHistorySchema = z.number().int().min(MIN_ASSISTANT_HISTORY).max(MAX_ASSISTANT_HISTORY);
|
|
67
|
+
/** Préférences de notification : assignation et commentaire, dans l'application et par e-mail. */
|
|
68
|
+
export const NotificationPreferencesSchema = z.object({
|
|
61
69
|
notifyAssignApp: z.boolean(),
|
|
62
70
|
notifyAssignEmail: z.boolean(),
|
|
63
71
|
notifyCommentApp: z.boolean(),
|
|
64
72
|
notifyCommentEmail: z.boolean(),
|
|
65
73
|
});
|
|
74
|
+
export const UserSettingsSchema = NotificationPreferencesSchema.extend({
|
|
75
|
+
userId: IdSchema,
|
|
76
|
+
assistantHistory: AssistantHistorySchema,
|
|
77
|
+
});
|
|
78
|
+
/** Préférences de notification d'un utilisateur propres à un espace ; elles remplacent celles du compte dans cet espace. */
|
|
79
|
+
export const SpaceNotificationSettingsSchema = NotificationPreferencesSchema.extend({
|
|
80
|
+
userId: IdSchema,
|
|
81
|
+
spaceId: IdSchema,
|
|
82
|
+
});
|
|
66
83
|
export const SpaceSchema = z.object({
|
|
67
84
|
id: IdSchema,
|
|
68
85
|
name: z.string().trim().min(1),
|
|
@@ -70,8 +87,20 @@ export const SpaceSchema = z.object({
|
|
|
70
87
|
ownerId: IdSchema,
|
|
71
88
|
keyPrefix: KeyPrefixSchema,
|
|
72
89
|
nextTaskNumber: z.number().int().min(1),
|
|
90
|
+
/** Le runner traite les demandes de l'espace ; décidé par un administrateur. */
|
|
91
|
+
runnerAllowed: z.boolean(),
|
|
73
92
|
createdAt: TimestampSchema,
|
|
74
93
|
});
|
|
94
|
+
/** Longueur maximale d'un texte d'instructions de l'agent. */
|
|
95
|
+
export const AGENT_INSTRUCTIONS_MAX = 4000;
|
|
96
|
+
/** Instructions personnalisées données à l'agent : celles du site (`spaceId` null) ou celles d'un espace. */
|
|
97
|
+
export const AgentInstructionsSchema = z.object({
|
|
98
|
+
spaceId: IdSchema.nullable(),
|
|
99
|
+
text: z.string().trim().min(1).max(AGENT_INSTRUCTIONS_MAX),
|
|
100
|
+
updatedAt: TimestampSchema,
|
|
101
|
+
/** Dernier auteur de la modification ; null quand son compte a été supprimé. */
|
|
102
|
+
updatedBy: IdSchema.nullable(),
|
|
103
|
+
});
|
|
75
104
|
export const MembershipSchema = z.object({
|
|
76
105
|
spaceId: IdSchema,
|
|
77
106
|
userId: IdSchema,
|
|
@@ -172,6 +201,37 @@ export const IdeaSchema = z.object({
|
|
|
172
201
|
archivedAt: TimestampSchema.nullable(),
|
|
173
202
|
createdAt: TimestampSchema,
|
|
174
203
|
});
|
|
204
|
+
export const MAX_BOARD_VIEW_NAME_LENGTH = 40;
|
|
205
|
+
/**
|
|
206
|
+
* Vue du tableau de bord d'un membre dans un espace : disposition, regroupements
|
|
207
|
+
* et filtres sur le statut et la priorité des tâches de premier niveau. Un
|
|
208
|
+
* filtre vide garde toutes les valeurs. `groupBy` forme les colonnes d'un Kanban
|
|
209
|
+
* ou d'une matrice et les sections d'une liste ; `thenBy` forme les lignes d'une
|
|
210
|
+
* matrice et les sous-sections d'une liste.
|
|
211
|
+
*/
|
|
212
|
+
export const BoardViewSchema = z
|
|
213
|
+
.object({
|
|
214
|
+
id: IdSchema,
|
|
215
|
+
spaceId: IdSchema,
|
|
216
|
+
userId: IdSchema,
|
|
217
|
+
name: z.string().trim().min(1).max(MAX_BOARD_VIEW_NAME_LENGTH),
|
|
218
|
+
layout: BoardLayoutSchema,
|
|
219
|
+
groupBy: BoardGroupingSchema,
|
|
220
|
+
thenBy: BoardGroupingSchema,
|
|
221
|
+
showEmptyGroups: z.boolean(),
|
|
222
|
+
statuses: z.array(TaskStatusSchema),
|
|
223
|
+
priorities: z.array(TaskPrioritySchema),
|
|
224
|
+
position: PositionSchema,
|
|
225
|
+
createdAt: TimestampSchema,
|
|
226
|
+
updatedAt: TimestampSchema,
|
|
227
|
+
})
|
|
228
|
+
.refine((view) => view.layout === "list" || view.groupBy !== "none", { message: "a kanban or matrix view must be grouped by status or priority", path: ["groupBy"] })
|
|
229
|
+
.refine((view) => view.layout !== "kanban" || view.thenBy === "none", { message: "a kanban view has a single grouping", path: ["thenBy"] })
|
|
230
|
+
.refine((view) => view.layout !== "matrix" || view.thenBy !== "none", { message: "a matrix view needs a second grouping", path: ["thenBy"] })
|
|
231
|
+
.refine((view) => view.thenBy === "none" || (view.groupBy !== "none" && view.thenBy !== view.groupBy), {
|
|
232
|
+
message: "the second grouping must follow a first one and differ from it",
|
|
233
|
+
path: ["thenBy"],
|
|
234
|
+
});
|
|
175
235
|
export const AgentRequestSchema = z.object({
|
|
176
236
|
id: IdSchema,
|
|
177
237
|
authorId: IdSchema,
|
|
@@ -183,6 +243,8 @@ export const AgentRequestSchema = z.object({
|
|
|
183
243
|
text: z.string().trim().min(1),
|
|
184
244
|
status: RequestStatusSchema,
|
|
185
245
|
reply: z.string().nullable(),
|
|
246
|
+
/** Points que l'auteur doit encore régler, laissés par l'agent en terminant la demande ; vide quand tout est traité. */
|
|
247
|
+
followUps: z.array(z.string().trim().min(1)),
|
|
186
248
|
failureReason: z.string().nullable(),
|
|
187
249
|
createdAt: TimestampSchema,
|
|
188
250
|
updatedAt: TimestampSchema,
|