@imenam/mcp-organizer 1.0.32 → 1.0.33

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.
Files changed (33) hide show
  1. package/README.md +36 -23
  2. package/dist/shared/logic/notes.d.ts +3 -2
  3. package/dist/shared/logic/notes.js +4 -3
  4. package/dist/shared/schemas/agent-tools.schema.d.ts +2 -0
  5. package/dist/shared/schemas/agent-tools.schema.js +6 -2
  6. package/dist/shared/schemas/api.schema.d.ts +9 -4
  7. package/dist/shared/schemas/api.schema.js +8 -2
  8. package/dist/shared/schemas/entities.schema.d.ts +40 -0
  9. package/dist/shared/schemas/entities.schema.js +33 -0
  10. package/dist/shared/schemas/notifications-api.schema.d.ts +18 -0
  11. package/dist/shared/schemas/notifications-api.schema.js +7 -1
  12. package/dist/shared/schemas/views-api.schema.d.ts +5 -0
  13. package/dist/shared/schemas/views-api.schema.js +2 -0
  14. package/dist/src/agent-api/views.js +21 -6
  15. package/dist/src/core/board-views.d.ts +6 -1
  16. package/dist/src/core/board-views.js +14 -0
  17. package/dist/src/core/history.js +2 -0
  18. package/dist/src/core/migrations.js +13 -0
  19. package/dist/src/core/notifications.d.ts +1 -0
  20. package/dist/src/core/notifications.js +6 -2
  21. package/dist/src/core/spaces.d.ts +8 -1
  22. package/dist/src/core/spaces.js +17 -4
  23. package/dist/src/core/store.d.ts +12 -1
  24. package/dist/src/core/store.js +48 -6
  25. package/dist/src/gui-api.js +8 -6
  26. package/dist/src/mcp/tools.js +7 -3
  27. package/gui/dist/assets/index-CLW9PAC7.js +104 -0
  28. package/gui/dist/assets/index-kNRY_0Gs.css +1 -0
  29. package/gui/dist/assets/organizer-logo-D0O_mXwN.svg +12 -0
  30. package/gui/dist/index.html +3 -2
  31. package/package.json +1 -1
  32. package/gui/dist/assets/index-B-B-jasM.css +0 -1
  33. package/gui/dist/assets/index-D4QIxUSt.js +0 -104
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { ActorTypeSchema, NotificationTypeSchema } from "./enums.schema.js";
3
- import { AssistantHistorySchema, EmailDigestSchema, IdSchema, NotificationPreferencesSchema, PomodoroSettingsSchema, TimestampSchema } from "./entities.schema.js";
3
+ import { AssistantHistorySchema, EmailDigestSchema, IdSchema, NotificationPreferencesSchema, PomodoroSettingsSchema, SidebarModeSchema, TaskOpenModeSchema, TimestampSchema } from "./entities.schema.js";
4
4
  /** Corps des requêtes et des réponses des notifications et des paramètres de la GUI. */
5
5
  /** Nombre de notifications renvoyées par défaut, et au plus, par page. */
6
6
  export const NOTIFICATIONS_PAGE_SIZE = 20;
@@ -61,6 +61,10 @@ export const SettingsResponseSchema = z.object({
61
61
  pomodoro: PomodoroSettingsSchema,
62
62
  /** Période du résumé des e-mails de notification, en minutes ; null : un e-mail par notification. */
63
63
  emailDigestMinutes: EmailDigestSchema,
64
+ /** Affichage de la barre latérale : toujours visible, au survol, ou repliée en icônes. */
65
+ sidebarMode: SidebarModeSchema,
66
+ /** Ouverture d'une tâche par un clic simple sur sa carte : en pleine page ou dans l'aperçu latéral. */
67
+ taskOpenMode: TaskOpenModeSchema,
64
68
  /** Envoi des e-mails de notification : `reason` dit pourquoi il n'a pas lieu. */
65
69
  email: z.object({ enabled: z.boolean(), reason: z.string().nullable() }),
66
70
  /** Dictée vocale : `reason` dit pourquoi elle est indisponible. */
@@ -77,6 +81,8 @@ export const UpdateSettingsRequestSchema = z
77
81
  assistantHistory: AssistantHistorySchema.optional(),
78
82
  pomodoro: PomodoroSettingsSchema.optional(),
79
83
  emailDigestMinutes: EmailDigestSchema.optional(),
84
+ sidebarMode: SidebarModeSchema.optional(),
85
+ taskOpenMode: TaskOpenModeSchema.optional(),
80
86
  })
81
87
  .strict()
82
88
  .refine((patch) => Object.values(patch).some((value) => value !== undefined), "Aucune modification demandée.");
@@ -125,6 +125,11 @@ export declare const CreateBoardViewRequestSchema: z.ZodObject<{
125
125
  }>>;
126
126
  }, z.core.$strict>;
127
127
  export type CreateBoardViewRequest = z.infer<typeof CreateBoardViewRequestSchema>;
128
+ /** Place de la vue parmi les onglets : juste après la vue `afterId`, ou en tête avec null (vue ouverte à l'arrivée sur l'espace). */
129
+ export declare const MoveBoardViewRequestSchema: z.ZodObject<{
130
+ afterId: z.ZodNullable<z.ZodString>;
131
+ }, z.core.$strict>;
132
+ export type MoveBoardViewRequest = z.infer<typeof MoveBoardViewRequestSchema>;
128
133
  /** Réglages à changer ; la vue obtenue doit rester valide. */
129
134
  export declare const UpdateBoardViewRequestSchema: z.ZodObject<{
130
135
  name: z.ZodOptional<z.ZodString>;
@@ -35,6 +35,8 @@ export const BoardViewViewSchema = BoardViewSettingsSchema.extend({ id: IdSchema
35
35
  export const BoardViewListResponseSchema = z.object({ views: z.array(BoardViewViewSchema) });
36
36
  /** Les réglages d'une vue sont validés par le serveur, qui dit quel regroupement manque ou ne convient pas. */
37
37
  export const CreateBoardViewRequestSchema = BoardViewSettingsSchema.strict();
38
+ /** Place de la vue parmi les onglets : juste après la vue `afterId`, ou en tête avec null (vue ouverte à l'arrivée sur l'espace). */
39
+ export const MoveBoardViewRequestSchema = z.object({ afterId: IdSchema.nullable() }).strict();
38
40
  /** Réglages à changer ; la vue obtenue doit rester valide. */
39
41
  export const UpdateBoardViewRequestSchema = BoardViewSettingsSchema.partial()
40
42
  .strict()
@@ -93,8 +93,19 @@ function settingsPatch(store, space, input) {
93
93
  types: input.types,
94
94
  };
95
95
  }
96
+ /** Place une vue de l'auteur juste après une autre de ses vues (`after_view`), ou en tête avec null. */
97
+ function placeView(tx, author, space, view, afterView) {
98
+ const after = afterView === null ? null : resolveView(tx.store, author, space, afterView);
99
+ return tx.moveBoardView(view.id, after?.id ?? null);
100
+ }
101
+ /** Place d'une vue dans les onglets de son membre, en français : « en tête », « après « Liste » ». */
102
+ function placeLabel(store, view) {
103
+ const views = store.listBoardViews(view.spaceId, view.userId);
104
+ const index = views.findIndex((other) => other.id === view.id);
105
+ return index <= 0 ? "placée en tête (ouverte par défaut)" : `placée après ${quote(views[index - 1].name)}`;
106
+ }
96
107
  /** Résumé français des réglages changés d'une vue. */
97
- function viewUpdateSummary(before, after) {
108
+ function viewUpdateSummary(store, before, after) {
98
109
  const parts = [];
99
110
  if (before.name !== after.name)
100
111
  parts.push(`Renommée ${quote(after.name)}`);
@@ -118,6 +129,8 @@ function viewUpdateSummary(before, after) {
118
129
  if (JSON.stringify(before.types) !== JSON.stringify(after.types)) {
119
130
  parts.push(`Types : ${after.types.length > 0 ? after.types.map((type) => TYPE_LABELS[type]).join(", ") : "tous"}`);
120
131
  }
132
+ if (before.position !== after.position)
133
+ parts.push(placeLabel(store, after));
121
134
  return `Vue ${quote(before.name)} : ${parts.join(" · ") || "inchangée"}`;
122
135
  }
123
136
  export const viewRoutes = [
@@ -128,7 +141,7 @@ export const viewRoutes = [
128
141
  const input = parseInput(ListViewsQuerySchema, query);
129
142
  const { author, space } = requestAuthor(store, agent, input.request_id, "views");
130
143
  const views = store.listBoardViews(space.id, author.id);
131
- const header = `Board views of ${userLabel(author)} <${author.email}> in "${space.name}", in the order of their tabs:`;
144
+ const header = `Board views of ${userLabel(author)} <${author.email}> in "${space.name}", in the order of their tabs (the first one opens when they arrive in the space):`;
132
145
  const lines = views.length > 0 ? views.map((view) => viewLine(store, view)) : ["(none yet: they get the default views \"Tableau\" and \"Liste\" when they open the board, or when you create a view)"];
133
146
  return respond(ViewsDataSchema, [header, ...lines].join("\n"), { owner: ownerData(author), views: views.map((view) => viewData(store, view)) });
134
147
  },
@@ -158,14 +171,15 @@ export const viewRoutes = [
158
171
  };
159
172
  requireGroupings(settings);
160
173
  ensureBoardViews(tx, space.id, author.id);
161
- const view = tx.createBoardView(space.id, author.id, settings);
174
+ const created = tx.createBoardView(space.id, author.id, settings);
175
+ const view = input.after_view === undefined ? created : placeView(tx, author, space, created, input.after_view);
162
176
  tx.recordAgentAction({
163
177
  entityType: "board_view",
164
178
  entityId: view.id,
165
179
  operation: "create",
166
180
  before: null,
167
181
  after: view,
168
- summary: `Vue ${quote(view.name)} créée pour ${userLabel(author)}`,
182
+ summary: `Vue ${quote(view.name)} créée pour ${userLabel(author)}${input.after_view === undefined ? "" : `, ${placeLabel(tx.store, view)}`}`,
169
183
  taskId: null,
170
184
  });
171
185
  return view;
@@ -189,8 +203,9 @@ export const viewRoutes = [
189
203
  const view = resolveView(tx.store, author, space, params.viewId);
190
204
  const patch = settingsPatch(tx.store, space, input);
191
205
  requireGroupings({ layout: patch.layout ?? view.layout, groupBy: patch.groupBy ?? view.groupBy, thenBy: patch.thenBy ?? view.thenBy });
192
- const updated = tx.updateBoardView(view.id, patch);
193
- tx.recordAgentAction({ entityType: "board_view", entityId: view.id, operation: "update", before: view, after: updated, summary: viewUpdateSummary(view, updated), taskId: null });
206
+ const changed = tx.updateBoardView(view.id, patch);
207
+ const updated = input.after_view === undefined ? changed : placeView(tx, author, space, changed, input.after_view);
208
+ tx.recordAgentAction({ entityType: "board_view", entityId: view.id, operation: "update", before: view, after: updated, summary: viewUpdateSummary(tx.store, view, updated), taskId: null });
194
209
  return updated;
195
210
  });
196
211
  return respond(ViewDataSchema, `Updated view ${updated.id} of ${userLabel(author)}; their open dashboard switches to it.\n${viewLine(store, updated)}`, {
@@ -1,5 +1,5 @@
1
1
  import type { BoardViewSettings, Mutation, Store } from "./store.js";
2
- import type { BoardViewListResponse, BoardViewView, CreateBoardViewRequest, UpdateBoardViewRequest } from "../../shared/schemas/views-api.schema.js";
2
+ import type { BoardViewListResponse, BoardViewView, CreateBoardViewRequest, MoveBoardViewRequest, UpdateBoardViewRequest } from "../../shared/schemas/views-api.schema.js";
3
3
  /** Vues créées pour un membre qui n'en a aucune : le Kanban et la liste par statut, sans filtre. */
4
4
  export declare const DEFAULT_BOARD_VIEWS: readonly BoardViewSettings[];
5
5
  /** Réglages de regroupement refusés par une disposition. */
@@ -18,5 +18,10 @@ export declare function listBoardViews(store: Store, userId: string, spaceId: st
18
18
  export declare function createBoardView(store: Store, userId: string, spaceId: string, input: CreateBoardViewRequest): BoardViewView;
19
19
  /** Change les réglages d'une vue. */
20
20
  export declare function updateBoardView(store: Store, userId: string, viewId: string, patch: UpdateBoardViewRequest): BoardViewView;
21
+ /**
22
+ * Déplace une vue parmi les onglets de l'utilisateur dans l'espace, juste
23
+ * après une autre ou en tête ; renvoie ses vues dans le nouvel ordre.
24
+ */
25
+ export declare function moveBoardView(store: Store, userId: string, viewId: string, input: MoveBoardViewRequest): BoardViewListResponse;
21
26
  /** Supprime une vue, sauf la dernière de l'utilisateur dans l'espace. */
22
27
  export declare function deleteBoardView(store: Store, userId: string, viewId: string): void;
@@ -104,6 +104,20 @@ export function updateBoardView(store, userId, viewId, patch) {
104
104
  });
105
105
  return viewOf(view);
106
106
  }
107
+ /**
108
+ * Déplace une vue parmi les onglets de l'utilisateur dans l'espace, juste
109
+ * après une autre ou en tête ; renvoie ses vues dans le nouvel ordre.
110
+ */
111
+ export function moveBoardView(store, userId, viewId, input) {
112
+ const spaceId = store.mutate(asUser(userId), (tx) => {
113
+ const view = requireOwnView(tx.store, viewId, userId);
114
+ if (input.afterId !== null)
115
+ requireOwnView(tx.store, input.afterId, userId);
116
+ tx.moveBoardView(view.id, input.afterId);
117
+ return view.spaceId;
118
+ });
119
+ return { views: store.listBoardViews(spaceId, userId).map(viewOf) };
120
+ }
107
121
  /** Supprime une vue, sauf la dernière de l'utilisateur dans l'espace. */
108
122
  export function deleteBoardView(store, userId, viewId) {
109
123
  store.mutate(asUser(userId), (tx) => {
@@ -321,6 +321,8 @@ function restore(tx, entityType, entityId, before) {
321
321
  const view = BoardViewSchema.parse(before);
322
322
  requireViewAssignees(tx, view);
323
323
  tx.updateBoardView(entityId, viewSettings(view));
324
+ if (tx.store.getBoardView(entityId).position !== view.position)
325
+ tx.setBoardViewPosition(entityId, view.position);
324
326
  return;
325
327
  }
326
328
  case "follow_up": {
@@ -778,6 +778,19 @@ export const MIGRATIONS = [
778
778
  // Résumé périodique des e-mails de notification : période en minutes, NULL pour un e-mail par notification.
779
779
  `
780
780
  ALTER TABLE user_settings ADD COLUMN email_digest_minutes INTEGER CHECK (email_digest_minutes IN (5, 15, 30, 60, 120));
781
+ `,
782
+ // Affichage de la barre latérale : toujours visible, au survol du bord gauche, ou repliée en icônes.
783
+ `
784
+ ALTER TABLE user_settings ADD COLUMN sidebar_mode TEXT NOT NULL DEFAULT 'pinned' CHECK (sidebar_mode IN ('pinned', 'hover', 'collapsed'));
785
+ `,
786
+ // Emoji de chaque espace : la maison pour les espaces personnels, aucun pour les espaces communs existants.
787
+ `
788
+ ALTER TABLE spaces ADD COLUMN emoji TEXT;
789
+ UPDATE spaces SET emoji = '🏠' WHERE kind = 'personal';
790
+ `,
791
+ // Ouverture d'une tâche par un clic simple sur sa carte : en pleine page ou dans l'aperçu latéral.
792
+ `
793
+ ALTER TABLE user_settings ADD COLUMN task_open_mode TEXT NOT NULL DEFAULT 'page' CHECK (task_open_mode IN ('page', 'preview'));
781
794
  `,
782
795
  ];
783
796
  /** Version du schéma attendue par ce code. */
@@ -90,6 +90,7 @@ export declare class NotificationMailer {
90
90
  /** Textes des points encore ouverts d'une demande. */
91
91
  private openPoints;
92
92
  private taskUrl;
93
+ /** Adresse de la demande dans la page Agent de son espace. */
93
94
  private requestUrl;
94
95
  }
95
96
  /** Notifications de l'utilisateur, non lues d'abord, par page. */
@@ -434,8 +434,10 @@ export class NotificationMailer {
434
434
  taskUrl(taskId) {
435
435
  return `${publicBase(this.deps.publicUrl)}/#/task/${encodeURIComponent(taskId)}`;
436
436
  }
437
+ /** Adresse de la demande dans la page Agent de son espace. */
437
438
  requestUrl(requestId) {
438
- return `${publicBase(this.deps.publicUrl)}/#/agent/demande/${encodeURIComponent(requestId)}`;
439
+ const { targetSpaceId } = this.store.getAgentRequest(requestId);
440
+ return `${publicBase(this.deps.publicUrl)}/#/espaces/${encodeURIComponent(targetSpaceId)}/agent/demande/${encodeURIComponent(requestId)}`;
439
441
  }
440
442
  }
441
443
  /** « 1 notification », « 3 notifications ». */
@@ -501,7 +503,7 @@ export function markAllNotificationsRead(store, userId) {
501
503
  return unreadCount(store, userId);
502
504
  }
503
505
  function settingsView(store, deps, userId) {
504
- const { notifyAssignApp, notifyAssignEmail, notifyCommentApp, notifyCommentEmail, notifyFollowUpApp, notifyFollowUpEmail, assistantHistory, pomodoro, emailDigestMinutes, } = store.getUserSettings(userId);
506
+ const { notifyAssignApp, notifyAssignEmail, notifyCommentApp, notifyCommentEmail, notifyFollowUpApp, notifyFollowUpEmail, assistantHistory, pomodoro, emailDigestMinutes, sidebarMode, taskOpenMode, } = store.getUserSettings(userId);
505
507
  const reason = notificationEmailBlocker(deps);
506
508
  return {
507
509
  notifyAssignApp,
@@ -513,6 +515,8 @@ function settingsView(store, deps, userId) {
513
515
  assistantHistory,
514
516
  pomodoro,
515
517
  emailDigestMinutes,
518
+ sidebarMode,
519
+ taskOpenMode,
516
520
  email: { enabled: reason === null, reason },
517
521
  transcription: { enabled: deps.transcriber.enabled, reason: deps.transcriber.disabledReason },
518
522
  };
@@ -31,7 +31,14 @@ export declare function createSharedSpace(store: Store, userId: string, input: {
31
31
  name: string;
32
32
  keyPrefix?: string;
33
33
  }): SpaceSummary;
34
- export declare function renameSpace(store: Store, userId: string, spaceId: string, name: string): SpaceSummary;
34
+ /**
35
+ * Change le nom d'un espace commun ou l'emoji d'un espace, ce que seul son
36
+ * propriétaire peut faire ; l'emoji de l'espace personnel appartient à son titulaire.
37
+ */
38
+ export declare function updateSpace(store: Store, userId: string, spaceId: string, patch: {
39
+ name?: string;
40
+ emoji?: string | null;
41
+ }): SpaceSummary;
35
42
  /** Supprime un espace commun, son contenu et les fichiers de ses pièces jointes et de ses documents. */
36
43
  export declare function deleteSpace(store: Store, storage: AttachmentStorage, userId: string, spaceId: string): void;
37
44
  /** Membres (propriétaire d'abord) et invitations en attente d'un espace, pour un de ses membres. */
@@ -22,7 +22,7 @@ export function requireOwner(store, spaceId, userId, action) {
22
22
  }
23
23
  // --- Vues -----------------------------------------------------------------------
24
24
  function summary(space, membership) {
25
- return { id: space.id, name: space.name, kind: space.kind, keyPrefix: space.keyPrefix, ownerId: space.ownerId, role: membership.role };
25
+ return { id: space.id, name: space.name, emoji: space.emoji, kind: space.kind, keyPrefix: space.keyPrefix, ownerId: space.ownerId, role: membership.role };
26
26
  }
27
27
  function memberView(store, user, membership) {
28
28
  return {
@@ -63,10 +63,23 @@ export function createSharedSpace(store, userId, input) {
63
63
  return summary(space, tx.store.findMembership(space.id, userId));
64
64
  });
65
65
  }
66
- export function renameSpace(store, userId, spaceId, name) {
66
+ /**
67
+ * Change le nom d'un espace commun ou l'emoji d'un espace, ce que seul son
68
+ * propriétaire peut faire ; l'emoji de l'espace personnel appartient à son titulaire.
69
+ */
70
+ export function updateSpace(store, userId, spaceId, patch) {
67
71
  return store.mutate({ type: "user", userId }, (tx) => {
68
- requireOwner(tx.store, spaceId, userId, "renommer l'espace");
69
- return summary(tx.renameSpace(spaceId, name), tx.store.findMembership(spaceId, userId));
72
+ if (patch.name !== undefined) {
73
+ requireOwner(tx.store, spaceId, userId, "renommer l'espace");
74
+ tx.renameSpace(spaceId, patch.name);
75
+ }
76
+ if (patch.emoji !== undefined) {
77
+ const { space, membership } = requireMember(tx.store, spaceId, userId);
78
+ if (membership.role !== "owner")
79
+ throw new ForbiddenError(`Seul le propriétaire de l'espace « ${space.name} » peut changer son emoji.`);
80
+ tx.setSpaceEmoji(spaceId, patch.emoji);
81
+ }
82
+ return summary(tx.store.getSpace(spaceId), tx.store.findMembership(spaceId, userId));
70
83
  });
71
84
  }
72
85
  /** Supprime un espace commun, son contenu et les fichiers de ses pièces jointes et de ses documents. */
@@ -1,7 +1,7 @@
1
1
  import type Database from "better-sqlite3";
2
2
  import { WatcherRegistry } from "./watchers.js";
3
3
  import { type BoardGrouping, type BoardLayout, type EntityType, type MemberRole, type RequestKind, type RequestStatus, type SpaceKind, type TaskPriority, type TaskStatus, type TaskType, type TestResultValue, type AccessLinkPurpose, type AgentOperation, type UserStatus, type VersionedEntityType } from "../../shared/schemas/enums.schema.js";
4
- import { type AccessLink, type AgentAction, type AgentInstructions, type AgentRequest, type AgentToken, type Attachment, type BoardView, type Change, type ChecklistItem, type Comment, type QuestionOption, type QuestionSnapshot, type TaskQuestion, type EntityVersion, type FollowUp, type Idea, type Invitation, type Note, type SpaceDocument, type Membership, type Notification, type Session, type Space, type Tag, type Task, type TaskSnapshot, type TestCheckpoint, type TestResult, type TestReview, type TimeSession, type PomodoroSettings, type EmailDigestMinutes, type User, type UserSettings, type NotificationPreferences, type SpaceNotificationSettings } from "../../shared/schemas/entities.schema.js";
4
+ import { type AccessLink, type AgentAction, type AgentInstructions, type AgentRequest, type AgentToken, type Attachment, type BoardView, type Change, type ChecklistItem, type Comment, type QuestionOption, type QuestionSnapshot, type TaskQuestion, type EntityVersion, type FollowUp, type Idea, type Invitation, type Note, type SpaceDocument, type Membership, type Notification, type Session, type Space, type Tag, type Task, type TaskSnapshot, type TestCheckpoint, type TestResult, type TestReview, type TimeSession, type PomodoroSettings, type EmailDigestMinutes, type SidebarMode, type TaskOpenMode, type User, type UserSettings, type NotificationPreferences, type SpaceNotificationSettings } from "../../shared/schemas/entities.schema.js";
5
5
  import { type ClaudeConnection, type NewRunnerSession, type RunnerSessionRecord, type RunnerSettings } from "../../shared/schemas/admin-api.schema.js";
6
6
  /**
7
7
  * Auteur d'une mutation : un utilisateur de la GUI, ou un agent qui agit avec
@@ -378,6 +378,8 @@ export interface UpdateUserSettingsInput {
378
378
  assistantHistory?: number;
379
379
  pomodoro?: PomodoroSettings;
380
380
  emailDigestMinutes?: EmailDigestMinutes | null;
381
+ sidebarMode?: SidebarMode;
382
+ taskOpenMode?: TaskOpenMode;
381
383
  }
382
384
  /** Issue de l'envoi de l'e-mail d'une notification. */
383
385
  export type NotificationEmailOutcome = {
@@ -576,6 +578,8 @@ export declare class Mutation {
576
578
  /** Autorise ou interdit le runner sur un espace. */
577
579
  setSpaceRunnerAllowed(id: string, allowed: boolean): Space;
578
580
  renameSpace(id: string, name: string): Space;
581
+ /** Change l'emoji d'un espace, ou le retire avec null. */
582
+ setSpaceEmoji(id: string, emoji: string | null): Space;
579
583
  /** Supprime un espace commun et tout son contenu. Un espace personnel ne se supprime pas. */
580
584
  deleteSpace(id: string): void;
581
585
  addMember(spaceId: string, userId: string, role?: MemberRole): Membership;
@@ -765,6 +769,13 @@ export declare class Mutation {
765
769
  restoreBoardView(view: BoardView): BoardView;
766
770
  private insertBoardView;
767
771
  updateBoardView(id: string, patch: Partial<BoardViewSettings>): BoardView;
772
+ /**
773
+ * Place une vue juste après `afterId` parmi les vues de son membre dans
774
+ * l'espace, ou en tête avec null : la première s'ouvre à l'arrivée sur l'espace.
775
+ */
776
+ moveBoardView(id: string, afterId: string | null): BoardView;
777
+ /** Donne un rang à une vue, tel quel (restauration d'un ordre d'onglets). */
778
+ setBoardViewPosition(id: string, position: number): BoardView;
768
779
  deleteBoardView(id: string): void;
769
780
  /** Dépose une demande `pending` de l'utilisateur acteur. */
770
781
  createAgentRequest(input: CreateAgentRequestInput): AgentRequest;
@@ -5,7 +5,7 @@ import { newId } from "./ids.js";
5
5
  import { WatcherRegistry } from "./watchers.js";
6
6
  import { isVisibleVersion, VERSION_SNAPSHOT_SCHEMAS, versionSnapshot } from "./versions.js";
7
7
  import { MAX_TASK_DEPTH, TASK_PRIORITIES, TASK_STATUSES, TASK_TYPES, VERSIONED_ENTITY_TYPES, } from "../../shared/schemas/enums.schema.js";
8
- import { AccessLinkSchema, AgentActionSchema, AgentInstructionsSchema, AgentTokenSchema, AgentRequestSchema, AttachmentSchema, BoardViewSchema, ChangeSchema, ChecklistItemSchema, CommentSchema, MAX_QUESTION_OPTIONS, QuestionOptionSchema, TaskQuestionSchema, EntityVersionSchema, FollowUpSchema, IdeaSchema, InvitationSchema, NoteSchema, SpaceDocumentSchema, MembershipSchema, NotificationSchema, SessionSchema, SpaceSchema, TagSchema, TaskSchema, TaskSnapshotSchema, TestCheckpointSchema, TestResultSchema, TestReviewSchema, TimeSessionSchema, UserSchema, UserSettingsSchema, SpaceNotificationSettingsSchema, } from "../../shared/schemas/entities.schema.js";
8
+ import { PERSONAL_SPACE_EMOJI, SHARED_SPACE_EMOJIS, AccessLinkSchema, AgentActionSchema, AgentInstructionsSchema, AgentTokenSchema, AgentRequestSchema, AttachmentSchema, BoardViewSchema, ChangeSchema, ChecklistItemSchema, CommentSchema, MAX_QUESTION_OPTIONS, QuestionOptionSchema, TaskQuestionSchema, EntityVersionSchema, FollowUpSchema, IdeaSchema, InvitationSchema, NoteSchema, SpaceDocumentSchema, MembershipSchema, NotificationSchema, SessionSchema, SpaceSchema, TagSchema, TaskSchema, TaskSnapshotSchema, TestCheckpointSchema, TestResultSchema, TestReviewSchema, TimeSessionSchema, UserSchema, UserSettingsSchema, SpaceNotificationSettingsSchema, } from "../../shared/schemas/entities.schema.js";
9
9
  import { ClaudeConnectionSchema, NewRunnerSessionSchema, RunnerSessionRecordSchema, RunnerSettingsSchema, } from "../../shared/schemas/admin-api.schema.js";
10
10
  /** Valide `value` avec `schema` ; une donnée invalide est une erreur métier qui liste les champs fautifs. */
11
11
  function validate(schema, value, what) {
@@ -85,6 +85,8 @@ function settingsFromRow(row) {
85
85
  cycles: row.pomodoro_cycles,
86
86
  },
87
87
  emailDigestMinutes: row.email_digest_minutes,
88
+ sidebarMode: row.sidebar_mode,
89
+ taskOpenMode: row.task_open_mode,
88
90
  });
89
91
  }
90
92
  function timeSessionFromRow(row) {
@@ -150,6 +152,7 @@ function spaceFromRow(row) {
150
152
  return SpaceSchema.parse({
151
153
  id: row.id,
152
154
  name: row.name,
155
+ emoji: row.emoji,
153
156
  kind: row.kind,
154
157
  ownerId: row.owner_id,
155
158
  keyPrefix: row.key_prefix,
@@ -1657,14 +1660,24 @@ export class Mutation {
1657
1660
  // --- Espaces et membres ---
1658
1661
  /** Crée un espace et en fait de son propriétaire le membre `owner`. */
1659
1662
  createSpace(input) {
1660
- const space = validate(SpaceSchema, { id: newId(), name: input.name, kind: input.kind, ownerId: input.ownerId, keyPrefix: input.keyPrefix, nextTaskNumber: 1, runnerAllowed: false, createdAt: this.now }, "space");
1663
+ const space = validate(SpaceSchema, {
1664
+ id: newId(),
1665
+ name: input.name,
1666
+ emoji: input.kind === "personal" ? PERSONAL_SPACE_EMOJI : SHARED_SPACE_EMOJIS[Math.floor(Math.random() * SHARED_SPACE_EMOJIS.length)],
1667
+ kind: input.kind,
1668
+ ownerId: input.ownerId,
1669
+ keyPrefix: input.keyPrefix,
1670
+ nextTaskNumber: 1,
1671
+ runnerAllowed: false,
1672
+ createdAt: this.now,
1673
+ }, "space");
1661
1674
  this.store.getUser(space.ownerId);
1662
1675
  if (space.kind === "personal" && this.store.findPersonalSpace(space.ownerId)) {
1663
1676
  throw new InvariantError(`User ${space.ownerId} already has a personal space.`);
1664
1677
  }
1665
1678
  this.db
1666
- .prepare("INSERT INTO spaces (id, name, kind, owner_id, key_prefix, next_task_number, created_at) VALUES (?, ?, ?, ?, ?, ?, ?)")
1667
- .run(space.id, space.name, space.kind, space.ownerId, space.keyPrefix, space.nextTaskNumber, space.createdAt);
1679
+ .prepare("INSERT INTO spaces (id, name, emoji, kind, owner_id, key_prefix, next_task_number, created_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?)")
1680
+ .run(space.id, space.name, space.emoji, space.kind, space.ownerId, space.keyPrefix, space.nextTaskNumber, space.createdAt);
1668
1681
  this.touch("space", space.id, space.id, null);
1669
1682
  this.insertMembership(space.id, space.ownerId, "owner");
1670
1683
  return space;
@@ -1684,6 +1697,13 @@ export class Mutation {
1684
1697
  this.touch("space", id, id, null);
1685
1698
  return space;
1686
1699
  }
1700
+ /** Change l'emoji d'un espace, ou le retire avec null. */
1701
+ setSpaceEmoji(id, emoji) {
1702
+ const space = validate(SpaceSchema, { ...this.store.getSpace(id), emoji }, "space");
1703
+ this.db.prepare("UPDATE spaces SET emoji = ? WHERE id = ?").run(space.emoji, id);
1704
+ this.touch("space", id, id, null);
1705
+ return space;
1706
+ }
1687
1707
  /** Supprime un espace commun et tout son contenu. Un espace personnel ne se supprime pas. */
1688
1708
  deleteSpace(id) {
1689
1709
  const space = this.store.getSpace(id);
@@ -2585,6 +2605,28 @@ export class Mutation {
2585
2605
  this.touch("board_view", id, null, view.userId, null, view.spaceId);
2586
2606
  return view;
2587
2607
  }
2608
+ /**
2609
+ * Place une vue juste après `afterId` parmi les vues de son membre dans
2610
+ * l'espace, ou en tête avec null : la première s'ouvre à l'arrivée sur l'espace.
2611
+ */
2612
+ moveBoardView(id, afterId) {
2613
+ const view = this.store.getBoardView(id);
2614
+ if (afterId === id)
2615
+ return view;
2616
+ const others = this.store.listBoardViews(view.spaceId, view.userId).filter((other) => other.id !== id);
2617
+ const position = this.slotAfter(others, afterId, `View ${afterId} is not a view of this member in this space`, (ids) => {
2618
+ const update = this.db.prepare("UPDATE board_views SET position = ? WHERE id = ?");
2619
+ ids.forEach((otherId, index) => update.run(index + 1, otherId));
2620
+ });
2621
+ return this.setBoardViewPosition(id, position);
2622
+ }
2623
+ /** Donne un rang à une vue, tel quel (restauration d'un ordre d'onglets). */
2624
+ setBoardViewPosition(id, position) {
2625
+ const view = this.store.getBoardView(id);
2626
+ this.db.prepare("UPDATE board_views SET position = ?, updated_at = ? WHERE id = ?").run(position, this.now, id);
2627
+ this.touch("board_view", id, null, view.userId, null, view.spaceId);
2628
+ return { ...view, position, updatedAt: this.now };
2629
+ }
2588
2630
  deleteBoardView(id) {
2589
2631
  const view = this.store.getBoardView(id);
2590
2632
  this.db.prepare("DELETE FROM board_views WHERE id = ?").run(id);
@@ -3094,8 +3136,8 @@ export class Mutation {
3094
3136
  this.db
3095
3137
  .prepare(`UPDATE user_settings SET notify_assign_app = ?, notify_assign_email = ?, notify_comment_app = ?, notify_comment_email = ?,
3096
3138
  notify_follow_up_app = ?, notify_follow_up_email = ?, assistant_history = ?, pomodoro_work_minutes = ?,
3097
- pomodoro_short_break_minutes = ?, pomodoro_long_break_minutes = ?, pomodoro_cycles = ?, email_digest_minutes = ? WHERE user_id = ?`)
3098
- .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, settings.pomodoro.workMinutes, settings.pomodoro.shortBreakMinutes, settings.pomodoro.longBreakMinutes, settings.pomodoro.cycles, settings.emailDigestMinutes, userId);
3139
+ pomodoro_short_break_minutes = ?, pomodoro_long_break_minutes = ?, pomodoro_cycles = ?, email_digest_minutes = ?, sidebar_mode = ?, task_open_mode = ? WHERE user_id = ?`)
3140
+ .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, settings.pomodoro.workMinutes, settings.pomodoro.shortBreakMinutes, settings.pomodoro.longBreakMinutes, settings.pomodoro.cycles, settings.emailDigestMinutes, settings.sidebarMode, settings.taskOpenMode, userId);
3099
3141
  this.touch("user_settings", userId, null, userId);
3100
3142
  return settings;
3101
3143
  }
@@ -1,7 +1,7 @@
1
- import { ActivateRequestSchema, ChangePasswordRequestSchema, CreateSpaceRequestSchema, InviteRequestSchema, LoginRequestSchema, PasswordResetRequestSchema, RenameSpaceRequestSchema, UpdateProfileRequestSchema, } from "../shared/schemas/api.schema.js";
1
+ import { ActivateRequestSchema, ChangePasswordRequestSchema, CreateSpaceRequestSchema, InviteRequestSchema, LoginRequestSchema, PasswordResetRequestSchema, UpdateSpaceRequestSchema, UpdateProfileRequestSchema, } from "../shared/schemas/api.schema.js";
2
2
  import { ForbiddenError, InvariantError, NotFoundError, OrganizerError, UnauthorizedError } from "./core/errors.js";
3
3
  import { authenticate, changePassword, login, logout, redeemAccessLink, resolveAccessLink, updateDisplayName } from "./core/accounts.js";
4
- import { acceptReceivedInvitation, createSharedSpace, declineReceivedInvitation, deleteSpace, inviteToSpace, leaveSpace, listMembers, listMemberSuggestions, listReceivedInvitations, listSpaces, removeMember, renameSpace, resendInvitation, revokeInvitation, } from "./core/spaces.js";
4
+ import { acceptReceivedInvitation, createSharedSpace, declineReceivedInvitation, deleteSpace, inviteToSpace, leaveSpace, listMembers, listMemberSuggestions, listReceivedInvitations, listSpaces, removeMember, updateSpace, resendInvitation, revokeInvitation, } from "./core/spaces.js";
5
5
  import { addChecklistItem, addComment, createTask, deleteAttachment, deleteChecklistItem, deleteComment, deleteTask, downloadAttachment, getBoard, getTaskDetail, listChanges, moveChecklistItem, moveTask, resolveTaskKey, setAssignees, setTags, updateChecklistItem, updateComment, updateTask, uploadAttachment, } from "./core/tasks.js";
6
6
  import { answerQuestion } from "./core/questions.js";
7
7
  import { listTimers, pauseTimer, resumeTimer, startTimer, stopTimer } from "./core/timers.js";
@@ -15,8 +15,8 @@ import { listTaskHistory, restoreTaskVersion } from "./core/task-history.js";
15
15
  import { listSpaceHistory, restoreDeletedTask } from "./core/space-history.js";
16
16
  import { SpaceHistoryQuerySchema } from "../shared/schemas/history-api.schema.js";
17
17
  import { CreateRequestSchema, CreateSuiteSchema, SetFollowUpDoneSchema, UpdateRequestSchema } from "../shared/schemas/agent-api.schema.js";
18
- import { createBoardView, deleteBoardView, listBoardViews, updateBoardView } from "./core/board-views.js";
19
- import { CreateBoardViewRequestSchema, UpdateBoardViewRequestSchema } from "../shared/schemas/views-api.schema.js";
18
+ import { createBoardView, deleteBoardView, listBoardViews, moveBoardView, updateBoardView } from "./core/board-views.js";
19
+ import { CreateBoardViewRequestSchema, MoveBoardViewRequestSchema, UpdateBoardViewRequestSchema } from "../shared/schemas/views-api.schema.js";
20
20
  import { createIdea, delegatePromotion, listIdeas, promoteIdea, setIdeaArchived } from "./core/ideas.js";
21
21
  import { CreateIdeaRequestSchema, PromoteIdeaRequestSchema, UpdateIdeaRequestSchema } from "../shared/schemas/ideas-api.schema.js";
22
22
  import { createNote, deleteNote, getNote, listNotes, sendNoteToAgent, updateNote } from "./core/notes.js";
@@ -187,8 +187,7 @@ route("POST", "/spaces", (ctx, { user, request }) => {
187
187
  return { body: createSharedSpace(ctx.store, user.id, input) };
188
188
  });
189
189
  route("PATCH", "/spaces/:spaceId", (ctx, { user, request, params }) => {
190
- const input = parseBody(RenameSpaceRequestSchema, request.body);
191
- return { body: renameSpace(ctx.store, user.id, params.spaceId, input.name) };
190
+ return { body: updateSpace(ctx.store, user.id, params.spaceId, parseBody(UpdateSpaceRequestSchema, request.body)) };
192
191
  });
193
192
  route("DELETE", "/spaces/:spaceId", (ctx, { user, params }) => {
194
193
  deleteSpace(ctx.store, ctx.attachments, user.id, params.spaceId);
@@ -231,6 +230,9 @@ route("POST", "/spaces/:spaceId/views", (ctx, { user, request, params }) => ({
231
230
  route("PATCH", "/views/:viewId", (ctx, { user, request, params }) => ({
232
231
  body: updateBoardView(ctx.store, user.id, params.viewId, parseBody(UpdateBoardViewRequestSchema, request.body)),
233
232
  }));
233
+ route("POST", "/views/:viewId/move", (ctx, { user, request, params }) => ({
234
+ body: moveBoardView(ctx.store, user.id, params.viewId, parseBody(MoveBoardViewRequestSchema, request.body)),
235
+ }));
234
236
  route("DELETE", "/views/:viewId", (ctx, { user, params }) => {
235
237
  deleteBoardView(ctx.store, user.id, params.viewId);
236
238
  return { body: ok };
@@ -25,6 +25,10 @@ const TIMER_REQUEST_ID = {
25
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
26
  };
27
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." };
28
+ const AFTER_VIEW = {
29
+ type: ["string", "null"],
30
+ description: "Place the view right after this view of theirs (its id, from list_views); null puts it first, which makes it the view opened when they arrive in the space. Omitted: create_view adds it last, update_view keeps its place.",
31
+ };
28
32
  /** Réglages d'une vue, communs à create_view et update_view. */
29
33
  const VIEW_SETTINGS = {
30
34
  name: { type: "string", maxLength: MAX_BOARD_VIEW_NAME_LENGTH, description: "Name of the view, shown as its tab, in the language of the users." },
@@ -520,7 +524,7 @@ export const AGENT_TOOLS = [
520
524
  definition: {
521
525
  name: "create_view",
522
526
  description: "Create a board view for the author of a request, or for your token's owner without request_id (e.g. \"show me only my critical tasks, by status\"), after their other tabs; their open dashboard switches to it. Defaults: kanban grouped by status, then_by none (a matrix crosses status and priority), empty groups shown except in a list, no filter. Prefer update_view when the author asks to change a view they have.",
523
- inputSchema: { type: "object", properties: { request_id: VIEW_REQUEST_ID, ...VIEW_SETTINGS }, required: ["name"], additionalProperties: false },
527
+ inputSchema: { type: "object", properties: { request_id: VIEW_REQUEST_ID, ...VIEW_SETTINGS, after_view: AFTER_VIEW }, required: ["name"], additionalProperties: false },
524
528
  },
525
529
  },
526
530
  {
@@ -528,8 +532,8 @@ export const AGENT_TOOLS = [
528
532
  path: "views/{view_id}",
529
533
  definition: {
530
534
  name: "update_view",
531
- 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.",
532
- inputSchema: { type: "object", properties: { request_id: VIEW_REQUEST_ID, view_id: VIEW_ID, ...VIEW_SETTINGS }, required: ["view_id"], additionalProperties: false },
535
+ 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, and its place among their tabs (after_view; the first tab opens when they arrive in the space). Only the given settings change; a list (statuses, priorities, assignees, tags, types) replaces the previous one. Their open dashboard switches to the view.",
536
+ inputSchema: { type: "object", properties: { request_id: VIEW_REQUEST_ID, view_id: VIEW_ID, ...VIEW_SETTINGS, after_view: AFTER_VIEW }, required: ["view_id"], additionalProperties: false },
533
537
  },
534
538
  },
535
539
  {