@imenam/mcp-organizer 1.0.41 → 1.0.43
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 +9 -4
- package/dist/shared/logic/feedback.d.ts +12 -0
- package/dist/shared/logic/feedback.js +37 -0
- package/dist/shared/schemas/agent-api.schema.d.ts +45 -0
- package/dist/shared/schemas/agent-api.schema.js +5 -1
- package/dist/shared/schemas/agent-tools.schema.d.ts +19 -0
- package/dist/shared/schemas/agent-tools.schema.js +3 -0
- package/dist/shared/schemas/api.schema.d.ts +54 -0
- package/dist/shared/schemas/api.schema.js +28 -2
- package/dist/shared/schemas/entities.schema.d.ts +51 -0
- package/dist/shared/schemas/entities.schema.js +37 -1
- package/dist/shared/schemas/enums.schema.d.ts +35 -3
- package/dist/shared/schemas/enums.schema.js +17 -2
- package/dist/shared/schemas/tasks-api.schema.d.ts +116 -0
- package/dist/shared/schemas/tasks-api.schema.js +41 -2
- package/dist/src/agent-api/tasks.js +9 -3
- package/dist/src/core/agent.js +41 -0
- package/dist/src/core/feedback.d.ts +26 -0
- package/dist/src/core/feedback.js +120 -0
- package/dist/src/core/migrations.js +72 -0
- package/dist/src/core/requests.js +7 -0
- package/dist/src/core/space-categories.d.ts +20 -0
- package/dist/src/core/space-categories.js +98 -0
- package/dist/src/core/store.d.ts +32 -1
- package/dist/src/core/store.js +147 -1
- package/dist/src/core/tasks.js +7 -2
- package/dist/src/core/text-edits.d.ts +12 -0
- package/dist/src/core/text-edits.js +29 -0
- package/dist/src/gui-api.js +23 -3
- package/dist/src/mcp/start.d.ts +1 -1
- package/dist/src/mcp/start.js +1 -0
- package/dist/src/mcp/tools.js +16 -2
- package/gui/dist/assets/index-BFv_ii15.js +144 -0
- package/gui/dist/assets/index-CwE72p7-.css +1 -0
- package/gui/dist/index.html +2 -2
- package/package.json +1 -1
- package/gui/dist/assets/index-BqD-wglW.js +0 -144
- package/gui/dist/assets/index-e6E6S5zV.css +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { AccessLinkPurposeSchema, ActorTypeSchema, AgentOperationSchema, BoardGroupingSchema, BoardLayoutSchema, EntityTypeSchema, IdeaOriginSchema, MAX_TASK_DEPTH, MemberRoleSchema, NotificationTypeSchema, RequestKindSchema, RequestStatusSchema, SpaceKindSchema, TaskPrioritySchema, TaskStatusSchema, TaskTypeSchema, TestResultValueSchema, TimerModeSchema, UserStatusSchema, VersionedEntityTypeSchema, } from "./enums.schema.js";
|
|
2
|
+
import { AccessLinkPurposeSchema, ActorTypeSchema, AgentOperationSchema, BoardGroupingSchema, BoardLayoutSchema, EntityTypeSchema, FeedbackShortcutSchema, FeedbackTargetKindSchema, IdeaOriginSchema, MAX_TASK_DEPTH, MemberRoleSchema, NotificationTypeSchema, RequestKindSchema, RequestStatusSchema, SpaceKindSchema, TaskPrioritySchema, TaskStatusSchema, TaskTypeSchema, TestResultValueSchema, TimerModeSchema, UserStatusSchema, VersionedEntityTypeSchema, } from "./enums.schema.js";
|
|
3
3
|
import { POMODORO_LIMITS } from "../logic/timer.js";
|
|
4
4
|
/** Entités du modèle de données, telles que lues et écrites par le store. */
|
|
5
5
|
export const IdSchema = z.string().min(1);
|
|
@@ -151,6 +151,24 @@ export const SpaceSchema = z.object({
|
|
|
151
151
|
runnerAllowed: z.boolean(),
|
|
152
152
|
createdAt: TimestampSchema,
|
|
153
153
|
});
|
|
154
|
+
/** Longueur maximale du nom d'une catégorie d'espaces. */
|
|
155
|
+
export const MAX_SPACE_CATEGORY_NAME_LENGTH = 60;
|
|
156
|
+
/** Catégorie du sélecteur d'espaces d'un utilisateur, à son rang parmi ses catégories. */
|
|
157
|
+
export const SpaceCategorySchema = z.object({
|
|
158
|
+
id: IdSchema,
|
|
159
|
+
userId: IdSchema,
|
|
160
|
+
name: z.string().trim().min(1).max(MAX_SPACE_CATEGORY_NAME_LENGTH),
|
|
161
|
+
position: PositionSchema,
|
|
162
|
+
createdAt: TimestampSchema,
|
|
163
|
+
updatedAt: TimestampSchema,
|
|
164
|
+
});
|
|
165
|
+
/** Place d'un espace dans le sélecteur d'un de ses membres : sa catégorie (null : « Autres espaces ») et son rang dans celle-ci. */
|
|
166
|
+
export const SpacePlacementSchema = z.object({
|
|
167
|
+
userId: IdSchema,
|
|
168
|
+
spaceId: IdSchema,
|
|
169
|
+
categoryId: IdSchema.nullable(),
|
|
170
|
+
position: PositionSchema,
|
|
171
|
+
});
|
|
154
172
|
/** Longueur maximale d'un texte d'instructions de l'agent. */
|
|
155
173
|
export const AGENT_INSTRUCTIONS_MAX = 4000;
|
|
156
174
|
/** Instructions personnalisées données à l'agent : celles du site (`spaceId` null) ou celles d'un espace. */
|
|
@@ -410,6 +428,24 @@ export const AgentRequestSchema = z.object({
|
|
|
410
428
|
dismissedAt: TimestampSchema.nullable(),
|
|
411
429
|
dismissedBy: IdSchema.nullable(),
|
|
412
430
|
});
|
|
431
|
+
export const MAX_FEEDBACK_EXCERPT_LENGTH = 4000;
|
|
432
|
+
/**
|
|
433
|
+
* Élément visé par une demande `feedback` : son type, son identifiant (null
|
|
434
|
+
* pour la description, une section ou un passage), son texte au moment du
|
|
435
|
+
* retour et le raccourci choisi (null : précision libre seule).
|
|
436
|
+
*/
|
|
437
|
+
export const RequestFeedbackSchema = z
|
|
438
|
+
.object({
|
|
439
|
+
requestId: IdSchema,
|
|
440
|
+
targetKind: FeedbackTargetKindSchema,
|
|
441
|
+
targetId: IdSchema.nullable(),
|
|
442
|
+
excerpt: z.string().trim().min(1).max(MAX_FEEDBACK_EXCERPT_LENGTH),
|
|
443
|
+
shortcut: FeedbackShortcutSchema.nullable(),
|
|
444
|
+
})
|
|
445
|
+
.refine((feedback) => (feedback.targetId === null) === ["description", "section", "passage"].includes(feedback.targetKind), {
|
|
446
|
+
message: "a question, an option, a checklist item, a checkpoint or a comment is designated by its id; the description, a section or a passage by none",
|
|
447
|
+
path: ["targetId"],
|
|
448
|
+
});
|
|
413
449
|
/**
|
|
414
450
|
* Point que l'auteur d'une demande doit régler, laissé par l'agent en la
|
|
415
451
|
* terminant. Un membre de l'espace le coche (`doneBy`), ou l'agent qui traite
|
|
@@ -80,10 +80,14 @@ export declare const IdeaOriginSchema: z.ZodEnum<{
|
|
|
80
80
|
manual: "manual";
|
|
81
81
|
}>;
|
|
82
82
|
export type IdeaOrigin = z.infer<typeof IdeaOriginSchema>;
|
|
83
|
-
/**
|
|
84
|
-
|
|
83
|
+
/**
|
|
84
|
+
* `direct` : lot d'une action que l'agent fait sans demande, au nom du propriétaire de son jeton.
|
|
85
|
+
* `feedback` : retour d'un membre sur un élément précis d'une tâche.
|
|
86
|
+
*/
|
|
87
|
+
export declare const REQUEST_KINDS: readonly ["idea", "remark", "test_review", "message", "idea_promotion", "direct", "feedback"];
|
|
85
88
|
export declare const RequestKindSchema: z.ZodEnum<{
|
|
86
89
|
direct: "direct";
|
|
90
|
+
feedback: "feedback";
|
|
87
91
|
idea: "idea";
|
|
88
92
|
idea_promotion: "idea_promotion";
|
|
89
93
|
message: "message";
|
|
@@ -91,6 +95,33 @@ export declare const RequestKindSchema: z.ZodEnum<{
|
|
|
91
95
|
test_review: "test_review";
|
|
92
96
|
}>;
|
|
93
97
|
export type RequestKind = z.infer<typeof RequestKindSchema>;
|
|
98
|
+
/**
|
|
99
|
+
* Élément d'une tâche visé par un retour : la description entière, une de ses
|
|
100
|
+
* sections (titre markdown), un passage sélectionné de la description, une
|
|
101
|
+
* question, une proposition, un élément de checklist, un point de vérification
|
|
102
|
+
* ou un commentaire.
|
|
103
|
+
*/
|
|
104
|
+
export declare const FEEDBACK_TARGET_KINDS: readonly ["description", "section", "passage", "question", "option", "checklist_item", "checkpoint", "comment"];
|
|
105
|
+
export declare const FeedbackTargetKindSchema: z.ZodEnum<{
|
|
106
|
+
checklist_item: "checklist_item";
|
|
107
|
+
checkpoint: "checkpoint";
|
|
108
|
+
comment: "comment";
|
|
109
|
+
description: "description";
|
|
110
|
+
option: "option";
|
|
111
|
+
passage: "passage";
|
|
112
|
+
question: "question";
|
|
113
|
+
section: "section";
|
|
114
|
+
}>;
|
|
115
|
+
export type FeedbackTargetKind = z.infer<typeof FeedbackTargetKindSchema>;
|
|
116
|
+
/** Raccourcis d'un retour : reformuler, corriger, détailler, simplifier. */
|
|
117
|
+
export declare const FEEDBACK_SHORTCUTS: readonly ["rephrase", "wrong", "details", "simplify"];
|
|
118
|
+
export declare const FeedbackShortcutSchema: z.ZodEnum<{
|
|
119
|
+
details: "details";
|
|
120
|
+
rephrase: "rephrase";
|
|
121
|
+
simplify: "simplify";
|
|
122
|
+
wrong: "wrong";
|
|
123
|
+
}>;
|
|
124
|
+
export type FeedbackShortcut = z.infer<typeof FeedbackShortcutSchema>;
|
|
94
125
|
export declare const REQUEST_STATUSES: readonly ["pending", "processing", "done", "failed", "cancelled"];
|
|
95
126
|
export declare const RequestStatusSchema: z.ZodEnum<{
|
|
96
127
|
cancelled: "cancelled";
|
|
@@ -130,7 +161,7 @@ export declare const TimerModeSchema: z.ZodEnum<{
|
|
|
130
161
|
}>;
|
|
131
162
|
export type TimerMode = z.infer<typeof TimerModeSchema>;
|
|
132
163
|
/** Types d'entités nommés dans le journal `Change`, les versions et les actions de l'agent. */
|
|
133
|
-
export declare const ENTITY_TYPES: readonly ["user", "user_settings", "space", "membership", "invitation", "task", "tag", "checklist_item", "task_question", "test_checkpoint", "test_result", "test_review", "comment", "attachment", "idea", "note", "document", "agent_request", "agent_action", "follow_up", "agent_token", "notification", "board_view", "agent_instructions", "time_session"];
|
|
164
|
+
export declare const ENTITY_TYPES: readonly ["user", "user_settings", "space", "membership", "invitation", "task", "tag", "checklist_item", "task_question", "test_checkpoint", "test_result", "test_review", "comment", "attachment", "idea", "note", "document", "agent_request", "agent_action", "follow_up", "agent_token", "notification", "board_view", "space_category", "agent_instructions", "time_session"];
|
|
134
165
|
export declare const EntityTypeSchema: z.ZodEnum<{
|
|
135
166
|
agent_action: "agent_action";
|
|
136
167
|
agent_instructions: "agent_instructions";
|
|
@@ -148,6 +179,7 @@ export declare const EntityTypeSchema: z.ZodEnum<{
|
|
|
148
179
|
note: "note";
|
|
149
180
|
notification: "notification";
|
|
150
181
|
space: "space";
|
|
182
|
+
space_category: "space_category";
|
|
151
183
|
tag: "tag";
|
|
152
184
|
task: "task";
|
|
153
185
|
task_question: "task_question";
|
|
@@ -27,9 +27,23 @@ export const TEST_RESULTS = ["ok", "ko", "blocked", "untested"];
|
|
|
27
27
|
export const TestResultValueSchema = z.enum(TEST_RESULTS);
|
|
28
28
|
export const IDEA_ORIGINS = ["manual", "agent"];
|
|
29
29
|
export const IdeaOriginSchema = z.enum(IDEA_ORIGINS);
|
|
30
|
-
/**
|
|
31
|
-
|
|
30
|
+
/**
|
|
31
|
+
* `direct` : lot d'une action que l'agent fait sans demande, au nom du propriétaire de son jeton.
|
|
32
|
+
* `feedback` : retour d'un membre sur un élément précis d'une tâche.
|
|
33
|
+
*/
|
|
34
|
+
export const REQUEST_KINDS = ["idea", "remark", "test_review", "message", "idea_promotion", "direct", "feedback"];
|
|
32
35
|
export const RequestKindSchema = z.enum(REQUEST_KINDS);
|
|
36
|
+
/**
|
|
37
|
+
* Élément d'une tâche visé par un retour : la description entière, une de ses
|
|
38
|
+
* sections (titre markdown), un passage sélectionné de la description, une
|
|
39
|
+
* question, une proposition, un élément de checklist, un point de vérification
|
|
40
|
+
* ou un commentaire.
|
|
41
|
+
*/
|
|
42
|
+
export const FEEDBACK_TARGET_KINDS = ["description", "section", "passage", "question", "option", "checklist_item", "checkpoint", "comment"];
|
|
43
|
+
export const FeedbackTargetKindSchema = z.enum(FEEDBACK_TARGET_KINDS);
|
|
44
|
+
/** Raccourcis d'un retour : reformuler, corriger, détailler, simplifier. */
|
|
45
|
+
export const FEEDBACK_SHORTCUTS = ["rephrase", "wrong", "details", "simplify"];
|
|
46
|
+
export const FeedbackShortcutSchema = z.enum(FEEDBACK_SHORTCUTS);
|
|
33
47
|
export const REQUEST_STATUSES = ["pending", "processing", "done", "failed", "cancelled"];
|
|
34
48
|
export const RequestStatusSchema = z.enum(REQUEST_STATUSES);
|
|
35
49
|
export const AGENT_OPERATIONS = ["create", "update", "delete", "move", "assign"];
|
|
@@ -66,6 +80,7 @@ export const ENTITY_TYPES = [
|
|
|
66
80
|
"agent_token",
|
|
67
81
|
"notification",
|
|
68
82
|
"board_view",
|
|
83
|
+
"space_category",
|
|
69
84
|
"agent_instructions",
|
|
70
85
|
"time_session",
|
|
71
86
|
];
|
|
@@ -324,6 +324,28 @@ export declare const CommentViewSchema: z.ZodObject<{
|
|
|
324
324
|
authorName: z.ZodString;
|
|
325
325
|
excerpt: z.ZodString;
|
|
326
326
|
}, z.core.$strip>>;
|
|
327
|
+
answersFeedback: z.ZodNullable<z.ZodObject<{
|
|
328
|
+
targetKind: z.ZodEnum<{
|
|
329
|
+
checklist_item: "checklist_item";
|
|
330
|
+
checkpoint: "checkpoint";
|
|
331
|
+
comment: "comment";
|
|
332
|
+
description: "description";
|
|
333
|
+
option: "option";
|
|
334
|
+
passage: "passage";
|
|
335
|
+
question: "question";
|
|
336
|
+
section: "section";
|
|
337
|
+
}>;
|
|
338
|
+
targetId: z.ZodNullable<z.ZodString>;
|
|
339
|
+
excerpt: z.ZodString;
|
|
340
|
+
authorName: z.ZodString;
|
|
341
|
+
shortcut: z.ZodNullable<z.ZodEnum<{
|
|
342
|
+
details: "details";
|
|
343
|
+
rephrase: "rephrase";
|
|
344
|
+
simplify: "simplify";
|
|
345
|
+
wrong: "wrong";
|
|
346
|
+
}>>;
|
|
347
|
+
text: z.ZodString;
|
|
348
|
+
}, z.core.$strip>>;
|
|
327
349
|
reply: z.ZodNullable<z.ZodObject<{
|
|
328
350
|
requestId: z.ZodString;
|
|
329
351
|
followUps: z.ZodArray<z.ZodObject<{
|
|
@@ -479,6 +501,29 @@ export declare const TestDetailSchema: z.ZodObject<{
|
|
|
479
501
|
}, z.core.$strip>>;
|
|
480
502
|
}, z.core.$strip>;
|
|
481
503
|
export type TestDetail = z.infer<typeof TestDetailSchema>;
|
|
504
|
+
/** Retour ciblé en attente ou en cours sur un élément de la tâche. */
|
|
505
|
+
export declare const TaskFeedbackViewSchema: z.ZodObject<{
|
|
506
|
+
requestId: z.ZodString;
|
|
507
|
+
targetKind: z.ZodEnum<{
|
|
508
|
+
checklist_item: "checklist_item";
|
|
509
|
+
checkpoint: "checkpoint";
|
|
510
|
+
comment: "comment";
|
|
511
|
+
description: "description";
|
|
512
|
+
option: "option";
|
|
513
|
+
passage: "passage";
|
|
514
|
+
question: "question";
|
|
515
|
+
section: "section";
|
|
516
|
+
}>;
|
|
517
|
+
targetId: z.ZodNullable<z.ZodString>;
|
|
518
|
+
excerpt: z.ZodString;
|
|
519
|
+
status: z.ZodEnum<{
|
|
520
|
+
pending: "pending";
|
|
521
|
+
processing: "processing";
|
|
522
|
+
}>;
|
|
523
|
+
authorName: z.ZodString;
|
|
524
|
+
canCancel: z.ZodBoolean;
|
|
525
|
+
}, z.core.$strip>;
|
|
526
|
+
export type TaskFeedbackView = z.infer<typeof TaskFeedbackViewSchema>;
|
|
482
527
|
export declare const TaskDetailResponseSchema: z.ZodObject<{
|
|
483
528
|
task: z.ZodObject<{
|
|
484
529
|
id: z.ZodString;
|
|
@@ -679,6 +724,28 @@ export declare const TaskDetailResponseSchema: z.ZodObject<{
|
|
|
679
724
|
authorName: z.ZodString;
|
|
680
725
|
excerpt: z.ZodString;
|
|
681
726
|
}, z.core.$strip>>;
|
|
727
|
+
answersFeedback: z.ZodNullable<z.ZodObject<{
|
|
728
|
+
targetKind: z.ZodEnum<{
|
|
729
|
+
checklist_item: "checklist_item";
|
|
730
|
+
checkpoint: "checkpoint";
|
|
731
|
+
comment: "comment";
|
|
732
|
+
description: "description";
|
|
733
|
+
option: "option";
|
|
734
|
+
passage: "passage";
|
|
735
|
+
question: "question";
|
|
736
|
+
section: "section";
|
|
737
|
+
}>;
|
|
738
|
+
targetId: z.ZodNullable<z.ZodString>;
|
|
739
|
+
excerpt: z.ZodString;
|
|
740
|
+
authorName: z.ZodString;
|
|
741
|
+
shortcut: z.ZodNullable<z.ZodEnum<{
|
|
742
|
+
details: "details";
|
|
743
|
+
rephrase: "rephrase";
|
|
744
|
+
simplify: "simplify";
|
|
745
|
+
wrong: "wrong";
|
|
746
|
+
}>>;
|
|
747
|
+
text: z.ZodString;
|
|
748
|
+
}, z.core.$strip>>;
|
|
682
749
|
reply: z.ZodNullable<z.ZodObject<{
|
|
683
750
|
requestId: z.ZodString;
|
|
684
751
|
followUps: z.ZodArray<z.ZodObject<{
|
|
@@ -738,6 +805,27 @@ export declare const TaskDetailResponseSchema: z.ZodObject<{
|
|
|
738
805
|
elapsedMs: z.ZodNumber;
|
|
739
806
|
}, z.core.$strip>>;
|
|
740
807
|
}, z.core.$strip>;
|
|
808
|
+
feedbacks: z.ZodArray<z.ZodObject<{
|
|
809
|
+
requestId: z.ZodString;
|
|
810
|
+
targetKind: z.ZodEnum<{
|
|
811
|
+
checklist_item: "checklist_item";
|
|
812
|
+
checkpoint: "checkpoint";
|
|
813
|
+
comment: "comment";
|
|
814
|
+
description: "description";
|
|
815
|
+
option: "option";
|
|
816
|
+
passage: "passage";
|
|
817
|
+
question: "question";
|
|
818
|
+
section: "section";
|
|
819
|
+
}>;
|
|
820
|
+
targetId: z.ZodNullable<z.ZodString>;
|
|
821
|
+
excerpt: z.ZodString;
|
|
822
|
+
status: z.ZodEnum<{
|
|
823
|
+
pending: "pending";
|
|
824
|
+
processing: "processing";
|
|
825
|
+
}>;
|
|
826
|
+
authorName: z.ZodString;
|
|
827
|
+
canCancel: z.ZodBoolean;
|
|
828
|
+
}, z.core.$strip>>;
|
|
741
829
|
}, z.core.$strip>;
|
|
742
830
|
export type TaskDetailResponse = z.infer<typeof TaskDetailResponseSchema>;
|
|
743
831
|
export declare const CreateTaskRequestSchema: z.ZodObject<{
|
|
@@ -870,6 +958,33 @@ export declare const CommentRequestSchema: z.ZodObject<{
|
|
|
870
958
|
body: z.ZodString;
|
|
871
959
|
}, z.core.$strip>;
|
|
872
960
|
export type CommentRequest = z.infer<typeof CommentRequestSchema>;
|
|
961
|
+
export declare const MAX_FEEDBACK_PRECISION_LENGTH = 4000;
|
|
962
|
+
/**
|
|
963
|
+
* Retour ciblé envoyé à l'agent sur un élément de la tâche : l'élément, son
|
|
964
|
+
* texte tel que le membre le voit, un raccourci et/ou une précision libre.
|
|
965
|
+
*/
|
|
966
|
+
export declare const SendFeedbackRequestSchema: z.ZodObject<{
|
|
967
|
+
targetKind: z.ZodEnum<{
|
|
968
|
+
checklist_item: "checklist_item";
|
|
969
|
+
checkpoint: "checkpoint";
|
|
970
|
+
comment: "comment";
|
|
971
|
+
description: "description";
|
|
972
|
+
option: "option";
|
|
973
|
+
passage: "passage";
|
|
974
|
+
question: "question";
|
|
975
|
+
section: "section";
|
|
976
|
+
}>;
|
|
977
|
+
targetId: z.ZodNullable<z.ZodString>;
|
|
978
|
+
excerpt: z.ZodString;
|
|
979
|
+
shortcut: z.ZodNullable<z.ZodEnum<{
|
|
980
|
+
details: "details";
|
|
981
|
+
rephrase: "rephrase";
|
|
982
|
+
simplify: "simplify";
|
|
983
|
+
wrong: "wrong";
|
|
984
|
+
}>>;
|
|
985
|
+
precision: z.ZodString;
|
|
986
|
+
}, z.core.$strip>;
|
|
987
|
+
export type SendFeedbackRequest = z.infer<typeof SendFeedbackRequestSchema>;
|
|
873
988
|
/** Type MIME `type/sous-type`, sans paramètres. */
|
|
874
989
|
export declare const MimeTypeSchema: z.ZodString;
|
|
875
990
|
/** Pièce jointe transmise par le serveur web, qui lit le formulaire multipart du navigateur. */
|
|
@@ -903,6 +1018,7 @@ export declare const ChangesResponseSchema: z.ZodObject<{
|
|
|
903
1018
|
note: "note";
|
|
904
1019
|
notification: "notification";
|
|
905
1020
|
space: "space";
|
|
1021
|
+
space_category: "space_category";
|
|
906
1022
|
tag: "tag";
|
|
907
1023
|
task: "task";
|
|
908
1024
|
task_question: "task_question";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { RequestStatusSchema, TaskPrioritySchema, TaskStatusSchema, TaskTypeSchema, TestResultValueSchema } from "./enums.schema.js";
|
|
2
|
+
import { FeedbackShortcutSchema, FeedbackTargetKindSchema, RequestStatusSchema, TaskPrioritySchema, TaskStatusSchema, TaskTypeSchema, TestResultValueSchema } from "./enums.schema.js";
|
|
3
3
|
import { TaskTimeSchema } from "./timers-api.schema.js";
|
|
4
|
-
import { ChangeSchema, EmailSchema, IdSchema, MAX_OTHER_ANSWER_LENGTH, PositionSchema, TimestampSchema } from "./entities.schema.js";
|
|
4
|
+
import { ChangeSchema, EmailSchema, IdSchema, MAX_FEEDBACK_EXCERPT_LENGTH, MAX_OTHER_ANSWER_LENGTH, PositionSchema, TimestampSchema } from "./entities.schema.js";
|
|
5
5
|
/** Corps des requêtes et des réponses de l'API des tâches de la GUI. */
|
|
6
6
|
/** Taille maximale d'une pièce jointe : 20 Mo. */
|
|
7
7
|
export const MAX_ATTACHMENT_BYTES = 20 * 1024 * 1024;
|
|
@@ -150,6 +150,18 @@ export const CommentViewSchema = z.object({
|
|
|
150
150
|
.nullable(),
|
|
151
151
|
/** Pour la réponse de l'agent : le commentaire auquel elle répond, son auteur et son début. */
|
|
152
152
|
replyTo: z.object({ commentId: IdSchema, authorName: z.string(), excerpt: z.string() }).nullable(),
|
|
153
|
+
/** Pour la réponse de l'agent à un retour ciblé : l'élément visé, son texte au moment du retour, et le retour de son auteur. */
|
|
154
|
+
answersFeedback: z
|
|
155
|
+
.object({
|
|
156
|
+
targetKind: FeedbackTargetKindSchema,
|
|
157
|
+
targetId: IdSchema.nullable(),
|
|
158
|
+
excerpt: z.string(),
|
|
159
|
+
authorName: z.string(),
|
|
160
|
+
shortcut: FeedbackShortcutSchema.nullable(),
|
|
161
|
+
/** Retour de son auteur : le raccourci choisi et sa précision, une ligne chacun. */
|
|
162
|
+
text: z.string(),
|
|
163
|
+
})
|
|
164
|
+
.nullable(),
|
|
153
165
|
/** Pour la réponse de l'agent : sa demande, ses points à régler et les modifications de son lot, actives ou annulées. */
|
|
154
166
|
reply: z
|
|
155
167
|
.object({
|
|
@@ -211,6 +223,17 @@ export const TestDetailSchema = z.object({
|
|
|
211
223
|
/** Reviews soumises, de la plus récente à la plus ancienne. */
|
|
212
224
|
reviews: z.array(SubmittedReviewViewSchema),
|
|
213
225
|
});
|
|
226
|
+
/** Retour ciblé en attente ou en cours sur un élément de la tâche. */
|
|
227
|
+
export const TaskFeedbackViewSchema = z.object({
|
|
228
|
+
requestId: IdSchema,
|
|
229
|
+
targetKind: FeedbackTargetKindSchema,
|
|
230
|
+
targetId: IdSchema.nullable(),
|
|
231
|
+
excerpt: z.string(),
|
|
232
|
+
status: z.enum(["pending", "processing"]),
|
|
233
|
+
authorName: z.string(),
|
|
234
|
+
/** Vrai si l'utilisateur peut annuler le retour : il attend encore l'agent, et l'utilisateur est membre de l'espace. */
|
|
235
|
+
canCancel: z.boolean(),
|
|
236
|
+
});
|
|
214
237
|
export const TaskDetailResponseSchema = z.object({
|
|
215
238
|
task: TaskViewSchema,
|
|
216
239
|
/** Tâches parentes, de la racine au parent direct. */
|
|
@@ -232,6 +255,8 @@ export const TaskDetailResponseSchema = z.object({
|
|
|
232
255
|
agentEdit: z.object({ actionId: IdSchema, at: TimestampSchema }).nullable(),
|
|
233
256
|
/** Temps passé : sessions de chrono de tous les membres. */
|
|
234
257
|
time: TaskTimeSchema,
|
|
258
|
+
/** Retours ciblés que l'agent n'a pas encore traités, du plus ancien au plus récent. */
|
|
259
|
+
feedbacks: z.array(TaskFeedbackViewSchema),
|
|
235
260
|
});
|
|
236
261
|
// --- Requêtes ---
|
|
237
262
|
export const CreateTaskRequestSchema = z.object({
|
|
@@ -297,6 +322,20 @@ export const ToggleCheckboxRequestSchema = z.object({
|
|
|
297
322
|
checked: z.boolean(),
|
|
298
323
|
});
|
|
299
324
|
export const CommentRequestSchema = z.object({ body: z.string().trim().min(1, "Le commentaire est vide.").max(10_000) });
|
|
325
|
+
export const MAX_FEEDBACK_PRECISION_LENGTH = 4000;
|
|
326
|
+
/**
|
|
327
|
+
* Retour ciblé envoyé à l'agent sur un élément de la tâche : l'élément, son
|
|
328
|
+
* texte tel que le membre le voit, un raccourci et/ou une précision libre.
|
|
329
|
+
*/
|
|
330
|
+
export const SendFeedbackRequestSchema = z
|
|
331
|
+
.object({
|
|
332
|
+
targetKind: FeedbackTargetKindSchema,
|
|
333
|
+
targetId: IdSchema.nullable(),
|
|
334
|
+
excerpt: z.string().trim().min(1, "L'élément visé est vide.").max(MAX_FEEDBACK_EXCERPT_LENGTH, `Le passage visé dépasse ${MAX_FEEDBACK_EXCERPT_LENGTH} caractères.`),
|
|
335
|
+
shortcut: FeedbackShortcutSchema.nullable(),
|
|
336
|
+
precision: z.string().max(MAX_FEEDBACK_PRECISION_LENGTH, `La précision dépasse ${MAX_FEEDBACK_PRECISION_LENGTH} caractères.`),
|
|
337
|
+
})
|
|
338
|
+
.refine((input) => input.shortcut !== null || input.precision.trim() !== "", { message: "Choisissez un raccourci ou écrivez votre retour.", path: ["precision"] });
|
|
300
339
|
/** Type MIME `type/sous-type`, sans paramètres. */
|
|
301
340
|
export const MimeTypeSchema = z.string().regex(/^[\w.+-]+\/[\w.+-]+$/, "Type de fichier invalide.");
|
|
302
341
|
/** Pièce jointe transmise par le serveur web, qui lit le formulaire multipart du navigateur. */
|
|
@@ -3,6 +3,7 @@ import { attachmentImages } from "../../shared/logic/attachments.js";
|
|
|
3
3
|
import { combinedResult } from "../../shared/logic/test-summary.js";
|
|
4
4
|
import { actFor, ago, attachmentLines, assigneesSummary, createdTaskSummary, ideaData, imageNote, documentData, memberData, recentIdeas, requireText, resolveMembers, resolveTask, spaceContextLines, spaceData, taskData, taskKey, taskUpdateSummary, treeData, userLabel, } from "../core/agent.js";
|
|
5
5
|
import { OrganizerError } from "../core/errors.js";
|
|
6
|
+
import { applyTextEdits } from "../core/text-edits.js";
|
|
6
7
|
import { questionData, questionLines, questionsOf } from "./questions.js";
|
|
7
8
|
import { parseInput, respond } from "./types.js";
|
|
8
9
|
/** Espace du jeton et ses tâches : contexte, lecture, recherche, création, modification, assignés, tags, commentaires. */
|
|
@@ -192,10 +193,13 @@ export const taskRoutes = [
|
|
|
192
193
|
path: "/tasks/:ref",
|
|
193
194
|
handle: ({ store }, { agent, params, body }) => {
|
|
194
195
|
const input = parseInput(UpdateTaskBodySchema, body);
|
|
195
|
-
const { title, description, status, priority, type, parent, after_task, tested_task_id } = input;
|
|
196
|
+
const { title, description, description_edits, status, priority, type, parent, after_task, tested_task_id } = input;
|
|
196
197
|
const { task, summary } = actFor(store, agent, input.request_id, (tx, space) => {
|
|
197
|
-
if ([title, description, status, priority, type, parent, after_task, tested_task_id].every((value) => value === undefined)) {
|
|
198
|
-
throw new OrganizerError("Nothing to change: give at least one of title, description, status, priority, type, parent, after_task or tested_task_id.");
|
|
198
|
+
if ([title, description, description_edits, status, priority, type, parent, after_task, tested_task_id].every((value) => value === undefined)) {
|
|
199
|
+
throw new OrganizerError("Nothing to change: give at least one of title, description, description_edits, status, priority, type, parent, after_task or tested_task_id.");
|
|
200
|
+
}
|
|
201
|
+
if (description !== undefined && description_edits !== undefined) {
|
|
202
|
+
throw new OrganizerError("Give either description (the whole new text) or description_edits (passages to replace), not both.");
|
|
199
203
|
}
|
|
200
204
|
const patch = {};
|
|
201
205
|
if (title !== undefined)
|
|
@@ -209,6 +213,8 @@ export const taskRoutes = [
|
|
|
209
213
|
if (type !== undefined)
|
|
210
214
|
patch.type = type;
|
|
211
215
|
const task = resolveTask(tx.store, space, params.ref);
|
|
216
|
+
if (description_edits !== undefined)
|
|
217
|
+
patch.description = applyTextEdits(task.description, description_edits, `the description of ${taskKey(tx.store, task)}`);
|
|
212
218
|
if (parent !== undefined)
|
|
213
219
|
patch.parentId = parent === null ? null : resolveTask(tx.store, space, parent).id;
|
|
214
220
|
if (tested_task_id !== undefined)
|
package/dist/src/core/agent.js
CHANGED
|
@@ -6,6 +6,8 @@ import { PRIORITY_LABELS, STATUS_LABELS, TYPE_LABELS } from "../../shared/logic/
|
|
|
6
6
|
import { summarizeTest } from "../../shared/logic/test-summary.js";
|
|
7
7
|
import { attachmentsOfRequest } from "./request-attachments.js";
|
|
8
8
|
import { attachmentImages } from "../../shared/logic/attachments.js";
|
|
9
|
+
import { FEEDBACK_SHORTCUT_LABELS } from "../../shared/logic/feedback.js";
|
|
10
|
+
import { targetText } from "./feedback.js";
|
|
9
11
|
export function agentActor(agent, requestId) {
|
|
10
12
|
return { type: "agent", requestId, tokenId: agent.token.id };
|
|
11
13
|
}
|
|
@@ -266,7 +268,42 @@ const KIND_GUIDANCE = {
|
|
|
266
268
|
test_review: "A test review written by a tester of the context task: feed it back into the existing tasks (status, checklist, comments, priorities) or create a task for each problem found.",
|
|
267
269
|
idea_promotion: "Promote the context idea into a well-formed task (clear title, description, type, priority, parent if relevant) with promote_idea.",
|
|
268
270
|
direct: "A batch of actions the agent performed directly, without a request: there is nothing to process.",
|
|
271
|
+
feedback: "A targeted feedback of a member on one element of the context task: change that element as asked (rephrase, correct, detail, simplify), or answer it without changing anything when the feedback asks for information.",
|
|
269
272
|
};
|
|
273
|
+
/** Élément visé par un retour, désigné pour l'agent, avec l'outil qui le modifie. */
|
|
274
|
+
const FEEDBACK_TARGETS = {
|
|
275
|
+
description: { name: "the whole description", tool: "update_task with description_edits (or description to rework it as a whole)" },
|
|
276
|
+
section: { name: "a section of the description (the heading below)", tool: "update_task with description_edits, limited to that section" },
|
|
277
|
+
passage: { name: "a passage of the description (the text below, as rendered on screen)", tool: "update_task with description_edits, limited to that passage" },
|
|
278
|
+
question: { name: "a question", tool: "edit_questions" },
|
|
279
|
+
option: { name: "an option of a question", tool: "edit_questions" },
|
|
280
|
+
checklist_item: { name: "a checklist item", tool: "edit_checklist" },
|
|
281
|
+
checkpoint: { name: "a test checkpoint", tool: "edit_checklist" },
|
|
282
|
+
comment: { name: "a comment", tool: "none: a comment is never rewritten, answer it in your reply" },
|
|
283
|
+
};
|
|
284
|
+
/** Lignes d'un retour ciblé : l'élément visé, son texte au moment du retour et maintenant, le raccourci choisi, et la façon d'agir. */
|
|
285
|
+
function feedbackLines(store, request, task) {
|
|
286
|
+
const feedback = store.findRequestFeedback(request.id);
|
|
287
|
+
if (!feedback)
|
|
288
|
+
return [];
|
|
289
|
+
const target = FEEDBACK_TARGETS[feedback.targetKind];
|
|
290
|
+
const lines = [
|
|
291
|
+
"",
|
|
292
|
+
`This request is a targeted feedback of ${userLabel(store.getUser(request.authorId))} on ${target.name}${feedback.targetId === null ? "" : ` (id ${feedback.targetId})`}${task ? ` of ${taskKey(store, task)}` : ""}.`,
|
|
293
|
+
`Its text when the feedback was sent: "${feedback.excerpt}"`,
|
|
294
|
+
];
|
|
295
|
+
const current = task ? targetText(store, task, feedback) : null;
|
|
296
|
+
if (feedback.targetId !== null) {
|
|
297
|
+
if (current === null)
|
|
298
|
+
lines.push("That element no longer exists: say so in your reply.");
|
|
299
|
+
else if (current.trim() !== feedback.excerpt)
|
|
300
|
+
lines.push(`Its text now: "${current.trim()}"`);
|
|
301
|
+
}
|
|
302
|
+
if (feedback.shortcut !== null)
|
|
303
|
+
lines.push(`Kind of feedback: ${feedback.shortcut} ("${FEEDBACK_SHORTCUT_LABELS[feedback.shortcut]}").`);
|
|
304
|
+
lines.push(`To change it: ${target.tool}. Change only that element: in a description, replace the sentences concerned with description_edits and leave the rest of the text untouched.`, "complete_request posts your reply as a comment of the task that quotes the element: write it as an answer to the feedback (what you changed, or the information asked). Do not add another comment for it.");
|
|
305
|
+
return lines;
|
|
306
|
+
}
|
|
270
307
|
/**
|
|
271
308
|
* Échanges précédents de l'auteur d'un message dans l'espace visé, du plus ancien
|
|
272
309
|
* au plus récent, au nombre fixé dans ses paramètres ; aucun pour les autres types.
|
|
@@ -380,6 +417,10 @@ export function requestContext(store, agent, request) {
|
|
|
380
417
|
const thread = requestThread(store, request);
|
|
381
418
|
if (thread)
|
|
382
419
|
lines.push(...threadLines(store, thread));
|
|
420
|
+
if (request.kind === "feedback") {
|
|
421
|
+
const discussed = request.contextTaskId === null ? null : store.findTask(request.contextTaskId);
|
|
422
|
+
lines.push(...feedbackLines(store, request, discussed && discussed.spaceId === request.targetSpaceId ? discussed : null));
|
|
423
|
+
}
|
|
383
424
|
const history = requestHistory(store, request);
|
|
384
425
|
if (history.length > 0) {
|
|
385
426
|
lines.push("", `Previous exchanges of the author in this space (oldest first, ${history.length} most recent) — use them to understand the message:`);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Store } from "./store.js";
|
|
2
|
+
import { type Comment, type RequestFeedback, type Task } from "../../shared/schemas/entities.schema.js";
|
|
3
|
+
import type { CommentView, SendFeedbackRequest, TaskFeedbackView } from "../../shared/schemas/tasks-api.schema.js";
|
|
4
|
+
/**
|
|
5
|
+
* Texte actuel de l'élément visé, ou null s'il n'existe plus ou n'appartient
|
|
6
|
+
* pas à la tâche : le texte d'une question, le libellé d'une proposition, le
|
|
7
|
+
* texte d'un élément de checklist ou d'un point, le corps d'un commentaire, la
|
|
8
|
+
* description. Une section ou un passage n'ont pas de texte propre : la
|
|
9
|
+
* description sert de référence.
|
|
10
|
+
*/
|
|
11
|
+
export declare function targetText(store: Store, task: Task, target: Pick<RequestFeedback, "targetKind" | "targetId">): string | null;
|
|
12
|
+
/**
|
|
13
|
+
* Envoie un retour ciblé à l'agent. L'élément désigné par un identifiant doit
|
|
14
|
+
* appartenir à la tâche ; son extrait est son texte actuel. Une section ou un
|
|
15
|
+
* passage gardent le texte que le membre a vu ; la description entière est
|
|
16
|
+
* citée telle qu'elle est.
|
|
17
|
+
*/
|
|
18
|
+
export declare function sendFeedback(store: Store, userId: string, taskId: string, input: SendFeedbackRequest): TaskFeedbackView;
|
|
19
|
+
/** Retours ciblés que l'agent n'a pas encore traités sur une tâche, du plus ancien au plus récent. */
|
|
20
|
+
export declare function openFeedbacks(store: Store, userId: string, taskId: string): TaskFeedbackView[];
|
|
21
|
+
/**
|
|
22
|
+
* Pour la réponse de l'agent à un retour ciblé — le commentaire publié par
|
|
23
|
+
* `complete_request`, dont le texte est la réponse de la demande — l'élément
|
|
24
|
+
* visé et le retour de son auteur ; null pour un autre commentaire.
|
|
25
|
+
*/
|
|
26
|
+
export declare function answeredFeedback(store: Store, comment: Comment): CommentView["answersFeedback"];
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { InvariantError, NotFoundError } from "./errors.js";
|
|
2
|
+
import { requireTask } from "./tasks.js";
|
|
3
|
+
import { feedbackRequestText } from "../../shared/logic/feedback.js";
|
|
4
|
+
import { MAX_FEEDBACK_EXCERPT_LENGTH } from "../../shared/schemas/entities.schema.js";
|
|
5
|
+
/**
|
|
6
|
+
* Retours ciblés : un membre envoie à l'agent un retour sur un élément précis
|
|
7
|
+
* d'une tâche (question, proposition, élément de checklist, point de
|
|
8
|
+
* vérification, commentaire, description, section ou passage). Le retour est
|
|
9
|
+
* une demande `feedback` qui a la tâche pour contexte et retient l'élément
|
|
10
|
+
* visé ; la réponse de l'agent est publiée en commentaire de la tâche, qui
|
|
11
|
+
* cite l'élément.
|
|
12
|
+
*/
|
|
13
|
+
const asUser = (userId) => ({ type: "user", userId });
|
|
14
|
+
function userName(store, userId) {
|
|
15
|
+
const user = store.findUser(userId);
|
|
16
|
+
return user ? (user.displayName ?? user.email) : "un ancien membre";
|
|
17
|
+
}
|
|
18
|
+
/** Texte limité à la longueur d'un extrait enregistré. */
|
|
19
|
+
function clipped(text) {
|
|
20
|
+
const trimmed = text.trim();
|
|
21
|
+
return trimmed.length > MAX_FEEDBACK_EXCERPT_LENGTH ? `${trimmed.slice(0, MAX_FEEDBACK_EXCERPT_LENGTH - 1)}…` : trimmed;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Texte actuel de l'élément visé, ou null s'il n'existe plus ou n'appartient
|
|
25
|
+
* pas à la tâche : le texte d'une question, le libellé d'une proposition, le
|
|
26
|
+
* texte d'un élément de checklist ou d'un point, le corps d'un commentaire, la
|
|
27
|
+
* description. Une section ou un passage n'ont pas de texte propre : la
|
|
28
|
+
* description sert de référence.
|
|
29
|
+
*/
|
|
30
|
+
export function targetText(store, task, target) {
|
|
31
|
+
const { targetKind, targetId } = target;
|
|
32
|
+
if (targetKind === "description" || targetKind === "section" || targetKind === "passage")
|
|
33
|
+
return task.description;
|
|
34
|
+
if (targetId === null)
|
|
35
|
+
return null;
|
|
36
|
+
if (targetKind === "question") {
|
|
37
|
+
const question = store.findQuestion(targetId);
|
|
38
|
+
return question?.taskId === task.id ? question.text : null;
|
|
39
|
+
}
|
|
40
|
+
if (targetKind === "option") {
|
|
41
|
+
const option = store.findQuestionOption(targetId);
|
|
42
|
+
const question = option ? store.findQuestion(option.questionId) : null;
|
|
43
|
+
return option && question?.taskId === task.id ? option.label : null;
|
|
44
|
+
}
|
|
45
|
+
if (targetKind === "checklist_item") {
|
|
46
|
+
const item = store.findChecklistItem(targetId);
|
|
47
|
+
return item?.taskId === task.id ? item.text : null;
|
|
48
|
+
}
|
|
49
|
+
if (targetKind === "checkpoint") {
|
|
50
|
+
const checkpoint = store.findCheckpoint(targetId);
|
|
51
|
+
return checkpoint?.taskId === task.id ? checkpoint.text : null;
|
|
52
|
+
}
|
|
53
|
+
const comment = store.findComment(targetId);
|
|
54
|
+
return comment?.taskId === task.id ? comment.body : null;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Envoie un retour ciblé à l'agent. L'élément désigné par un identifiant doit
|
|
58
|
+
* appartenir à la tâche ; son extrait est son texte actuel. Une section ou un
|
|
59
|
+
* passage gardent le texte que le membre a vu ; la description entière est
|
|
60
|
+
* citée telle qu'elle est.
|
|
61
|
+
*/
|
|
62
|
+
export function sendFeedback(store, userId, taskId, input) {
|
|
63
|
+
const request = store.mutate(asUser(userId), (tx) => {
|
|
64
|
+
const { task } = requireTask(tx.store, taskId, userId);
|
|
65
|
+
const designated = !["description", "section", "passage"].includes(input.targetKind);
|
|
66
|
+
if (designated !== (input.targetId !== null)) {
|
|
67
|
+
throw new InvariantError(designated ? "Indiquez l'élément visé par son identifiant." : "La description, une section ou un passage ne portent pas d'identifiant.");
|
|
68
|
+
}
|
|
69
|
+
const current = targetText(tx.store, task, input);
|
|
70
|
+
if (current === null)
|
|
71
|
+
throw new NotFoundError("L'élément visé n'existe plus dans cette tâche : rechargez la page.");
|
|
72
|
+
if (input.targetKind === "description" && current.trim() === "")
|
|
73
|
+
throw new InvariantError("La description est vide : il n'y a rien à reprendre.");
|
|
74
|
+
const excerpt = clipped(designated || input.targetKind === "description" ? current : input.excerpt);
|
|
75
|
+
return tx.createAgentRequest({
|
|
76
|
+
targetSpaceId: task.spaceId,
|
|
77
|
+
kind: "feedback",
|
|
78
|
+
text: feedbackRequestText(input.targetKind, excerpt, input.shortcut, input.precision),
|
|
79
|
+
contextTaskId: task.id,
|
|
80
|
+
feedback: { targetKind: input.targetKind, targetId: input.targetId, excerpt, shortcut: input.shortcut },
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
return feedbackView(store, userId, request, store.findRequestFeedback(request.id));
|
|
84
|
+
}
|
|
85
|
+
function feedbackView(store, userId, request, feedback) {
|
|
86
|
+
return {
|
|
87
|
+
requestId: request.id,
|
|
88
|
+
targetKind: feedback.targetKind,
|
|
89
|
+
targetId: feedback.targetId,
|
|
90
|
+
excerpt: feedback.excerpt,
|
|
91
|
+
status: request.status === "processing" ? "processing" : "pending",
|
|
92
|
+
authorName: userName(store, request.authorId),
|
|
93
|
+
canCancel: request.status === "pending" && store.isMember(request.targetSpaceId, userId),
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
/** Retours ciblés que l'agent n'a pas encore traités sur une tâche, du plus ancien au plus récent. */
|
|
97
|
+
export function openFeedbacks(store, userId, taskId) {
|
|
98
|
+
return store.listOpenFeedbackRequests(taskId).map(({ request, feedback }) => feedbackView(store, userId, request, feedback));
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Pour la réponse de l'agent à un retour ciblé — le commentaire publié par
|
|
102
|
+
* `complete_request`, dont le texte est la réponse de la demande — l'élément
|
|
103
|
+
* visé et le retour de son auteur ; null pour un autre commentaire.
|
|
104
|
+
*/
|
|
105
|
+
export function answeredFeedback(store, comment) {
|
|
106
|
+
const request = comment.requestId === null ? null : store.findAgentRequest(comment.requestId);
|
|
107
|
+
if (!request || request.kind !== "feedback" || request.reply === null || request.reply !== comment.body)
|
|
108
|
+
return null;
|
|
109
|
+
const feedback = store.findRequestFeedback(request.id);
|
|
110
|
+
if (!feedback)
|
|
111
|
+
return null;
|
|
112
|
+
return {
|
|
113
|
+
targetKind: feedback.targetKind,
|
|
114
|
+
targetId: feedback.targetId,
|
|
115
|
+
excerpt: feedback.excerpt,
|
|
116
|
+
authorName: userName(store, request.authorId),
|
|
117
|
+
shortcut: feedback.shortcut,
|
|
118
|
+
text: request.text.split("\n").slice(1).join("\n"),
|
|
119
|
+
};
|
|
120
|
+
}
|