@imenam/mcp-organizer 1.0.20 → 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 +110 -32
- package/dist/shared/logic/attachments.d.ts +28 -0
- package/dist/shared/logic/attachments.js +52 -0
- package/dist/shared/logic/documents.d.ts +20 -0
- package/dist/shared/logic/documents.js +33 -0
- package/dist/shared/logic/line-diff.d.ts +13 -0
- package/dist/shared/logic/line-diff.js +66 -0
- package/dist/shared/logic/notes.d.ts +12 -0
- package/dist/shared/logic/notes.js +23 -0
- package/dist/shared/logic/timer.d.ts +69 -0
- package/dist/shared/logic/timer.js +87 -0
- package/dist/shared/schemas/agent-api.schema.d.ts +10 -29
- package/dist/shared/schemas/agent-api.schema.js +4 -15
- package/dist/shared/schemas/agent-tools.schema.d.ts +648 -2
- package/dist/shared/schemas/agent-tools.schema.js +158 -8
- package/dist/shared/schemas/api.schema.d.ts +7 -0
- package/dist/shared/schemas/api.schema.js +6 -0
- package/dist/shared/schemas/documents-api.schema.d.ts +47 -0
- package/dist/shared/schemas/documents-api.schema.js +36 -0
- package/dist/shared/schemas/entities.schema.d.ts +107 -54
- package/dist/shared/schemas/entities.schema.js +81 -10
- package/dist/shared/schemas/enums.schema.d.ts +19 -3
- package/dist/shared/schemas/enums.schema.js +8 -2
- package/dist/shared/schemas/gui-api.schema.d.ts +1 -0
- package/dist/shared/schemas/gui-api.schema.js +2 -0
- package/dist/shared/schemas/history-api.schema.d.ts +961 -0
- package/dist/shared/schemas/history-api.schema.js +104 -0
- package/dist/shared/schemas/notes-api.schema.d.ts +54 -0
- package/dist/shared/schemas/notes-api.schema.js +38 -0
- package/dist/shared/schemas/notifications-api.schema.d.ts +12 -0
- package/dist/shared/schemas/notifications-api.schema.js +4 -1
- package/dist/shared/schemas/tasks-api.schema.d.ts +39 -0
- package/dist/shared/schemas/tasks-api.schema.js +5 -0
- package/dist/shared/schemas/timers-api.schema.d.ts +119 -0
- package/dist/shared/schemas/timers-api.schema.js +44 -0
- package/dist/shared/schemas/views-api.schema.d.ts +16 -0
- package/dist/shared/schemas/views-api.schema.js +4 -2
- package/dist/src/agent-api/attachments.d.ts +2 -0
- package/dist/src/agent-api/attachments.js +96 -0
- package/dist/src/agent-api/documents.d.ts +3 -0
- package/dist/src/agent-api/documents.js +42 -0
- package/dist/src/agent-api/files.d.ts +35 -0
- package/dist/src/agent-api/files.js +86 -0
- package/dist/src/agent-api/history.d.ts +3 -0
- package/dist/src/agent-api/history.js +103 -0
- package/dist/src/agent-api/notes.d.ts +3 -0
- package/dist/src/agent-api/notes.js +39 -0
- package/dist/src/agent-api/requests.js +2 -1
- package/dist/src/agent-api/router.d.ts +2 -2
- package/dist/src/agent-api/router.js +9 -4
- package/dist/src/agent-api/tasks.js +13 -5
- package/dist/src/agent-api/timers.d.ts +2 -0
- package/dist/src/agent-api/timers.js +170 -0
- package/dist/src/agent-api/types.d.ts +7 -2
- package/dist/src/agent-api/views.js +15 -30
- package/dist/src/cli/backup.js +3 -3
- package/dist/src/core/accounts.d.ts +12 -5
- package/dist/src/core/accounts.js +28 -10
- package/dist/src/core/agent-files.d.ts +41 -0
- package/dist/src/core/agent-files.js +102 -0
- package/dist/src/core/agent.d.ts +29 -3
- package/dist/src/core/agent.js +129 -1
- package/dist/src/core/attachments.d.ts +6 -3
- package/dist/src/core/attachments.js +9 -4
- package/dist/src/core/board-views.js +4 -4
- package/dist/src/core/document-text.d.ts +18 -0
- package/dist/src/core/document-text.js +119 -0
- package/dist/src/core/documents.d.ts +22 -0
- package/dist/src/core/documents.js +167 -0
- package/dist/src/core/history-events.d.ts +34 -0
- package/dist/src/core/history-events.js +236 -0
- package/dist/src/core/history.d.ts +3 -1
- package/dist/src/core/history.js +59 -12
- package/dist/src/core/migrations.js +153 -0
- package/dist/src/core/notes.d.ts +23 -0
- package/dist/src/core/notes.js +78 -0
- package/dist/src/core/notifications.d.ts +48 -5
- package/dist/src/core/notifications.js +209 -33
- package/dist/src/core/password-reset.d.ts +37 -0
- package/dist/src/core/password-reset.js +56 -0
- package/dist/src/core/requests.d.ts +13 -7
- package/dist/src/core/requests.js +26 -14
- package/dist/src/core/snapshots.d.ts +3 -3
- package/dist/src/core/snapshots.js +5 -1
- package/dist/src/core/space-history.d.ts +18 -0
- package/dist/src/core/space-history.js +86 -0
- package/dist/src/core/spaces.d.ts +1 -1
- package/dist/src/core/spaces.js +4 -4
- package/dist/src/core/store.d.ts +154 -11
- package/dist/src/core/store.js +479 -52
- package/dist/src/core/task-history.d.ts +9 -5
- package/dist/src/core/task-history.js +17 -25
- package/dist/src/core/tasks.d.ts +2 -2
- package/dist/src/core/tasks.js +13 -2
- package/dist/src/core/timers.d.ts +33 -0
- package/dist/src/core/timers.js +101 -0
- package/dist/src/core/versions.d.ts +22 -0
- package/dist/src/core/versions.js +106 -0
- package/dist/src/gui-api.d.ts +4 -1
- package/dist/src/gui-api.js +87 -8
- 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 +14 -9
- package/dist/src/mcp/tools.d.ts +11 -0
- package/dist/src/mcp/tools.js +182 -5
- package/dist/src/mcp/upload.d.ts +22 -0
- package/dist/src/mcp/upload.js +79 -0
- package/dist/src/server/app.d.ts +4 -2
- package/dist/src/server/app.js +58 -8
- package/dist/src/server/login-limiter.d.ts +27 -1
- package/dist/src/server/login-limiter.js +31 -1
- package/dist/src/server/start.js +1 -0
- package/gui/dist/assets/index-C1f7hOcM.js +104 -0
- package/gui/dist/assets/index-CfMiwPSL.css +1 -0
- package/gui/dist/index.html +2 -2
- package/package.json +3 -1
- package/gui/dist/assets/index-9c9BlfUi.js +0 -99
- package/gui/dist/assets/index-DH23A5aa.css +0 -1
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 and an idea box. 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 **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- 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 and tags. Each member has their own views in each space.\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 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 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), 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.\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, 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); 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
|
@@ -14,19 +14,24 @@ export const INSTRUCTIONS = `mcp-organizer connects you to an organizer site: a
|
|
|
14
14
|
Your token covers exactly one space, with the rights of the user who created the token. Every tool works on that space.
|
|
15
15
|
|
|
16
16
|
Concepts:
|
|
17
|
-
- A **space** holds tasks
|
|
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. 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
|
+
- 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) and PDF files; an image comes as the image itself, which you see.
|
|
19
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.
|
|
20
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
|
+
- 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.
|
|
21
25
|
- 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.
|
|
22
|
-
- 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 and
|
|
23
|
-
-
|
|
26
|
+
- 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.
|
|
27
|
+
- 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.
|
|
28
|
+
- 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.
|
|
24
29
|
|
|
25
30
|
Work loop, when the user asks you to process the queue:
|
|
26
31
|
1. list_requests to see the pending requests of your space.
|
|
27
|
-
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), along with the custom instructions of the site and of the space, which you follow. get_context shows the space at any time.
|
|
28
|
-
3. Read what you need with get_task and search_tasks.
|
|
29
|
-
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, and with check_follow_ups for a follow-up — always passing the request_id. Each write is one undoable action of the batch.
|
|
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_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.
|
|
30
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.
|
|
31
36
|
When the queue is empty, tell the user.
|
|
32
37
|
|
|
@@ -40,7 +45,7 @@ How to handle each kind of request:
|
|
|
40
45
|
- **remark** and **message**: do whatever is useful — answer, update or create tasks, comment — and say what you did in the reply.
|
|
41
46
|
- **idea_promotion**: turn the context idea into a well-formed task with promote_idea.
|
|
42
47
|
|
|
43
|
-
Rules: write titles, descriptions and replies in the language of the users; keep the reply short and factual (markdown is rendered); 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.`;
|
|
48
|
+
Rules: 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.`;
|
|
44
49
|
/** Hôtes de la machine locale, seuls admis en http. */
|
|
45
50
|
const LOCAL_HOSTNAMES = new Set(["localhost", "127.0.0.1", "[::1]"]);
|
|
46
51
|
/** Variable d'environnement non vide, ou null. */
|
|
@@ -112,8 +117,8 @@ export async function runMcpMode() {
|
|
|
112
117
|
if (!tool)
|
|
113
118
|
return errorResult(`Unknown tool "${name}". Call tools/list to get the available tools.`);
|
|
114
119
|
try {
|
|
115
|
-
const text = await client.call(toolHttpRequest(tool, (args ?? {})));
|
|
116
|
-
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 }))] };
|
|
117
122
|
}
|
|
118
123
|
catch (error) {
|
|
119
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 {
|
package/dist/src/mcp/tools.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { BOARD_GROUPINGS, BOARD_LAYOUTS, REQUEST_STATUSES, TASK_PRIORITIES, TASK_STATUSES, TASK_TYPES } from "../../shared/schemas/enums.schema.js";
|
|
1
|
+
import { BOARD_GROUPINGS, BOARD_LAYOUTS, REQUEST_STATUSES, TASK_PRIORITIES, TASK_STATUSES, TASK_TYPES, TIMER_MODES } from "../../shared/schemas/enums.schema.js";
|
|
2
|
+
import { POMODORO_LIMITS } from "../../shared/logic/timer.js";
|
|
3
|
+
import { HISTORY_CATEGORIES, MAX_HISTORY_PAGE } from "../../shared/schemas/history-api.schema.js";
|
|
2
4
|
import { MAX_BOARD_VIEW_NAME_LENGTH, MAX_QUESTION_LENGTH, MAX_QUESTION_OPTION_DETAIL_LENGTH, MAX_QUESTION_OPTION_LABEL_LENGTH, MAX_QUESTION_OPTIONS, } from "../../shared/schemas/entities.schema.js";
|
|
3
5
|
import { MAX_TAG_LENGTH, MAX_TASK_TITLE_LENGTH } from "../../shared/schemas/tasks-api.schema.js";
|
|
4
6
|
import { MAX_CHECKLIST_ITEM_LENGTH, MAX_CHECKLIST_OPERATIONS, MAX_COMMENT_LENGTH, MAX_FOLLOW_UP_LENGTH, MAX_FOLLOW_UPS, MAX_IDEA_LENGTH, MAX_QUESTION_OPERATIONS, MAX_REASON_LENGTH, MAX_REPLY_LENGTH, MAX_REQUEST_LIST_LIMIT, MAX_SEARCH_LIMIT, } from "../../shared/schemas/agent-tools.schema.js";
|
|
@@ -18,6 +20,10 @@ const VIEW_REQUEST_ID = {
|
|
|
18
20
|
type: "string",
|
|
19
21
|
description: "Id of the request you claimed (status processing): you act on the board views of its author, and every write is recorded in its batch and can be undone by that author. Omit it only when your user asks you directly, outside any request: you then act on the views of your token's owner, each write forming its own batch. The site runner always passes it.",
|
|
20
22
|
};
|
|
23
|
+
const TIMER_REQUEST_ID = {
|
|
24
|
+
type: "string",
|
|
25
|
+
description: "Id of the request you claimed (status processing): you act on the timers of its author, and every change is recorded in its batch and can be undone by that author. Omit it only when your user asks you directly, outside any request: you then act on the timers of your token's owner, each change forming its own batch. The site runner always passes it.",
|
|
26
|
+
};
|
|
21
27
|
const VIEW_ID = { type: "string", description: "Id of a view of the request's author (or of your token's owner), from list_views." };
|
|
22
28
|
/** Réglages d'une vue, communs à create_view et update_view. */
|
|
23
29
|
const VIEW_SETTINGS = {
|
|
@@ -47,6 +53,11 @@ const VIEW_SETTINGS = {
|
|
|
47
53
|
items: { type: "string" },
|
|
48
54
|
description: "Tag names of your space (case-insensitive): the view keeps the tasks that carry at least one of them; empty: every task. A name that is not a tag of your space is refused, with the list of its tags.",
|
|
49
55
|
},
|
|
56
|
+
types: {
|
|
57
|
+
type: "array",
|
|
58
|
+
items: { type: "string", enum: [...TASK_TYPES] },
|
|
59
|
+
description: "Task types kept by the view: standard tasks, test tasks, or both; empty: all types.",
|
|
60
|
+
},
|
|
50
61
|
};
|
|
51
62
|
export const AGENT_TOOLS = [
|
|
52
63
|
{
|
|
@@ -70,7 +81,7 @@ export const AGENT_TOOLS = [
|
|
|
70
81
|
path: "requests/{request_id}/claim",
|
|
71
82
|
definition: {
|
|
72
83
|
name: "claim_request",
|
|
73
|
-
description: "Claim a pending request before working on it: it becomes processing for your token only (no other agent can take it or act for it) and you get its full context — text, author, context task or idea, for a message the previous exchanges of its author (their requests and your replies), the task tree of your space with keys, statuses, priorities and assignees, its members and recent ideas. Pass this request_id to every write tool while you process it.",
|
|
84
|
+
description: "Claim a pending request before working on it: it becomes processing for your token only (no other agent can take it or act for it) and you get its full context — text, author, context task or idea, for a message the previous exchanges of its author (their requests and your replies), the context task's attachments (open them with get_attachment), the task tree of your space with keys, statuses, priorities and assignees, its members and recent ideas. Pass this request_id to every write tool while you process it.",
|
|
74
85
|
inputSchema: {
|
|
75
86
|
type: "object",
|
|
76
87
|
properties: { request_id: { type: "string", description: "Id of a pending request, from list_requests." } },
|
|
@@ -93,7 +104,7 @@ export const AGENT_TOOLS = [
|
|
|
93
104
|
path: "tasks/{task}",
|
|
94
105
|
definition: {
|
|
95
106
|
name: "get_task",
|
|
96
|
-
description: "Read one task of your space in detail: fields, parents, assignees, tags, description, questions with their options and the members' answers (ids needed by edit_questions), checklist items or test checkpoints (with their ids, needed by edit_checklist), sub-tasks, recent comments and attachments. Use it before modifying a task.",
|
|
107
|
+
description: "Read one task of your space in detail: fields, parents, assignees, tags, description, questions with their options and the members' answers (ids needed by edit_questions), checklist items or test checkpoints (with their ids, needed by edit_checklist), sub-tasks, recent comments and attachments with their id (open them with get_attachment). Use it before modifying a task.",
|
|
97
108
|
inputSchema: { type: "object", properties: { task: TASK_REF }, required: ["task"], additionalProperties: false },
|
|
98
109
|
},
|
|
99
110
|
},
|
|
@@ -117,6 +128,98 @@ export const AGENT_TOOLS = [
|
|
|
117
128
|
},
|
|
118
129
|
},
|
|
119
130
|
},
|
|
131
|
+
{
|
|
132
|
+
method: "GET",
|
|
133
|
+
path: "notes",
|
|
134
|
+
definition: {
|
|
135
|
+
name: "search_notes",
|
|
136
|
+
description: "Search the notes of your space by words of their title or content (most recently updated first). Notes are the members' drafts: they never reach your queue. Read them only when a member asks you to, in a request, a comment or directly.",
|
|
137
|
+
inputSchema: {
|
|
138
|
+
type: "object",
|
|
139
|
+
properties: {
|
|
140
|
+
query: { type: "string", description: "Words to look for (case-insensitive, all must match). Omit to list every note." },
|
|
141
|
+
limit: { type: "integer", minimum: 1, maximum: MAX_SEARCH_LIMIT, description: "Maximum number of results. Default: 30." },
|
|
142
|
+
},
|
|
143
|
+
additionalProperties: false,
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
method: "GET",
|
|
149
|
+
path: "notes/{note}",
|
|
150
|
+
definition: {
|
|
151
|
+
name: "get_note",
|
|
152
|
+
description: "Read one note of your space in full: title, author, dates and markdown content. A text refers to a note by a link ending in #/notes/<id>. Use it when a member asks you to process a note, or when a request, a task or a comment you work on links one.",
|
|
153
|
+
inputSchema: {
|
|
154
|
+
type: "object",
|
|
155
|
+
properties: { note: { type: "string", description: "Note of your space: its id, or a link that contains #/notes/<id>." } },
|
|
156
|
+
required: ["note"],
|
|
157
|
+
additionalProperties: false,
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
method: "GET",
|
|
163
|
+
path: "documents",
|
|
164
|
+
definition: {
|
|
165
|
+
name: "list_documents",
|
|
166
|
+
description: "List the reference documents of your space: files the members upload (reports, specifications, exports…) so you know the real state of their project. Each one comes with its id, file name, description, format, size and version; read one with get_document.",
|
|
167
|
+
inputSchema: { type: "object", properties: {}, additionalProperties: false },
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
method: "GET",
|
|
172
|
+
path: "documents/{document}",
|
|
173
|
+
definition: {
|
|
174
|
+
name: "get_document",
|
|
175
|
+
description: "Read a reference document of your space. Text files (txt, md, csv, json, yaml, xml…) come as they are, Word files (.docx) and PDF files as their extracted text, in parts of 20,000 characters: the result says how many parts there are. An image comes as the image itself, which you see (reduced when it exceeds the limits of the Claude API). A PDF without a text layer (a scan) is reported as such. Read a document when it helps the request you process, for example to align tasks and priorities with a report on the project.",
|
|
176
|
+
inputSchema: {
|
|
177
|
+
type: "object",
|
|
178
|
+
properties: {
|
|
179
|
+
document: { type: "string", description: "Document of your space: its id, or its exact file name." },
|
|
180
|
+
part: { type: "integer", minimum: 1, description: "Part to read, from 1. Default: 1." },
|
|
181
|
+
},
|
|
182
|
+
required: ["document"],
|
|
183
|
+
additionalProperties: false,
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
method: "GET",
|
|
189
|
+
path: "attachments/{attachment}",
|
|
190
|
+
definition: {
|
|
191
|
+
name: "get_attachment",
|
|
192
|
+
description: "Open an attachment of a task of your space. An image comes as the image itself, which you see (reduced when it exceeds the limits of the Claude API); a PDF file, a text file or a Word file (.docx) comes as its extracted text, in parts of 20,000 characters. A PDF without a text layer (a scan) is reported as such. Take the id from get_task or claim_request, or from a reference  in a description, a comment or a checkpoint comment. Open the attachments that matter for the request, for example a screenshot of a failed checkpoint or one cited in a comment mentioning @agent.",
|
|
193
|
+
inputSchema: {
|
|
194
|
+
type: "object",
|
|
195
|
+
properties: {
|
|
196
|
+
attachment: { type: "string", description: "Id of an attachment of a task of your space." },
|
|
197
|
+
part: { type: "integer", minimum: 1, description: "Part of the text to read, from 1. Default: 1." },
|
|
198
|
+
},
|
|
199
|
+
required: ["attachment"],
|
|
200
|
+
additionalProperties: false,
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
method: "GET",
|
|
206
|
+
path: "history",
|
|
207
|
+
definition: {
|
|
208
|
+
name: "get_history",
|
|
209
|
+
description: "Read the history of your space, most recent first: who created, changed or deleted what and when — task fields with their before and after values (status, priority, assignees, tags, description…), checklist items, ideas, members, notes and documents — whether a member or the agent did it. Comments are not part of it. Pass task to read the history of one task, author and category to narrow it. Use it when a member asks who changed something, or when you need to know what happened to a task before acting on it.",
|
|
210
|
+
inputSchema: {
|
|
211
|
+
type: "object",
|
|
212
|
+
properties: {
|
|
213
|
+
task: { type: "string", description: "Task of your space (key like ORG-41, or id): only its events and those of its checklist or checkpoints. Omit for the whole space." },
|
|
214
|
+
author: { type: "string", description: "Member id or e-mail: only what this member did themselves; \"agent\": only what the agent did. Omit for everybody." },
|
|
215
|
+
category: { type: "string", enum: [...HISTORY_CATEGORIES], description: "Kind of events: task (tasks, checklists, checkpoints), idea, member (members and invitations), note or document. Omit for all." },
|
|
216
|
+
before: { type: "integer", minimum: 1, description: "Cursor from a previous call (its \"before\" hint): returns the older events." },
|
|
217
|
+
limit: { type: "integer", minimum: 1, maximum: MAX_HISTORY_PAGE, description: "Maximum number of events. Default: 30." },
|
|
218
|
+
},
|
|
219
|
+
additionalProperties: false,
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
},
|
|
120
223
|
{
|
|
121
224
|
method: "POST",
|
|
122
225
|
path: "tasks",
|
|
@@ -313,6 +416,32 @@ export const AGENT_TOOLS = [
|
|
|
313
416
|
},
|
|
314
417
|
},
|
|
315
418
|
},
|
|
419
|
+
{
|
|
420
|
+
method: "POST",
|
|
421
|
+
path: "tasks/{task}/attachments",
|
|
422
|
+
upload: true,
|
|
423
|
+
definition: {
|
|
424
|
+
name: "add_attachment",
|
|
425
|
+
description: "Attach a local file to a task of your space: a screenshot you took during a test, an export or a report you generated. Give the absolute path of the file on the machine where you run: this MCP server reads it and uploads it to the site itself, so its content never goes through you. Any format, up to 20 MB. To show it to the members, pass comment (a comment posted with the file shown in it: an image as a thumbnail, another file by its name) or append_to_description (the same reference added at the end of the description). Members see the file among the attachments of the task and can undo the upload with the rest of the batch.",
|
|
426
|
+
inputSchema: {
|
|
427
|
+
type: "object",
|
|
428
|
+
properties: {
|
|
429
|
+
request_id: REQUEST_ID,
|
|
430
|
+
task: TASK_REF,
|
|
431
|
+
path: { type: "string", description: "Absolute path of a regular file on the machine where you run (e.g. C:\\Users\\me\\capture.png or /tmp/report.pdf)." },
|
|
432
|
+
name: { type: "string", maxLength: 255, description: "File name shown to the members. Default: the name of the file." },
|
|
433
|
+
comment: {
|
|
434
|
+
type: "string",
|
|
435
|
+
maxLength: MAX_COMMENT_LENGTH,
|
|
436
|
+
description: "Text of a comment to post on the task, in the language of the space; the reference to the file is added after it. Omit for no comment.",
|
|
437
|
+
},
|
|
438
|
+
append_to_description: { type: "boolean", description: "Add the reference to the file at the end of the task description. Default: false." },
|
|
439
|
+
},
|
|
440
|
+
required: ["task", "path"],
|
|
441
|
+
additionalProperties: false,
|
|
442
|
+
},
|
|
443
|
+
},
|
|
444
|
+
},
|
|
316
445
|
{
|
|
317
446
|
method: "POST",
|
|
318
447
|
path: "ideas",
|
|
@@ -376,7 +505,7 @@ export const AGENT_TOOLS = [
|
|
|
376
505
|
path: "views",
|
|
377
506
|
definition: {
|
|
378
507
|
name: "list_views",
|
|
379
|
-
description: "List the board views of the author of a request (without request_id: of your token's owner), in your space: each view is a tab of their dashboard with a layout (kanban, list, matrix), groupings by status or priority, and filters on the status, priority, assignees and
|
|
508
|
+
description: "List the board views of the author of a request (without request_id: of your token's owner), in your space: each view is a tab of their dashboard with a layout (kanban, list, matrix), groupings by status or priority, and filters on the status, priority, assignees, tags and type (standard or test) of the top-level tasks. Read them before changing how someone's board looks.",
|
|
380
509
|
inputSchema: { type: "object", properties: { request_id: VIEW_REQUEST_ID }, additionalProperties: false },
|
|
381
510
|
},
|
|
382
511
|
},
|
|
@@ -394,7 +523,7 @@ export const AGENT_TOOLS = [
|
|
|
394
523
|
path: "views/{view_id}",
|
|
395
524
|
definition: {
|
|
396
525
|
name: "update_view",
|
|
397
|
-
description: "Change a board view of the author of a request (without request_id: of your token's owner): name, layout, groupings, empty groups, filters. Only the given settings change; a list (statuses, priorities, assignees, tags) replaces the previous one. Their open dashboard switches to the view.",
|
|
526
|
+
description: "Change a board view of the author of a request (without request_id: of your token's owner): name, layout, groupings, empty groups, filters. Only the given settings change; a list (statuses, priorities, assignees, tags, types) replaces the previous one. Their open dashboard switches to the view.",
|
|
398
527
|
inputSchema: { type: "object", properties: { request_id: VIEW_REQUEST_ID, view_id: VIEW_ID, ...VIEW_SETTINGS }, required: ["view_id"], additionalProperties: false },
|
|
399
528
|
},
|
|
400
529
|
},
|
|
@@ -407,6 +536,46 @@ export const AGENT_TOOLS = [
|
|
|
407
536
|
inputSchema: { type: "object", properties: { request_id: VIEW_REQUEST_ID, view_id: VIEW_ID }, required: ["view_id"], additionalProperties: false },
|
|
408
537
|
},
|
|
409
538
|
},
|
|
539
|
+
{
|
|
540
|
+
method: "GET",
|
|
541
|
+
path: "tasks/{task}/time",
|
|
542
|
+
definition: {
|
|
543
|
+
name: "get_task_time",
|
|
544
|
+
description: "Read the time spent on a task of your space: the total, the total of each member, and every timer session (member, free timer or pomodoro with its settings, running, paused or stopped, start, end, time counted). Only the work phases of a pomodoro count.",
|
|
545
|
+
inputSchema: { type: "object", properties: { task: TASK_REF }, required: ["task"], additionalProperties: false },
|
|
546
|
+
},
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
method: "POST",
|
|
550
|
+
path: "tasks/{task}/timer",
|
|
551
|
+
definition: {
|
|
552
|
+
name: "start_timer",
|
|
553
|
+
description: "Start measuring the time the author of a request (without request_id: your token's owner) spends on a task, when they ask for it: a free timer, or a pomodoro that alternates work phases and breaks. Each member has their own timer on a task and only one runs at a time: the timer running on another task is paused. The timer counts on the site's clock and shows on their task, card and header. Refused when they already have a timer on the task: stop_timer first.",
|
|
554
|
+
inputSchema: {
|
|
555
|
+
type: "object",
|
|
556
|
+
properties: {
|
|
557
|
+
request_id: TIMER_REQUEST_ID,
|
|
558
|
+
task: TASK_REF,
|
|
559
|
+
mode: { type: "string", enum: [...TIMER_MODES], description: "free (default) or pomodoro. Giving a pomodoro setting implies pomodoro." },
|
|
560
|
+
work_minutes: { type: "integer", minimum: POMODORO_LIMITS.workMinutes.min, maximum: POMODORO_LIMITS.workMinutes.max, description: "Pomodoro work phase. Default: the member's preference (25)." },
|
|
561
|
+
short_break_minutes: { type: "integer", minimum: POMODORO_LIMITS.shortBreakMinutes.min, maximum: POMODORO_LIMITS.shortBreakMinutes.max, description: "Pomodoro short break. Default: the member's preference (5)." },
|
|
562
|
+
long_break_minutes: { type: "integer", minimum: POMODORO_LIMITS.longBreakMinutes.min, maximum: POMODORO_LIMITS.longBreakMinutes.max, description: "Pomodoro long break. Default: the member's preference (15)." },
|
|
563
|
+
cycles: { type: "integer", minimum: POMODORO_LIMITS.cycles.min, maximum: POMODORO_LIMITS.cycles.max, description: "Work phases before the long break. Default: the member's preference (4)." },
|
|
564
|
+
},
|
|
565
|
+
required: ["task"],
|
|
566
|
+
additionalProperties: false,
|
|
567
|
+
},
|
|
568
|
+
},
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
method: "POST",
|
|
572
|
+
path: "tasks/{task}/timer/stop",
|
|
573
|
+
definition: {
|
|
574
|
+
name: "stop_timer",
|
|
575
|
+
description: "Stop the timer (running or paused) of the author of a request (without request_id: of your token's owner) on a task; its session joins the time spent on the task.",
|
|
576
|
+
inputSchema: { type: "object", properties: { request_id: TIMER_REQUEST_ID, task: TASK_REF }, required: ["task"], additionalProperties: false },
|
|
577
|
+
},
|
|
578
|
+
},
|
|
410
579
|
{
|
|
411
580
|
method: "POST",
|
|
412
581
|
path: "requests/{request_id}/follow-ups",
|
|
@@ -516,6 +685,14 @@ export function toolHttpRequest(tool, args) {
|
|
|
516
685
|
delete rest[name];
|
|
517
686
|
return encodeURIComponent(value.trim());
|
|
518
687
|
});
|
|
688
|
+
if (tool.upload) {
|
|
689
|
+
const { path: filePath, name, ...fields } = rest;
|
|
690
|
+
if (typeof filePath !== "string" || filePath.trim() === "")
|
|
691
|
+
throw new ToolArgumentError("Invalid arguments — path: expected the absolute path of a file. Check the tool's input schema.");
|
|
692
|
+
if (name !== undefined && (typeof name !== "string" || name.trim() === ""))
|
|
693
|
+
throw new ToolArgumentError("Invalid arguments — name: expected a non-empty string. Check the tool's input schema.");
|
|
694
|
+
return { method: tool.method, path, query: {}, body: fields, file: { path: filePath.trim(), ...(name === undefined ? {} : { name: name }) } };
|
|
695
|
+
}
|
|
519
696
|
if (tool.method !== "GET")
|
|
520
697
|
return { method: tool.method, path, query: {}, body: rest };
|
|
521
698
|
const query = {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fichier local envoyé par l'agent comme pièce jointe : le mode MCP le lit
|
|
3
|
+
* sur la machine où il tourne, avec les droits de l'utilisateur qui l'a
|
|
4
|
+
* lancé, et l'envoie au site. Son contenu ne passe jamais par l'agent.
|
|
5
|
+
*/
|
|
6
|
+
/** Fichier local lu pour l'envoi. */
|
|
7
|
+
export interface LocalUpload {
|
|
8
|
+
filename: string;
|
|
9
|
+
mime: string;
|
|
10
|
+
content: Buffer;
|
|
11
|
+
}
|
|
12
|
+
/** Fichier local refusé : chemin relatif, introuvable, dossier, fichier spécial ou trop lourd. */
|
|
13
|
+
export declare class LocalFileError extends Error {
|
|
14
|
+
constructor(message: string);
|
|
15
|
+
}
|
|
16
|
+
/** Type MIME d'un fichier d'après son extension ; `application/octet-stream` pour une extension inconnue. */
|
|
17
|
+
export declare function mimeOfFilename(filename: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Lit le fichier régulier désigné par le chemin absolu `filePath` ; `name`
|
|
20
|
+
* remplace son nom. Un lien symbolique est suivi jusqu'au fichier qu'il désigne.
|
|
21
|
+
*/
|
|
22
|
+
export declare function readLocalUpload(filePath: string, name?: string): Promise<LocalUpload>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import fs from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { DOCUMENT_FORMATS } from "../../shared/logic/documents.js";
|
|
4
|
+
import { MAX_ATTACHMENT_BYTES } from "../../shared/schemas/tasks-api.schema.js";
|
|
5
|
+
/** Fichier local refusé : chemin relatif, introuvable, dossier, fichier spécial ou trop lourd. */
|
|
6
|
+
export class LocalFileError extends Error {
|
|
7
|
+
constructor(message) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.name = "LocalFileError";
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/** Types MIME reconnus à l'extension, en plus de ceux des documents d'espace. */
|
|
13
|
+
const EXTRA_TYPES = {
|
|
14
|
+
html: "text/html",
|
|
15
|
+
htm: "text/html",
|
|
16
|
+
zip: "application/zip",
|
|
17
|
+
svg: "image/svg+xml",
|
|
18
|
+
bmp: "image/bmp",
|
|
19
|
+
tif: "image/tiff",
|
|
20
|
+
tiff: "image/tiff",
|
|
21
|
+
heic: "image/heic",
|
|
22
|
+
mp4: "video/mp4",
|
|
23
|
+
webm: "video/webm",
|
|
24
|
+
mp3: "audio/mpeg",
|
|
25
|
+
wav: "audio/wav",
|
|
26
|
+
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
27
|
+
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
28
|
+
};
|
|
29
|
+
/** Type MIME d'un fichier d'après son extension ; `application/octet-stream` pour une extension inconnue. */
|
|
30
|
+
export function mimeOfFilename(filename) {
|
|
31
|
+
const match = /\.([^.]+)$/.exec(filename);
|
|
32
|
+
if (!match)
|
|
33
|
+
return "application/octet-stream";
|
|
34
|
+
const extension = match[1].toLowerCase();
|
|
35
|
+
return DOCUMENT_FORMATS.find((format) => format.extensions.includes(extension))?.mime ?? EXTRA_TYPES[extension] ?? "application/octet-stream";
|
|
36
|
+
}
|
|
37
|
+
function megabytes(bytes) {
|
|
38
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Lit le fichier régulier désigné par le chemin absolu `filePath` ; `name`
|
|
42
|
+
* remplace son nom. Un lien symbolique est suivi jusqu'au fichier qu'il désigne.
|
|
43
|
+
*/
|
|
44
|
+
export async function readLocalUpload(filePath, name) {
|
|
45
|
+
if (!path.isAbsolute(filePath))
|
|
46
|
+
throw new LocalFileError(`path must be an absolute path on the machine where the agent runs (got "${filePath}").`);
|
|
47
|
+
let stat;
|
|
48
|
+
try {
|
|
49
|
+
stat = await fs.stat(filePath);
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
if (err?.code === "ENOENT" || err?.code === "ENOTDIR")
|
|
53
|
+
throw new LocalFileError(`No file at ${filePath}: check the path.`);
|
|
54
|
+
if (err?.code === "EACCES" || err?.code === "EPERM")
|
|
55
|
+
throw new LocalFileError(`The file ${filePath} cannot be read: permission denied.`);
|
|
56
|
+
throw new LocalFileError(`The file ${filePath} cannot be read (${err?.message ?? err}).`);
|
|
57
|
+
}
|
|
58
|
+
if (stat.isDirectory())
|
|
59
|
+
throw new LocalFileError(`${filePath} is a directory: give the path of a file.`);
|
|
60
|
+
if (!stat.isFile())
|
|
61
|
+
throw new LocalFileError(`${filePath} is not a regular file: only regular files can be attached.`);
|
|
62
|
+
if (stat.size > MAX_ATTACHMENT_BYTES) {
|
|
63
|
+
throw new LocalFileError(`The file ${filePath} is too large (${megabytes(stat.size)}): an attachment cannot exceed ${megabytes(MAX_ATTACHMENT_BYTES)}.`);
|
|
64
|
+
}
|
|
65
|
+
let content;
|
|
66
|
+
try {
|
|
67
|
+
content = await fs.readFile(filePath);
|
|
68
|
+
}
|
|
69
|
+
catch (err) {
|
|
70
|
+
throw new LocalFileError(`The file ${filePath} cannot be read (${err?.message ?? err}).`);
|
|
71
|
+
}
|
|
72
|
+
if (content.length > MAX_ATTACHMENT_BYTES) {
|
|
73
|
+
throw new LocalFileError(`The file ${filePath} is too large (${megabytes(content.length)}): an attachment cannot exceed ${megabytes(MAX_ATTACHMENT_BYTES)}.`);
|
|
74
|
+
}
|
|
75
|
+
const filename = (name ?? path.basename(filePath)).trim();
|
|
76
|
+
if (filename === "")
|
|
77
|
+
throw new LocalFileError("name must not be empty.");
|
|
78
|
+
return { filename, mime: mimeOfFilename(path.basename(filePath)), content };
|
|
79
|
+
}
|
package/dist/src/server/app.d.ts
CHANGED
|
@@ -2,10 +2,11 @@ import { Hono } from "hono";
|
|
|
2
2
|
import { type GuiApiContext } from "../gui-api.js";
|
|
3
3
|
import type { Logger } from "../core/logger.js";
|
|
4
4
|
import type { SiteConfig } from "./config.js";
|
|
5
|
-
import { LoginLimiter } from "./login-limiter.js";
|
|
5
|
+
import { LoginLimiter, PasswordResetLimiter } from "./login-limiter.js";
|
|
6
6
|
/**
|
|
7
7
|
* Serveur web du site : en-têtes de sécurité, contrôle d'origine des
|
|
8
|
-
* modifications, limitation des connexions
|
|
8
|
+
* modifications, limitation des connexions et des demandes de
|
|
9
|
+
* réinitialisation du mot de passe, API de la GUI, API des agents
|
|
9
10
|
* (`/api/agent/*`, authentifiée par jeton) et fichiers de `gui/dist`.
|
|
10
11
|
*/
|
|
11
12
|
export interface SiteDeps {
|
|
@@ -15,6 +16,7 @@ export interface SiteDeps {
|
|
|
15
16
|
/** Répertoire de la GUI compilée (`gui/dist`). */
|
|
16
17
|
staticRoot: string;
|
|
17
18
|
loginLimiter?: LoginLimiter;
|
|
19
|
+
passwordResetLimiter?: PasswordResetLimiter;
|
|
18
20
|
}
|
|
19
21
|
/**
|
|
20
22
|
* Politique de contenu de la GUI : scripts, styles et polices du site
|