@hasna/assistants 1.1.15 → 1.1.16
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/dist/index.js +92 -39
- package/dist/index.js.map +7 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -25784,6 +25784,60 @@ var init_executor3 = __esm(async () => {
|
|
|
25784
25784
|
MAX_SHELL_OUTPUT_LENGTH = 64 * 1024;
|
|
25785
25785
|
});
|
|
25786
25786
|
|
|
25787
|
+
// packages/core/src/channels/mentions.ts
|
|
25788
|
+
function parseMentions(content) {
|
|
25789
|
+
const mentions = [];
|
|
25790
|
+
const quotedRegex = /@"([^"]+)"/g;
|
|
25791
|
+
let match;
|
|
25792
|
+
while ((match = quotedRegex.exec(content)) !== null) {
|
|
25793
|
+
const name = match[1].trim();
|
|
25794
|
+
if (name && !mentions.includes(name)) {
|
|
25795
|
+
mentions.push(name);
|
|
25796
|
+
}
|
|
25797
|
+
}
|
|
25798
|
+
const simpleRegex = /@([a-zA-Z0-9_-]+)/g;
|
|
25799
|
+
while ((match = simpleRegex.exec(content)) !== null) {
|
|
25800
|
+
const name = match[1];
|
|
25801
|
+
if (!mentions.includes(name)) {
|
|
25802
|
+
mentions.push(name);
|
|
25803
|
+
}
|
|
25804
|
+
}
|
|
25805
|
+
return mentions;
|
|
25806
|
+
}
|
|
25807
|
+
function resolveNameToKnown(mentionName, knownNames) {
|
|
25808
|
+
const lower = mentionName.toLowerCase();
|
|
25809
|
+
const exact = knownNames.find((k) => k.name.toLowerCase() === lower);
|
|
25810
|
+
if (exact)
|
|
25811
|
+
return exact;
|
|
25812
|
+
const prefix = knownNames.find((k) => k.name.toLowerCase().startsWith(lower));
|
|
25813
|
+
if (prefix)
|
|
25814
|
+
return prefix;
|
|
25815
|
+
const word = knownNames.find((k) => k.name.toLowerCase().split(/\s+/).some((w) => w === lower));
|
|
25816
|
+
if (word)
|
|
25817
|
+
return word;
|
|
25818
|
+
return null;
|
|
25819
|
+
}
|
|
25820
|
+
function resolveMentions(names, members) {
|
|
25821
|
+
const resolved = [];
|
|
25822
|
+
for (const name of names) {
|
|
25823
|
+
const lower = name.toLowerCase();
|
|
25824
|
+
const member = members.find((m) => m.assistantName.toLowerCase() === lower);
|
|
25825
|
+
if (member) {
|
|
25826
|
+
resolved.push({
|
|
25827
|
+
name,
|
|
25828
|
+
memberId: member.assistantId,
|
|
25829
|
+
memberType: member.memberType
|
|
25830
|
+
});
|
|
25831
|
+
}
|
|
25832
|
+
}
|
|
25833
|
+
return resolved;
|
|
25834
|
+
}
|
|
25835
|
+
function getMentionedMemberIds(content, members) {
|
|
25836
|
+
const names = parseMentions(content);
|
|
25837
|
+
const resolved = resolveMentions(names, members);
|
|
25838
|
+
return resolved.map((r) => r.memberId);
|
|
25839
|
+
}
|
|
25840
|
+
|
|
25787
25841
|
// packages/core/src/scheduler/format.ts
|
|
25788
25842
|
function formatRelativeTime(timestamp, now2 = Date.now()) {
|
|
25789
25843
|
if (!timestamp)
|
|
@@ -74459,11 +74513,26 @@ Configure the external source with the URL and secret above.
|
|
|
74459
74513
|
`);
|
|
74460
74514
|
context.emit("done");
|
|
74461
74515
|
if (activePerson && result.success) {
|
|
74516
|
+
const mentions = parseMentions(message);
|
|
74517
|
+
let mentionContext = "";
|
|
74518
|
+
if (mentions.length > 0) {
|
|
74519
|
+
const assistantManager = context.getAssistantManager?.();
|
|
74520
|
+
if (assistantManager) {
|
|
74521
|
+
const assistants = assistantManager.listAssistants?.() || [];
|
|
74522
|
+
const knownNames = assistants.map((a) => ({ id: a.id, name: a.name }));
|
|
74523
|
+
const resolved = mentions.map((m) => resolveNameToKnown(m, knownNames)).filter(Boolean);
|
|
74524
|
+
if (resolved.length > 0) {
|
|
74525
|
+
mentionContext = `
|
|
74526
|
+
|
|
74527
|
+
Note: ${activePerson.name} mentioned ${resolved.map((r) => r.name).join(", ")}. Respond as the mentioned assistant.`;
|
|
74528
|
+
}
|
|
74529
|
+
}
|
|
74530
|
+
}
|
|
74462
74531
|
return {
|
|
74463
74532
|
handled: false,
|
|
74464
|
-
prompt: `[Channel Message] ${activePerson.name} posted in #${channel}: "${message}"
|
|
74533
|
+
prompt: `[Channel Message] ${activePerson.name} posted in #${channel}: "${message}"${mentionContext}
|
|
74465
74534
|
|
|
74466
|
-
|
|
74535
|
+
Respond in #${channel} using channel_send. Be helpful and conversational.`
|
|
74467
74536
|
};
|
|
74468
74537
|
}
|
|
74469
74538
|
return { handled: true };
|
|
@@ -79318,7 +79387,7 @@ ${repoUrl}/issues/new
|
|
|
79318
79387
|
context.setProjectContext(projectContext);
|
|
79319
79388
|
}
|
|
79320
79389
|
}
|
|
79321
|
-
var VERSION = "1.1.
|
|
79390
|
+
var VERSION = "1.1.16";
|
|
79322
79391
|
var init_builtin = __esm(async () => {
|
|
79323
79392
|
init_src2();
|
|
79324
79393
|
init_store();
|
|
@@ -173097,40 +173166,6 @@ var init_manager6 = __esm(async () => {
|
|
|
173097
173166
|
await init_store7();
|
|
173098
173167
|
});
|
|
173099
173168
|
|
|
173100
|
-
// packages/core/src/channels/mentions.ts
|
|
173101
|
-
function parseMentions(content) {
|
|
173102
|
-
const regex = /@([a-zA-Z0-9_-]+)/g;
|
|
173103
|
-
const mentions = [];
|
|
173104
|
-
let match;
|
|
173105
|
-
while ((match = regex.exec(content)) !== null) {
|
|
173106
|
-
const name2 = match[1];
|
|
173107
|
-
if (!mentions.includes(name2)) {
|
|
173108
|
-
mentions.push(name2);
|
|
173109
|
-
}
|
|
173110
|
-
}
|
|
173111
|
-
return mentions;
|
|
173112
|
-
}
|
|
173113
|
-
function resolveMentions(names, members) {
|
|
173114
|
-
const resolved = [];
|
|
173115
|
-
for (const name2 of names) {
|
|
173116
|
-
const lower = name2.toLowerCase();
|
|
173117
|
-
const member = members.find((m5) => m5.assistantName.toLowerCase() === lower);
|
|
173118
|
-
if (member) {
|
|
173119
|
-
resolved.push({
|
|
173120
|
-
name: name2,
|
|
173121
|
-
memberId: member.assistantId,
|
|
173122
|
-
memberType: member.memberType
|
|
173123
|
-
});
|
|
173124
|
-
}
|
|
173125
|
-
}
|
|
173126
|
-
return resolved;
|
|
173127
|
-
}
|
|
173128
|
-
function getMentionedMemberIds(content, members) {
|
|
173129
|
-
const names = parseMentions(content);
|
|
173130
|
-
const resolved = resolveMentions(names, members);
|
|
173131
|
-
return resolved.map((r6) => r6.memberId);
|
|
173132
|
-
}
|
|
173133
|
-
|
|
173134
173169
|
// packages/core/src/channels/tools.ts
|
|
173135
173170
|
function createChannelToolExecutors(getChannelsManager) {
|
|
173136
173171
|
return {
|
|
@@ -186469,6 +186504,7 @@ __export(exports_src2, {
|
|
|
186469
186504
|
saveHistory: () => saveHistory,
|
|
186470
186505
|
resourceLimitsTool: () => resourceLimitsTool,
|
|
186471
186506
|
resolveTaskId: () => resolveTaskId,
|
|
186507
|
+
resolveNameToKnown: () => resolveNameToKnown,
|
|
186472
186508
|
resolveMentions: () => resolveMentions,
|
|
186473
186509
|
resolveHeartbeatPersistPath: () => resolveHeartbeatPersistPath,
|
|
186474
186510
|
resolveHeartbeatHistoryPath: () => resolveHeartbeatHistoryPath,
|
|
@@ -219649,6 +219685,9 @@ function ChannelsPanel({ manager, onClose, activePersonId, activePersonName, onP
|
|
|
219649
219685
|
}, undefined, true, undefined, this);
|
|
219650
219686
|
}
|
|
219651
219687
|
|
|
219688
|
+
// packages/terminal/src/components/App.tsx
|
|
219689
|
+
await init_src3();
|
|
219690
|
+
|
|
219652
219691
|
// packages/terminal/src/components/PeoplePanel.tsx
|
|
219653
219692
|
var import_react47 = __toESM(require_react(), 1);
|
|
219654
219693
|
var jsx_dev_runtime24 = __toESM(require_jsx_dev_runtime(), 1);
|
|
@@ -233573,8 +233612,22 @@ When done, report the result.`);
|
|
|
233573
233612
|
activePersonId: activeSession?.client.getPeopleManager?.()?.getActivePersonId?.() || undefined,
|
|
233574
233613
|
activePersonName: activeSession?.client.getPeopleManager?.()?.getActivePerson?.()?.name || undefined,
|
|
233575
233614
|
onPersonMessage: (channelName, personName, message) => {
|
|
233615
|
+
const members = channelsManager.getMembers(channelName);
|
|
233616
|
+
const assistantMembers = members.filter((m5) => m5.memberType === "assistant").map((m5) => m5.assistantName);
|
|
233617
|
+
const mentions = parseMentions(message);
|
|
233618
|
+
let targetAssistants = assistantMembers;
|
|
233619
|
+
if (mentions.length > 0) {
|
|
233620
|
+
const knownNames = assistantMembers.map((name2) => ({ id: name2, name: name2 }));
|
|
233621
|
+
const resolved = mentions.map((m5) => resolveNameToKnown(m5, knownNames)).filter(Boolean).map((r6) => r6.name);
|
|
233622
|
+
if (resolved.length > 0) {
|
|
233623
|
+
targetAssistants = resolved;
|
|
233624
|
+
}
|
|
233625
|
+
}
|
|
233626
|
+
const assistantList = targetAssistants.length > 0 ? `Assistants in this channel: ${targetAssistants.join(", ")}.` : "";
|
|
233576
233627
|
const prompt = `[Channel Message] ${personName} posted in #${channelName}: "${message}"
|
|
233577
233628
|
|
|
233629
|
+
${assistantList}
|
|
233630
|
+
|
|
233578
233631
|
Respond in #${channelName} using channel_send. Be helpful and conversational.`;
|
|
233579
233632
|
activeSession?.client.send(prompt);
|
|
233580
233633
|
}
|
|
@@ -234368,7 +234421,7 @@ Interactive Mode:
|
|
|
234368
234421
|
// packages/terminal/src/index.tsx
|
|
234369
234422
|
var jsx_dev_runtime44 = __toESM(require_jsx_dev_runtime(), 1);
|
|
234370
234423
|
setRuntime(bunRuntime);
|
|
234371
|
-
var VERSION4 = "1.1.
|
|
234424
|
+
var VERSION4 = "1.1.16";
|
|
234372
234425
|
var SYNC_START = "\x1B[?2026h";
|
|
234373
234426
|
var SYNC_END = "\x1B[?2026l";
|
|
234374
234427
|
function enableSynchronizedOutput() {
|
|
@@ -234508,4 +234561,4 @@ export {
|
|
|
234508
234561
|
main
|
|
234509
234562
|
};
|
|
234510
234563
|
|
|
234511
|
-
//# debugId=
|
|
234564
|
+
//# debugId=16DA2E0FA4EFC84C64756E2164756E21
|