@imenam/mcp-organizer 1.0.31 → 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 +40 -26
  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 +46 -0
  9. package/dist/shared/schemas/entities.schema.js +39 -0
  10. package/dist/shared/schemas/notifications-api.schema.d.ts +20 -0
  11. package/dist/shared/schemas/notifications-api.schema.js +10 -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 +17 -0
  19. package/dist/src/core/notifications.d.ts +20 -4
  20. package/dist/src/core/notifications.js +144 -30
  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 +15 -1
  24. package/dist/src/core/store.js +56 -8
  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-D4I3h65z.css +0 -1
  33. package/gui/dist/assets/index-F67zTtnA.js +0 -104
@@ -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 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
@@ -377,6 +377,9 @@ export interface UpdateUserSettingsInput {
377
377
  notifyFollowUpEmail?: boolean;
378
378
  assistantHistory?: number;
379
379
  pomodoro?: PomodoroSettings;
380
+ emailDigestMinutes?: EmailDigestMinutes | null;
381
+ sidebarMode?: SidebarMode;
382
+ taskOpenMode?: TaskOpenMode;
380
383
  }
381
384
  /** Issue de l'envoi de l'e-mail d'une notification. */
382
385
  export type NotificationEmailOutcome = {
@@ -480,6 +483,8 @@ export declare class Mutation {
480
483
  readonly emailNotificationIds: string[];
481
484
  /** Demandes de l'agent touchées par la mutation. */
482
485
  readonly touchedRequestIds: Set<string>;
486
+ /** Vrai si la mutation change la période du résumé des e-mails d'un utilisateur. */
487
+ emailScheduleChanged: boolean;
483
488
  /** Demandes passées en attente par la mutation : créées, ou libérées. */
484
489
  readonly pendingRequestIds: string[];
485
490
  /** Espaces où la mutation a autorisé le runner. */
@@ -573,6 +578,8 @@ export declare class Mutation {
573
578
  /** Autorise ou interdit le runner sur un espace. */
574
579
  setSpaceRunnerAllowed(id: string, allowed: boolean): Space;
575
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;
576
583
  /** Supprime un espace commun et tout son contenu. Un espace personnel ne se supprime pas. */
577
584
  deleteSpace(id: string): void;
578
585
  addMember(spaceId: string, userId: string, role?: MemberRole): Membership;
@@ -762,6 +769,13 @@ export declare class Mutation {
762
769
  restoreBoardView(view: BoardView): BoardView;
763
770
  private insertBoardView;
764
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;
765
779
  deleteBoardView(id: string): void;
766
780
  /** Dépose une demande `pending` de l'utilisateur acteur. */
767
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) {
@@ -84,6 +84,9 @@ function settingsFromRow(row) {
84
84
  longBreakMinutes: row.pomodoro_long_break_minutes,
85
85
  cycles: row.pomodoro_cycles,
86
86
  },
87
+ emailDigestMinutes: row.email_digest_minutes,
88
+ sidebarMode: row.sidebar_mode,
89
+ taskOpenMode: row.task_open_mode,
87
90
  });
88
91
  }
89
92
  function timeSessionFromRow(row) {
@@ -149,6 +152,7 @@ function spaceFromRow(row) {
149
152
  return SpaceSchema.parse({
150
153
  id: row.id,
151
154
  name: row.name,
155
+ emoji: row.emoji,
152
156
  kind: row.kind,
153
157
  ownerId: row.owner_id,
154
158
  keyPrefix: row.key_prefix,
@@ -1317,7 +1321,7 @@ export class Store {
1317
1321
  try {
1318
1322
  const result = fn(tx);
1319
1323
  tx.finish();
1320
- emails = tx.emailNotificationIds.length > 0 || tx.touchedRequestIds.size > 0;
1324
+ emails = tx.emailNotificationIds.length > 0 || tx.touchedRequestIds.size > 0 || tx.emailScheduleChanged;
1321
1325
  pending = tx.pendingRequestIds;
1322
1326
  allowed = tx.runnerAllowedSpaceIds;
1323
1327
  return result;
@@ -1363,6 +1367,8 @@ export class Mutation {
1363
1367
  emailNotificationIds = [];
1364
1368
  /** Demandes de l'agent touchées par la mutation. */
1365
1369
  touchedRequestIds = new Set();
1370
+ /** Vrai si la mutation change la période du résumé des e-mails d'un utilisateur. */
1371
+ emailScheduleChanged = false;
1366
1372
  /** Demandes passées en attente par la mutation : créées, ou libérées. */
1367
1373
  pendingRequestIds = [];
1368
1374
  /** Espaces où la mutation a autorisé le runner. */
@@ -1654,14 +1660,24 @@ export class Mutation {
1654
1660
  // --- Espaces et membres ---
1655
1661
  /** Crée un espace et en fait de son propriétaire le membre `owner`. */
1656
1662
  createSpace(input) {
1657
- 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");
1658
1674
  this.store.getUser(space.ownerId);
1659
1675
  if (space.kind === "personal" && this.store.findPersonalSpace(space.ownerId)) {
1660
1676
  throw new InvariantError(`User ${space.ownerId} already has a personal space.`);
1661
1677
  }
1662
1678
  this.db
1663
- .prepare("INSERT INTO spaces (id, name, kind, owner_id, key_prefix, next_task_number, created_at) VALUES (?, ?, ?, ?, ?, ?, ?)")
1664
- .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);
1665
1681
  this.touch("space", space.id, space.id, null);
1666
1682
  this.insertMembership(space.id, space.ownerId, "owner");
1667
1683
  return space;
@@ -1681,6 +1697,13 @@ export class Mutation {
1681
1697
  this.touch("space", id, id, null);
1682
1698
  return space;
1683
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
+ }
1684
1707
  /** Supprime un espace commun et tout son contenu. Un espace personnel ne se supprime pas. */
1685
1708
  deleteSpace(id) {
1686
1709
  const space = this.store.getSpace(id);
@@ -2582,6 +2605,28 @@ export class Mutation {
2582
2605
  this.touch("board_view", id, null, view.userId, null, view.spaceId);
2583
2606
  return view;
2584
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
+ }
2585
2630
  deleteBoardView(id) {
2586
2631
  const view = this.store.getBoardView(id);
2587
2632
  this.db.prepare("DELETE FROM board_views WHERE id = ?").run(id);
@@ -3084,12 +3129,15 @@ export class Mutation {
3084
3129
  }
3085
3130
  /** Modifie les préférences d'un utilisateur. */
3086
3131
  updateUserSettings(userId, patch) {
3087
- const settings = validate(UserSettingsSchema, { ...this.store.getUserSettings(userId), ...definedFields(patch) }, "settings");
3132
+ const previous = this.store.getUserSettings(userId);
3133
+ const settings = validate(UserSettingsSchema, { ...previous, ...definedFields(patch) }, "settings");
3134
+ if (settings.emailDigestMinutes !== previous.emailDigestMinutes)
3135
+ this.emailScheduleChanged = true;
3088
3136
  this.db
3089
3137
  .prepare(`UPDATE user_settings SET notify_assign_app = ?, notify_assign_email = ?, notify_comment_app = ?, notify_comment_email = ?,
3090
3138
  notify_follow_up_app = ?, notify_follow_up_email = ?, assistant_history = ?, pomodoro_work_minutes = ?,
3091
- pomodoro_short_break_minutes = ?, pomodoro_long_break_minutes = ?, pomodoro_cycles = ? WHERE user_id = ?`)
3092
- .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, 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);
3093
3141
  this.touch("user_settings", userId, null, userId);
3094
3142
  return settings;
3095
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
  {