@imenam/mcp-organizer 1.0.7 → 1.0.9

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.
Files changed (58) hide show
  1. package/README.md +107 -28
  2. package/dist/shared/schemas/admin-api.schema.d.ts +92 -0
  3. package/dist/shared/schemas/admin-api.schema.js +46 -1
  4. package/dist/shared/schemas/agent-api.schema.d.ts +31 -4
  5. package/dist/shared/schemas/agent-api.schema.js +16 -4
  6. package/dist/shared/schemas/agent-tools.schema.d.ts +14 -0
  7. package/dist/shared/schemas/agent-tools.schema.js +12 -1
  8. package/dist/shared/schemas/api.schema.d.ts +17 -0
  9. package/dist/shared/schemas/api.schema.js +9 -0
  10. package/dist/shared/schemas/entities.schema.d.ts +63 -0
  11. package/dist/shared/schemas/entities.schema.js +47 -1
  12. package/dist/shared/schemas/enums.schema.d.ts +19 -1
  13. package/dist/shared/schemas/enums.schema.js +8 -0
  14. package/dist/shared/schemas/instructions-api.schema.d.ts +42 -0
  15. package/dist/shared/schemas/instructions-api.schema.js +25 -0
  16. package/dist/shared/schemas/tasks-api.schema.d.ts +5 -0
  17. package/dist/shared/schemas/tasks-api.schema.js +2 -0
  18. package/dist/shared/schemas/views-api.schema.d.ts +139 -0
  19. package/dist/shared/schemas/views-api.schema.js +33 -0
  20. package/dist/src/agent-api/requests.js +4 -2
  21. package/dist/src/cli/setup.d.ts +9 -6
  22. package/dist/src/cli/setup.js +108 -35
  23. package/dist/src/core/admin.d.ts +21 -1
  24. package/dist/src/core/admin.js +68 -0
  25. package/dist/src/core/agent-instructions.d.ts +6 -0
  26. package/dist/src/core/agent-instructions.js +43 -0
  27. package/dist/src/core/agent.d.ts +2 -0
  28. package/dist/src/core/agent.js +16 -2
  29. package/dist/src/core/board-views.d.ts +12 -0
  30. package/dist/src/core/board-views.js +84 -0
  31. package/dist/src/core/migrations.js +71 -0
  32. package/dist/src/core/requests.d.ts +21 -10
  33. package/dist/src/core/requests.js +54 -39
  34. package/dist/src/core/spaces.d.ts +7 -1
  35. package/dist/src/core/spaces.js +29 -0
  36. package/dist/src/core/store.d.ts +48 -5
  37. package/dist/src/core/store.js +213 -16
  38. package/dist/src/core/tasks.js +1 -0
  39. package/dist/src/deploy/env-render.d.ts +1 -1
  40. package/dist/src/deploy/env-render.js +2 -0
  41. package/dist/src/gui-api.d.ts +12 -1
  42. package/dist/src/gui-api.js +56 -6
  43. package/dist/src/mcp/start.d.ts +1 -1
  44. package/dist/src/mcp/start.js +4 -4
  45. package/dist/src/mcp/tools.js +13 -3
  46. package/dist/src/server/claude-processes.d.ts +26 -0
  47. package/dist/src/server/claude-processes.js +72 -0
  48. package/dist/src/server/claude-stream.d.ts +39 -0
  49. package/dist/src/server/claude-stream.js +111 -0
  50. package/dist/src/server/runner.d.ts +40 -0
  51. package/dist/src/server/runner.js +157 -24
  52. package/dist/src/server/start.js +19 -1
  53. package/gui/dist/assets/index--vL3hM-5.js +70 -0
  54. package/gui/dist/assets/index-D0rq0343.css +1 -0
  55. package/gui/dist/index.html +2 -2
  56. package/package.json +1 -1
  57. package/gui/dist/assets/index-DuoSNpBr.js +0 -70
  58. package/gui/dist/assets/index-duxL0fvO.css +0 -1
@@ -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<{
@@ -81,7 +84,6 @@ export declare const RequestViewSchema: z.ZodObject<{
81
84
  processing: "processing";
82
85
  }>;
83
86
  text: z.ZodString;
84
- title: z.ZodString;
85
87
  authorId: z.ZodString;
86
88
  authorName: z.ZodString;
87
89
  authorEmail: z.ZodString;
@@ -93,6 +95,7 @@ export declare const RequestViewSchema: z.ZodObject<{
93
95
  title: z.ZodString;
94
96
  }, z.core.$strip>>;
95
97
  reply: z.ZodNullable<z.ZodString>;
98
+ followUps: z.ZodArray<z.ZodString>;
96
99
  failureReason: z.ZodNullable<z.ZodString>;
97
100
  createdAt: z.ZodISODateTime;
98
101
  updatedAt: z.ZodISODateTime;
@@ -101,20 +104,25 @@ export declare const RequestViewSchema: z.ZodObject<{
101
104
  tokenId: z.ZodString;
102
105
  name: z.ZodString;
103
106
  ownerName: z.ZodString;
107
+ isRunner: z.ZodBoolean;
104
108
  }, z.core.$strip>>;
105
109
  completedAt: z.ZodNullable<z.ZodISODateTime>;
106
110
  cancelledByName: z.ZodNullable<z.ZodString>;
107
111
  canEdit: z.ZodBoolean;
108
- canRelease: z.ZodBoolean;
112
+ stoppedByName: z.ZodNullable<z.ZodString>;
113
+ canStop: z.ZodBoolean;
114
+ canRelaunch: z.ZodBoolean;
109
115
  canUndo: z.ZodBoolean;
110
116
  actions: z.ZodArray<z.ZodObject<{
111
117
  id: z.ZodString;
112
118
  seq: z.ZodNumber;
113
119
  entityType: z.ZodEnum<{
114
120
  agent_action: "agent_action";
121
+ agent_instructions: "agent_instructions";
115
122
  agent_request: "agent_request";
116
123
  agent_token: "agent_token";
117
124
  attachment: "attachment";
125
+ board_view: "board_view";
118
126
  checklist_item: "checklist_item";
119
127
  comment: "comment";
120
128
  idea: "idea";
@@ -146,6 +154,12 @@ export declare const RequestViewSchema: z.ZodObject<{
146
154
  }, z.core.$strip>>;
147
155
  }, z.core.$strip>;
148
156
  export type RequestView = z.infer<typeof RequestViewSchema>;
157
+ /** Dernière session du runner terminée en échec dans un espace : quand, et pourquoi. */
158
+ export declare const RunnerFailureSchema: z.ZodObject<{
159
+ at: z.ZodISODateTime;
160
+ message: z.ZodString;
161
+ }, z.core.$strip>;
162
+ export type RunnerFailure = z.infer<typeof RunnerFailureSchema>;
149
163
  export declare const RequestListResponseSchema: z.ZodObject<{
150
164
  requests: z.ZodArray<z.ZodObject<{
151
165
  id: z.ZodString;
@@ -164,7 +178,6 @@ export declare const RequestListResponseSchema: z.ZodObject<{
164
178
  processing: "processing";
165
179
  }>;
166
180
  text: z.ZodString;
167
- title: z.ZodString;
168
181
  authorId: z.ZodString;
169
182
  authorName: z.ZodString;
170
183
  authorEmail: 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,20 +198,25 @@ 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>;
190
205
  canEdit: z.ZodBoolean;
191
- canRelease: z.ZodBoolean;
206
+ stoppedByName: z.ZodNullable<z.ZodString>;
207
+ canStop: z.ZodBoolean;
208
+ canRelaunch: z.ZodBoolean;
192
209
  canUndo: z.ZodBoolean;
193
210
  actions: z.ZodArray<z.ZodObject<{
194
211
  id: z.ZodString;
195
212
  seq: z.ZodNumber;
196
213
  entityType: z.ZodEnum<{
197
214
  agent_action: "agent_action";
215
+ agent_instructions: "agent_instructions";
198
216
  agent_request: "agent_request";
199
217
  agent_token: "agent_token";
200
218
  attachment: "attachment";
219
+ board_view: "board_view";
201
220
  checklist_item: "checklist_item";
202
221
  comment: "comment";
203
222
  idea: "idea";
@@ -233,11 +252,19 @@ export declare const RequestListResponseSchema: z.ZodObject<{
233
252
  tokenId: z.ZodString;
234
253
  name: z.ZodString;
235
254
  ownerName: z.ZodString;
255
+ isRunner: z.ZodBoolean;
236
256
  lastUsedAt: z.ZodNullable<z.ZodISODateTime>;
237
257
  listening: z.ZodBoolean;
238
258
  }, z.core.$strip>>;
239
259
  runnerAllowed: z.ZodBoolean;
240
260
  runnerDisabledReason: z.ZodNullable<z.ZodString>;
261
+ runnerFailure: z.ZodNullable<z.ZodObject<{
262
+ at: z.ZodISODateTime;
263
+ message: z.ZodString;
264
+ }, z.core.$strip>>;
265
+ runnerSession: z.ZodNullable<z.ZodObject<{
266
+ startedAt: z.ZodISODateTime;
267
+ }, z.core.$strip>>;
241
268
  }, z.core.$strip>;
242
269
  export type RequestListResponse = z.infer<typeof RequestListResponseSchema>;
243
270
  /** Version d'une tâche dans son historique. */
@@ -39,14 +39,14 @@ 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,
45
47
  kind: RequestKindSchema,
46
48
  status: RequestStatusSchema,
47
49
  text: z.string(),
48
- /** Ligne affichée dans la file : le texte, ou un résumé pour une review de test ou une promotion d'idée. */
49
- title: z.string(),
50
50
  authorId: IdSchema,
51
51
  authorName: z.string(),
52
52
  authorEmail: z.string(),
@@ -54,6 +54,8 @@ export const RequestViewSchema = z.object({
54
54
  targetSpaceName: z.string(),
55
55
  contextTask: TaskRefSchema.nullable(),
56
56
  reply: z.string().nullable(),
57
+ /** Points que l'auteur doit encore régler, laissés par l'agent ; vide quand tout est traité. */
58
+ followUps: z.array(z.string()),
57
59
  failureReason: z.string().nullable(),
58
60
  createdAt: TimestampSchema,
59
61
  updatedAt: TimestampSchema,
@@ -64,13 +66,19 @@ export const RequestViewSchema = z.object({
64
66
  cancelledByName: z.string().nullable(),
65
67
  /** Vrai si l'utilisateur peut modifier ou annuler la demande (en attente, et membre de son espace). */
66
68
  canEdit: z.boolean(),
67
- /** Vrai si l'utilisateur peut libérer la demande prise par l'agent (en cours, et membre de son espace). */
68
- canRelease: z.boolean(),
69
+ /** Nom de qui a stoppé la demande pendant son traitement ; null si elle n'a pas été stoppée. */
70
+ stoppedByName: z.string().nullable(),
71
+ /** Vrai si l'utilisateur peut stopper la demande en cours : il en est l'auteur, ou administrateur. */
72
+ canStop: z.boolean(),
73
+ /** Vrai si l'utilisateur peut remettre en attente la demande stoppée : il en est l'auteur, ou administrateur. */
74
+ canRelaunch: z.boolean(),
69
75
  /** Vrai si l'utilisateur voit et peut annuler les actions du lot (membre de son espace, demande terminée). */
70
76
  canUndo: z.boolean(),
71
77
  /** Actions du lot, dans l'ordre ; vide pour qui n'est pas membre de son espace. */
72
78
  actions: z.array(AgentActionViewSchema),
73
79
  });
80
+ /** Dernière session du runner terminée en échec dans un espace : quand, et pourquoi. */
81
+ export const RunnerFailureSchema = z.object({ at: TimestampSchema, message: z.string() });
74
82
  export const RequestListResponseSchema = z.object({
75
83
  /** Demandes de l'espace, de la plus récente à la plus ancienne. */
76
84
  requests: z.array(RequestViewSchema),
@@ -84,6 +92,10 @@ export const RequestListResponseSchema = z.object({
84
92
  runnerAllowed: z.boolean(),
85
93
  /** Raison pour laquelle le runner du site est désactivé (en français), null quand il est actif. */
86
94
  runnerDisabledReason: z.string().nullable(),
95
+ /** Dernière session du runner dans l'espace, quand elle a échoué ; null dès qu'une nouvelle session démarre. */
96
+ runnerFailure: RunnerFailureSchema.nullable(),
97
+ /** Session du runner en cours dans l'espace, null quand aucune ne tourne. */
98
+ runnerSession: z.object({ startedAt: TimestampSchema }).nullable(),
87
99
  });
88
100
  /** Version d'une tâche dans son historique. */
89
101
  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,6 +365,7 @@ 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>;
364
371
  history: z.ZodArray<z.ZodObject<{
@@ -393,8 +400,13 @@ export declare const ClaimRequestDataSchema: z.ZodObject<{
393
400
  claimedAt: z.ZodNullable<z.ZodISODateTime>;
394
401
  claimedByThisToken: z.ZodBoolean;
395
402
  reply: z.ZodNullable<z.ZodString>;
403
+ followUps: z.ZodArray<z.ZodString>;
396
404
  failureReason: z.ZodNullable<z.ZodString>;
397
405
  }, z.core.$strip>>;
406
+ instructions: z.ZodObject<{
407
+ site: z.ZodNullable<z.ZodString>;
408
+ space: z.ZodNullable<z.ZodString>;
409
+ }, z.core.$strip>;
398
410
  space: z.ZodObject<{
399
411
  id: z.ZodString;
400
412
  name: z.ZodString;
@@ -479,6 +491,7 @@ export declare const FinishRequestDataSchema: z.ZodObject<{
479
491
  claimedAt: z.ZodNullable<z.ZodISODateTime>;
480
492
  claimedByThisToken: z.ZodBoolean;
481
493
  reply: z.ZodNullable<z.ZodString>;
494
+ followUps: z.ZodArray<z.ZodString>;
482
495
  failureReason: z.ZodNullable<z.ZodString>;
483
496
  }, z.core.$strip>;
484
497
  actionCount: z.ZodNumber;
@@ -849,6 +862,7 @@ export declare const WaitRequestsDataSchema: z.ZodObject<{
849
862
  claimedAt: z.ZodNullable<z.ZodISODateTime>;
850
863
  claimedByThisToken: z.ZodBoolean;
851
864
  reply: z.ZodNullable<z.ZodString>;
865
+ followUps: z.ZodArray<z.ZodString>;
852
866
  failureReason: z.ZodNullable<z.ZodString>;
853
867
  }, z.core.$strip>>;
854
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
- export const CompleteRequestBodySchema = z.object({ reply: z.string().max(MAX_REPLY_LENGTH) }).strict();
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,6 +147,7 @@ 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 });
@@ -147,6 +156,8 @@ export const ClaimRequestDataSchema = z.object({
147
156
  request: AgentRequestSummarySchema,
148
157
  /** Échanges précédents de l'auteur dans l'espace, du plus ancien au plus récent, pour une demande de type message. */
149
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() }),
150
161
  space: AgentSpaceSchema,
151
162
  members: z.array(AgentMemberSchema),
152
163
  tasks: z.array(AgentTaskSummarySchema),
@@ -163,6 +163,23 @@ export declare const MembersResponseSchema: z.ZodObject<{
163
163
  }, z.core.$strip>>;
164
164
  }, z.core.$strip>;
165
165
  export type MembersResponse = z.infer<typeof MembersResponseSchema>;
166
+ /** Compte actif qui partage un autre espace commun avec le propriétaire, proposé à l'ajout. */
167
+ export declare const MemberSuggestionSchema: z.ZodObject<{
168
+ userId: z.ZodString;
169
+ email: z.ZodPipe<z.ZodString, z.ZodEmail>;
170
+ displayName: z.ZodNullable<z.ZodString>;
171
+ sharedSpaces: z.ZodArray<z.ZodString>;
172
+ }, z.core.$strip>;
173
+ export type MemberSuggestion = z.infer<typeof MemberSuggestionSchema>;
174
+ export declare const MemberSuggestionsResponseSchema: z.ZodObject<{
175
+ suggestions: z.ZodArray<z.ZodObject<{
176
+ userId: z.ZodString;
177
+ email: z.ZodPipe<z.ZodString, z.ZodEmail>;
178
+ displayName: z.ZodNullable<z.ZodString>;
179
+ sharedSpaces: z.ZodArray<z.ZodString>;
180
+ }, z.core.$strip>>;
181
+ }, z.core.$strip>;
182
+ export type MemberSuggestionsResponse = z.infer<typeof MemberSuggestionsResponseSchema>;
166
183
  export declare const InviteRequestSchema: z.ZodObject<{
167
184
  email: z.ZodPipe<z.ZodString, z.ZodEmail>;
168
185
  }, z.core.$strip>;
@@ -78,6 +78,15 @@ export const MembersResponseSchema = z.object({
78
78
  members: z.array(MemberViewSchema),
79
79
  invitations: z.array(PendingInvitationViewSchema),
80
80
  });
81
+ /** Compte actif qui partage un autre espace commun avec le propriétaire, proposé à l'ajout. */
82
+ export const MemberSuggestionSchema = z.object({
83
+ userId: IdSchema,
84
+ email: EmailSchema,
85
+ displayName: z.string().nullable(),
86
+ /** Noms des espaces communs partagés avec le propriétaire, par ordre alphabétique. */
87
+ sharedSpaces: z.array(z.string()),
88
+ });
89
+ export const MemberSuggestionsResponseSchema = z.object({ suggestions: z.array(MemberSuggestionSchema) });
81
90
  export const InviteRequestSchema = z.object({
82
91
  email: z.string().trim().toLowerCase().min(1, "L'adresse e-mail est requise.").pipe(z.email("Adresse e-mail invalide.")),
83
92
  });
@@ -107,6 +107,16 @@ export declare const SpaceSchema: z.ZodObject<{
107
107
  createdAt: z.ZodISODateTime;
108
108
  }, z.core.$strip>;
109
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>;
110
120
  export declare const MembershipSchema: z.ZodObject<{
111
121
  spaceId: z.ZodString;
112
122
  userId: z.ZodString;
@@ -250,6 +260,52 @@ export declare const IdeaSchema: z.ZodObject<{
250
260
  createdAt: z.ZodISODateTime;
251
261
  }, z.core.$strip>;
252
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>;
253
309
  export declare const AgentRequestSchema: z.ZodObject<{
254
310
  id: z.ZodString;
255
311
  authorId: z.ZodString;
@@ -272,6 +328,7 @@ export declare const AgentRequestSchema: z.ZodObject<{
272
328
  processing: "processing";
273
329
  }>;
274
330
  reply: z.ZodNullable<z.ZodString>;
331
+ followUps: z.ZodArray<z.ZodString>;
275
332
  failureReason: z.ZodNullable<z.ZodString>;
276
333
  createdAt: z.ZodISODateTime;
277
334
  updatedAt: z.ZodISODateTime;
@@ -279,6 +336,8 @@ export declare const AgentRequestSchema: z.ZodObject<{
279
336
  claimedByTokenId: z.ZodNullable<z.ZodString>;
280
337
  completedAt: z.ZodNullable<z.ZodISODateTime>;
281
338
  cancelledBy: z.ZodNullable<z.ZodString>;
339
+ stoppedAt: z.ZodNullable<z.ZodISODateTime>;
340
+ stoppedBy: z.ZodNullable<z.ZodString>;
282
341
  }, z.core.$strip>;
283
342
  export type AgentRequest = z.infer<typeof AgentRequestSchema>;
284
343
  export declare const AgentActionSchema: z.ZodObject<{
@@ -287,9 +346,11 @@ export declare const AgentActionSchema: z.ZodObject<{
287
346
  seq: z.ZodNumber;
288
347
  entityType: z.ZodEnum<{
289
348
  agent_action: "agent_action";
349
+ agent_instructions: "agent_instructions";
290
350
  agent_request: "agent_request";
291
351
  agent_token: "agent_token";
292
352
  attachment: "attachment";
353
+ board_view: "board_view";
293
354
  checklist_item: "checklist_item";
294
355
  comment: "comment";
295
356
  idea: "idea";
@@ -473,9 +534,11 @@ export declare const ChangeSchema: z.ZodObject<{
473
534
  userId: z.ZodNullable<z.ZodString>;
474
535
  entityType: z.ZodEnum<{
475
536
  agent_action: "agent_action";
537
+ agent_instructions: "agent_instructions";
476
538
  agent_request: "agent_request";
477
539
  agent_token: "agent_token";
478
540
  attachment: "attachment";
541
+ board_view: "board_view";
479
542
  checklist_item: "checklist_item";
480
543
  comment: "comment";
481
544
  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();
@@ -91,6 +91,16 @@ export const SpaceSchema = z.object({
91
91
  runnerAllowed: z.boolean(),
92
92
  createdAt: TimestampSchema,
93
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
+ });
94
104
  export const MembershipSchema = z.object({
95
105
  spaceId: IdSchema,
96
106
  userId: IdSchema,
@@ -191,6 +201,37 @@ export const IdeaSchema = z.object({
191
201
  archivedAt: TimestampSchema.nullable(),
192
202
  createdAt: TimestampSchema,
193
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
+ });
194
235
  export const AgentRequestSchema = z.object({
195
236
  id: IdSchema,
196
237
  authorId: IdSchema,
@@ -202,6 +243,8 @@ export const AgentRequestSchema = z.object({
202
243
  text: z.string().trim().min(1),
203
244
  status: RequestStatusSchema,
204
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)),
205
248
  failureReason: z.string().nullable(),
206
249
  createdAt: TimestampSchema,
207
250
  updatedAt: TimestampSchema,
@@ -210,6 +253,9 @@ export const AgentRequestSchema = z.object({
210
253
  claimedByTokenId: IdSchema.nullable(),
211
254
  completedAt: TimestampSchema.nullable(),
212
255
  cancelledBy: IdSchema.nullable(),
256
+ /** Arrêt du traitement par l'auteur ou un administrateur : la demande est alors `failed`. */
257
+ stoppedAt: TimestampSchema.nullable(),
258
+ stoppedBy: IdSchema.nullable(),
213
259
  });
214
260
  export const AgentActionSchema = z.object({
215
261
  id: IdSchema,
@@ -48,6 +48,22 @@ export declare const TaskPrioritySchema: z.ZodEnum<{
48
48
  medium: "medium";
49
49
  }>;
50
50
  export type TaskPriority = z.infer<typeof TaskPrioritySchema>;
51
+ /** Dispositions d'une vue du tableau de bord ; une matrice croise deux regroupements. */
52
+ export declare const BOARD_LAYOUTS: readonly ["kanban", "list", "matrix"];
53
+ export declare const BoardLayoutSchema: z.ZodEnum<{
54
+ kanban: "kanban";
55
+ list: "list";
56
+ matrix: "matrix";
57
+ }>;
58
+ export type BoardLayout = z.infer<typeof BoardLayoutSchema>;
59
+ /** Regroupements d'une vue du tableau de bord ; `none` n'existe qu'en liste. */
60
+ export declare const BOARD_GROUPINGS: readonly ["status", "priority", "none"];
61
+ export declare const BoardGroupingSchema: z.ZodEnum<{
62
+ none: "none";
63
+ priority: "priority";
64
+ status: "status";
65
+ }>;
66
+ export type BoardGrouping = z.infer<typeof BoardGroupingSchema>;
51
67
  /** Profondeur maximale d'une tâche : tâche (0) > sous-tâche (1) > sous-sous-tâche (2). */
52
68
  export declare const MAX_TASK_DEPTH = 2;
53
69
  export declare const TEST_RESULTS: readonly ["ok", "ko", "blocked", "untested"];
@@ -104,12 +120,14 @@ export declare const NotificationTypeSchema: z.ZodEnum<{
104
120
  }>;
105
121
  export type NotificationType = z.infer<typeof NotificationTypeSchema>;
106
122
  /** Types d'entités nommés dans le journal `Change`, les versions et les actions de l'agent. */
107
- export declare const ENTITY_TYPES: readonly ["user", "user_settings", "space", "membership", "invitation", "task", "tag", "checklist_item", "test_checkpoint", "test_result", "test_review", "comment", "attachment", "idea", "agent_request", "agent_action", "agent_token", "notification"];
123
+ export declare const ENTITY_TYPES: readonly ["user", "user_settings", "space", "membership", "invitation", "task", "tag", "checklist_item", "test_checkpoint", "test_result", "test_review", "comment", "attachment", "idea", "agent_request", "agent_action", "agent_token", "notification", "board_view", "agent_instructions"];
108
124
  export declare const EntityTypeSchema: z.ZodEnum<{
109
125
  agent_action: "agent_action";
126
+ agent_instructions: "agent_instructions";
110
127
  agent_request: "agent_request";
111
128
  agent_token: "agent_token";
112
129
  attachment: "attachment";
130
+ board_view: "board_view";
113
131
  checklist_item: "checklist_item";
114
132
  comment: "comment";
115
133
  idea: "idea";
@@ -15,6 +15,12 @@ export const TASK_STATUSES = ["todo", "doing", "review", "done"];
15
15
  export const TaskStatusSchema = z.enum(TASK_STATUSES);
16
16
  export const TASK_PRIORITIES = ["low", "medium", "high", "critical"];
17
17
  export const TaskPrioritySchema = z.enum(TASK_PRIORITIES);
18
+ /** Dispositions d'une vue du tableau de bord ; une matrice croise deux regroupements. */
19
+ export const BOARD_LAYOUTS = ["kanban", "list", "matrix"];
20
+ export const BoardLayoutSchema = z.enum(BOARD_LAYOUTS);
21
+ /** Regroupements d'une vue du tableau de bord ; `none` n'existe qu'en liste. */
22
+ export const BOARD_GROUPINGS = ["status", "priority", "none"];
23
+ export const BoardGroupingSchema = z.enum(BOARD_GROUPINGS);
18
24
  /** Profondeur maximale d'une tâche : tâche (0) > sous-tâche (1) > sous-sous-tâche (2). */
19
25
  export const MAX_TASK_DEPTH = 2;
20
26
  export const TEST_RESULTS = ["ok", "ko", "blocked", "untested"];
@@ -51,6 +57,8 @@ export const ENTITY_TYPES = [
51
57
  "agent_action",
52
58
  "agent_token",
53
59
  "notification",
60
+ "board_view",
61
+ "agent_instructions",
54
62
  ];
55
63
  export const EntityTypeSchema = z.enum(ENTITY_TYPES);
56
64
  /** Entités dont chaque modification produit une `EntityVersion`. */
@@ -0,0 +1,42 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Instructions personnalisées de l'agent : celles du site
4
+ * (`/api/admin/agent-instructions`, administrateurs) et celles d'un espace
5
+ * (`/api/spaces/:spaceId/agent-instructions`). L'agent reçoit les premières,
6
+ * puis les secondes, avec chaque demande qu'il prend.
7
+ */
8
+ export declare const AgentInstructionsViewSchema: z.ZodObject<{
9
+ text: z.ZodString;
10
+ updatedAt: z.ZodISODateTime;
11
+ updatedByName: z.ZodNullable<z.ZodString>;
12
+ }, z.core.$strip>;
13
+ export type AgentInstructionsView = z.infer<typeof AgentInstructionsViewSchema>;
14
+ /** `GET|PUT /admin/agent-instructions` : instructions du site, null s'il n'y en a pas. */
15
+ export declare const SiteInstructionsResponseSchema: z.ZodObject<{
16
+ instructions: z.ZodNullable<z.ZodObject<{
17
+ text: z.ZodString;
18
+ updatedAt: z.ZodISODateTime;
19
+ updatedByName: z.ZodNullable<z.ZodString>;
20
+ }, z.core.$strip>>;
21
+ }, z.core.$strip>;
22
+ export type SiteInstructionsResponse = z.infer<typeof SiteInstructionsResponseSchema>;
23
+ /** `GET|PUT /spaces/:spaceId/agent-instructions` : instructions de l'espace, celles du site en lecture, et le droit de modifier. */
24
+ export declare const SpaceInstructionsResponseSchema: z.ZodObject<{
25
+ instructions: z.ZodNullable<z.ZodObject<{
26
+ text: z.ZodString;
27
+ updatedAt: z.ZodISODateTime;
28
+ updatedByName: z.ZodNullable<z.ZodString>;
29
+ }, z.core.$strip>>;
30
+ site: z.ZodNullable<z.ZodObject<{
31
+ text: z.ZodString;
32
+ updatedAt: z.ZodISODateTime;
33
+ updatedByName: z.ZodNullable<z.ZodString>;
34
+ }, z.core.$strip>>;
35
+ canEdit: z.ZodBoolean;
36
+ }, z.core.$strip>;
37
+ export type SpaceInstructionsResponse = z.infer<typeof SpaceInstructionsResponseSchema>;
38
+ /** Corps des `PUT` : un texte vide retire les instructions. */
39
+ export declare const SetAgentInstructionsRequestSchema: z.ZodObject<{
40
+ text: z.ZodString;
41
+ }, z.core.$strict>;
42
+ export type SetAgentInstructionsRequest = z.infer<typeof SetAgentInstructionsRequestSchema>;