@imenam/mcp-organizer 1.0.19 → 1.0.21
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 +103 -29
- package/dist/shared/logic/attachments.d.ts +28 -0
- package/dist/shared/logic/attachments.js +52 -0
- package/dist/shared/logic/documents.d.ts +22 -0
- package/dist/shared/logic/documents.js +38 -0
- package/dist/shared/logic/line-diff.d.ts +13 -0
- package/dist/shared/logic/line-diff.js +66 -0
- package/dist/shared/logic/notes.d.ts +12 -0
- package/dist/shared/logic/notes.js +23 -0
- package/dist/shared/logic/timer.d.ts +69 -0
- package/dist/shared/logic/timer.js +87 -0
- package/dist/shared/schemas/agent-api.schema.d.ts +10 -29
- package/dist/shared/schemas/agent-api.schema.js +4 -15
- package/dist/shared/schemas/agent-tools.schema.d.ts +522 -2
- package/dist/shared/schemas/agent-tools.schema.js +111 -6
- package/dist/shared/schemas/api.schema.d.ts +7 -0
- package/dist/shared/schemas/api.schema.js +6 -0
- package/dist/shared/schemas/documents-api.schema.d.ts +49 -0
- package/dist/shared/schemas/documents-api.schema.js +38 -0
- package/dist/shared/schemas/entities.schema.d.ts +107 -54
- package/dist/shared/schemas/entities.schema.js +81 -10
- package/dist/shared/schemas/enums.schema.d.ts +19 -3
- package/dist/shared/schemas/enums.schema.js +8 -2
- package/dist/shared/schemas/gui-api.schema.d.ts +1 -0
- package/dist/shared/schemas/gui-api.schema.js +2 -0
- package/dist/shared/schemas/history-api.schema.d.ts +961 -0
- package/dist/shared/schemas/history-api.schema.js +104 -0
- package/dist/shared/schemas/notes-api.schema.d.ts +54 -0
- package/dist/shared/schemas/notes-api.schema.js +38 -0
- package/dist/shared/schemas/notifications-api.schema.d.ts +12 -0
- package/dist/shared/schemas/notifications-api.schema.js +4 -1
- package/dist/shared/schemas/tasks-api.schema.d.ts +39 -0
- package/dist/shared/schemas/tasks-api.schema.js +5 -0
- package/dist/shared/schemas/timers-api.schema.d.ts +119 -0
- package/dist/shared/schemas/timers-api.schema.js +44 -0
- package/dist/shared/schemas/views-api.schema.d.ts +16 -0
- package/dist/shared/schemas/views-api.schema.js +4 -2
- package/dist/src/agent-api/documents.d.ts +3 -0
- package/dist/src/agent-api/documents.js +66 -0
- package/dist/src/agent-api/history.d.ts +3 -0
- package/dist/src/agent-api/history.js +103 -0
- package/dist/src/agent-api/notes.d.ts +3 -0
- package/dist/src/agent-api/notes.js +39 -0
- package/dist/src/agent-api/requests.js +2 -1
- package/dist/src/agent-api/router.js +5 -1
- package/dist/src/agent-api/tasks.js +17 -6
- package/dist/src/agent-api/timers.d.ts +2 -0
- package/dist/src/agent-api/timers.js +170 -0
- package/dist/src/agent-api/types.d.ts +3 -0
- package/dist/src/agent-api/views.js +15 -30
- package/dist/src/cli/backup.js +3 -3
- package/dist/src/core/accounts.d.ts +12 -5
- package/dist/src/core/accounts.js +28 -10
- package/dist/src/core/agent.d.ts +27 -3
- package/dist/src/core/agent.js +118 -1
- package/dist/src/core/attachments.d.ts +6 -3
- package/dist/src/core/attachments.js +9 -4
- package/dist/src/core/board-views.js +4 -4
- package/dist/src/core/document-text.d.ts +17 -0
- package/dist/src/core/document-text.js +118 -0
- package/dist/src/core/documents.d.ts +22 -0
- package/dist/src/core/documents.js +168 -0
- package/dist/src/core/history-events.d.ts +34 -0
- package/dist/src/core/history-events.js +236 -0
- package/dist/src/core/history.js +33 -3
- package/dist/src/core/migrations.js +153 -0
- package/dist/src/core/notes.d.ts +23 -0
- package/dist/src/core/notes.js +78 -0
- package/dist/src/core/notifications.d.ts +48 -5
- package/dist/src/core/notifications.js +209 -33
- package/dist/src/core/password-reset.d.ts +37 -0
- package/dist/src/core/password-reset.js +56 -0
- package/dist/src/core/requests.d.ts +4 -3
- package/dist/src/core/requests.js +5 -4
- package/dist/src/core/snapshots.d.ts +3 -3
- package/dist/src/core/snapshots.js +3 -1
- package/dist/src/core/space-history.d.ts +18 -0
- package/dist/src/core/space-history.js +86 -0
- package/dist/src/core/spaces.d.ts +1 -1
- package/dist/src/core/spaces.js +4 -4
- package/dist/src/core/store.d.ts +154 -11
- package/dist/src/core/store.js +479 -52
- package/dist/src/core/task-history.d.ts +9 -5
- package/dist/src/core/task-history.js +17 -25
- package/dist/src/core/tasks.d.ts +2 -2
- package/dist/src/core/tasks.js +13 -2
- package/dist/src/core/timers.d.ts +33 -0
- package/dist/src/core/timers.js +101 -0
- package/dist/src/core/versions.d.ts +22 -0
- package/dist/src/core/versions.js +106 -0
- package/dist/src/gui-api.d.ts +4 -1
- package/dist/src/gui-api.js +85 -6
- package/dist/src/mcp/start.d.ts +1 -1
- package/dist/src/mcp/start.js +12 -7
- package/dist/src/mcp/tools.js +129 -3
- package/dist/src/server/app.d.ts +4 -2
- package/dist/src/server/app.js +21 -5
- package/dist/src/server/login-limiter.d.ts +27 -1
- package/dist/src/server/login-limiter.js +31 -1
- package/dist/src/server/start.js +1 -0
- package/gui/dist/assets/index-DbzcjyaW.js +104 -0
- package/gui/dist/assets/index-Dvf5Yo0e.css +1 -0
- package/gui/dist/index.html +2 -2
- package/package.json +1 -1
- package/gui/dist/assets/index-B-AB8nGt.css +0 -1
- package/gui/dist/assets/index-DU-RfoVk.js +0 -99
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ActorTypeSchema, MemberRoleSchema, TaskPrioritySchema, TaskStatusSchema, TaskTypeSchema } from "./enums.schema.js";
|
|
3
|
+
import { IdSchema, TimestampSchema } from "./entities.schema.js";
|
|
4
|
+
/** Historique des événements : celui d'une tâche (modale du détail) et celui d'un espace (page Historique). */
|
|
5
|
+
/** Catégories d'événements, filtre « Type d'événement » de l'historique de l'espace. */
|
|
6
|
+
export const HISTORY_CATEGORIES = ["task", "idea", "member", "note", "document"];
|
|
7
|
+
export const HistoryCategorySchema = z.enum(HISTORY_CATEGORIES);
|
|
8
|
+
export const MAX_HISTORY_PAGE = 100;
|
|
9
|
+
export const DEFAULT_HISTORY_PAGE = 50;
|
|
10
|
+
/** Personne nommée par un événement ; `id` est null pour une adresse invitée sans compte connu. */
|
|
11
|
+
export const HistoryPersonSchema = z.object({ id: IdSchema.nullable(), name: z.string() });
|
|
12
|
+
/** Tâche nommée par un événement : sa clé et son titre, existante ou supprimée. */
|
|
13
|
+
export const HistoryTaskRefSchema = z.object({ id: IdSchema, key: z.string(), title: z.string(), deleted: z.boolean() });
|
|
14
|
+
/** Ligne d'un diff de texte : inchangée, ajoutée ou retirée. */
|
|
15
|
+
export const DiffLineSchema = z.object({ kind: z.enum(["same", "add", "del"]), text: z.string() });
|
|
16
|
+
/** Changement élémentaire d'un événement, que la GUI met en phrase. */
|
|
17
|
+
export const HistoryChangeSchema = z.discriminatedUnion("kind", [
|
|
18
|
+
z.object({ kind: z.literal("created") }),
|
|
19
|
+
z.object({ kind: z.literal("deleted") }),
|
|
20
|
+
z.object({ kind: z.literal("restored") }),
|
|
21
|
+
z.object({ kind: z.literal("title"), from: z.string(), to: z.string() }),
|
|
22
|
+
z.object({ kind: z.literal("status"), from: TaskStatusSchema, to: TaskStatusSchema }),
|
|
23
|
+
z.object({ kind: z.literal("priority"), from: TaskPrioritySchema, to: TaskPrioritySchema }),
|
|
24
|
+
z.object({ kind: z.literal("type"), from: TaskTypeSchema, to: TaskTypeSchema }),
|
|
25
|
+
/** Description : lignes ajoutées et retirées ; `lines` porte le diff complet dans l'historique d'une tâche, null dans celui de l'espace. */
|
|
26
|
+
z.object({ kind: z.literal("description"), added: z.number().int().min(0), removed: z.number().int().min(0), lines: z.array(DiffLineSchema).nullable() }),
|
|
27
|
+
z.object({ kind: z.literal("assignees"), added: z.array(HistoryPersonSchema), removed: z.array(HistoryPersonSchema) }),
|
|
28
|
+
z.object({ kind: z.literal("tags"), added: z.array(z.string()), removed: z.array(z.string()) }),
|
|
29
|
+
z.object({ kind: z.literal("parent"), from: HistoryTaskRefSchema.nullable(), to: HistoryTaskRefSchema.nullable() }),
|
|
30
|
+
z.object({ kind: z.literal("tested"), from: HistoryTaskRefSchema.nullable(), to: HistoryTaskRefSchema.nullable() }),
|
|
31
|
+
z.object({ kind: z.literal("checklist"), action: z.enum(["added", "removed", "checked", "unchecked", "edited"]), text: z.string(), previous: z.string().nullable() }),
|
|
32
|
+
z.object({ kind: z.literal("checkpoint"), action: z.enum(["added", "removed", "edited"]), text: z.string(), previous: z.string().nullable() }),
|
|
33
|
+
z.object({
|
|
34
|
+
kind: z.literal("idea"),
|
|
35
|
+
action: z.enum(["created", "deleted", "restored", "edited", "archived", "unarchived", "promoted"]),
|
|
36
|
+
text: z.string(),
|
|
37
|
+
previous: z.string().nullable(),
|
|
38
|
+
task: HistoryTaskRefSchema.nullable(),
|
|
39
|
+
}),
|
|
40
|
+
z.object({ kind: z.literal("member"), action: z.enum(["created_space", "joined", "added", "left", "removed", "role"]), person: HistoryPersonSchema, role: MemberRoleSchema }),
|
|
41
|
+
z.object({ kind: z.literal("invitation"), action: z.enum(["invited", "revoked", "declined"]), person: HistoryPersonSchema }),
|
|
42
|
+
z.object({ kind: z.literal("note"), action: z.enum(["created", "renamed", "edited", "deleted", "restored"]), noteId: IdSchema, title: z.string(), previous: z.string().nullable() }),
|
|
43
|
+
z.object({ kind: z.literal("document"), action: z.enum(["added", "replaced", "described", "deleted", "restored"]), filename: z.string() }),
|
|
44
|
+
]);
|
|
45
|
+
/**
|
|
46
|
+
* Événement de l'historique : une version d'une entité, faite par une
|
|
47
|
+
* mutation. Pour l'agent, `actor` nomme le membre pour qui il agit (l'auteur
|
|
48
|
+
* de la demande) et `request` la demande traitée. `task` est la tâche
|
|
49
|
+
* concernée, `version` le numéro de version de la tâche que l'événement a
|
|
50
|
+
* produite (cible de « Restaurer »), `restorable` vrai pour la suppression
|
|
51
|
+
* d'une tâche toujours supprimée.
|
|
52
|
+
*/
|
|
53
|
+
export const HistoryEventSchema = z.object({
|
|
54
|
+
id: z.string(),
|
|
55
|
+
seq: z.number().int().min(1),
|
|
56
|
+
at: TimestampSchema,
|
|
57
|
+
category: HistoryCategorySchema,
|
|
58
|
+
actor: z.object({ type: ActorTypeSchema, id: IdSchema.nullable(), name: z.string() }),
|
|
59
|
+
request: z.object({ id: IdSchema, text: z.string() }).nullable(),
|
|
60
|
+
task: HistoryTaskRefSchema.nullable(),
|
|
61
|
+
version: z.number().int().min(1).nullable(),
|
|
62
|
+
restorable: z.boolean(),
|
|
63
|
+
changes: z.array(HistoryChangeSchema).min(1),
|
|
64
|
+
});
|
|
65
|
+
/** Historique d'une tâche, du plus récent au plus ancien ; `currentVersion` est la version de son état actuel. */
|
|
66
|
+
export const TaskHistoryResponseSchema = z.object({
|
|
67
|
+
task: HistoryTaskRefSchema,
|
|
68
|
+
currentVersion: z.number().int().min(1),
|
|
69
|
+
events: z.array(HistoryEventSchema),
|
|
70
|
+
});
|
|
71
|
+
/** Requête de l'historique d'un espace : auteur (`agent` ou un identifiant de membre), catégories, date de début, curseur. */
|
|
72
|
+
export const SpaceHistoryQuerySchema = z
|
|
73
|
+
.object({
|
|
74
|
+
actor: z.string().min(1).optional(),
|
|
75
|
+
categories: z
|
|
76
|
+
.string()
|
|
77
|
+
.optional()
|
|
78
|
+
.transform((raw, ctx) => {
|
|
79
|
+
if (raw === undefined)
|
|
80
|
+
return undefined;
|
|
81
|
+
const values = raw.split(",").filter((value) => value !== "");
|
|
82
|
+
const unknown = values.filter((value) => !HISTORY_CATEGORIES.includes(value));
|
|
83
|
+
if (unknown.length > 0)
|
|
84
|
+
ctx.addIssue({ code: "custom", message: `catégorie inconnue : ${unknown.join(", ")} (attendu : ${HISTORY_CATEGORIES.join(", ")})` });
|
|
85
|
+
return values;
|
|
86
|
+
}),
|
|
87
|
+
since: TimestampSchema.optional(),
|
|
88
|
+
before: z.coerce.number().int().min(1).optional(),
|
|
89
|
+
limit: z.coerce.number().int().min(1).max(MAX_HISTORY_PAGE).default(DEFAULT_HISTORY_PAGE),
|
|
90
|
+
})
|
|
91
|
+
.strict();
|
|
92
|
+
/**
|
|
93
|
+
* Page de l'historique d'un espace : événements du plus récent au plus
|
|
94
|
+
* ancien, nombre total de ceux qui passent les filtres, curseur de la page
|
|
95
|
+
* suivante (null à la fin) et auteurs proposés par le filtre.
|
|
96
|
+
*/
|
|
97
|
+
export const SpaceHistoryResponseSchema = z.object({
|
|
98
|
+
events: z.array(HistoryEventSchema),
|
|
99
|
+
total: z.number().int().min(0),
|
|
100
|
+
nextBefore: z.number().int().min(1).nullable(),
|
|
101
|
+
authors: z.array(HistoryPersonSchema.extend({ id: IdSchema })),
|
|
102
|
+
});
|
|
103
|
+
/** Réponse de la restauration d'une tâche supprimée. */
|
|
104
|
+
export const RestoreTaskResponseSchema = z.object({ task: HistoryTaskRefSchema });
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Corps des requêtes et des réponses de la page Notes de la GUI. */
|
|
3
|
+
export declare const MAX_NOTE_TITLE_LENGTH = 200;
|
|
4
|
+
export declare const MAX_NOTE_BODY_LENGTH = 50000;
|
|
5
|
+
export declare const MAX_NOTE_INSTRUCTION_LENGTH = 2000;
|
|
6
|
+
export declare const NoteTitleSchema: z.ZodString;
|
|
7
|
+
export declare const NoteBodySchema: z.ZodString;
|
|
8
|
+
/** Note telle que l'affiche la page Notes. */
|
|
9
|
+
export declare const NoteViewSchema: z.ZodObject<{
|
|
10
|
+
id: z.ZodString;
|
|
11
|
+
spaceId: z.ZodString;
|
|
12
|
+
title: z.ZodString;
|
|
13
|
+
body: z.ZodString;
|
|
14
|
+
authorId: z.ZodString;
|
|
15
|
+
authorName: z.ZodString;
|
|
16
|
+
updatedByName: z.ZodString;
|
|
17
|
+
createdAt: z.ZodISODateTime;
|
|
18
|
+
updatedAt: z.ZodISODateTime;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
export type NoteView = z.infer<typeof NoteViewSchema>;
|
|
21
|
+
export declare const NoteListResponseSchema: z.ZodObject<{
|
|
22
|
+
notes: z.ZodArray<z.ZodObject<{
|
|
23
|
+
id: z.ZodString;
|
|
24
|
+
spaceId: z.ZodString;
|
|
25
|
+
title: z.ZodString;
|
|
26
|
+
body: z.ZodString;
|
|
27
|
+
authorId: z.ZodString;
|
|
28
|
+
authorName: z.ZodString;
|
|
29
|
+
updatedByName: z.ZodString;
|
|
30
|
+
createdAt: z.ZodISODateTime;
|
|
31
|
+
updatedAt: z.ZodISODateTime;
|
|
32
|
+
}, z.core.$strip>>;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
export type NoteListResponse = z.infer<typeof NoteListResponseSchema>;
|
|
35
|
+
export declare const CreateNoteRequestSchema: z.ZodObject<{
|
|
36
|
+
title: z.ZodString;
|
|
37
|
+
body: z.ZodDefault<z.ZodString>;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
export type CreateNoteRequest = z.infer<typeof CreateNoteRequestSchema>;
|
|
40
|
+
export declare const UpdateNoteRequestSchema: z.ZodObject<{
|
|
41
|
+
title: z.ZodOptional<z.ZodString>;
|
|
42
|
+
body: z.ZodOptional<z.ZodString>;
|
|
43
|
+
}, z.core.$strip>;
|
|
44
|
+
export type UpdateNoteRequest = z.infer<typeof UpdateNoteRequestSchema>;
|
|
45
|
+
/** « Envoyer à l'agent » : consigne facultative ajoutée à la référence de la note. */
|
|
46
|
+
export declare const SendNoteRequestSchema: z.ZodObject<{
|
|
47
|
+
instruction: z.ZodDefault<z.ZodString>;
|
|
48
|
+
}, z.core.$strip>;
|
|
49
|
+
export type SendNoteRequest = z.infer<typeof SendNoteRequestSchema>;
|
|
50
|
+
/** Demande créée par « Envoyer à l'agent ». */
|
|
51
|
+
export declare const SendNoteResponseSchema: z.ZodObject<{
|
|
52
|
+
requestId: z.ZodString;
|
|
53
|
+
}, z.core.$strip>;
|
|
54
|
+
export type SendNoteResponse = z.infer<typeof SendNoteResponseSchema>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { IdSchema, TimestampSchema } from "./entities.schema.js";
|
|
3
|
+
/** Corps des requêtes et des réponses de la page Notes de la GUI. */
|
|
4
|
+
export const MAX_NOTE_TITLE_LENGTH = 200;
|
|
5
|
+
export const MAX_NOTE_BODY_LENGTH = 50_000;
|
|
6
|
+
export const MAX_NOTE_INSTRUCTION_LENGTH = 2_000;
|
|
7
|
+
export const NoteTitleSchema = z
|
|
8
|
+
.string()
|
|
9
|
+
.trim()
|
|
10
|
+
.min(1, "Le titre est vide : donnez un titre à la note.")
|
|
11
|
+
.max(MAX_NOTE_TITLE_LENGTH, `Le titre dépasse ${MAX_NOTE_TITLE_LENGTH} caractères.`);
|
|
12
|
+
export const NoteBodySchema = z.string().max(MAX_NOTE_BODY_LENGTH, `La note dépasse ${MAX_NOTE_BODY_LENGTH} caractères.`);
|
|
13
|
+
/** Note telle que l'affiche la page Notes. */
|
|
14
|
+
export const NoteViewSchema = z.object({
|
|
15
|
+
id: IdSchema,
|
|
16
|
+
spaceId: IdSchema,
|
|
17
|
+
title: z.string(),
|
|
18
|
+
body: z.string(),
|
|
19
|
+
authorId: IdSchema,
|
|
20
|
+
authorName: z.string(),
|
|
21
|
+
updatedByName: z.string(),
|
|
22
|
+
createdAt: TimestampSchema,
|
|
23
|
+
updatedAt: TimestampSchema,
|
|
24
|
+
});
|
|
25
|
+
export const NoteListResponseSchema = z.object({
|
|
26
|
+
/** Notes de l'espace, de la plus récemment modifiée à la plus ancienne. */
|
|
27
|
+
notes: z.array(NoteViewSchema),
|
|
28
|
+
});
|
|
29
|
+
export const CreateNoteRequestSchema = z.object({ title: NoteTitleSchema, body: NoteBodySchema.default("") });
|
|
30
|
+
export const UpdateNoteRequestSchema = z
|
|
31
|
+
.object({ title: NoteTitleSchema.optional(), body: NoteBodySchema.optional() })
|
|
32
|
+
.refine((patch) => patch.title !== undefined || patch.body !== undefined, "Rien à modifier : donnez le titre ou le contenu.");
|
|
33
|
+
/** « Envoyer à l'agent » : consigne facultative ajoutée à la référence de la note. */
|
|
34
|
+
export const SendNoteRequestSchema = z.object({
|
|
35
|
+
instruction: z.string().trim().max(MAX_NOTE_INSTRUCTION_LENGTH, `La consigne dépasse ${MAX_NOTE_INSTRUCTION_LENGTH} caractères.`).default(""),
|
|
36
|
+
});
|
|
37
|
+
/** Demande créée par « Envoyer à l'agent ». */
|
|
38
|
+
export const SendNoteResponseSchema = z.object({ requestId: IdSchema });
|
|
@@ -85,6 +85,12 @@ export declare const SettingsResponseSchema: z.ZodObject<{
|
|
|
85
85
|
notifyFollowUpApp: z.ZodBoolean;
|
|
86
86
|
notifyFollowUpEmail: z.ZodBoolean;
|
|
87
87
|
assistantHistory: z.ZodNumber;
|
|
88
|
+
pomodoro: z.ZodObject<{
|
|
89
|
+
workMinutes: z.ZodNumber;
|
|
90
|
+
shortBreakMinutes: z.ZodNumber;
|
|
91
|
+
longBreakMinutes: z.ZodNumber;
|
|
92
|
+
cycles: z.ZodNumber;
|
|
93
|
+
}, z.core.$strip>;
|
|
88
94
|
email: z.ZodObject<{
|
|
89
95
|
enabled: z.ZodBoolean;
|
|
90
96
|
reason: z.ZodNullable<z.ZodString>;
|
|
@@ -103,6 +109,12 @@ export declare const UpdateSettingsRequestSchema: z.ZodObject<{
|
|
|
103
109
|
notifyFollowUpApp: z.ZodOptional<z.ZodBoolean>;
|
|
104
110
|
notifyFollowUpEmail: z.ZodOptional<z.ZodBoolean>;
|
|
105
111
|
assistantHistory: z.ZodOptional<z.ZodNumber>;
|
|
112
|
+
pomodoro: z.ZodOptional<z.ZodObject<{
|
|
113
|
+
workMinutes: z.ZodNumber;
|
|
114
|
+
shortBreakMinutes: z.ZodNumber;
|
|
115
|
+
longBreakMinutes: z.ZodNumber;
|
|
116
|
+
cycles: z.ZodNumber;
|
|
117
|
+
}, z.core.$strip>>;
|
|
106
118
|
}, z.core.$strict>;
|
|
107
119
|
export type UpdateSettingsRequest = z.infer<typeof UpdateSettingsRequestSchema>;
|
|
108
120
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { ActorTypeSchema, NotificationTypeSchema } from "./enums.schema.js";
|
|
3
|
-
import { AssistantHistorySchema, IdSchema, NotificationPreferencesSchema, TimestampSchema } from "./entities.schema.js";
|
|
3
|
+
import { AssistantHistorySchema, IdSchema, NotificationPreferencesSchema, PomodoroSettingsSchema, TimestampSchema } from "./entities.schema.js";
|
|
4
4
|
/** Corps des requêtes et des réponses des notifications et des paramètres de la GUI. */
|
|
5
5
|
/** Nombre de notifications renvoyées par défaut, et au plus, par page. */
|
|
6
6
|
export const NOTIFICATIONS_PAGE_SIZE = 20;
|
|
@@ -57,6 +57,8 @@ export const SettingsResponseSchema = z.object({
|
|
|
57
57
|
notifyFollowUpEmail: z.boolean(),
|
|
58
58
|
/** Nombre d'échanges précédents transmis à l'agent avec un message de l'assistant. */
|
|
59
59
|
assistantHistory: AssistantHistorySchema,
|
|
60
|
+
/** Réglages pomodoro proposés au démarrage d'un chrono. */
|
|
61
|
+
pomodoro: PomodoroSettingsSchema,
|
|
60
62
|
/** Envoi des e-mails de notification : `reason` dit pourquoi il n'a pas lieu. */
|
|
61
63
|
email: z.object({ enabled: z.boolean(), reason: z.string().nullable() }),
|
|
62
64
|
/** Dictée vocale : `reason` dit pourquoi elle est indisponible. */
|
|
@@ -71,6 +73,7 @@ export const UpdateSettingsRequestSchema = z
|
|
|
71
73
|
notifyFollowUpApp: z.boolean().optional(),
|
|
72
74
|
notifyFollowUpEmail: z.boolean().optional(),
|
|
73
75
|
assistantHistory: AssistantHistorySchema.optional(),
|
|
76
|
+
pomodoro: PomodoroSettingsSchema.optional(),
|
|
74
77
|
})
|
|
75
78
|
.strict()
|
|
76
79
|
.refine((patch) => Object.values(patch).some((value) => value !== undefined), "Aucune modification demandée.");
|
|
@@ -68,6 +68,10 @@ export declare const TaskNodeSchema: z.ZodObject<{
|
|
|
68
68
|
done: z.ZodNumber;
|
|
69
69
|
total: z.ZodNumber;
|
|
70
70
|
}, z.core.$strip>;
|
|
71
|
+
questions: z.ZodObject<{
|
|
72
|
+
done: z.ZodNumber;
|
|
73
|
+
total: z.ZodNumber;
|
|
74
|
+
}, z.core.$strip>;
|
|
71
75
|
test: z.ZodNullable<z.ZodObject<{
|
|
72
76
|
total: z.ZodNumber;
|
|
73
77
|
verified: z.ZodNumber;
|
|
@@ -156,6 +160,10 @@ export declare const BoardResponseSchema: z.ZodObject<{
|
|
|
156
160
|
done: z.ZodNumber;
|
|
157
161
|
total: z.ZodNumber;
|
|
158
162
|
}, z.core.$strip>;
|
|
163
|
+
questions: z.ZodObject<{
|
|
164
|
+
done: z.ZodNumber;
|
|
165
|
+
total: z.ZodNumber;
|
|
166
|
+
}, z.core.$strip>;
|
|
159
167
|
test: z.ZodNullable<z.ZodObject<{
|
|
160
168
|
total: z.ZodNumber;
|
|
161
169
|
verified: z.ZodNumber;
|
|
@@ -526,6 +534,10 @@ export declare const TaskDetailResponseSchema: z.ZodObject<{
|
|
|
526
534
|
done: z.ZodNumber;
|
|
527
535
|
total: z.ZodNumber;
|
|
528
536
|
}, z.core.$strip>;
|
|
537
|
+
questions: z.ZodObject<{
|
|
538
|
+
done: z.ZodNumber;
|
|
539
|
+
total: z.ZodNumber;
|
|
540
|
+
}, z.core.$strip>;
|
|
529
541
|
test: z.ZodNullable<z.ZodObject<{
|
|
530
542
|
total: z.ZodNumber;
|
|
531
543
|
verified: z.ZodNumber;
|
|
@@ -679,6 +691,30 @@ export declare const TaskDetailResponseSchema: z.ZodObject<{
|
|
|
679
691
|
actionId: z.ZodString;
|
|
680
692
|
at: z.ZodISODateTime;
|
|
681
693
|
}, z.core.$strip>>;
|
|
694
|
+
time: z.ZodObject<{
|
|
695
|
+
serverNow: z.ZodISODateTime;
|
|
696
|
+
totalMs: z.ZodNumber;
|
|
697
|
+
sessions: z.ZodArray<z.ZodObject<{
|
|
698
|
+
id: z.ZodString;
|
|
699
|
+
taskId: z.ZodString;
|
|
700
|
+
userId: z.ZodString;
|
|
701
|
+
userName: z.ZodString;
|
|
702
|
+
mode: z.ZodEnum<{
|
|
703
|
+
free: "free";
|
|
704
|
+
pomodoro: "pomodoro";
|
|
705
|
+
}>;
|
|
706
|
+
pomodoro: z.ZodNullable<z.ZodObject<{
|
|
707
|
+
workMinutes: z.ZodNumber;
|
|
708
|
+
shortBreakMinutes: z.ZodNumber;
|
|
709
|
+
longBreakMinutes: z.ZodNumber;
|
|
710
|
+
cycles: z.ZodNumber;
|
|
711
|
+
}, z.core.$strip>>;
|
|
712
|
+
startedAt: z.ZodISODateTime;
|
|
713
|
+
endedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
714
|
+
runningSince: z.ZodNullable<z.ZodISODateTime>;
|
|
715
|
+
elapsedMs: z.ZodNumber;
|
|
716
|
+
}, z.core.$strip>>;
|
|
717
|
+
}, z.core.$strip>;
|
|
682
718
|
}, z.core.$strip>;
|
|
683
719
|
export type TaskDetailResponse = z.infer<typeof TaskDetailResponseSchema>;
|
|
684
720
|
export declare const CreateTaskRequestSchema: z.ZodObject<{
|
|
@@ -828,10 +864,12 @@ export declare const ChangesResponseSchema: z.ZodObject<{
|
|
|
828
864
|
board_view: "board_view";
|
|
829
865
|
checklist_item: "checklist_item";
|
|
830
866
|
comment: "comment";
|
|
867
|
+
document: "document";
|
|
831
868
|
follow_up: "follow_up";
|
|
832
869
|
idea: "idea";
|
|
833
870
|
invitation: "invitation";
|
|
834
871
|
membership: "membership";
|
|
872
|
+
note: "note";
|
|
835
873
|
notification: "notification";
|
|
836
874
|
space: "space";
|
|
837
875
|
tag: "tag";
|
|
@@ -840,6 +878,7 @@ export declare const ChangesResponseSchema: z.ZodObject<{
|
|
|
840
878
|
test_checkpoint: "test_checkpoint";
|
|
841
879
|
test_result: "test_result";
|
|
842
880
|
test_review: "test_review";
|
|
881
|
+
time_session: "time_session";
|
|
843
882
|
user: "user";
|
|
844
883
|
user_settings: "user_settings";
|
|
845
884
|
}>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { RequestStatusSchema, TaskPrioritySchema, TaskStatusSchema, TaskTypeSchema, TestResultValueSchema } from "./enums.schema.js";
|
|
3
|
+
import { TaskTimeSchema } from "./timers-api.schema.js";
|
|
3
4
|
import { ChangeSchema, EmailSchema, IdSchema, MAX_OTHER_ANSWER_LENGTH, PositionSchema, TimestampSchema } from "./entities.schema.js";
|
|
4
5
|
/** Corps des requêtes et des réponses de l'API des tâches de la GUI. */
|
|
5
6
|
/** Taille maximale d'une pièce jointe : 20 Mo. */
|
|
@@ -45,6 +46,8 @@ export const TaskNodeSchema = z.object({
|
|
|
45
46
|
subtasks: ProgressSchema,
|
|
46
47
|
/** Éléments cochés de la checklist ; 0/0 pour une tâche de test. */
|
|
47
48
|
checklist: ProgressSchema,
|
|
49
|
+
/** Questions répondues (une proposition choisie ou une réponse libre) sur le total des questions. */
|
|
50
|
+
questions: ProgressSchema,
|
|
48
51
|
/** Bilan des points de vérification d'une tâche de test ; null pour une tâche standard. */
|
|
49
52
|
test: TestSummarySchema.nullable(),
|
|
50
53
|
get children() {
|
|
@@ -221,6 +224,8 @@ export const TaskDetailResponseSchema = z.object({
|
|
|
221
224
|
tags: z.array(TagViewSchema),
|
|
222
225
|
/** Dernière modification de la tâche quand elle vient de l'agent : l'action à annuler et sa date. */
|
|
223
226
|
agentEdit: z.object({ actionId: IdSchema, at: TimestampSchema }).nullable(),
|
|
227
|
+
/** Temps passé : sessions de chrono de tous les membres. */
|
|
228
|
+
time: TaskTimeSchema,
|
|
224
229
|
});
|
|
225
230
|
// --- Requêtes ---
|
|
226
231
|
export const CreateTaskRequestSchema = z.object({
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Corps des requêtes et des réponses du chrono des tâches, côté GUI. */
|
|
3
|
+
/** Session de chrono telle que l'affiche la GUI ; les durées se calculent avec `shared/logic/timer.ts`. */
|
|
4
|
+
export declare const TimeSessionViewSchema: z.ZodObject<{
|
|
5
|
+
id: z.ZodString;
|
|
6
|
+
taskId: z.ZodString;
|
|
7
|
+
userId: z.ZodString;
|
|
8
|
+
userName: z.ZodString;
|
|
9
|
+
mode: z.ZodEnum<{
|
|
10
|
+
free: "free";
|
|
11
|
+
pomodoro: "pomodoro";
|
|
12
|
+
}>;
|
|
13
|
+
pomodoro: z.ZodNullable<z.ZodObject<{
|
|
14
|
+
workMinutes: z.ZodNumber;
|
|
15
|
+
shortBreakMinutes: z.ZodNumber;
|
|
16
|
+
longBreakMinutes: z.ZodNumber;
|
|
17
|
+
cycles: z.ZodNumber;
|
|
18
|
+
}, z.core.$strip>>;
|
|
19
|
+
startedAt: z.ZodISODateTime;
|
|
20
|
+
endedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
21
|
+
runningSince: z.ZodNullable<z.ZodISODateTime>;
|
|
22
|
+
elapsedMs: z.ZodNumber;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
export type TimeSessionView = z.infer<typeof TimeSessionViewSchema>;
|
|
25
|
+
/** Temps passé sur une tâche : toutes ses sessions, et le total compté à `serverNow`. */
|
|
26
|
+
export declare const TaskTimeSchema: z.ZodObject<{
|
|
27
|
+
serverNow: z.ZodISODateTime;
|
|
28
|
+
totalMs: z.ZodNumber;
|
|
29
|
+
sessions: z.ZodArray<z.ZodObject<{
|
|
30
|
+
id: z.ZodString;
|
|
31
|
+
taskId: z.ZodString;
|
|
32
|
+
userId: z.ZodString;
|
|
33
|
+
userName: z.ZodString;
|
|
34
|
+
mode: z.ZodEnum<{
|
|
35
|
+
free: "free";
|
|
36
|
+
pomodoro: "pomodoro";
|
|
37
|
+
}>;
|
|
38
|
+
pomodoro: z.ZodNullable<z.ZodObject<{
|
|
39
|
+
workMinutes: z.ZodNumber;
|
|
40
|
+
shortBreakMinutes: z.ZodNumber;
|
|
41
|
+
longBreakMinutes: z.ZodNumber;
|
|
42
|
+
cycles: z.ZodNumber;
|
|
43
|
+
}, z.core.$strip>>;
|
|
44
|
+
startedAt: z.ZodISODateTime;
|
|
45
|
+
endedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
46
|
+
runningSince: z.ZodNullable<z.ZodISODateTime>;
|
|
47
|
+
elapsedMs: z.ZodNumber;
|
|
48
|
+
}, z.core.$strip>>;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
export type TaskTime = z.infer<typeof TaskTimeSchema>;
|
|
51
|
+
/** Session active de l'utilisateur, avec sa tâche et son espace. */
|
|
52
|
+
export declare const ActiveTimerViewSchema: z.ZodObject<{
|
|
53
|
+
id: z.ZodString;
|
|
54
|
+
taskId: z.ZodString;
|
|
55
|
+
userId: z.ZodString;
|
|
56
|
+
userName: z.ZodString;
|
|
57
|
+
mode: z.ZodEnum<{
|
|
58
|
+
free: "free";
|
|
59
|
+
pomodoro: "pomodoro";
|
|
60
|
+
}>;
|
|
61
|
+
pomodoro: z.ZodNullable<z.ZodObject<{
|
|
62
|
+
workMinutes: z.ZodNumber;
|
|
63
|
+
shortBreakMinutes: z.ZodNumber;
|
|
64
|
+
longBreakMinutes: z.ZodNumber;
|
|
65
|
+
cycles: z.ZodNumber;
|
|
66
|
+
}, z.core.$strip>>;
|
|
67
|
+
startedAt: z.ZodISODateTime;
|
|
68
|
+
endedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
69
|
+
runningSince: z.ZodNullable<z.ZodISODateTime>;
|
|
70
|
+
elapsedMs: z.ZodNumber;
|
|
71
|
+
taskKey: z.ZodString;
|
|
72
|
+
taskTitle: z.ZodString;
|
|
73
|
+
spaceId: z.ZodString;
|
|
74
|
+
spaceName: z.ZodString;
|
|
75
|
+
}, z.core.$strip>;
|
|
76
|
+
export type ActiveTimerView = z.infer<typeof ActiveTimerViewSchema>;
|
|
77
|
+
/** `GET timers` et réponse des actions du chrono : sessions actives de l'utilisateur, en marche d'abord. */
|
|
78
|
+
export declare const TimersResponseSchema: z.ZodObject<{
|
|
79
|
+
serverNow: z.ZodISODateTime;
|
|
80
|
+
timers: z.ZodArray<z.ZodObject<{
|
|
81
|
+
id: z.ZodString;
|
|
82
|
+
taskId: z.ZodString;
|
|
83
|
+
userId: z.ZodString;
|
|
84
|
+
userName: z.ZodString;
|
|
85
|
+
mode: z.ZodEnum<{
|
|
86
|
+
free: "free";
|
|
87
|
+
pomodoro: "pomodoro";
|
|
88
|
+
}>;
|
|
89
|
+
pomodoro: z.ZodNullable<z.ZodObject<{
|
|
90
|
+
workMinutes: z.ZodNumber;
|
|
91
|
+
shortBreakMinutes: z.ZodNumber;
|
|
92
|
+
longBreakMinutes: z.ZodNumber;
|
|
93
|
+
cycles: z.ZodNumber;
|
|
94
|
+
}, z.core.$strip>>;
|
|
95
|
+
startedAt: z.ZodISODateTime;
|
|
96
|
+
endedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
97
|
+
runningSince: z.ZodNullable<z.ZodISODateTime>;
|
|
98
|
+
elapsedMs: z.ZodNumber;
|
|
99
|
+
taskKey: z.ZodString;
|
|
100
|
+
taskTitle: z.ZodString;
|
|
101
|
+
spaceId: z.ZodString;
|
|
102
|
+
spaceName: z.ZodString;
|
|
103
|
+
}, z.core.$strip>>;
|
|
104
|
+
}, z.core.$strip>;
|
|
105
|
+
export type TimersResponse = z.infer<typeof TimersResponseSchema>;
|
|
106
|
+
/** `POST tasks/:taskId/timer` : démarre un chrono libre, ou un pomodoro (réglages de l'utilisateur sans `pomodoro`). */
|
|
107
|
+
export declare const StartTimerRequestSchema: z.ZodObject<{
|
|
108
|
+
mode: z.ZodEnum<{
|
|
109
|
+
free: "free";
|
|
110
|
+
pomodoro: "pomodoro";
|
|
111
|
+
}>;
|
|
112
|
+
pomodoro: z.ZodOptional<z.ZodObject<{
|
|
113
|
+
workMinutes: z.ZodNumber;
|
|
114
|
+
shortBreakMinutes: z.ZodNumber;
|
|
115
|
+
longBreakMinutes: z.ZodNumber;
|
|
116
|
+
cycles: z.ZodNumber;
|
|
117
|
+
}, z.core.$strip>>;
|
|
118
|
+
}, z.core.$strict>;
|
|
119
|
+
export type StartTimerRequest = z.infer<typeof StartTimerRequestSchema>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { TimerModeSchema } from "./enums.schema.js";
|
|
3
|
+
import { IdSchema, PomodoroSettingsSchema, TimestampSchema } from "./entities.schema.js";
|
|
4
|
+
/** Corps des requêtes et des réponses du chrono des tâches, côté GUI. */
|
|
5
|
+
/** Session de chrono telle que l'affiche la GUI ; les durées se calculent avec `shared/logic/timer.ts`. */
|
|
6
|
+
export const TimeSessionViewSchema = z.object({
|
|
7
|
+
id: IdSchema,
|
|
8
|
+
taskId: IdSchema,
|
|
9
|
+
userId: IdSchema,
|
|
10
|
+
userName: z.string(),
|
|
11
|
+
mode: TimerModeSchema,
|
|
12
|
+
pomodoro: PomodoroSettingsSchema.nullable(),
|
|
13
|
+
startedAt: TimestampSchema,
|
|
14
|
+
endedAt: TimestampSchema.nullable(),
|
|
15
|
+
runningSince: TimestampSchema.nullable(),
|
|
16
|
+
elapsedMs: z.number().int().min(0),
|
|
17
|
+
});
|
|
18
|
+
/** Temps passé sur une tâche : toutes ses sessions, et le total compté à `serverNow`. */
|
|
19
|
+
export const TaskTimeSchema = z.object({
|
|
20
|
+
/** Heure du serveur à la lecture : la GUI en tire le décalage de son horloge. */
|
|
21
|
+
serverNow: TimestampSchema,
|
|
22
|
+
totalMs: z.number().int().min(0),
|
|
23
|
+
sessions: z.array(TimeSessionViewSchema),
|
|
24
|
+
});
|
|
25
|
+
/** Session active de l'utilisateur, avec sa tâche et son espace. */
|
|
26
|
+
export const ActiveTimerViewSchema = TimeSessionViewSchema.extend({
|
|
27
|
+
taskKey: z.string(),
|
|
28
|
+
taskTitle: z.string(),
|
|
29
|
+
spaceId: IdSchema,
|
|
30
|
+
spaceName: z.string(),
|
|
31
|
+
});
|
|
32
|
+
/** `GET timers` et réponse des actions du chrono : sessions actives de l'utilisateur, en marche d'abord. */
|
|
33
|
+
export const TimersResponseSchema = z.object({
|
|
34
|
+
serverNow: TimestampSchema,
|
|
35
|
+
timers: z.array(ActiveTimerViewSchema),
|
|
36
|
+
});
|
|
37
|
+
/** `POST tasks/:taskId/timer` : démarre un chrono libre, ou un pomodoro (réglages de l'utilisateur sans `pomodoro`). */
|
|
38
|
+
export const StartTimerRequestSchema = z
|
|
39
|
+
.object({
|
|
40
|
+
mode: TimerModeSchema,
|
|
41
|
+
pomodoro: PomodoroSettingsSchema.optional(),
|
|
42
|
+
})
|
|
43
|
+
.strict()
|
|
44
|
+
.refine((input) => input.mode === "pomodoro" || input.pomodoro === undefined, "Un chrono libre n'a pas de réglages pomodoro.");
|
|
@@ -35,6 +35,10 @@ export declare const BoardViewViewSchema: z.ZodObject<{
|
|
|
35
35
|
assigneeIds: z.ZodArray<z.ZodString>;
|
|
36
36
|
unassigned: z.ZodBoolean;
|
|
37
37
|
tagIds: z.ZodArray<z.ZodString>;
|
|
38
|
+
types: z.ZodArray<z.ZodEnum<{
|
|
39
|
+
standard: "standard";
|
|
40
|
+
test: "test";
|
|
41
|
+
}>>;
|
|
38
42
|
id: z.ZodString;
|
|
39
43
|
}, z.core.$strip>;
|
|
40
44
|
export type BoardViewView = z.infer<typeof BoardViewViewSchema>;
|
|
@@ -73,6 +77,10 @@ export declare const BoardViewListResponseSchema: z.ZodObject<{
|
|
|
73
77
|
assigneeIds: z.ZodArray<z.ZodString>;
|
|
74
78
|
unassigned: z.ZodBoolean;
|
|
75
79
|
tagIds: z.ZodArray<z.ZodString>;
|
|
80
|
+
types: z.ZodArray<z.ZodEnum<{
|
|
81
|
+
standard: "standard";
|
|
82
|
+
test: "test";
|
|
83
|
+
}>>;
|
|
76
84
|
id: z.ZodString;
|
|
77
85
|
}, z.core.$strip>>;
|
|
78
86
|
}, z.core.$strip>;
|
|
@@ -111,6 +119,10 @@ export declare const CreateBoardViewRequestSchema: z.ZodObject<{
|
|
|
111
119
|
assigneeIds: z.ZodArray<z.ZodString>;
|
|
112
120
|
unassigned: z.ZodBoolean;
|
|
113
121
|
tagIds: z.ZodArray<z.ZodString>;
|
|
122
|
+
types: z.ZodArray<z.ZodEnum<{
|
|
123
|
+
standard: "standard";
|
|
124
|
+
test: "test";
|
|
125
|
+
}>>;
|
|
114
126
|
}, z.core.$strict>;
|
|
115
127
|
export type CreateBoardViewRequest = z.infer<typeof CreateBoardViewRequestSchema>;
|
|
116
128
|
/** Réglages à changer ; la vue obtenue doit rester valide. */
|
|
@@ -147,5 +159,9 @@ export declare const UpdateBoardViewRequestSchema: z.ZodObject<{
|
|
|
147
159
|
assigneeIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
148
160
|
unassigned: z.ZodOptional<z.ZodBoolean>;
|
|
149
161
|
tagIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
162
|
+
types: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
163
|
+
standard: "standard";
|
|
164
|
+
test: "test";
|
|
165
|
+
}>>>;
|
|
150
166
|
}, z.core.$strict>;
|
|
151
167
|
export type UpdateBoardViewRequest = z.infer<typeof UpdateBoardViewRequestSchema>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { BoardGroupingSchema, BoardLayoutSchema, TaskPrioritySchema, TaskStatusSchema } from "./enums.schema.js";
|
|
2
|
+
import { BoardGroupingSchema, BoardLayoutSchema, TaskPrioritySchema, TaskStatusSchema, TaskTypeSchema } from "./enums.schema.js";
|
|
3
3
|
import { IdSchema, MAX_BOARD_VIEW_NAME_LENGTH } from "./entities.schema.js";
|
|
4
4
|
/** Corps des requêtes et des réponses des vues du tableau de bord de la GUI. */
|
|
5
5
|
export const BoardViewNameSchema = z
|
|
@@ -13,7 +13,8 @@ export const BoardViewNameSchema = z
|
|
|
13
13
|
* groupes vides, filtres (vides : toutes les valeurs ; `assigneeIds` : membres
|
|
14
14
|
* de l'espace dont la vue montre les tâches ; `unassigned` : la vue montre
|
|
15
15
|
* aussi les tâches sans assigné ; `tagIds` : tags de l'espace dont la vue
|
|
16
|
-
* montre les tâches
|
|
16
|
+
* montre les tâches ; `types` : types de tâche, standard ou test, que la vue
|
|
17
|
+
* montre).
|
|
17
18
|
*/
|
|
18
19
|
const BoardViewSettingsSchema = z.object({
|
|
19
20
|
name: BoardViewNameSchema,
|
|
@@ -26,6 +27,7 @@ const BoardViewSettingsSchema = z.object({
|
|
|
26
27
|
assigneeIds: z.array(IdSchema),
|
|
27
28
|
unassigned: z.boolean(),
|
|
28
29
|
tagIds: z.array(IdSchema),
|
|
30
|
+
types: z.array(TaskTypeSchema),
|
|
29
31
|
});
|
|
30
32
|
/** Vue du tableau de bord telle que l'affiche la GUI. */
|
|
31
33
|
export const BoardViewViewSchema = BoardViewSettingsSchema.extend({ id: IdSchema });
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { DocumentDetailDataSchema, GetDocumentQuerySchema, ListDocumentsDataSchema, NoQuerySchema } from "../../shared/schemas/agent-tools.schema.js";
|
|
2
|
+
import { ago, byteSize, documentData, documentLine, resolveDocument } from "../core/agent.js";
|
|
3
|
+
import { DocumentTextError, documentText, splitParts } from "../core/document-text.js";
|
|
4
|
+
import { OrganizerError } from "../core/errors.js";
|
|
5
|
+
import { parseInput, respond } from "./types.js";
|
|
6
|
+
/** Documents de référence de l'espace du jeton, en lecture seule : liste et lecture par parties. */
|
|
7
|
+
export const documentRoutes = [
|
|
8
|
+
{
|
|
9
|
+
method: "GET",
|
|
10
|
+
path: "/documents",
|
|
11
|
+
handle: ({ store }, { agent, query }) => {
|
|
12
|
+
parseInput(NoQuerySchema, query);
|
|
13
|
+
const space = agent.space;
|
|
14
|
+
const documents = store.listDocuments(space.id);
|
|
15
|
+
if (documents.length === 0)
|
|
16
|
+
return respond(ListDocumentsDataSchema, `No reference document in "${space.name}".`, { documents: [] });
|
|
17
|
+
const lines = documents.map((document) => documentLine(store, document));
|
|
18
|
+
return respond(ListDocumentsDataSchema, `${documents.length} reference document(s) in "${space.name}", most recently updated first:\n${lines.join("\n")}\nRead one with get_document.`, {
|
|
19
|
+
documents: documents.map((document) => documentData(store, document)),
|
|
20
|
+
});
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
method: "GET",
|
|
25
|
+
path: "/documents/:ref",
|
|
26
|
+
handle: ({ store, attachments }, { agent, params, query }) => {
|
|
27
|
+
const input = parseInput(GetDocumentQuerySchema, query);
|
|
28
|
+
const document = resolveDocument(store, agent.space, params.ref);
|
|
29
|
+
const data = documentData(store, document);
|
|
30
|
+
const replaced = document.version > 1 ? `, version ${document.version} uploaded by ${data.updatedBy} ${ago(document.updatedAt)}` : `, version 1`;
|
|
31
|
+
const header = [
|
|
32
|
+
`Document ${document.id} "${document.filename}" (${data.format}, ${byteSize(document.size)}), uploaded by ${data.uploadedBy} ${ago(document.createdAt)}${replaced}.`,
|
|
33
|
+
`Description: ${document.description.trim() === "" ? "(none)" : document.description}`,
|
|
34
|
+
];
|
|
35
|
+
if (!data.readable) {
|
|
36
|
+
const text = [
|
|
37
|
+
...header,
|
|
38
|
+
"",
|
|
39
|
+
`You cannot read the content of this ${data.format} file: the organizer only extracts the text of text files (txt, md, csv, json, yaml, xml…) and Word files (.docx). Rely on its name and description, and when you need its content, ask a member (in your reply or a comment) to upload a text, markdown or Word version.`,
|
|
40
|
+
].join("\n");
|
|
41
|
+
return respond(DocumentDetailDataSchema, text, { document: data, part: 1, partCount: 1, text: null });
|
|
42
|
+
}
|
|
43
|
+
let content;
|
|
44
|
+
try {
|
|
45
|
+
content = documentText(document.filename, attachments.readPath(document.storagePath)) ?? "";
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
if (err instanceof DocumentTextError)
|
|
49
|
+
throw new OrganizerError(`The text of document ${document.id} "${document.filename}" cannot be read (invalid UTF-8 text or damaged Word file). Ask a member to upload it again.`);
|
|
50
|
+
throw err;
|
|
51
|
+
}
|
|
52
|
+
const parts = splitParts(content);
|
|
53
|
+
if (input.part > parts.length)
|
|
54
|
+
throw new OrganizerError(`Document "${document.filename}" has ${parts.length} part(s): pass a part between 1 and ${parts.length}.`);
|
|
55
|
+
const position = parts.length > 1 ? `Part ${input.part} of ${parts.length}:` : "Content:";
|
|
56
|
+
const next = input.part < parts.length ? `\n\n(Next: get_document with part ${input.part + 1}.)` : "";
|
|
57
|
+
const body = content.trim() === "" ? "(empty)" : parts[input.part - 1];
|
|
58
|
+
return respond(DocumentDetailDataSchema, [...header, "", position, body].join("\n") + next, {
|
|
59
|
+
document: data,
|
|
60
|
+
part: input.part,
|
|
61
|
+
partCount: parts.length,
|
|
62
|
+
text: parts[input.part - 1],
|
|
63
|
+
});
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
];
|