@vite-hub/comments 0.5.1 → 0.6.0
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 +3 -1
- package/dist/client.d.ts +29 -3
- package/dist/client.js +50 -22
- package/dist/{console-CK2F53QP.d.ts → console-CCLX_eIk.d.ts} +1 -1
- package/dist/{define-9uMM3Ewc.js → define-BCxNaSZv.js} +1 -1
- package/dist/hosted/hosted-comments/overlay-CFuq5QAH.js +182 -0
- package/dist/hosted/hosted-comments/{tools-CdwnUCOr.js → tools-Bz--joZw.js} +3 -3
- package/dist/hosted/hosted-comments.js +2 -2
- package/dist/{index-BEnHTj2Z.d.ts → index-D1T7RJ4R.d.ts} +5 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/{install-B-FQpi47.d.ts → install-NehuMNhG.d.ts} +1 -1
- package/dist/{install-BUXxryut.js → install-w6CCgGFV.js} +39 -15
- package/dist/{operations-CKC_lMG_.js → operations-B8IMhRmY.js} +1 -1
- package/dist/operations.js +2 -2
- package/dist/overlay/overlay.js +27 -15
- package/dist/page/loader.js +1 -1
- package/dist/{plugin-B2hETRii.js → plugin-DbCYT7Ac.js} +8 -3
- package/dist/realtime.d.ts +2 -2
- package/dist/realtime.js +1 -1
- package/dist/runtime/console.d.ts +1 -1
- package/dist/runtime/console.js +1 -1
- package/dist/runtime/index.d.ts +40 -10
- package/dist/runtime/index.js +11 -5
- package/dist/server.d.ts +1 -1
- package/dist/server.js +4 -4
- package/dist/{service-DDD4Ubxd.js → service-DUh2uGd2.js} +1 -1
- package/dist/{session-CTh9nisq.d.ts → session-CN4irEqf.d.ts} +1 -1
- package/dist/{session-BGN6Vlm6.js → session-_1GY5gaG.js} +23 -8
- package/dist/vite.d.ts +18 -2
- package/dist/vite.js +16 -3
- package/package.json +7 -7
- package/dist/hosted/hosted-comments/overlay-4-mWX4Uz.js +0 -170
package/README.md
CHANGED
|
@@ -118,6 +118,8 @@ A failure in `onComment`, `onMention`, or the pull request sync never fails the
|
|
|
118
118
|
|
|
119
119
|
## Send to an agent
|
|
120
120
|
|
|
121
|
+
A Console team member who opens the app through Site access gets **Copy prompt** when the page has open threads and the Console MCP lets them read those threads. The prompt names the linked app, its team, and the thread IDs. It includes resolution instructions only with Console MCP write access. `/session` supplies `agent: { mcp, project, resolve }`. For one click without a paste, use `send`:
|
|
122
|
+
|
|
121
123
|
`defineComments({ send: true })` adds **Send N** to the comment pill: one click hands the open threads of the page that wait for an answer to the person's own agent, such as a T3 Code thread. The first press copies a setup prompt; the agent creates a T3 webhook task and pairs it with the one-use code, and the pill asks once to allow it. Each send is a signed `POST` with the thread ids and a read token for 24 hours, through the member endpoints of `@vite-hub/webhooks`. `send: { grant: false }` leaves the token out, for an app that reads through its own MCP server, and `payload` adds fields, and `prompt` changes the setup prompt. Each member has their own count, and Allow sends only the threads the member saw. The `comments_get_send` MCP tool reads a send, and `comments.listSends(user)` and `comments.readSend(user, id)` read sends on the server. Reopening a thread can restore a done inbox send or let the member send it to a webhook agent again. Send needs a ViteHub app with a SQLite Database. See [Send comments to your agent](https://vitehub.dev/docs/comments/send).
|
|
122
124
|
|
|
123
125
|
## Deployment and security boundaries
|
|
@@ -136,7 +138,7 @@ A failure in `onComment`, `onMention`, or the pull request sync never fails the
|
|
|
136
138
|
| Import | Purpose |
|
|
137
139
|
| --- | --- |
|
|
138
140
|
| `@vite-hub/comments` | `defineComments()` and types. `installComments()` is in `@vite-hub/comments/server`. |
|
|
139
|
-
| `@vite-hub/comments/client` | Framework-free client, transport types, `createAnchor()`, `resolveAnchor()`, and `createCommentSend()`, the state of the Send segment that hands a member's waiting comments to their agent. |
|
|
141
|
+
| `@vite-hub/comments/client` | Framework-free client, transport types, `createAnchor()`, `resolveAnchor()`, `commentsAgentPrompt()`, the text of **Copy prompt**, and `createCommentSend()`, the state of the Send segment that hands a member's waiting comments to their agent. |
|
|
140
142
|
| `@vite-hub/comments/testing` | In-memory client transport for tests and examples. |
|
|
141
143
|
| `@vite-hub/comments/anchor` | DOM anchoring: `createAnchor()`, `placeAnchor()`, `selectorOf()`, `labelOf()`. |
|
|
142
144
|
| `@vite-hub/comments/database` | `commentsSchema`, the Drizzle tables, and `commentsTables`, the statements that create them. |
|
package/dist/client.d.ts
CHANGED
|
@@ -110,6 +110,18 @@ export declare function createMemoryOutboxStore(): CommentsOutboxStore;
|
|
|
110
110
|
* does not open, as in some private windows, it keeps the entries in memory and `persisted` is `false`.
|
|
111
111
|
*/
|
|
112
112
|
export declare function createIndexedDBOutboxStore(): CommentsOutboxStore;
|
|
113
|
+
interface CommentsAgentPromptInput {
|
|
114
|
+
url: string;
|
|
115
|
+
threadIds: readonly string[];
|
|
116
|
+
mcp: string;
|
|
117
|
+
project: {
|
|
118
|
+
id: string;
|
|
119
|
+
teamId: string;
|
|
120
|
+
url: string;
|
|
121
|
+
};
|
|
122
|
+
resolve: boolean;
|
|
123
|
+
}
|
|
124
|
+
export declare function commentsAgentPrompt({ mcp, project, resolve, threadIds, url }: CommentsAgentPromptInput): string;
|
|
113
125
|
/** A point in client (viewport) coordinates, such as `event.clientX` and `event.clientY`. */
|
|
114
126
|
interface AnchorPoint {
|
|
115
127
|
x: number;
|
|
@@ -420,11 +432,20 @@ interface CommentSendStatus {
|
|
|
420
432
|
count: number;
|
|
421
433
|
/** The member's agent. Without one, Send pairs an agent first. */
|
|
422
434
|
agent?: CommentSendAgent;
|
|
423
|
-
/** The member's last send,
|
|
435
|
+
/** The member's last send, after the agent read it and while it works on it. `thread` is the URL of the agent's thread. */
|
|
424
436
|
working?: {
|
|
425
437
|
id: string;
|
|
426
438
|
thread?: string;
|
|
427
439
|
};
|
|
440
|
+
/**
|
|
441
|
+
* The member's last send, delivered and not read by the agent yet. An inbox send stays here until the agent reads it.
|
|
442
|
+
* `inbox` tells where this send went. If omitted, the client uses `agent` to tell whether it went to an inbox.
|
|
443
|
+
*/
|
|
444
|
+
sent?: {
|
|
445
|
+
id: string;
|
|
446
|
+
thread?: string;
|
|
447
|
+
inbox?: boolean;
|
|
448
|
+
};
|
|
428
449
|
/** The last delivery is still being attempted. */
|
|
429
450
|
pending?: boolean;
|
|
430
451
|
/** While the member may not send, the time in ms when the next send may go. */
|
|
@@ -464,6 +485,7 @@ type CommentSendResult = {
|
|
|
464
485
|
status: "sent" | "pending";
|
|
465
486
|
id: string;
|
|
466
487
|
thread?: string;
|
|
488
|
+
inbox?: boolean;
|
|
467
489
|
} | {
|
|
468
490
|
status: "failed";
|
|
469
491
|
reason: string;
|
|
@@ -500,7 +522,10 @@ interface CommentSendTransport {
|
|
|
500
522
|
/** Pushes events, and returns a function that stops them. Without it, the client asks `status()` while the agent works. */
|
|
501
523
|
subscribe?: (listener: (event: CommentSendEvent) => void) => () => void;
|
|
502
524
|
}
|
|
503
|
-
/**
|
|
525
|
+
/**
|
|
526
|
+
* What the Send segment shows. Every state has the number of waiting threads, `count`. In `sent`, `inbox` tells where
|
|
527
|
+
* the last send went, and `agent` is where the next Send goes.
|
|
528
|
+
*/
|
|
504
529
|
type CommentSendState = {
|
|
505
530
|
status: "idle";
|
|
506
531
|
count: number;
|
|
@@ -524,6 +549,7 @@ type CommentSendState = {
|
|
|
524
549
|
status: "sent";
|
|
525
550
|
count: number;
|
|
526
551
|
inbox: boolean;
|
|
552
|
+
agent?: CommentSendAgent;
|
|
527
553
|
} | {
|
|
528
554
|
status: "working";
|
|
529
555
|
count: number;
|
|
@@ -720,4 +746,4 @@ export declare function createCommentsClient(options: CommentsClientOptions & {
|
|
|
720
746
|
readonly outbox: CommentsOutbox;
|
|
721
747
|
};
|
|
722
748
|
export declare function createCommentsClient(options: CommentsClientOptions): CommentsClient;
|
|
723
|
-
export type { AnchorPoint, AnchorPosition, AnchorRect, AnchorTarget, AreaAnchor, CommentActor, CommentAnchor, CommentAttachment, CommentBuild, CommentComponent, CommentContext, CommentCreateInput, CommentDeleteInput, CommentDelivery, CommentDeliveryError, CommentEditInput, CommentEvent, CommentFiles, CommentForgeLink, CommentGetInput, CommentListCursor, CommentListQuery, CommentMessage, CommentMetadata, CommentReplyInput, CommentSendAgent, CommentSendClient, CommentSendCopy, CommentSendEvent, CommentSendLogo, CommentSendOptions, CommentSendPairing, CommentSendPairingCheck, CommentSendResult, CommentSendState, CommentSendStatus, CommentSendTransport, CommentSendTransportOptions, CommentStatus, CommentStatusInput, CommentSubject, CommentThread, CommentUploadInput, CommentUser, CommentUsersInput, CommentsGuest, CommentsOutbox, CommentsOutboxEntry, CommentsOutboxEnvironment, CommentsOutboxMessage, CommentsOutboxOptions, CommentsOutboxStore, CommentsRestAnswer, CommentsRestRequest, CommentsTransport, CreateAnchorOptions, DetachedAnchor, ElementAnchor, ImageAnchor, PageAnchor, ResolvedAnchor, RestCommentThread, RestTransport, RestTransportOptions, TextAnchor };
|
|
749
|
+
export type { AnchorPoint, AnchorPosition, AnchorRect, AnchorTarget, AreaAnchor, CommentActor, CommentAnchor, CommentAttachment, CommentBuild, CommentComponent, CommentContext, CommentCreateInput, CommentDeleteInput, CommentDelivery, CommentDeliveryError, CommentEditInput, CommentEvent, CommentFiles, CommentForgeLink, CommentGetInput, CommentListCursor, CommentListQuery, CommentMessage, CommentMetadata, CommentReplyInput, CommentSendAgent, CommentSendClient, CommentSendCopy, CommentSendEvent, CommentSendLogo, CommentSendOptions, CommentSendPairing, CommentSendPairingCheck, CommentSendResult, CommentSendState, CommentSendStatus, CommentSendTransport, CommentSendTransportOptions, CommentStatus, CommentStatusInput, CommentSubject, CommentThread, CommentUploadInput, CommentUser, CommentUsersInput, CommentsAgentPromptInput, CommentsGuest, CommentsOutbox, CommentsOutboxEntry, CommentsOutboxEnvironment, CommentsOutboxMessage, CommentsOutboxOptions, CommentsOutboxStore, CommentsRestAnswer, CommentsRestRequest, CommentsTransport, CreateAnchorOptions, DetachedAnchor, ElementAnchor, ImageAnchor, PageAnchor, ResolvedAnchor, RestCommentThread, RestTransport, RestTransportOptions, TextAnchor };
|
package/dist/client.js
CHANGED
|
@@ -726,6 +726,14 @@ function createOutbox(options, host) {
|
|
|
726
726
|
}
|
|
727
727
|
};
|
|
728
728
|
}
|
|
729
|
+
// src/agent-prompt.ts
|
|
730
|
+
function commentsAgentPrompt({ mcp, project, resolve, threadIds, url }) {
|
|
731
|
+
return [
|
|
732
|
+
`Fix ${threadIds.length === 1 ? "the open ViteHub comment" : `the ${threadIds.length} open ViteHub comments`} on ${new URL(url).href}`,
|
|
733
|
+
`In the ViteHub MCP (${mcp}), use list_apps to verify team ${project.teamId} and app ${project.url} (id: ${project.id}). If the team is different, ask me to switch to that team in the Console; if the app is missing, ask me to check the link. Only after both match, call read_operation with the app id, operation "comments.get", and input { threadId } for each ID in ${JSON.stringify(threadIds)}.`,
|
|
734
|
+
resolve ? "After each fix, use run_operation with the app id, operation \"comments.resolve\", and input { threadId, reply }. In the reply, say what changed." : "Report the fixes to me without resolving the threads."
|
|
735
|
+
].join("\n");
|
|
736
|
+
}
|
|
729
737
|
// src/client-anchor.ts
|
|
730
738
|
const defaultContext = 32;
|
|
731
739
|
const clamp = (value) => Math.min(1e3, Math.max(0, value));
|
|
@@ -1153,10 +1161,13 @@ function createCommentSend(transport, options = {}) {
|
|
|
1153
1161
|
let fetching = false;
|
|
1154
1162
|
let sendId;
|
|
1155
1163
|
let thread;
|
|
1164
|
+
let sentInbox = false;
|
|
1156
1165
|
let pushed;
|
|
1157
1166
|
let step = 0;
|
|
1167
|
+
let sentUntil = 0;
|
|
1158
1168
|
let timer;
|
|
1159
1169
|
let run = 0;
|
|
1170
|
+
let lastStep = "send";
|
|
1160
1171
|
const notify = () => {
|
|
1161
1172
|
for (const listener of listeners) listener();
|
|
1162
1173
|
};
|
|
@@ -1173,6 +1184,7 @@ function createCommentSend(transport, options = {}) {
|
|
|
1173
1184
|
timer = setTimeout(() => at === step && then(), ms);
|
|
1174
1185
|
};
|
|
1175
1186
|
const inbox = () => Boolean(agent && !agent.host);
|
|
1187
|
+
const needsStatus = () => state.status === "failed" && lastStep === "allow";
|
|
1176
1188
|
const idleState = () => ({
|
|
1177
1189
|
status: "idle",
|
|
1178
1190
|
count,
|
|
@@ -1180,6 +1192,12 @@ function createCommentSend(transport, options = {}) {
|
|
|
1180
1192
|
...agent && count > 0 ? { canPairAnother: true } : {}
|
|
1181
1193
|
});
|
|
1182
1194
|
const idle = () => set(idleState());
|
|
1195
|
+
const sentState = () => ({
|
|
1196
|
+
status: "sent",
|
|
1197
|
+
count,
|
|
1198
|
+
inbox: sentInbox,
|
|
1199
|
+
...agent ? { agent } : {}
|
|
1200
|
+
});
|
|
1183
1201
|
const finish = () => {
|
|
1184
1202
|
sendId = void 0;
|
|
1185
1203
|
thread = void 0;
|
|
@@ -1194,6 +1212,11 @@ function createCommentSend(transport, options = {}) {
|
|
|
1194
1212
|
});
|
|
1195
1213
|
if (!transport.subscribe) later(statusInterval, () => void refresh(working));
|
|
1196
1214
|
};
|
|
1215
|
+
const sent = () => {
|
|
1216
|
+
set(sentState());
|
|
1217
|
+
if (!transport.subscribe) later(statusInterval, () => void refresh(sent));
|
|
1218
|
+
};
|
|
1219
|
+
const holdingSent = () => state.status === "sent" && Date.now() < sentUntil;
|
|
1197
1220
|
const limited = (retryAt) => {
|
|
1198
1221
|
set({
|
|
1199
1222
|
status: "limited",
|
|
@@ -1212,18 +1235,17 @@ function createCommentSend(transport, options = {}) {
|
|
|
1212
1235
|
const apply = (status) => {
|
|
1213
1236
|
agent = status.agent;
|
|
1214
1237
|
if (status.pending) return pending();
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
};
|
|
1238
|
+
const last = status.working ?? status.sent;
|
|
1239
|
+
if (last) {
|
|
1240
|
+
if (status.sent) sentInbox = status.sent.inbox ?? inbox();
|
|
1241
|
+
const hold = holdingSent() && sendId === last.id;
|
|
1242
|
+
sendId = last.id;
|
|
1243
|
+
thread = hold ? thread ?? last.thread : last.thread;
|
|
1244
|
+
if (hold) {
|
|
1245
|
+
state = sentState();
|
|
1224
1246
|
return notify();
|
|
1225
1247
|
}
|
|
1226
|
-
return working();
|
|
1248
|
+
return status.working ? working() : sent();
|
|
1227
1249
|
}
|
|
1228
1250
|
sendId = void 0;
|
|
1229
1251
|
thread = void 0;
|
|
@@ -1276,13 +1298,12 @@ function createCommentSend(transport, options = {}) {
|
|
|
1276
1298
|
const update = updates?.get(result.id);
|
|
1277
1299
|
thread = update?.thread ?? result.thread;
|
|
1278
1300
|
if (revision === countRevision) count = 0;
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
});
|
|
1284
|
-
later(sentFor, update?.done ? finish : working);
|
|
1301
|
+
sentInbox = result.inbox ?? inbox();
|
|
1302
|
+
set(sentState());
|
|
1303
|
+
sentUntil = Date.now() + sentFor;
|
|
1304
|
+
later(sentFor, update?.done ? finish : update ? working : () => void refresh(sent));
|
|
1285
1305
|
};
|
|
1306
|
+
const drop = (dropped) => void transport.cancel(dropped).catch(() => void 0);
|
|
1286
1307
|
const deliver = async (request, paired) => {
|
|
1287
1308
|
const revision = countRevision;
|
|
1288
1309
|
pushed = transport.subscribe ? /* @__PURE__ */ new Map() : void 0;
|
|
@@ -1300,9 +1321,10 @@ function createCommentSend(transport, options = {}) {
|
|
|
1300
1321
|
reason: reasonOf(error)
|
|
1301
1322
|
};
|
|
1302
1323
|
}
|
|
1303
|
-
|
|
1324
|
+
const current = at === step;
|
|
1325
|
+
if (current) settle(result, revision, paired);
|
|
1326
|
+
if (paired && (result.status === "failed" || result.status === "limited" || !current && result.status === "changed")) drop(paired.code);
|
|
1304
1327
|
};
|
|
1305
|
-
const drop = (dropped) => void transport.cancel(dropped).catch(() => void 0);
|
|
1306
1328
|
const poll = () => {
|
|
1307
1329
|
later(pairingInterval, async () => {
|
|
1308
1330
|
if (state.status !== "pairing" || !code) return;
|
|
@@ -1328,6 +1350,7 @@ function createCommentSend(transport, options = {}) {
|
|
|
1328
1350
|
const pair = async (copy) => {
|
|
1329
1351
|
if (fetching) return;
|
|
1330
1352
|
fetching = true;
|
|
1353
|
+
lastStep = "pair";
|
|
1331
1354
|
const at = ++step;
|
|
1332
1355
|
try {
|
|
1333
1356
|
const pairing = transport.startPairing();
|
|
@@ -1424,12 +1447,13 @@ function createCommentSend(transport, options = {}) {
|
|
|
1424
1447
|
});
|
|
1425
1448
|
return;
|
|
1426
1449
|
}
|
|
1427
|
-
if (fetching || state.status === "pairing" || state.status === "confirm") return;
|
|
1450
|
+
if (fetching || state.status === "pairing" || state.status === "confirm" || needsStatus()) return;
|
|
1428
1451
|
if ((state.status === "working" || state.status === "sent") && sendId !== event.id) return;
|
|
1429
1452
|
if (event.type === "working") {
|
|
1430
1453
|
thread = event.thread ?? (event.id === sendId ? thread : void 0);
|
|
1431
1454
|
sendId = event.id;
|
|
1432
|
-
if (
|
|
1455
|
+
if (holdingSent()) later(sentUntil - Date.now(), working);
|
|
1456
|
+
else working();
|
|
1433
1457
|
return;
|
|
1434
1458
|
}
|
|
1435
1459
|
if (event.id === sendId) finish();
|
|
@@ -1450,9 +1474,12 @@ function createCommentSend(transport, options = {}) {
|
|
|
1450
1474
|
},
|
|
1451
1475
|
refresh: () => refresh(),
|
|
1452
1476
|
async send(copy) {
|
|
1453
|
-
if (fetching || state.status !== "idle" && state.status !== "failed" && state.status !== "working") return;
|
|
1477
|
+
if (fetching || state.status !== "idle" && state.status !== "failed" && state.status !== "sent" && state.status !== "working") return;
|
|
1454
1478
|
if (state.status !== "failed" && count === 0) return;
|
|
1479
|
+
if (state.status === "failed" && lastStep === "pair") return pair(copy);
|
|
1480
|
+
if (needsStatus()) return refresh(() => void 0);
|
|
1455
1481
|
if (!agent) return pair(copy);
|
|
1482
|
+
lastStep = "send";
|
|
1456
1483
|
return deliver(() => transport.send());
|
|
1457
1484
|
},
|
|
1458
1485
|
async pairAnother(copy) {
|
|
@@ -1463,6 +1490,7 @@ function createCommentSend(transport, options = {}) {
|
|
|
1463
1490
|
if (state.status !== "confirm" || !code) return;
|
|
1464
1491
|
const used = code;
|
|
1465
1492
|
code = void 0;
|
|
1493
|
+
lastStep = "allow";
|
|
1466
1494
|
return deliver(() => transport.allow(used, selection), {
|
|
1467
1495
|
code: used,
|
|
1468
1496
|
agent: state.agent
|
|
@@ -1903,4 +1931,4 @@ function createCommentsClient(options) {
|
|
|
1903
1931
|
}
|
|
1904
1932
|
};
|
|
1905
1933
|
}
|
|
1906
|
-
export { anchorRange, commentAttachmentUrl, commentsErrorDiagnostics, createAnchor, createCommentSend, createCommentSendTransport, createCommentsClient, createCommentsRestRequest, createIndexedDBOutboxStore, createMemoryOutboxStore, createRestTransport, foldName, replyMessageId, resolveAnchor, selectorFor };
|
|
1934
|
+
export { anchorRange, commentAttachmentUrl, commentsAgentPrompt, commentsErrorDiagnostics, createAnchor, createCommentSend, createCommentSendTransport, createCommentsClient, createCommentsRestRequest, createIndexedDBOutboxStore, createMemoryOutboxStore, createRestTransport, foldName, replyMessageId, resolveAnchor, selectorFor };
|
|
@@ -127,7 +127,7 @@ interface ViteHubConsoleOperationAction {
|
|
|
127
127
|
operation: string;
|
|
128
128
|
input: Readonly<Record<string, string>>;
|
|
129
129
|
/**
|
|
130
|
-
* The result is `{ url }`, such as a
|
|
130
|
+
* The result is `{ url }`, such as a provider sign-in: the Console opens it in a new tab, and loads
|
|
131
131
|
* the list again when the person comes back. The URL must be `https:`, or `http:` on a loopback host.
|
|
132
132
|
*/
|
|
133
133
|
tab?: true;
|
|
@@ -27,7 +27,7 @@ const builtinCommentSubjects = [defineCommentSubject({
|
|
|
27
27
|
kind: "content",
|
|
28
28
|
scope: () => "site"
|
|
29
29
|
})];
|
|
30
|
-
/** The roles of a user: the comma-separated `role
|
|
30
|
+
/** The roles of a user: the comma-separated `role`, such as the roles of the Site access cookie or of Better Auth's `admin()` plugin. */
|
|
31
31
|
function rolesOf(user) {
|
|
32
32
|
const role = user?.role;
|
|
33
33
|
return typeof role === "string" ? role.split(",").map((name) => name.trim()) : [];
|