@imenam/mcp-organizer 1.0.14 → 1.0.15
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 +7 -1
- package/dist/src/core/migrations.js +511 -511
- package/dist/src/core/store.js +40 -40
- package/dist/src/index.js +29 -29
- package/package.json +5 -2
package/dist/src/core/store.js
CHANGED
|
@@ -337,8 +337,8 @@ function notificationFromRow(row) {
|
|
|
337
337
|
});
|
|
338
338
|
}
|
|
339
339
|
/** Jointure qui garde les notifications dont la tâche ou la demande appartient à un espace dont le destinataire est membre. */
|
|
340
|
-
const VISIBLE_NOTIFICATION_JOIN = `LEFT JOIN tasks t ON t.id = n.task_id
|
|
341
|
-
LEFT JOIN agent_requests r ON n.task_id IS NULL AND r.id = n.request_id
|
|
340
|
+
const VISIBLE_NOTIFICATION_JOIN = `LEFT JOIN tasks t ON t.id = n.task_id
|
|
341
|
+
LEFT JOIN agent_requests r ON n.task_id IS NULL AND r.id = n.request_id
|
|
342
342
|
JOIN memberships m ON m.space_id = COALESCE(t.space_id, r.target_space_id) AND m.user_id = n.user_id`;
|
|
343
343
|
/** Libellé d'une tâche dans les messages : `ORG-41`. */
|
|
344
344
|
function taskLabel(db, task) {
|
|
@@ -512,7 +512,7 @@ export class Store {
|
|
|
512
512
|
/** Espaces dont l'utilisateur est membre : son espace personnel d'abord, puis les espaces communs par nom. */
|
|
513
513
|
listSpacesOf(userId) {
|
|
514
514
|
const rows = this.db
|
|
515
|
-
.prepare(`SELECT s.* FROM spaces s JOIN memberships m ON m.space_id = s.id
|
|
515
|
+
.prepare(`SELECT s.* FROM spaces s JOIN memberships m ON m.space_id = s.id
|
|
516
516
|
WHERE m.user_id = ? ORDER BY s.kind = 'shared', s.name COLLATE NOCASE`)
|
|
517
517
|
.all(userId);
|
|
518
518
|
return rows.map(spaceFromRow);
|
|
@@ -684,7 +684,7 @@ export class Store {
|
|
|
684
684
|
/** Résultats saisis sur les points des tâches d'un espace. */
|
|
685
685
|
listTestResultsInSpace(spaceId) {
|
|
686
686
|
const rows = this.db
|
|
687
|
-
.prepare(`SELECT c.task_id, r.checkpoint_id, r.tester_id, r.result FROM test_results r
|
|
687
|
+
.prepare(`SELECT c.task_id, r.checkpoint_id, r.tester_id, r.result FROM test_results r
|
|
688
688
|
JOIN test_checkpoints c ON c.id = r.checkpoint_id JOIN tasks t ON t.id = c.task_id WHERE t.space_id = ?`)
|
|
689
689
|
.all(spaceId);
|
|
690
690
|
return rows.map((row) => ({
|
|
@@ -729,7 +729,7 @@ export class Store {
|
|
|
729
729
|
/** Pièces jointes d'une tâche et de toutes ses sous-tâches. */
|
|
730
730
|
listAttachmentsInSubtree(taskId) {
|
|
731
731
|
const rows = this.db
|
|
732
|
-
.prepare(`WITH RECURSIVE subtree(id) AS (SELECT ? UNION ALL SELECT t.id FROM tasks t JOIN subtree s ON t.parent_id = s.id)
|
|
732
|
+
.prepare(`WITH RECURSIVE subtree(id) AS (SELECT ? UNION ALL SELECT t.id FROM tasks t JOIN subtree s ON t.parent_id = s.id)
|
|
733
733
|
SELECT a.* FROM attachments a JOIN subtree s ON a.task_id = s.id`)
|
|
734
734
|
.all(taskId);
|
|
735
735
|
return rows.map(attachmentFromRow);
|
|
@@ -759,7 +759,7 @@ export class Store {
|
|
|
759
759
|
/** Demandes de promotion (`idea_promotion`) en attente ou en cours sur les idées d'un espace. */
|
|
760
760
|
listOpenPromotionRequests(spaceId) {
|
|
761
761
|
const rows = this.db
|
|
762
|
-
.prepare(`SELECT r.* FROM agent_requests r JOIN ideas i ON i.id = r.context_idea_id
|
|
762
|
+
.prepare(`SELECT r.* FROM agent_requests r JOIN ideas i ON i.id = r.context_idea_id
|
|
763
763
|
WHERE i.space_id = ? AND r.kind = 'idea_promotion' AND r.status IN ('pending', 'processing') ORDER BY r.created_at, r.id`)
|
|
764
764
|
.all(spaceId);
|
|
765
765
|
return rows.map(requestFromRow);
|
|
@@ -817,9 +817,9 @@ export class Store {
|
|
|
817
817
|
if (limit === 0)
|
|
818
818
|
return [];
|
|
819
819
|
const rows = this.db
|
|
820
|
-
.prepare(`SELECT * FROM agent_requests
|
|
821
|
-
WHERE target_space_id = @spaceId AND author_id = @authorId AND status IN ('done', 'failed') AND kind <> 'direct'
|
|
822
|
-
AND (created_at < @createdAt OR (created_at = @createdAt AND id < @id))
|
|
820
|
+
.prepare(`SELECT * FROM agent_requests
|
|
821
|
+
WHERE target_space_id = @spaceId AND author_id = @authorId AND status IN ('done', 'failed') AND kind <> 'direct'
|
|
822
|
+
AND (created_at < @createdAt OR (created_at = @createdAt AND id < @id))
|
|
823
823
|
ORDER BY created_at DESC, id DESC LIMIT @limit`)
|
|
824
824
|
.all({ spaceId, authorId, createdAt: before.createdAt, id: before.id, limit });
|
|
825
825
|
return rows.map(requestFromRow).reverse();
|
|
@@ -911,8 +911,8 @@ export class Store {
|
|
|
911
911
|
*/
|
|
912
912
|
listNotifications(userId, limit, offset) {
|
|
913
913
|
const rows = this.db
|
|
914
|
-
.prepare(`SELECT n.* FROM notifications n ${VISIBLE_NOTIFICATION_JOIN}
|
|
915
|
-
WHERE n.user_id = ? AND n.in_app = 1
|
|
914
|
+
.prepare(`SELECT n.* FROM notifications n ${VISIBLE_NOTIFICATION_JOIN}
|
|
915
|
+
WHERE n.user_id = ? AND n.in_app = 1
|
|
916
916
|
ORDER BY n.read_at IS NOT NULL, n.created_at DESC, n.id DESC LIMIT ? OFFSET ?`)
|
|
917
917
|
.all(userId, limit, offset);
|
|
918
918
|
return rows.map(notificationFromRow);
|
|
@@ -920,7 +920,7 @@ export class Store {
|
|
|
920
920
|
/** Nombre de notifications non lues affichées dans l'application d'un utilisateur. */
|
|
921
921
|
countUnreadNotifications(userId) {
|
|
922
922
|
const row = this.db
|
|
923
|
-
.prepare(`SELECT COUNT(*) AS n FROM notifications n ${VISIBLE_NOTIFICATION_JOIN}
|
|
923
|
+
.prepare(`SELECT COUNT(*) AS n FROM notifications n ${VISIBLE_NOTIFICATION_JOIN}
|
|
924
924
|
WHERE n.user_id = ? AND n.in_app = 1 AND n.read_at IS NULL`)
|
|
925
925
|
.get(userId);
|
|
926
926
|
return row.n;
|
|
@@ -949,8 +949,8 @@ export class Store {
|
|
|
949
949
|
*/
|
|
950
950
|
listChangesForUser(userId, since, limit) {
|
|
951
951
|
const rows = this.db
|
|
952
|
-
.prepare(`SELECT * FROM changes WHERE seq > ?
|
|
953
|
-
AND (user_id = ? OR space_id IN (SELECT space_id FROM memberships WHERE user_id = ?))
|
|
952
|
+
.prepare(`SELECT * FROM changes WHERE seq > ?
|
|
953
|
+
AND (user_id = ? OR space_id IN (SELECT space_id FROM memberships WHERE user_id = ?))
|
|
954
954
|
ORDER BY seq LIMIT ?`)
|
|
955
955
|
.all(since, userId, userId, limit);
|
|
956
956
|
return rows.map(changeFromRow);
|
|
@@ -1235,7 +1235,7 @@ export class Mutation {
|
|
|
1235
1235
|
if (!this.store.isMember(token.spaceId, token.userId))
|
|
1236
1236
|
throw new ForbiddenError("An agent token can only cover a space its owner is a member of.");
|
|
1237
1237
|
this.db
|
|
1238
|
-
.prepare(`INSERT INTO agent_tokens (id, user_id, space_id, name, prefix, token_hash, created_at, expires_at, is_runner)
|
|
1238
|
+
.prepare(`INSERT INTO agent_tokens (id, user_id, space_id, name, prefix, token_hash, created_at, expires_at, is_runner)
|
|
1239
1239
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`)
|
|
1240
1240
|
.run(token.id, token.userId, token.spaceId, token.name, token.prefix, token.tokenHash, token.createdAt, token.expiresAt, token.isRunner ? 1 : 0);
|
|
1241
1241
|
this.touch("agent_token", token.id, null, token.userId);
|
|
@@ -1371,7 +1371,7 @@ export class Mutation {
|
|
|
1371
1371
|
this.touch("membership", `${id}:${membership.userId}`, id, membership.userId);
|
|
1372
1372
|
}
|
|
1373
1373
|
this.db
|
|
1374
|
-
.prepare(`DELETE FROM entity_versions WHERE (entity_type = 'task' AND entity_id IN (SELECT id FROM tasks WHERE space_id = ?))
|
|
1374
|
+
.prepare(`DELETE FROM entity_versions WHERE (entity_type = 'task' AND entity_id IN (SELECT id FROM tasks WHERE space_id = ?))
|
|
1375
1375
|
OR (entity_type = 'idea' AND entity_id IN (SELECT id FROM ideas WHERE space_id = ?))`)
|
|
1376
1376
|
.run(id, id);
|
|
1377
1377
|
this.db.prepare("DELETE FROM spaces WHERE id = ?").run(id);
|
|
@@ -1447,8 +1447,8 @@ export class Mutation {
|
|
|
1447
1447
|
version: 1,
|
|
1448
1448
|
}, "task");
|
|
1449
1449
|
this.db
|
|
1450
|
-
.prepare(`INSERT INTO tasks (id, space_id, number, parent_id, depth, type, title, description, status, priority, position,
|
|
1451
|
-
created_by, created_at, updated_at, version)
|
|
1450
|
+
.prepare(`INSERT INTO tasks (id, space_id, number, parent_id, depth, type, title, description, status, priority, position,
|
|
1451
|
+
created_by, created_at, updated_at, version)
|
|
1452
1452
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
|
|
1453
1453
|
.run(task.id, task.spaceId, task.number, task.parentId, task.depth, task.type, task.title, task.description, task.status, task.priority, task.position, task.createdBy, task.createdAt, task.updatedAt, task.version);
|
|
1454
1454
|
this.db.prepare("UPDATE spaces SET next_task_number = next_task_number + 1 WHERE id = ?").run(space.id);
|
|
@@ -1482,7 +1482,7 @@ export class Mutation {
|
|
|
1482
1482
|
const testedTaskId = fields.testedTaskId !== undefined ? fields.testedTaskId : type === "standard" ? null : current.testedTaskId;
|
|
1483
1483
|
const task = validate(TaskSchema, { ...current, ...fields, parentId, depth, status, position, testedTaskId, updatedAt: this.now }, "task");
|
|
1484
1484
|
this.db
|
|
1485
|
-
.prepare(`UPDATE tasks SET parent_id = ?, depth = ?, type = ?, title = ?, description = ?, status = ?, priority = ?,
|
|
1485
|
+
.prepare(`UPDATE tasks SET parent_id = ?, depth = ?, type = ?, title = ?, description = ?, status = ?, priority = ?,
|
|
1486
1486
|
position = ?, tested_task_id = ?, updated_at = ? WHERE id = ?`)
|
|
1487
1487
|
.run(task.parentId, task.depth, task.type, task.title, task.description, task.status, task.priority, task.position, task.testedTaskId, task.updatedAt, id);
|
|
1488
1488
|
this.touch("task", id, task.spaceId, null);
|
|
@@ -1741,7 +1741,7 @@ export class Mutation {
|
|
|
1741
1741
|
updatedAt: this.now,
|
|
1742
1742
|
}, "test result");
|
|
1743
1743
|
this.db
|
|
1744
|
-
.prepare(`INSERT INTO test_results (checkpoint_id, tester_id, result, comment, updated_at) VALUES (?, ?, ?, ?, ?)
|
|
1744
|
+
.prepare(`INSERT INTO test_results (checkpoint_id, tester_id, result, comment, updated_at) VALUES (?, ?, ?, ?, ?)
|
|
1745
1745
|
ON CONFLICT (checkpoint_id, tester_id) DO UPDATE SET result = excluded.result, comment = excluded.comment, updated_at = excluded.updated_at`)
|
|
1746
1746
|
.run(result.checkpointId, result.testerId, result.result, result.comment, result.updatedAt);
|
|
1747
1747
|
this.touch("test_result", `${checkpointId}:${testerId}`, task.spaceId, null, task.id);
|
|
@@ -1904,7 +1904,7 @@ export class Mutation {
|
|
|
1904
1904
|
createdAt: this.now,
|
|
1905
1905
|
}, "idea");
|
|
1906
1906
|
this.db
|
|
1907
|
-
.prepare(`INSERT INTO ideas (id, space_id, author_id, text, origin, request_id, promoted_task_id, archived_at, created_at)
|
|
1907
|
+
.prepare(`INSERT INTO ideas (id, space_id, author_id, text, origin, request_id, promoted_task_id, archived_at, created_at)
|
|
1908
1908
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`)
|
|
1909
1909
|
.run(idea.id, idea.spaceId, idea.authorId, idea.text, idea.origin, idea.requestId, idea.promotedTaskId, idea.archivedAt, idea.createdAt);
|
|
1910
1910
|
this.touch("idea", idea.id, idea.spaceId, null);
|
|
@@ -1964,7 +1964,7 @@ export class Mutation {
|
|
|
1964
1964
|
}
|
|
1965
1965
|
insertBoardView(view) {
|
|
1966
1966
|
this.db
|
|
1967
|
-
.prepare(`INSERT INTO board_views (id, space_id, user_id, name, layout, group_by, then_by, show_empty_groups, statuses, priorities, assignee_ids, unassigned, position, created_at, updated_at)
|
|
1967
|
+
.prepare(`INSERT INTO board_views (id, space_id, user_id, name, layout, group_by, then_by, show_empty_groups, statuses, priorities, assignee_ids, unassigned, position, created_at, updated_at)
|
|
1968
1968
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
|
|
1969
1969
|
.run(view.id, view.spaceId, view.userId, view.name, view.layout, view.groupBy, view.thenBy, view.showEmptyGroups ? 1 : 0, JSON.stringify(view.statuses), JSON.stringify(view.priorities), JSON.stringify(view.assigneeIds), view.unassigned ? 1 : 0, view.position, view.createdAt, view.updatedAt);
|
|
1970
1970
|
this.touch("board_view", view.id, null, view.userId, null, view.spaceId);
|
|
@@ -1973,7 +1973,7 @@ export class Mutation {
|
|
|
1973
1973
|
const current = this.store.getBoardView(id);
|
|
1974
1974
|
const view = validate(BoardViewSchema, { ...current, ...normalizedSettings({ ...current, ...definedFields(patch) }), updatedAt: this.now }, "board view");
|
|
1975
1975
|
this.db
|
|
1976
|
-
.prepare(`UPDATE board_views SET name = ?, layout = ?, group_by = ?, then_by = ?, show_empty_groups = ?, statuses = ?, priorities = ?, assignee_ids = ?, unassigned = ?, updated_at = ?
|
|
1976
|
+
.prepare(`UPDATE board_views SET name = ?, layout = ?, group_by = ?, then_by = ?, show_empty_groups = ?, statuses = ?, priorities = ?, assignee_ids = ?, unassigned = ?, updated_at = ?
|
|
1977
1977
|
WHERE id = ?`)
|
|
1978
1978
|
.run(view.name, view.layout, view.groupBy, view.thenBy, view.showEmptyGroups ? 1 : 0, JSON.stringify(view.statuses), JSON.stringify(view.priorities), JSON.stringify(view.assigneeIds), view.unassigned ? 1 : 0, view.updatedAt, id);
|
|
1979
1979
|
this.touch("board_view", id, null, view.userId, null, view.spaceId);
|
|
@@ -2013,8 +2013,8 @@ export class Mutation {
|
|
|
2013
2013
|
}, "request");
|
|
2014
2014
|
this.store.getSpace(request.targetSpaceId);
|
|
2015
2015
|
this.db
|
|
2016
|
-
.prepare(`INSERT INTO agent_requests (id, author_id, target_space_id, kind, context_task_id, context_idea_id,
|
|
2017
|
-
text, status, parent_request_id, comment_id, created_at, updated_at)
|
|
2016
|
+
.prepare(`INSERT INTO agent_requests (id, author_id, target_space_id, kind, context_task_id, context_idea_id,
|
|
2017
|
+
text, status, parent_request_id, comment_id, created_at, updated_at)
|
|
2018
2018
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
|
|
2019
2019
|
.run(request.id, request.authorId, request.targetSpaceId, request.kind, request.contextTaskId, request.contextIdeaId, request.text, request.status, request.parentRequestId, request.commentId, request.createdAt, request.updatedAt);
|
|
2020
2020
|
this.createdRequestIds.add(request.id);
|
|
@@ -2082,7 +2082,7 @@ export class Mutation {
|
|
|
2082
2082
|
if (current.status !== "failed" || current.stoppedAt === null)
|
|
2083
2083
|
throw new InvariantError(`Request ${id} is ${current.status}: only a stopped request can be relaunched.`);
|
|
2084
2084
|
this.db
|
|
2085
|
-
.prepare(`UPDATE agent_requests SET status = 'pending', claimed_at = NULL, claimed_by_token_id = NULL, completed_at = NULL, failure_reason = NULL,
|
|
2085
|
+
.prepare(`UPDATE agent_requests SET status = 'pending', claimed_at = NULL, claimed_by_token_id = NULL, completed_at = NULL, failure_reason = NULL,
|
|
2086
2086
|
stopped_at = NULL, stopped_by = NULL, updated_at = ? WHERE id = ?`)
|
|
2087
2087
|
.run(this.now, id);
|
|
2088
2088
|
this.db.prepare("DELETE FROM follow_ups WHERE request_id = ?").run(id);
|
|
@@ -2146,7 +2146,7 @@ export class Mutation {
|
|
|
2146
2146
|
stoppedBy: null,
|
|
2147
2147
|
}, "request");
|
|
2148
2148
|
this.db
|
|
2149
|
-
.prepare(`INSERT INTO agent_requests (id, author_id, target_space_id, kind, text, status, created_at, updated_at, claimed_at, claimed_by_token_id)
|
|
2149
|
+
.prepare(`INSERT INTO agent_requests (id, author_id, target_space_id, kind, text, status, created_at, updated_at, claimed_at, claimed_by_token_id)
|
|
2150
2150
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
|
|
2151
2151
|
.run(request.id, request.authorId, request.targetSpaceId, request.kind, request.text, request.status, request.createdAt, request.updatedAt, request.claimedAt, request.claimedByTokenId);
|
|
2152
2152
|
this.createdRequestIds.add(request.id);
|
|
@@ -2286,7 +2286,7 @@ export class Mutation {
|
|
|
2286
2286
|
tokenId: token.id,
|
|
2287
2287
|
}, "agent action");
|
|
2288
2288
|
this.db
|
|
2289
|
-
.prepare(`INSERT INTO agent_actions (id, request_id, seq, entity_type, entity_id, operation, before, after, summary, created_at, token_id)
|
|
2289
|
+
.prepare(`INSERT INTO agent_actions (id, request_id, seq, entity_type, entity_id, operation, before, after, summary, created_at, token_id)
|
|
2290
2290
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
|
|
2291
2291
|
.run(action.id, action.requestId, action.seq, action.entityType, action.entityId, action.operation, action.before === null ? null : JSON.stringify(action.before), action.after === null ? null : JSON.stringify(action.after), action.summary, action.createdAt, action.tokenId);
|
|
2292
2292
|
this.touch("agent_action", action.id, request.targetSpaceId, null, input.taskId);
|
|
@@ -2345,7 +2345,7 @@ export class Mutation {
|
|
|
2345
2345
|
emailError: null,
|
|
2346
2346
|
}, "notification");
|
|
2347
2347
|
this.db
|
|
2348
|
-
.prepare(`INSERT INTO notifications (id, user_id, type, task_id, actor_type, actor_id, request_id, comment_id, in_app, created_at)
|
|
2348
|
+
.prepare(`INSERT INTO notifications (id, user_id, type, task_id, actor_type, actor_id, request_id, comment_id, in_app, created_at)
|
|
2349
2349
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
|
|
2350
2350
|
.run(notification.id, notification.userId, notification.type, notification.taskId, notification.actorType, notification.actorId, notification.requestId, notification.commentId, inApp ? 1 : 0, notification.createdAt);
|
|
2351
2351
|
if (inApp)
|
|
@@ -2387,7 +2387,7 @@ export class Mutation {
|
|
|
2387
2387
|
updateUserSettings(userId, patch) {
|
|
2388
2388
|
const settings = validate(UserSettingsSchema, { ...this.store.getUserSettings(userId), ...definedFields(patch) }, "settings");
|
|
2389
2389
|
this.db
|
|
2390
|
-
.prepare(`UPDATE user_settings SET notify_assign_app = ?, notify_assign_email = ?, notify_comment_app = ?, notify_comment_email = ?,
|
|
2390
|
+
.prepare(`UPDATE user_settings SET notify_assign_app = ?, notify_assign_email = ?, notify_comment_app = ?, notify_comment_email = ?,
|
|
2391
2391
|
notify_follow_up_app = ?, notify_follow_up_email = ?, assistant_history = ? WHERE user_id = ?`)
|
|
2392
2392
|
.run(settings.notifyAssignApp ? 1 : 0, settings.notifyAssignEmail ? 1 : 0, settings.notifyCommentApp ? 1 : 0, settings.notifyCommentEmail ? 1 : 0, settings.notifyFollowUpApp ? 1 : 0, settings.notifyFollowUpEmail ? 1 : 0, settings.assistantHistory, userId);
|
|
2393
2393
|
this.touch("user_settings", userId, null, userId);
|
|
@@ -2407,11 +2407,11 @@ export class Mutation {
|
|
|
2407
2407
|
}
|
|
2408
2408
|
const settings = validate(SpaceNotificationSettingsSchema, { userId, spaceId, ...preferences }, "space notification settings");
|
|
2409
2409
|
this.db
|
|
2410
|
-
.prepare(`INSERT INTO space_notification_settings (user_id, space_id, notify_assign_app, notify_assign_email, notify_comment_app, notify_comment_email,
|
|
2411
|
-
notify_follow_up_app, notify_follow_up_email)
|
|
2412
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
2413
|
-
ON CONFLICT (user_id, space_id) DO UPDATE SET notify_assign_app = excluded.notify_assign_app, notify_assign_email = excluded.notify_assign_email,
|
|
2414
|
-
notify_comment_app = excluded.notify_comment_app, notify_comment_email = excluded.notify_comment_email,
|
|
2410
|
+
.prepare(`INSERT INTO space_notification_settings (user_id, space_id, notify_assign_app, notify_assign_email, notify_comment_app, notify_comment_email,
|
|
2411
|
+
notify_follow_up_app, notify_follow_up_email)
|
|
2412
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
2413
|
+
ON CONFLICT (user_id, space_id) DO UPDATE SET notify_assign_app = excluded.notify_assign_app, notify_assign_email = excluded.notify_assign_email,
|
|
2414
|
+
notify_comment_app = excluded.notify_comment_app, notify_comment_email = excluded.notify_comment_email,
|
|
2415
2415
|
notify_follow_up_app = excluded.notify_follow_up_app, notify_follow_up_email = excluded.notify_follow_up_email`)
|
|
2416
2416
|
.run(userId, spaceId, settings.notifyAssignApp ? 1 : 0, settings.notifyAssignEmail ? 1 : 0, settings.notifyCommentApp ? 1 : 0, settings.notifyCommentEmail ? 1 : 0, settings.notifyFollowUpApp ? 1 : 0, settings.notifyFollowUpEmail ? 1 : 0);
|
|
2417
2417
|
return settings;
|
|
@@ -2449,7 +2449,7 @@ export class Mutation {
|
|
|
2449
2449
|
recordRunnerSession(record) {
|
|
2450
2450
|
const valid = validate(RunnerSessionRecordSchema, record, "runner session");
|
|
2451
2451
|
this.db
|
|
2452
|
-
.prepare(`INSERT INTO runner_sessions (id, space_id, space_name, started_at, ended_at, outcome, model, turns, cost_usd, input_tokens, output_tokens, cache_read_tokens, cache_creation_tokens)
|
|
2452
|
+
.prepare(`INSERT INTO runner_sessions (id, space_id, space_name, started_at, ended_at, outcome, model, turns, cost_usd, input_tokens, output_tokens, cache_read_tokens, cache_creation_tokens)
|
|
2453
2453
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
|
|
2454
2454
|
.run(valid.id, valid.spaceId, valid.spaceName, valid.startedAt, valid.endedAt, valid.outcome, valid.model, valid.turns, valid.costUsd, valid.inputTokens, valid.outputTokens, valid.cacheReadTokens, valid.cacheCreationTokens);
|
|
2455
2455
|
}
|
|
@@ -2529,8 +2529,8 @@ export class Mutation {
|
|
|
2529
2529
|
}
|
|
2530
2530
|
}
|
|
2531
2531
|
const outsiders = this.db
|
|
2532
|
-
.prepare(`SELECT t.number AS number, x.user_id AS user_id FROM task_assignees x JOIN tasks t ON t.id = x.task_id
|
|
2533
|
-
WHERE t.space_id = ? AND NOT EXISTS (SELECT 1 FROM memberships m WHERE m.space_id = t.space_id AND m.user_id = x.user_id)
|
|
2532
|
+
.prepare(`SELECT t.number AS number, x.user_id AS user_id FROM task_assignees x JOIN tasks t ON t.id = x.task_id
|
|
2533
|
+
WHERE t.space_id = ? AND NOT EXISTS (SELECT 1 FROM memberships m WHERE m.space_id = t.space_id AND m.user_id = x.user_id)
|
|
2534
2534
|
ORDER BY t.number LIMIT 1`)
|
|
2535
2535
|
.get(space.id);
|
|
2536
2536
|
if (outsiders) {
|
|
@@ -2602,7 +2602,7 @@ export class Mutation {
|
|
|
2602
2602
|
const actorId = this.actingUserId;
|
|
2603
2603
|
const requestId = this.request?.id ?? null;
|
|
2604
2604
|
const tokenId = this.token?.id ?? null;
|
|
2605
|
-
const insert = this.db.prepare(`INSERT INTO entity_versions (entity_type, entity_id, version, snapshot, actor_type, actor_id, request_id, created_at, token_id)
|
|
2605
|
+
const insert = this.db.prepare(`INSERT INTO entity_versions (entity_type, entity_id, version, snapshot, actor_type, actor_id, request_id, created_at, token_id)
|
|
2606
2606
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`);
|
|
2607
2607
|
for (const entry of this.touched.values()) {
|
|
2608
2608
|
if (!VERSIONED.has(entry.entityType))
|
|
@@ -2624,7 +2624,7 @@ export class Mutation {
|
|
|
2624
2624
|
}
|
|
2625
2625
|
/** Une ligne du journal par entité modifiée, avec l'auteur de la mutation. */
|
|
2626
2626
|
writeChanges() {
|
|
2627
|
-
const insert = this.db.prepare(`INSERT INTO changes (space_id, user_id, entity_type, entity_id, task_id, at, actor_type, actor_id, request_id)
|
|
2627
|
+
const insert = this.db.prepare(`INSERT INTO changes (space_id, user_id, entity_type, entity_id, task_id, at, actor_type, actor_id, request_id)
|
|
2628
2628
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`);
|
|
2629
2629
|
const actorId = this.actingUserId;
|
|
2630
2630
|
const requestId = this.request?.id ?? null;
|
package/dist/src/index.js
CHANGED
|
@@ -5,35 +5,35 @@ import { APP_VERSION } from "./version.js";
|
|
|
5
5
|
import { ConfigError } from "./core/errors.js";
|
|
6
6
|
import { findProjectRoot } from "./core/project-root.js";
|
|
7
7
|
import { loadEnvFile, resolveEnvFile, withoutEnvFileFlag } from "./core/env-file.js";
|
|
8
|
-
const USAGE = `mcp-organizer v${APP_VERSION} — gestionnaire de tâches multi-utilisateur piloté par un agent
|
|
9
|
-
|
|
10
|
-
Usage :
|
|
11
|
-
mcp-organizer Mode MCP (stdio) : outils de l'agent, relayés à l'API du site.
|
|
12
|
-
mcp-organizer --server Site web : interface, API et base de données, sur HOST:PORT.
|
|
13
|
-
mcp-organizer --set-user [email] [--name="Prénom Nom"] [--non-interactive]
|
|
14
|
-
Crée un compte ou remplace son mot de passe.
|
|
15
|
-
mcp-organizer --set-admin <email> [--revoke]
|
|
16
|
-
Accorde (ou retire) le rôle d'administrateur du site à un compte actif.
|
|
17
|
-
Le premier compte créé est administrateur d'office.
|
|
18
|
-
mcp-organizer --setup [options] Installe le site : .env, unité systemd, bloc nginx, premier compte
|
|
19
|
-
(interactif, ou --non-interactive ; --setup --help pour les options).
|
|
20
|
-
mcp-organizer --backup <fichier> [--force]
|
|
21
|
-
Sauvegarde la base (site en service ou non) et ses pièces jointes
|
|
22
|
-
(dossier <fichier>.attachments).
|
|
23
|
-
mcp-organizer --claude-setup-mcp [--force] --url=<URL du site> --token=<jeton>
|
|
24
|
-
Écrit l'entrée du mode MCP dans ./.mcp.json.
|
|
25
|
-
mcp-organizer --watch <id du jeton>
|
|
26
|
-
Veilleur de notifications : une ligne par demande passée en attente.
|
|
27
|
-
Lancé par l'outil Monitor de l'agent, avec la commande que rend
|
|
28
|
-
l'outil enable_notifications.
|
|
29
|
-
mcp-organizer --version Affiche la version.
|
|
30
|
-
mcp-organizer --help Affiche cette aide.
|
|
31
|
-
|
|
32
|
-
Option commune : --dotenv=<fichier> lit ce fichier .env. Sans elle, le site et ses commandes
|
|
33
|
-
lisent <package>/.env ; le mode MCP n'en lit aucun.
|
|
34
|
-
Le site exige PORT et ORGANIZER_PUBLIC_URL ; HOST vaut 127.0.0.1 par défaut.
|
|
35
|
-
Le mode MCP exige ORGANIZER_URL (URL publique du site, en https hors de la machine locale)
|
|
36
|
-
et ORGANIZER_TOKEN (jeton d'agent), fournis par son environnement.
|
|
8
|
+
const USAGE = `mcp-organizer v${APP_VERSION} — gestionnaire de tâches multi-utilisateur piloté par un agent
|
|
9
|
+
|
|
10
|
+
Usage :
|
|
11
|
+
mcp-organizer Mode MCP (stdio) : outils de l'agent, relayés à l'API du site.
|
|
12
|
+
mcp-organizer --server Site web : interface, API et base de données, sur HOST:PORT.
|
|
13
|
+
mcp-organizer --set-user [email] [--name="Prénom Nom"] [--non-interactive]
|
|
14
|
+
Crée un compte ou remplace son mot de passe.
|
|
15
|
+
mcp-organizer --set-admin <email> [--revoke]
|
|
16
|
+
Accorde (ou retire) le rôle d'administrateur du site à un compte actif.
|
|
17
|
+
Le premier compte créé est administrateur d'office.
|
|
18
|
+
mcp-organizer --setup [options] Installe le site : .env, unité systemd, bloc nginx, premier compte
|
|
19
|
+
(interactif, ou --non-interactive ; --setup --help pour les options).
|
|
20
|
+
mcp-organizer --backup <fichier> [--force]
|
|
21
|
+
Sauvegarde la base (site en service ou non) et ses pièces jointes
|
|
22
|
+
(dossier <fichier>.attachments).
|
|
23
|
+
mcp-organizer --claude-setup-mcp [--force] --url=<URL du site> --token=<jeton>
|
|
24
|
+
Écrit l'entrée du mode MCP dans ./.mcp.json.
|
|
25
|
+
mcp-organizer --watch <id du jeton>
|
|
26
|
+
Veilleur de notifications : une ligne par demande passée en attente.
|
|
27
|
+
Lancé par l'outil Monitor de l'agent, avec la commande que rend
|
|
28
|
+
l'outil enable_notifications.
|
|
29
|
+
mcp-organizer --version Affiche la version.
|
|
30
|
+
mcp-organizer --help Affiche cette aide.
|
|
31
|
+
|
|
32
|
+
Option commune : --dotenv=<fichier> lit ce fichier .env. Sans elle, le site et ses commandes
|
|
33
|
+
lisent <package>/.env ; le mode MCP n'en lit aucun.
|
|
34
|
+
Le site exige PORT et ORGANIZER_PUBLIC_URL ; HOST vaut 127.0.0.1 par défaut.
|
|
35
|
+
Le mode MCP exige ORGANIZER_URL (URL publique du site, en https hors de la machine locale)
|
|
36
|
+
et ORGANIZER_TOKEN (jeton d'agent), fournis par son environnement.
|
|
37
37
|
Voir le README pour la liste complète des variables.`;
|
|
38
38
|
/** Commandes qui ouvrent la base du site ; toute autre invocation démarre le mode MCP. */
|
|
39
39
|
const SITE_COMMANDS = ["--server", "--set-user", "--set-admin", "--setup", "--backup"];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imenam/mcp-organizer",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
4
4
|
"description": "MCP server with a multi-user web GUI to organize tasks in personal and shared spaces; requests to the AI are queued and processed by the connected agent, every agent action is logged and undoable.",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
"build": "npm run build:backend && npm run build:gui",
|
|
10
10
|
"start": "node dist/src/index.js",
|
|
11
11
|
"prepublishOnly": "npm run build",
|
|
12
|
-
"release": "npm version patch && npm publish && git push --follow-tags",
|
|
13
12
|
"prebuild": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
14
13
|
"test": "node --test \"dist/test/*.test.js\"",
|
|
15
14
|
"test:e2e": "playwright test",
|
|
@@ -65,5 +64,9 @@
|
|
|
65
64
|
"allowScripts": {
|
|
66
65
|
"better-sqlite3@12.11.1": true,
|
|
67
66
|
"argon2@0.45.1": true
|
|
67
|
+
},
|
|
68
|
+
"repository": {
|
|
69
|
+
"type": "git",
|
|
70
|
+
"url": "git+https://github.com/Matthieu-Pesnot-Pin/mcp-organizer.git"
|
|
68
71
|
}
|
|
69
72
|
}
|