@sparkelf/dsh-group-chat 0.5.1 → 0.5.3
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/lib/client.js +257 -138
- package/lib/client.js.map +1 -1
- package/lib/index.js +25 -1
- package/package.json +7 -7
package/lib/index.js
CHANGED
|
@@ -492,6 +492,29 @@ const messageId = (event) => {
|
|
|
492
492
|
* message text. Parsing text would misread a code sample containing `@`, and it
|
|
493
493
|
* would let any message smuggle itself into an execution path.
|
|
494
494
|
*/
|
|
495
|
+
/**
|
|
496
|
+
* Member ids a prompt's sender declared on its source, in pick order.
|
|
497
|
+
*
|
|
498
|
+
* The composer's roster source inserts chips with `appearance: 'mention'`, and the reference
|
|
499
|
+
* pipeline hands those ids to the Host on the prompt; this reads them back. Only ids that source
|
|
500
|
+
* owns qualify — another source's chip is a file, a session, or a quoted message, never a member.
|
|
501
|
+
*/
|
|
502
|
+
const declaredMentions = (source) => {
|
|
503
|
+
const raw = source?.mentions;
|
|
504
|
+
if (!Array.isArray(raw)) return [];
|
|
505
|
+
const out = [];
|
|
506
|
+
const seen = /* @__PURE__ */ new Set();
|
|
507
|
+
for (const entry of raw) {
|
|
508
|
+
if (typeof entry !== "object" || entry === null) continue;
|
|
509
|
+
const record = entry;
|
|
510
|
+
if (record.sourceId !== "@sparkelf/dsh-group-chat/member") continue;
|
|
511
|
+
const memberId = record.itemId;
|
|
512
|
+
if (typeof memberId !== "string" || memberId.length === 0 || seen.has(memberId)) continue;
|
|
513
|
+
seen.add(memberId);
|
|
514
|
+
out.push(memberId);
|
|
515
|
+
}
|
|
516
|
+
return out;
|
|
517
|
+
};
|
|
495
518
|
const mentionsOf = (event) => {
|
|
496
519
|
const raw = eventSource(event)?.["mentions"];
|
|
497
520
|
if (!Array.isArray(raw)) return [];
|
|
@@ -9755,7 +9778,8 @@ const activate = (ctx, target) => {
|
|
|
9755
9778
|
if (typeof messageId === "string" && messageId.startsWith(WARM_UP_PREFIX)) return;
|
|
9756
9779
|
if (data.source?.kind === QUOTE_CONTEXT_KIND) return;
|
|
9757
9780
|
const content = data.content;
|
|
9758
|
-
const
|
|
9781
|
+
const declared = declaredMentions(data.source);
|
|
9782
|
+
const mentions = declared.length > 0 ? declared : mentionedMemberIds(textOfContent(content), runtimes.get(roomId)?.members ?? []);
|
|
9759
9783
|
const quote = pendingQuotes.get(roomId);
|
|
9760
9784
|
const outgoing = quote === void 0 ? content : withQuote(content, quote);
|
|
9761
9785
|
backend.sendMessage(roomId, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sparkelf/dsh-group-chat",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"description": "Human-agent group chat for DataOps-managed DSH workspaces: rooms broadcast to every member, and only a member's own @mention wakes that member's agent.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -40,6 +40,11 @@
|
|
|
40
40
|
"cordis.patch.yml",
|
|
41
41
|
"README.md"
|
|
42
42
|
],
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsdown",
|
|
45
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
46
|
+
"test": "vitest run --root ../.. packages/group-chat/tests"
|
|
47
|
+
},
|
|
43
48
|
"repository": {
|
|
44
49
|
"type": "git",
|
|
45
50
|
"url": "git+https://github.com/SparkElf/dsh-plugins-plus.git",
|
|
@@ -91,10 +96,5 @@
|
|
|
91
96
|
"@deepseek-ai/schemastery": "^3.18.2",
|
|
92
97
|
"ws": "^8.18.0",
|
|
93
98
|
"socket.io-client": "^4.8.1"
|
|
94
|
-
},
|
|
95
|
-
"scripts": {
|
|
96
|
-
"build": "tsdown",
|
|
97
|
-
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
98
|
-
"test": "vitest run --root ../.. packages/group-chat/tests"
|
|
99
99
|
}
|
|
100
|
-
}
|
|
100
|
+
}
|