@imenam/mcp-organizer 1.0.21 → 1.0.22
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 +15 -11
- package/dist/shared/logic/documents.d.ts +2 -4
- package/dist/shared/logic/documents.js +6 -11
- package/dist/shared/schemas/agent-tools.schema.d.ts +133 -7
- package/dist/shared/schemas/agent-tools.schema.js +52 -7
- package/dist/shared/schemas/documents-api.schema.d.ts +0 -2
- package/dist/shared/schemas/documents-api.schema.js +0 -2
- package/dist/src/agent-api/attachments.d.ts +2 -0
- package/dist/src/agent-api/attachments.js +96 -0
- package/dist/src/agent-api/documents.d.ts +1 -1
- package/dist/src/agent-api/documents.js +9 -33
- package/dist/src/agent-api/files.d.ts +35 -0
- package/dist/src/agent-api/files.js +86 -0
- package/dist/src/agent-api/router.d.ts +2 -2
- package/dist/src/agent-api/router.js +5 -4
- package/dist/src/agent-api/tasks.js +5 -8
- package/dist/src/agent-api/types.d.ts +4 -2
- package/dist/src/core/agent-files.d.ts +41 -0
- package/dist/src/core/agent-files.js +102 -0
- package/dist/src/core/agent.d.ts +3 -1
- package/dist/src/core/agent.js +14 -3
- package/dist/src/core/document-text.d.ts +3 -2
- package/dist/src/core/document-text.js +3 -2
- package/dist/src/core/documents.js +0 -1
- package/dist/src/core/history.d.ts +3 -1
- package/dist/src/core/history.js +28 -11
- package/dist/src/core/requests.d.ts +9 -4
- package/dist/src/core/requests.js +21 -10
- package/dist/src/core/snapshots.d.ts +3 -3
- package/dist/src/core/snapshots.js +3 -1
- package/dist/src/gui-api.js +2 -2
- package/dist/src/mcp/client.d.ts +7 -4
- package/dist/src/mcp/client.js +31 -4
- package/dist/src/mcp/start.d.ts +1 -1
- package/dist/src/mcp/start.js +6 -6
- package/dist/src/mcp/tools.d.ts +11 -0
- package/dist/src/mcp/tools.js +55 -4
- package/dist/src/mcp/upload.d.ts +22 -0
- package/dist/src/mcp/upload.js +79 -0
- package/dist/src/server/app.js +38 -4
- package/gui/dist/assets/{index-DbzcjyaW.js → index-C1f7hOcM.js} +2 -2
- package/gui/dist/assets/{index-Dvf5Yo0e.css → index-CfMiwPSL.css} +1 -1
- package/gui/dist/index.html +2 -2
- package/package.json +3 -1
|
@@ -4,7 +4,8 @@ import { OrganizerError } from "./errors.js";
|
|
|
4
4
|
/**
|
|
5
5
|
* Texte d'un document pour l'agent : le contenu d'un fichier texte décodé en
|
|
6
6
|
* UTF-8, ou le texte des paragraphes d'un fichier Word (.docx), lu dans
|
|
7
|
-
* l'archive sans dépendance.
|
|
7
|
+
* l'archive sans dépendance. Le texte d'un PDF et les images se lisent de
|
|
8
|
+
* façon asynchrone (voir `agent-files.ts`).
|
|
8
9
|
*/
|
|
9
10
|
/** Longueur d'une partie d'un document lu par morceaux, en caractères. */
|
|
10
11
|
export const DOCUMENT_PART_LENGTH = 20_000;
|
|
@@ -91,7 +92,7 @@ function docxText(content) {
|
|
|
91
92
|
}
|
|
92
93
|
return parts.join("").replace(/\n{3,}/g, "\n\n").trim();
|
|
93
94
|
}
|
|
94
|
-
/** Texte d'un
|
|
95
|
+
/** Texte d'un fichier texte ou Word ; null pour un PDF ou une image. */
|
|
95
96
|
export function documentText(filename, content) {
|
|
96
97
|
const format = documentFormatOf(filename);
|
|
97
98
|
if (!format)
|
|
@@ -38,7 +38,6 @@ function documentView(store, document) {
|
|
|
38
38
|
format: format.label,
|
|
39
39
|
size: document.size,
|
|
40
40
|
version: document.version,
|
|
41
|
-
agentReadable: format.reading !== "none",
|
|
42
41
|
uploaderName: userName(store, document.uploaderId),
|
|
43
42
|
updatedByName: userName(store, document.updatedBy),
|
|
44
43
|
createdAt: document.createdAt,
|
|
@@ -13,8 +13,10 @@ declare const TASK_FIELDS: readonly ["title", "description", "status", "priority
|
|
|
13
13
|
* refus nomme l'auteur de la modification. Une création est supprimée, une
|
|
14
14
|
* suppression recréée, une modification ramenée à l'état d'avant. Une action
|
|
15
15
|
* sur une vue du tableau de bord ne s'annule que par le membre à qui la vue appartient.
|
|
16
|
+
* Renvoie le chemin du fichier d'une pièce jointe supprimée, que l'appelant
|
|
17
|
+
* efface une fois la mutation validée ; null sinon.
|
|
16
18
|
*/
|
|
17
|
-
export declare function undoAgentAction(tx: Mutation, action: AgentAction):
|
|
19
|
+
export declare function undoAgentAction(tx: Mutation, action: AgentAction): string | null;
|
|
18
20
|
/** Libellés français des champs restaurables d'une tâche ; « position » est le rang dans une même colonne. */
|
|
19
21
|
export declare const TASK_FIELD_LABELS: Record<(typeof TASK_FIELDS)[number] | "position" | "assigneeIds" | "tagIds", string>;
|
|
20
22
|
/**
|
package/dist/src/core/history.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ForbiddenError, InvariantError, NotFoundError } from "./errors.js";
|
|
2
2
|
import { CheckpointSnapshotSchema, isTracked, snapshotOf, taskIdOfAction } from "./snapshots.js";
|
|
3
|
-
import { BoardViewSchema, ChecklistItemSchema, FollowUpSchema, QuestionSnapshotSchema, CommentSchema, IdeaSchema, TaskSnapshotSchema, TestCheckpointSchema, TimeSessionSchema, } from "../../shared/schemas/entities.schema.js";
|
|
3
|
+
import { BoardViewSchema, ChecklistItemSchema, FollowUpSchema, QuestionSnapshotSchema, CommentSchema, AttachmentSchema, IdeaSchema, TaskSnapshotSchema, TestCheckpointSchema, TimeSessionSchema, } from "../../shared/schemas/entities.schema.js";
|
|
4
4
|
/**
|
|
5
5
|
* Retour à un état antérieur : annulation d'une action de l'agent, après
|
|
6
6
|
* comparaison de l'état courant de l'entité avec celui que l'action a
|
|
@@ -27,6 +27,8 @@ function comparable(entityType, snapshot) {
|
|
|
27
27
|
return [TestCheckpointSchema.parse(snapshot).text];
|
|
28
28
|
case "comment":
|
|
29
29
|
return [CommentSchema.parse(snapshot).body];
|
|
30
|
+
case "attachment":
|
|
31
|
+
return [AttachmentSchema.parse(snapshot).filename];
|
|
30
32
|
case "idea": {
|
|
31
33
|
const idea = IdeaSchema.parse(snapshot);
|
|
32
34
|
return [idea.text, idea.promotedTaskId, idea.archivedAt !== null];
|
|
@@ -82,6 +84,8 @@ function describe(store, entityType, snapshot) {
|
|
|
82
84
|
return { label: `Le point de vérification « ${TestCheckpointSchema.parse(snapshot).text} »`, feminine: false };
|
|
83
85
|
case "comment":
|
|
84
86
|
return { label: "Le commentaire de l'agent", feminine: false };
|
|
87
|
+
case "attachment":
|
|
88
|
+
return { label: `La pièce jointe « ${AttachmentSchema.parse(snapshot).filename} »`, feminine: true };
|
|
85
89
|
case "idea":
|
|
86
90
|
return { label: `L'idée « ${excerpt(IdeaSchema.parse(snapshot).text)} »`, feminine: true };
|
|
87
91
|
case "board_view":
|
|
@@ -118,6 +122,8 @@ function lastModifier(store, entityType, entityId, action) {
|
|
|
118
122
|
* refus nomme l'auteur de la modification. Une création est supprimée, une
|
|
119
123
|
* suppression recréée, une modification ramenée à l'état d'avant. Une action
|
|
120
124
|
* sur une vue du tableau de bord ne s'annule que par le membre à qui la vue appartient.
|
|
125
|
+
* Renvoie le chemin du fichier d'une pièce jointe supprimée, que l'appelant
|
|
126
|
+
* efface une fois la mutation validée ; null sinon.
|
|
121
127
|
*/
|
|
122
128
|
export function undoAgentAction(tx, action) {
|
|
123
129
|
if (action.undoneAt !== null)
|
|
@@ -131,6 +137,7 @@ export function undoAgentAction(tx, action) {
|
|
|
131
137
|
if (entityType === "time_session")
|
|
132
138
|
requireTimerOwner(tx, TimeSessionSchema.parse(action.after ?? action.before));
|
|
133
139
|
const current = snapshotOf(store, entityType, action.entityId);
|
|
140
|
+
let removedFile = null;
|
|
134
141
|
if (action.after === null) {
|
|
135
142
|
const { label } = describe(store, entityType, action.before);
|
|
136
143
|
if (current !== null)
|
|
@@ -147,11 +154,12 @@ export function undoAgentAction(tx, action) {
|
|
|
147
154
|
throw new InvariantError(`${label} a été modifié${agreement} depuis par ${lastModifier(store, entityType, action.entityId, action)} : l'annulation écraserait cette modification.`);
|
|
148
155
|
}
|
|
149
156
|
if (action.before === null)
|
|
150
|
-
remove(tx, entityType, current, label);
|
|
157
|
+
removedFile = remove(tx, entityType, current, label);
|
|
151
158
|
else
|
|
152
159
|
restore(tx, entityType, action.entityId, action.before);
|
|
153
160
|
}
|
|
154
161
|
tx.markAgentActionUndone(action.id, taskIdOfAction(action));
|
|
162
|
+
return removedFile;
|
|
155
163
|
}
|
|
156
164
|
/** Seul le membre à qui appartient une vue annule les changements que l'agent y a faits. */
|
|
157
165
|
function requireViewOwner(tx, view) {
|
|
@@ -176,7 +184,11 @@ function requireViewAssignees(tx, view) {
|
|
|
176
184
|
}
|
|
177
185
|
}
|
|
178
186
|
}
|
|
179
|
-
/**
|
|
187
|
+
/**
|
|
188
|
+
* Supprime une entité créée par l'agent ; une tâche qui porte d'autres
|
|
189
|
+
* éléments est refusée. Renvoie le chemin du fichier d'une pièce jointe
|
|
190
|
+
* supprimée, null pour une autre entité.
|
|
191
|
+
*/
|
|
180
192
|
function remove(tx, entityType, current, label) {
|
|
181
193
|
const store = tx.store;
|
|
182
194
|
switch (entityType) {
|
|
@@ -196,39 +208,42 @@ function remove(tx, entityType, current, label) {
|
|
|
196
208
|
throw new InvariantError(`${label} porte ${found.join(", ")} : annulez d'abord les actions qui les ont ajoutés, ou supprimez-les.`);
|
|
197
209
|
}
|
|
198
210
|
tx.deleteTask(task.id);
|
|
199
|
-
return;
|
|
211
|
+
return null;
|
|
200
212
|
}
|
|
201
213
|
case "checklist_item":
|
|
202
214
|
tx.deleteChecklistItem(ChecklistItemSchema.parse(current).id);
|
|
203
|
-
return;
|
|
215
|
+
return null;
|
|
204
216
|
case "task_question":
|
|
205
217
|
tx.deleteQuestion(QuestionSnapshotSchema.parse(current).id);
|
|
206
|
-
return;
|
|
218
|
+
return null;
|
|
207
219
|
case "test_checkpoint": {
|
|
208
220
|
const checkpoint = CheckpointSnapshotSchema.parse(current);
|
|
209
221
|
if (checkpoint.results.length > 0)
|
|
210
222
|
throw new InvariantError(`${label} a reçu des résultats de test depuis : annulation impossible sans les perdre.`);
|
|
211
223
|
tx.deleteCheckpoint(checkpoint.id);
|
|
212
|
-
return;
|
|
224
|
+
return null;
|
|
213
225
|
}
|
|
214
226
|
case "comment":
|
|
215
227
|
tx.deleteAgentComment(CommentSchema.parse(current).id);
|
|
216
|
-
return;
|
|
228
|
+
return null;
|
|
229
|
+
case "attachment":
|
|
230
|
+
return tx.deleteAttachment(AttachmentSchema.parse(current).id).storagePath;
|
|
217
231
|
case "idea":
|
|
218
232
|
tx.deleteIdea(IdeaSchema.parse(current).id);
|
|
219
|
-
return;
|
|
233
|
+
return null;
|
|
220
234
|
case "board_view": {
|
|
221
235
|
const view = BoardViewSchema.parse(current);
|
|
222
236
|
if (store.listBoardViews(view.spaceId, view.userId).length === 1) {
|
|
223
237
|
throw new InvariantError(`${label} est la dernière vue de son propriétaire dans l'espace : créez-en une autre avant d'annuler.`);
|
|
224
238
|
}
|
|
225
239
|
tx.deleteBoardView(view.id);
|
|
226
|
-
return;
|
|
240
|
+
return null;
|
|
227
241
|
}
|
|
228
242
|
case "time_session":
|
|
229
243
|
tx.deleteTimeSession(TimeSessionSchema.parse(current).id);
|
|
230
|
-
return;
|
|
244
|
+
return null;
|
|
231
245
|
}
|
|
246
|
+
return null;
|
|
232
247
|
}
|
|
233
248
|
/** Recrée une entité supprimée par l'agent. */
|
|
234
249
|
function recreate(tx, entityType, before) {
|
|
@@ -300,6 +315,8 @@ function restore(tx, entityType, entityId, before) {
|
|
|
300
315
|
}
|
|
301
316
|
case "comment":
|
|
302
317
|
throw new InvariantError("La modification d'un commentaire ne s'annule pas.");
|
|
318
|
+
case "attachment":
|
|
319
|
+
throw new InvariantError("La modification d'une pièce jointe ne s'annule pas.");
|
|
303
320
|
case "board_view": {
|
|
304
321
|
const view = BoardViewSchema.parse(before);
|
|
305
322
|
requireViewAssignees(tx, view);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AttachmentStorage } from "./attachments.js";
|
|
1
2
|
import type { Store } from "./store.js";
|
|
2
3
|
import type { AgentAction, AgentRequest } from "../../shared/schemas/entities.schema.js";
|
|
3
4
|
import type { RequestKind } from "../../shared/schemas/enums.schema.js";
|
|
@@ -65,7 +66,11 @@ export declare function listRequests(store: Store, userId: string, spaceId: stri
|
|
|
65
66
|
startedAt: string;
|
|
66
67
|
} | null;
|
|
67
68
|
}, now?: Date): RequestListResponse;
|
|
68
|
-
/** Annule une action de l'agent
|
|
69
|
-
export declare function undoAction(store: Store, userId: string, actionId: string): RequestView;
|
|
70
|
-
/**
|
|
71
|
-
|
|
69
|
+
/** Annule une action de l'agent ; le fichier d'une pièce jointe ainsi supprimée est effacé. */
|
|
70
|
+
export declare function undoAction(store: Store, storage: AttachmentStorage, userId: string, actionId: string): RequestView;
|
|
71
|
+
/**
|
|
72
|
+
* Annule toutes les actions non annulées d'un lot, de la plus récente à la
|
|
73
|
+
* plus ancienne : tout le lot ou rien. Les fichiers des pièces jointes
|
|
74
|
+
* supprimées sont effacés.
|
|
75
|
+
*/
|
|
76
|
+
export declare function undoRequest(store: Store, storage: AttachmentStorage, userId: string, requestId: string): RequestView;
|
|
@@ -262,29 +262,40 @@ function requireUndoableRequest(request) {
|
|
|
262
262
|
if (request.status === "processing")
|
|
263
263
|
throw new InvariantError("L'agent traite encore cette demande : attendez qu'il ait terminé pour annuler ses actions.");
|
|
264
264
|
}
|
|
265
|
-
/** Annule une action de l'agent
|
|
266
|
-
export function undoAction(store, userId, actionId) {
|
|
267
|
-
const requestId = store.mutate(asUser(userId), (tx) => {
|
|
265
|
+
/** Annule une action de l'agent ; le fichier d'une pièce jointe ainsi supprimée est effacé. */
|
|
266
|
+
export function undoAction(store, storage, userId, actionId) {
|
|
267
|
+
const { requestId, removedFile } = store.mutate(asUser(userId), (tx) => {
|
|
268
268
|
const action = tx.store.findAgentAction(actionId);
|
|
269
269
|
if (!action)
|
|
270
270
|
throw new NotFoundError("Action introuvable.");
|
|
271
271
|
const request = requireVisibleRequest(tx.store, userId, action.requestId);
|
|
272
272
|
requireUndoableRequest(request);
|
|
273
|
-
undoAgentAction(tx, action);
|
|
274
|
-
return request.id;
|
|
273
|
+
return { requestId: request.id, removedFile: undoAgentAction(tx, action) };
|
|
275
274
|
});
|
|
275
|
+
if (removedFile !== null)
|
|
276
|
+
storage.remove([removedFile]);
|
|
276
277
|
return requestView(store, userId, store.getAgentRequest(requestId));
|
|
277
278
|
}
|
|
278
|
-
/**
|
|
279
|
-
|
|
280
|
-
|
|
279
|
+
/**
|
|
280
|
+
* Annule toutes les actions non annulées d'un lot, de la plus récente à la
|
|
281
|
+
* plus ancienne : tout le lot ou rien. Les fichiers des pièces jointes
|
|
282
|
+
* supprimées sont effacés.
|
|
283
|
+
*/
|
|
284
|
+
export function undoRequest(store, storage, userId, requestId) {
|
|
285
|
+
const removedFiles = store.mutate(asUser(userId), (tx) => {
|
|
281
286
|
const request = requireVisibleRequest(tx.store, userId, requestId);
|
|
282
287
|
requireUndoableRequest(request);
|
|
283
288
|
const remaining = tx.store.listAgentActions(requestId).filter((action) => action.undoneAt === null);
|
|
284
289
|
if (remaining.length === 0)
|
|
285
290
|
throw new InvariantError("Toutes les actions de ce lot sont déjà annulées.");
|
|
286
|
-
|
|
287
|
-
|
|
291
|
+
const files = [];
|
|
292
|
+
for (const action of remaining.reverse()) {
|
|
293
|
+
const removed = undoAgentAction(tx, tx.store.getAgentAction(action.id));
|
|
294
|
+
if (removed !== null)
|
|
295
|
+
files.push(removed);
|
|
296
|
+
}
|
|
297
|
+
return files;
|
|
288
298
|
});
|
|
299
|
+
storage.remove(removedFiles);
|
|
289
300
|
return requestView(store, userId, store.getAgentRequest(requestId));
|
|
290
301
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { Store } from "./store.js";
|
|
3
3
|
import type { EntityType } from "../../shared/schemas/enums.schema.js";
|
|
4
|
-
import { type AgentAction, type BoardView, type ChecklistItem, type Comment, type FollowUp, type Idea, type QuestionSnapshot, type TaskSnapshot, type TimeSession } from "../../shared/schemas/entities.schema.js";
|
|
4
|
+
import { type AgentAction, type Attachment, type BoardView, type ChecklistItem, type Comment, type FollowUp, type Idea, type QuestionSnapshot, type TaskSnapshot, type TimeSession } from "../../shared/schemas/entities.schema.js";
|
|
5
5
|
/** Instantanés des entités que l'agent modifie : l'état avant et après chaque action de son lot. */
|
|
6
6
|
/** Point de vérification avec les résultats saisis dessus. */
|
|
7
7
|
export declare const CheckpointSnapshotSchema: z.ZodObject<{
|
|
@@ -24,9 +24,9 @@ export declare const CheckpointSnapshotSchema: z.ZodObject<{
|
|
|
24
24
|
}, z.core.$strip>;
|
|
25
25
|
export type CheckpointSnapshot = z.infer<typeof CheckpointSnapshotSchema>;
|
|
26
26
|
/** Entités dont l'agent enregistre l'état avant et après chaque action. */
|
|
27
|
-
export type TrackedEntityType = "task" | "checklist_item" | "task_question" | "test_checkpoint" | "comment" | "idea" | "board_view" | "follow_up" | "time_session";
|
|
27
|
+
export type TrackedEntityType = "task" | "checklist_item" | "task_question" | "test_checkpoint" | "comment" | "attachment" | "idea" | "board_view" | "follow_up" | "time_session";
|
|
28
28
|
export declare function isTracked(entityType: EntityType): entityType is TrackedEntityType;
|
|
29
29
|
/** Instantané courant d'une entité, ou null si elle n'existe pas. */
|
|
30
|
-
export declare function snapshotOf(store: Store, entityType: TrackedEntityType, entityId: string): TaskSnapshot | ChecklistItem | QuestionSnapshot | CheckpointSnapshot | Comment | Idea | BoardView | FollowUp | TimeSession | null;
|
|
30
|
+
export declare function snapshotOf(store: Store, entityType: TrackedEntityType, entityId: string): TaskSnapshot | ChecklistItem | QuestionSnapshot | CheckpointSnapshot | Comment | Attachment | Idea | BoardView | FollowUp | TimeSession | null;
|
|
31
31
|
/** Tâche concernée par une action : la tâche elle-même, ou celle qui porte l'élément ; null pour une idée, une vue ou un point à régler. */
|
|
32
32
|
export declare function taskIdOfAction(action: Pick<AgentAction, "entityType" | "entityId" | "before" | "after">): string | null;
|
|
@@ -3,7 +3,7 @@ import { TestCheckpointSchema, TestResultSchema } from "../../shared/schemas/ent
|
|
|
3
3
|
/** Instantanés des entités que l'agent modifie : l'état avant et après chaque action de son lot. */
|
|
4
4
|
/** Point de vérification avec les résultats saisis dessus. */
|
|
5
5
|
export const CheckpointSnapshotSchema = TestCheckpointSchema.extend({ results: z.array(TestResultSchema) });
|
|
6
|
-
const TRACKED = new Set(["task", "checklist_item", "task_question", "test_checkpoint", "comment", "idea", "board_view", "follow_up", "time_session"]);
|
|
6
|
+
const TRACKED = new Set(["task", "checklist_item", "task_question", "test_checkpoint", "comment", "attachment", "idea", "board_view", "follow_up", "time_session"]);
|
|
7
7
|
export function isTracked(entityType) {
|
|
8
8
|
return TRACKED.has(entityType);
|
|
9
9
|
}
|
|
@@ -24,6 +24,8 @@ export function snapshotOf(store, entityType, entityId) {
|
|
|
24
24
|
}
|
|
25
25
|
case "comment":
|
|
26
26
|
return store.findComment(entityId);
|
|
27
|
+
case "attachment":
|
|
28
|
+
return store.findAttachment(entityId);
|
|
27
29
|
case "idea":
|
|
28
30
|
return store.findIdea(entityId);
|
|
29
31
|
case "board_view":
|
package/dist/src/gui-api.js
CHANGED
|
@@ -396,14 +396,14 @@ route("PATCH", "/requests/:requestId", (ctx, { user, request, params }) => ({
|
|
|
396
396
|
route("POST", "/requests/:requestId/cancel", (ctx, { user, params }) => ({ body: cancelRequest(ctx.store, user.id, params.requestId) }));
|
|
397
397
|
route("POST", "/requests/:requestId/stop", (ctx, { user, params }) => ({ body: stopRequest(ctx.store, user.id, params.requestId, ctx.runner.stopSession) }));
|
|
398
398
|
route("POST", "/requests/:requestId/relaunch", (ctx, { user, params }) => ({ body: relaunchRequest(ctx.store, user.id, params.requestId) }));
|
|
399
|
-
route("POST", "/requests/:requestId/undo", (ctx, { user, params }) => ({ body: undoRequest(ctx.store, user.id, params.requestId) }));
|
|
399
|
+
route("POST", "/requests/:requestId/undo", (ctx, { user, params }) => ({ body: undoRequest(ctx.store, ctx.attachments, user.id, params.requestId) }));
|
|
400
400
|
route("POST", "/requests/:requestId/suites", (ctx, { user, request, params }) => ({
|
|
401
401
|
body: createSuite(ctx.store, user.id, params.requestId, parseBody(CreateSuiteSchema, request.body).text),
|
|
402
402
|
}));
|
|
403
403
|
route("PUT", "/follow-ups/:followUpId", (ctx, { user, request, params }) => ({
|
|
404
404
|
body: setFollowUpDone(ctx.store, user.id, params.followUpId, parseBody(SetFollowUpDoneSchema, request.body).done),
|
|
405
405
|
}));
|
|
406
|
-
route("POST", "/agent-actions/:actionId/undo", (ctx, { user, params }) => ({ body: undoAction(ctx.store, user.id, params.actionId) }));
|
|
406
|
+
route("POST", "/agent-actions/:actionId/undo", (ctx, { user, params }) => ({ body: undoAction(ctx.store, ctx.attachments, user.id, params.actionId) }));
|
|
407
407
|
route("GET", "/tasks/:taskId/history", (ctx, { user, params }) => ({ body: listTaskHistory(ctx.store, user.id, params.taskId) }));
|
|
408
408
|
route("POST", "/tasks/:taskId/restore", (ctx, { user, params }) => ({ body: restoreDeletedTask(ctx.store, user.id, params.taskId) }));
|
|
409
409
|
route("GET", "/spaces/:spaceId/history", (ctx, { user, request, params }) => {
|
package/dist/src/mcp/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { z } from "zod";
|
|
2
|
-
import { type AgentEnvelope, type WaitRequestsData } from "../../shared/schemas/agent-tools.schema.js";
|
|
3
|
-
import type
|
|
2
|
+
import { type AgentEnvelope, type AgentImageContent, type WaitRequestsData } from "../../shared/schemas/agent-tools.schema.js";
|
|
3
|
+
import { type ToolHttpRequest } from "./tools.js";
|
|
4
4
|
/**
|
|
5
5
|
* Client HTTP de l'API agent du site : seul point de sortie réseau du mode
|
|
6
6
|
* MCP. Chaque appel porte le jeton dans `Authorization: Bearer`.
|
|
@@ -20,8 +20,11 @@ export interface SiteConnection {
|
|
|
20
20
|
export declare class OrganizerSiteClient {
|
|
21
21
|
private readonly connection;
|
|
22
22
|
constructor(connection: SiteConnection);
|
|
23
|
-
/** Exécute la requête d'un outil et renvoie le texte rédigé pour l'agent. */
|
|
24
|
-
call(request: ToolHttpRequest): Promise<
|
|
23
|
+
/** Exécute la requête d'un outil et renvoie le texte rédigé pour l'agent, avec les images à lui montrer. */
|
|
24
|
+
call(request: ToolHttpRequest): Promise<{
|
|
25
|
+
text: string;
|
|
26
|
+
images: AgentImageContent[];
|
|
27
|
+
}>;
|
|
25
28
|
/**
|
|
26
29
|
* Attente longue des demandes qui passent en attente (`GET requests/wait`) ;
|
|
27
30
|
* le délai de l'appel couvre la durée de l'attente.
|
package/dist/src/mcp/client.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { AgentEnvelopeSchema, AgentErrorSchema, WaitRequestsDataSchema } from "../../shared/schemas/agent-tools.schema.js";
|
|
2
|
+
import { ToolArgumentError } from "./tools.js";
|
|
3
|
+
import { LocalFileError, readLocalUpload } from "./upload.js";
|
|
2
4
|
/**
|
|
3
5
|
* Client HTTP de l'API agent du site : seul point de sortie réseau du mode
|
|
4
6
|
* MCP. Chaque appel porte le jeton dans `Authorization: Bearer`.
|
|
@@ -26,14 +28,38 @@ function redirectTarget(response, requestUrl) {
|
|
|
26
28
|
return location;
|
|
27
29
|
}
|
|
28
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Formulaire multipart d'un envoi de fichier : le fichier local dans le champ
|
|
33
|
+
* `file`, chaque autre argument dans un champ texte.
|
|
34
|
+
*/
|
|
35
|
+
async function uploadForm(file, fields) {
|
|
36
|
+
let upload;
|
|
37
|
+
try {
|
|
38
|
+
upload = await readLocalUpload(file.path, file.name);
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
if (err instanceof LocalFileError)
|
|
42
|
+
throw new ToolArgumentError(err.message);
|
|
43
|
+
throw err;
|
|
44
|
+
}
|
|
45
|
+
const form = new FormData();
|
|
46
|
+
for (const [name, value] of Object.entries(fields)) {
|
|
47
|
+
if (value === undefined || value === null)
|
|
48
|
+
continue;
|
|
49
|
+
form.set(name, typeof value === "string" ? value : JSON.stringify(value));
|
|
50
|
+
}
|
|
51
|
+
form.set("file", new Blob([new Uint8Array(upload.content)], { type: upload.mime }), upload.filename);
|
|
52
|
+
return form;
|
|
53
|
+
}
|
|
29
54
|
export class OrganizerSiteClient {
|
|
30
55
|
connection;
|
|
31
56
|
constructor(connection) {
|
|
32
57
|
this.connection = connection;
|
|
33
58
|
}
|
|
34
|
-
/** Exécute la requête d'un outil et renvoie le texte rédigé pour l'agent. */
|
|
59
|
+
/** Exécute la requête d'un outil et renvoie le texte rédigé pour l'agent, avec les images à lui montrer. */
|
|
35
60
|
async call(request) {
|
|
36
|
-
|
|
61
|
+
const envelope = await this.envelope(request);
|
|
62
|
+
return { text: envelope.text, images: envelope.images ?? [] };
|
|
37
63
|
}
|
|
38
64
|
/**
|
|
39
65
|
* Attente longue des demandes qui passent en attente (`GET requests/wait`) ;
|
|
@@ -61,6 +87,7 @@ export class OrganizerSiteClient {
|
|
|
61
87
|
const url = new URL(`${this.connection.url}/api/agent/${request.path}`);
|
|
62
88
|
for (const [name, value] of Object.entries(request.query))
|
|
63
89
|
url.searchParams.set(name, value);
|
|
90
|
+
const body = request.file ? await uploadForm(request.file, request.body ?? {}) : request.body === undefined ? undefined : JSON.stringify(request.body);
|
|
64
91
|
let response;
|
|
65
92
|
try {
|
|
66
93
|
response = await fetch(url, {
|
|
@@ -68,9 +95,9 @@ export class OrganizerSiteClient {
|
|
|
68
95
|
headers: {
|
|
69
96
|
authorization: `Bearer ${this.connection.token}`,
|
|
70
97
|
accept: "application/json",
|
|
71
|
-
...(
|
|
98
|
+
...(typeof body === "string" ? { "content-type": "application/json" } : {}),
|
|
72
99
|
},
|
|
73
|
-
body
|
|
100
|
+
body,
|
|
74
101
|
// Une redirection n'est jamais suivie : le jeton ne part que vers ORGANIZER_URL.
|
|
75
102
|
redirect: "manual",
|
|
76
103
|
signal: AbortSignal.timeout(timeoutMs),
|
package/dist/src/mcp/start.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type SiteConnection } from "./client.js";
|
|
2
2
|
/** Présentation du serveur transmise au client MCP : concepts et déroulé. */
|
|
3
|
-
export declare const INSTRUCTIONS = "mcp-organizer connects you to an organizer site: a multi-user task manager where people organize tasks in a web app and queue requests for the AI. You, the connected agent, process those requests when the user asks you to. The site never calls an LLM: you are the intelligence.\n\nYour token covers exactly one space, with the rights of the user who created the token. Every tool works on that space.\n\nConcepts:\n- A **space** holds tasks, an idea box, notes and reference documents. A user's **personal space** is private; a **shared space** has one owner and members.\n- A **task** has a title, a markdown description, a status (todo, doing, review, done), a priority (low, medium, high, critical), assignees and tags. Tasks nest on two levels: task > sub-task > sub-sub-task. A task is either standard (with a checklist) or a test (with checkpoints that each tester marks ok, ko, blocked or untested). Any task can also carry **questions** you ask the members to settle a point: options to choose from (one, or several), each with a markdown detail, plus a free answer. The members answer on the site; an answer does not notify you. You read the answers with get_task, and act on them only when a member asks you to, in a message or in a comment mentioning @agent.\n- A task has **attachments** (files the members upload), listed by get_task with their id. Members paste screenshots into descriptions, comments and checkpoint comments: such an image is an attachment of the task, referenced in the text as ``, and get_task flags the comments and checkpoint comments that contain one. You cannot open the image: rely on the surrounding text, and ask its author in a comment or your reply when you need to know what it shows.\n- A **note** is a markdown draft a member writes in the space to mature a thought over several sessions. Notes never reach your queue and writing one does not notify you: read them only when a member asks you to, with get_note and search_notes (read-only). A text refers to a note by a link ending in `#/notes/<id>`; when a request links notes, claim_request shows them in full. \"Envoyer \u00E0 l'agent\" on a note queues a message that links it: process the note as that message asks (create or update tasks, ideas\u2026).\n- A **document** is a reference file a member uploads to the space (a report on the project, a specification, a data export\u2026) so that your decisions match the real state of the project. claim_request and get_context list the documents with their description; read the ones that help the request with get_document (read-only, in parts for long files). You read text files (txt, md, csv, json, yaml, xml\u2026) and the text of Word files (.docx); you cannot read PDF files or images, only their name and description: ask a member for a text, markdown or Word version when you need their content.\n- A **request** is something a member of your space asked the AI: an idea, a remark, a test review, a message or an idea promotion. It is pending, then processing once you claim it (only your token can then act for it), then done (with your reply and the points left to its author) or failed (with the reason). The points left to the author are checkboxes the members tick off. A **follow-up** is a message a member sends from a handled request: claim_request shows that original request, your reply and its points with their ids, and check_follow_ups ticks off the points the follow-up settles. A member can also hand a request to you by mentioning @agent in a comment of a task: claim_request then shows the task's thread, and complete_request posts your reply as a comment right after theirs.\n- A **batch** is the set of actions you perform for one request. Every action is logged with its before and after state and with your token, and users can undo one action or the whole batch.\n- The **history** of the space records every event, by the members and by you: tasks created, changed (with before and after values) or deleted, checklist items, ideas, members, notes and documents (comments keep their own thread). Members read it on the site and restore an old version of a task, or a deleted task, from there. Read it with get_history when a member asks who changed something or what happened to a task.\n- A **direct action** is a write you make without request_id, when your user asks you directly (in their editor, for example) rather than through a request: it is done in the name of your token's owner and forms its own batch, listed among the requests of the space as a direct action and undoable like any other. The site runner never acts directly: it always passes the request_id of the request it processes.\n- A **view** is a tab of a member's dashboard: a layout (kanban, list, matrix), groupings by status or priority, and filters on status, priority, assignees, tags and task type (standard or test). Each member has their own views in each space.\n- A **timer** measures the time a member spends on a task: a free timer, or a pomodoro that alternates work phases and breaks (default 25 / 5 / 15 min, long break after 4 cycles). Each member has their own timer on a task, only one runs at a time, and the site's clock counts it; only the work phases of a pomodoro count. The time spent on a task is the sum of the sessions of all members: read it with get_task_time. When a member asks you to measure their time, call start_timer (and stop_timer to end it): you act on the timers of the author of the request, like their views.\n- The **scope** of your work is the space of your token: you see and process the requests of all its members, and you never act outside it. You change the views and timers of the author of the request you process, and nobody else's: only when the author owns your token, or when you are the site runner. A direct action on views or timers changes those of your token's owner.\n\nWork loop, when the user asks you to process the queue:\n1. list_requests to see the pending requests of your space.\n2. claim_request on the oldest one: it becomes processing for you and you get its context (text, author, context task, for a message the previous exchanges of its author, task tree, members, recent ideas, reference documents), along with the custom instructions of the site and of the space, which you follow. get_context shows the space at any time.\n3. Read what you need with get_task and search_tasks, with get_history to know who changed what, with get_note for a note the request or a task links, and with get_document for a reference document that helps the request.\n4. Act with create_task, update_task, set_assignees, set_tags, edit_checklist, edit_questions, add_comment, create_idea, update_idea, promote_idea, with list_views, create_view, update_view, delete_view when the author asks how their board should look, with start_timer and stop_timer when the author asks to measure their time on a task, and with check_follow_ups for a follow-up \u2014 always passing the request_id. Each write is one undoable action of the batch.\n5. complete_request with a short reply in the author's language and, in follow_ups, every point the author still has to handle (or fail_request with the reason), then go back to step 1 until no request is pending.\nWhen the queue is empty, tell the user.\n\nDirect work, when the user asks you to change the space outside any request: read with get_context, get_task and search_tasks, then call the write tools without request_id. Do not claim, complete or fail anything: there is no request to close. When your user still has points to handle afterwards, leave them with report_direct.\n\nNotifications: call enable_notifications once at the start of the session and arm the watcher it hands you with Monitor, whatever the command (behind mcp-http-gateway, the gateway relay answers in place of this server and gives its own watcher command). Each request that becomes pending in your space then arrives on its own as one line (kind, author, excerpt, request id), even while you are idle: process it with the work loop above, starting with claim_request. The host stops that watcher after 30 minutes at most: each time it tells you the watcher expired, re-arm it at once with the same Monitor call; otherwise notifications stop for good. A line \"notifications stopped\" means the site refused the token, and a line \"[gateway-watch] \u2026 la veille \u00E9choue\" means the gateway watcher keeps failing: tell the user. wait_for_requests is the waiting tool of the watcher: you do not need to call it.\n\nHow to handle each kind of request:\n- **idea**: classify it. If it belongs to an existing task or sub-task, attach it there (sub-task, checklist item or comment). If it is actionable and important enough, create a task (or sub-task) with a fitting priority. Otherwise, put it in the idea box with create_idea. Prefer existing tasks over duplicates.\n- **test_review**: feed the tester's findings back into the existing tasks (status, checklist, comments, priority of the affected tasks), or create a task for each problem that has none.\n- **remark** and **message**: do whatever is useful \u2014 answer, update or create tasks, comment \u2014 and say what you did in the reply.\n- **idea_promotion**: turn the context idea into a well-formed task with promote_idea.\n\nRules: write titles, descriptions and replies in the language of the users; keep the reply short and factual (markdown is rendered); put anything the members are meant to copy and paste (a command, code, a prompt, an identifier, a URL to reuse) in a fenced markdown code block, which the site shows with a Copy button; never bury in the reply something the author must act on: it belongs in follow_ups. Errors tell you what to do next; an error about the token (missing, revoked, expired, owner no longer a member) cannot be fixed by retrying: tell the user.";
|
|
3
|
+
export declare const INSTRUCTIONS = "mcp-organizer connects you to an organizer site: a multi-user task manager where people organize tasks in a web app and queue requests for the AI. You, the connected agent, process those requests when the user asks you to. The site never calls an LLM: you are the intelligence.\n\nYour token covers exactly one space, with the rights of the user who created the token. Every tool works on that space.\n\nConcepts:\n- A **space** holds tasks, an idea box, notes and reference documents. A user's **personal space** is private; a **shared space** has one owner and members.\n- A **task** has a title, a markdown description, a status (todo, doing, review, done), a priority (low, medium, high, critical), assignees and tags. Tasks nest on two levels: task > sub-task > sub-sub-task. A task is either standard (with a checklist) or a test (with checkpoints that each tester marks ok, ko, blocked or untested). Any task can also carry **questions** you ask the members to settle a point: options to choose from (one, or several), each with a markdown detail, plus a free answer. The members answer on the site; an answer does not notify you. You read the answers with get_task, and act on them only when a member asks you to, in a message or in a comment mentioning @agent.\n- A task has **attachments** (files the members upload), listed by get_task with their id. Members paste screenshots into descriptions, comments and checkpoint comments: such an image is an attachment of the task, referenced in the text as ``, and get_task flags the comments and checkpoint comments that contain one. Open with get_attachment the images and PDF files that matter for the request \u2014 a screenshot attached to a failed checkpoint, an image cited in a comment mentioning @agent, a PDF specification: you see an image as it is, and read the text of a PDF (a scanned PDF without a text layer is reported as such). You can attach a file yourself with add_attachment \u2014 a screenshot you took during a test, an export or a report you generated: give the absolute path of the file on your machine; this server reads and uploads it, so its content never goes through you. Pass comment to post it in a comment (an image shows as a thumbnail) or append_to_description to reference it in the description.\n- A **note** is a markdown draft a member writes in the space to mature a thought over several sessions. Notes never reach your queue and writing one does not notify you: read them only when a member asks you to, with get_note and search_notes (read-only). A text refers to a note by a link ending in `#/notes/<id>`; when a request links notes, claim_request shows them in full. \"Envoyer \u00E0 l'agent\" on a note queues a message that links it: process the note as that message asks (create or update tasks, ideas\u2026).\n- A **document** is a reference file a member uploads to the space (a report on the project, a specification, a data export\u2026) so that your decisions match the real state of the project. claim_request and get_context list the documents with their description; read the ones that help the request with get_document (read-only, in parts for long files). You read text files (txt, md, csv, json, yaml, xml\u2026) and the text of Word files (.docx) and PDF files; an image comes as the image itself, which you see.\n- A **request** is something a member of your space asked the AI: an idea, a remark, a test review, a message or an idea promotion. It is pending, then processing once you claim it (only your token can then act for it), then done (with your reply and the points left to its author) or failed (with the reason). The points left to the author are checkboxes the members tick off. A **follow-up** is a message a member sends from a handled request: claim_request shows that original request, your reply and its points with their ids, and check_follow_ups ticks off the points the follow-up settles. A member can also hand a request to you by mentioning @agent in a comment of a task: claim_request then shows the task's thread, and complete_request posts your reply as a comment right after theirs.\n- A **batch** is the set of actions you perform for one request. Every action is logged with its before and after state and with your token, and users can undo one action or the whole batch.\n- The **history** of the space records every event, by the members and by you: tasks created, changed (with before and after values) or deleted, checklist items, ideas, members, notes and documents (comments keep their own thread). Members read it on the site and restore an old version of a task, or a deleted task, from there. Read it with get_history when a member asks who changed something or what happened to a task.\n- A **direct action** is a write you make without request_id, when your user asks you directly (in their editor, for example) rather than through a request: it is done in the name of your token's owner and forms its own batch, listed among the requests of the space as a direct action and undoable like any other. The site runner never acts directly: it always passes the request_id of the request it processes.\n- A **view** is a tab of a member's dashboard: a layout (kanban, list, matrix), groupings by status or priority, and filters on status, priority, assignees, tags and task type (standard or test). Each member has their own views in each space.\n- A **timer** measures the time a member spends on a task: a free timer, or a pomodoro that alternates work phases and breaks (default 25 / 5 / 15 min, long break after 4 cycles). Each member has their own timer on a task, only one runs at a time, and the site's clock counts it; only the work phases of a pomodoro count. The time spent on a task is the sum of the sessions of all members: read it with get_task_time. When a member asks you to measure their time, call start_timer (and stop_timer to end it): you act on the timers of the author of the request, like their views.\n- The **scope** of your work is the space of your token: you see and process the requests of all its members, and you never act outside it. You change the views and timers of the author of the request you process, and nobody else's: only when the author owns your token, or when you are the site runner. A direct action on views or timers changes those of your token's owner.\n\nWork loop, when the user asks you to process the queue:\n1. list_requests to see the pending requests of your space.\n2. claim_request on the oldest one: it becomes processing for you and you get its context (text, author, context task, for a message the previous exchanges of its author, task tree, members, recent ideas, reference documents), along with the custom instructions of the site and of the space, which you follow. get_context shows the space at any time.\n3. Read what you need with get_task and search_tasks, with get_attachment for an image or a file attached to a task, with get_history to know who changed what, with get_note for a note the request or a task links, and with get_document for a reference document that helps the request.\n4. Act with create_task, update_task, set_assignees, set_tags, edit_checklist, edit_questions, add_comment, add_attachment, create_idea, update_idea, promote_idea, with list_views, create_view, update_view, delete_view when the author asks how their board should look, with start_timer and stop_timer when the author asks to measure their time on a task, and with check_follow_ups for a follow-up \u2014 always passing the request_id. Each write is one undoable action of the batch.\n5. complete_request with a short reply in the author's language and, in follow_ups, every point the author still has to handle (or fail_request with the reason), then go back to step 1 until no request is pending.\nWhen the queue is empty, tell the user.\n\nDirect work, when the user asks you to change the space outside any request: read with get_context, get_task and search_tasks, then call the write tools without request_id. Do not claim, complete or fail anything: there is no request to close. When your user still has points to handle afterwards, leave them with report_direct.\n\nNotifications: call enable_notifications once at the start of the session and arm the watcher it hands you with Monitor, whatever the command (behind mcp-http-gateway, the gateway relay answers in place of this server and gives its own watcher command). Each request that becomes pending in your space then arrives on its own as one line (kind, author, excerpt, request id), even while you are idle: process it with the work loop above, starting with claim_request. The host stops that watcher after 30 minutes at most: each time it tells you the watcher expired, re-arm it at once with the same Monitor call; otherwise notifications stop for good. A line \"notifications stopped\" means the site refused the token, and a line \"[gateway-watch] \u2026 la veille \u00E9choue\" means the gateway watcher keeps failing: tell the user. wait_for_requests is the waiting tool of the watcher: you do not need to call it.\n\nHow to handle each kind of request:\n- **idea**: classify it. If it belongs to an existing task or sub-task, attach it there (sub-task, checklist item or comment). If it is actionable and important enough, create a task (or sub-task) with a fitting priority. Otherwise, put it in the idea box with create_idea. Prefer existing tasks over duplicates.\n- **test_review**: feed the tester's findings back into the existing tasks (status, checklist, comments, priority of the affected tasks), or create a task for each problem that has none.\n- **remark** and **message**: do whatever is useful \u2014 answer, update or create tasks, comment \u2014 and say what you did in the reply.\n- **idea_promotion**: turn the context idea into a well-formed task with promote_idea.\n\nRules: write titles, descriptions and replies in the language of the users; keep the reply short and factual (markdown is rendered); put anything the members are meant to copy and paste (a command, code, a prompt, an identifier, a URL to reuse) in a fenced markdown code block, which the site shows with a Copy button; never bury in the reply something the author must act on: it belongs in follow_ups. Errors tell you what to do next; an error about the token (missing, revoked, expired, owner no longer a member) cannot be fixed by retrying: tell the user.";
|
|
4
4
|
/**
|
|
5
5
|
* Connexion au site d'après `ORGANIZER_URL` et `ORGANIZER_TOKEN` ; une valeur
|
|
6
6
|
* absente ou invalide, ou une URL http vers une autre machine, est une `ConfigError`.
|
package/dist/src/mcp/start.js
CHANGED
|
@@ -16,9 +16,9 @@ Your token covers exactly one space, with the rights of the user who created the
|
|
|
16
16
|
Concepts:
|
|
17
17
|
- A **space** holds tasks, an idea box, notes and reference documents. A user's **personal space** is private; a **shared space** has one owner and members.
|
|
18
18
|
- A **task** has a title, a markdown description, a status (todo, doing, review, done), a priority (low, medium, high, critical), assignees and tags. Tasks nest on two levels: task > sub-task > sub-sub-task. A task is either standard (with a checklist) or a test (with checkpoints that each tester marks ok, ko, blocked or untested). Any task can also carry **questions** you ask the members to settle a point: options to choose from (one, or several), each with a markdown detail, plus a free answer. The members answer on the site; an answer does not notify you. You read the answers with get_task, and act on them only when a member asks you to, in a message or in a comment mentioning @agent.
|
|
19
|
-
- A task has **attachments** (files the members upload), listed by get_task with their id. Members paste screenshots into descriptions, comments and checkpoint comments: such an image is an attachment of the task, referenced in the text as \`\`, and get_task flags the comments and checkpoint comments that contain one.
|
|
19
|
+
- A task has **attachments** (files the members upload), listed by get_task with their id. Members paste screenshots into descriptions, comments and checkpoint comments: such an image is an attachment of the task, referenced in the text as \`\`, and get_task flags the comments and checkpoint comments that contain one. Open with get_attachment the images and PDF files that matter for the request — a screenshot attached to a failed checkpoint, an image cited in a comment mentioning @agent, a PDF specification: you see an image as it is, and read the text of a PDF (a scanned PDF without a text layer is reported as such). You can attach a file yourself with add_attachment — a screenshot you took during a test, an export or a report you generated: give the absolute path of the file on your machine; this server reads and uploads it, so its content never goes through you. Pass comment to post it in a comment (an image shows as a thumbnail) or append_to_description to reference it in the description.
|
|
20
20
|
- A **note** is a markdown draft a member writes in the space to mature a thought over several sessions. Notes never reach your queue and writing one does not notify you: read them only when a member asks you to, with get_note and search_notes (read-only). A text refers to a note by a link ending in \`#/notes/<id>\`; when a request links notes, claim_request shows them in full. "Envoyer à l'agent" on a note queues a message that links it: process the note as that message asks (create or update tasks, ideas…).
|
|
21
|
-
- A **document** is a reference file a member uploads to the space (a report on the project, a specification, a data export…) so that your decisions match the real state of the project. claim_request and get_context list the documents with their description; read the ones that help the request with get_document (read-only, in parts for long files). You read text files (txt, md, csv, json, yaml, xml…) and the text of Word files (.docx)
|
|
21
|
+
- A **document** is a reference file a member uploads to the space (a report on the project, a specification, a data export…) so that your decisions match the real state of the project. claim_request and get_context list the documents with their description; read the ones that help the request with get_document (read-only, in parts for long files). You read text files (txt, md, csv, json, yaml, xml…) and the text of Word files (.docx) and PDF files; an image comes as the image itself, which you see.
|
|
22
22
|
- A **request** is something a member of your space asked the AI: an idea, a remark, a test review, a message or an idea promotion. It is pending, then processing once you claim it (only your token can then act for it), then done (with your reply and the points left to its author) or failed (with the reason). The points left to the author are checkboxes the members tick off. A **follow-up** is a message a member sends from a handled request: claim_request shows that original request, your reply and its points with their ids, and check_follow_ups ticks off the points the follow-up settles. A member can also hand a request to you by mentioning @agent in a comment of a task: claim_request then shows the task's thread, and complete_request posts your reply as a comment right after theirs.
|
|
23
23
|
- A **batch** is the set of actions you perform for one request. Every action is logged with its before and after state and with your token, and users can undo one action or the whole batch.
|
|
24
24
|
- The **history** of the space records every event, by the members and by you: tasks created, changed (with before and after values) or deleted, checklist items, ideas, members, notes and documents (comments keep their own thread). Members read it on the site and restore an old version of a task, or a deleted task, from there. Read it with get_history when a member asks who changed something or what happened to a task.
|
|
@@ -30,8 +30,8 @@ Concepts:
|
|
|
30
30
|
Work loop, when the user asks you to process the queue:
|
|
31
31
|
1. list_requests to see the pending requests of your space.
|
|
32
32
|
2. claim_request on the oldest one: it becomes processing for you and you get its context (text, author, context task, for a message the previous exchanges of its author, task tree, members, recent ideas, reference documents), along with the custom instructions of the site and of the space, which you follow. get_context shows the space at any time.
|
|
33
|
-
3. Read what you need with get_task and search_tasks, with get_history to know who changed what, with get_note for a note the request or a task links, and with get_document for a reference document that helps the request.
|
|
34
|
-
4. Act with create_task, update_task, set_assignees, set_tags, edit_checklist, edit_questions, add_comment, create_idea, update_idea, promote_idea, with list_views, create_view, update_view, delete_view when the author asks how their board should look, with start_timer and stop_timer when the author asks to measure their time on a task, and with check_follow_ups for a follow-up — always passing the request_id. Each write is one undoable action of the batch.
|
|
33
|
+
3. Read what you need with get_task and search_tasks, with get_attachment for an image or a file attached to a task, with get_history to know who changed what, with get_note for a note the request or a task links, and with get_document for a reference document that helps the request.
|
|
34
|
+
4. Act with create_task, update_task, set_assignees, set_tags, edit_checklist, edit_questions, add_comment, add_attachment, create_idea, update_idea, promote_idea, with list_views, create_view, update_view, delete_view when the author asks how their board should look, with start_timer and stop_timer when the author asks to measure their time on a task, and with check_follow_ups for a follow-up — always passing the request_id. Each write is one undoable action of the batch.
|
|
35
35
|
5. complete_request with a short reply in the author's language and, in follow_ups, every point the author still has to handle (or fail_request with the reason), then go back to step 1 until no request is pending.
|
|
36
36
|
When the queue is empty, tell the user.
|
|
37
37
|
|
|
@@ -117,8 +117,8 @@ export async function runMcpMode() {
|
|
|
117
117
|
if (!tool)
|
|
118
118
|
return errorResult(`Unknown tool "${name}". Call tools/list to get the available tools.`);
|
|
119
119
|
try {
|
|
120
|
-
const text = await client.call(toolHttpRequest(tool, (args ?? {})));
|
|
121
|
-
return { content: [{ type: "text", text }] };
|
|
120
|
+
const { text, images } = await client.call(toolHttpRequest(tool, (args ?? {})));
|
|
121
|
+
return { content: [{ type: "text", text }, ...images.map((image) => ({ type: "image", data: image.data, mimeType: image.mimeType }))] };
|
|
122
122
|
}
|
|
123
123
|
catch (error) {
|
|
124
124
|
if (!(error instanceof SiteError) && !(error instanceof ToolArgumentError))
|
package/dist/src/mcp/tools.d.ts
CHANGED
|
@@ -22,6 +22,12 @@ export interface AgentTool {
|
|
|
22
22
|
* encodé ; les autres arguments forment la requête d'un GET, le corps JSON sinon.
|
|
23
23
|
*/
|
|
24
24
|
path: string;
|
|
25
|
+
/**
|
|
26
|
+
* Envoi d'un fichier local : l'argument `path` désigne le fichier, que le
|
|
27
|
+
* mode MCP lit et envoie en multipart avec les autres arguments ; `name`
|
|
28
|
+
* remplace son nom.
|
|
29
|
+
*/
|
|
30
|
+
upload?: true;
|
|
25
31
|
}
|
|
26
32
|
/** Requête HTTP d'un appel d'outil. */
|
|
27
33
|
export interface ToolHttpRequest {
|
|
@@ -30,6 +36,11 @@ export interface ToolHttpRequest {
|
|
|
30
36
|
path: string;
|
|
31
37
|
query: Record<string, string>;
|
|
32
38
|
body: Record<string, unknown> | undefined;
|
|
39
|
+
/** Fichier local à envoyer en multipart (champ `file`), pour un outil d'envoi. */
|
|
40
|
+
file?: {
|
|
41
|
+
path: string;
|
|
42
|
+
name?: string;
|
|
43
|
+
};
|
|
33
44
|
}
|
|
34
45
|
/** Argument d'appel d'outil inutilisable pour former la requête. */
|
|
35
46
|
export declare class ToolArgumentError extends Error {
|