comisai 1.0.10 → 1.0.11
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 -3
- package/node_modules/@comis/agent/package.json +1 -1
- package/node_modules/@comis/channels/package.json +1 -1
- package/node_modules/@comis/cli/dist/wizard/steps/06-channels.js +88 -11
- package/node_modules/@comis/cli/dist/wizard/steps/10-write-config.js +4 -0
- package/node_modules/@comis/cli/dist/wizard/types.d.ts +1 -0
- package/node_modules/@comis/cli/package.json +1 -1
- package/node_modules/@comis/core/package.json +1 -1
- package/node_modules/@comis/daemon/package.json +1 -1
- package/node_modules/@comis/gateway/package.json +1 -1
- package/node_modules/@comis/infra/package.json +1 -1
- package/node_modules/@comis/memory/package.json +1 -1
- package/node_modules/@comis/scheduler/package.json +1 -1
- package/node_modules/@comis/shared/package.json +1 -1
- package/node_modules/@comis/skills/package.json +1 -1
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
<p align="center">
|
|
10
10
|
<a href="https://www.npmjs.com/package/comisai"><img src="https://img.shields.io/npm/v/comisai" alt="npm version" /></a>
|
|
11
11
|
<a href="https://github.com/comisai/comis/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-06B6D4?style=flat" alt="License" /></a>
|
|
12
|
-
<a href="https://discord.gg/
|
|
12
|
+
<a href="https://discord.gg/FsqgJkpp"><img src="https://img.shields.io/badge/discord-join-5865F2?style=flat&logo=discord&logoColor=white" alt="Discord" /></a>
|
|
13
13
|
<a href="https://nodejs.org"><img src="https://img.shields.io/node/v/comisai" alt="Node" /></a>
|
|
14
14
|
</p>
|
|
15
15
|
|
|
16
16
|
<p align="center">
|
|
17
17
|
<a href="https://docs.comis.ai">Docs</a> ·
|
|
18
|
-
<a href="https://discord.gg/
|
|
18
|
+
<a href="https://discord.gg/FsqgJkpp">Discord</a> ·
|
|
19
19
|
<a href="https://twitter.com/comis_ai">Twitter</a> ·
|
|
20
20
|
<a href="#quick-start">Quick Start</a>
|
|
21
21
|
</p>
|
|
@@ -168,7 +168,7 @@ shared (Result type, utilities)
|
|
|
168
168
|
<p align="center">
|
|
169
169
|
<a href="https://github.com/comisai/comis"><strong>GitHub</strong></a> ·
|
|
170
170
|
<a href="https://docs.comis.ai"><strong>Docs</strong></a> ·
|
|
171
|
-
<a href="https://discord.gg/
|
|
171
|
+
<a href="https://discord.gg/FsqgJkpp"><strong>Discord</strong></a> ·
|
|
172
172
|
<a href="https://twitter.com/comis_ai"><strong>Twitter</strong></a> ·
|
|
173
173
|
<a href="https://github.com/comisai/comis/issues"><strong>Issues</strong></a>
|
|
174
174
|
</p>
|
|
@@ -130,6 +130,37 @@ async function validateLineLive(channelToken) {
|
|
|
130
130
|
clearTimeout(timeout);
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* Fetch the most recent sender's user ID from the bot's getUpdates endpoint.
|
|
135
|
+
*
|
|
136
|
+
* Calls getUpdates with a short timeout. Returns the first message sender's
|
|
137
|
+
* user ID and name, or null if no messages are available.
|
|
138
|
+
*/
|
|
139
|
+
async function fetchTelegramSenderId(token) {
|
|
140
|
+
const controller = new AbortController();
|
|
141
|
+
const timeout = setTimeout(() => controller.abort(), 5000);
|
|
142
|
+
try {
|
|
143
|
+
const response = await fetch(`https://api.telegram.org/bot${token}/getUpdates?limit=5&allowed_updates=["message"]`, { method: "GET", signal: controller.signal });
|
|
144
|
+
if (!response.ok)
|
|
145
|
+
return null;
|
|
146
|
+
const data = (await response.json());
|
|
147
|
+
if (!data.ok || !data.result.length)
|
|
148
|
+
return null;
|
|
149
|
+
for (const update of data.result.reverse()) {
|
|
150
|
+
const from = update.message?.from;
|
|
151
|
+
if (from) {
|
|
152
|
+
return { userId: from.id, firstName: from.first_name };
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
catch {
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
finally {
|
|
161
|
+
clearTimeout(timeout);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
133
164
|
// ---------- Per-Channel Handlers ----------
|
|
134
165
|
/**
|
|
135
166
|
* Collect Discord bot token and optional guild IDs with live validation.
|
|
@@ -456,17 +487,63 @@ export const channelsStep = {
|
|
|
456
487
|
message: "Grant admin access to specific senders?",
|
|
457
488
|
});
|
|
458
489
|
if (wantTrust) {
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
490
|
+
const telegramConfig = configs.find((c) => c.type === "telegram");
|
|
491
|
+
let detectedId = null;
|
|
492
|
+
if (telegramConfig?.botToken) {
|
|
493
|
+
const wantDetect = await prompter.confirm({
|
|
494
|
+
message: "Auto-detect your Telegram user ID? (send any message to your bot first)",
|
|
495
|
+
});
|
|
496
|
+
if (wantDetect) {
|
|
497
|
+
const spin = prompter.spinner();
|
|
498
|
+
spin.start("Checking for messages...");
|
|
499
|
+
const sender = await fetchTelegramSenderId(telegramConfig.botToken);
|
|
500
|
+
if (sender) {
|
|
501
|
+
spin.stop(`Found: ${sender.firstName} (${sender.userId})`);
|
|
502
|
+
const useIt = await prompter.confirm({
|
|
503
|
+
message: `Use ${sender.userId} as your admin sender ID?`,
|
|
504
|
+
});
|
|
505
|
+
if (useIt) {
|
|
506
|
+
detectedId = String(sender.userId);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
else {
|
|
510
|
+
spin.stop("No messages found");
|
|
511
|
+
prompter.log.warn("Send a message to your bot in Telegram and try again, or enter your ID manually below.");
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
const hasOtherChannels = configs.some((c) => c.type !== "telegram" && c.type !== "whatsapp" && c.type !== "signal" && c.type !== "irc");
|
|
516
|
+
let senderIds;
|
|
517
|
+
if (detectedId && !hasOtherChannels) {
|
|
518
|
+
senderIds = [detectedId];
|
|
519
|
+
}
|
|
520
|
+
else {
|
|
521
|
+
if (detectedId) {
|
|
522
|
+
prompter.note(info("Add sender IDs for your other channels.\nDiscord: enable Developer Mode → right-click your name → Copy User ID."));
|
|
523
|
+
}
|
|
524
|
+
else {
|
|
525
|
+
prompter.note(info("Enter YOUR user ID (not the bot ID).\nTelegram: send a message to your bot, then re-run setup to auto-detect — or find it via Telegram API.\nDiscord: enable Developer Mode → right-click your name → Copy User ID."));
|
|
526
|
+
}
|
|
527
|
+
const input = await prompter.text({
|
|
528
|
+
message: "Your sender IDs (comma-separated)",
|
|
529
|
+
placeholder: detectedId ? `e.g. ${detectedId}, <discord-id>` : "e.g. 678314278",
|
|
530
|
+
defaultValue: detectedId ? `${detectedId}, ` : "",
|
|
531
|
+
validate: (v) => v.trim().length === 0 ? "At least one sender ID required" : undefined,
|
|
532
|
+
});
|
|
533
|
+
senderIds = input
|
|
534
|
+
.split(",")
|
|
535
|
+
.map((s) => s.trim())
|
|
536
|
+
.filter((s) => s.length > 0);
|
|
537
|
+
}
|
|
538
|
+
const entries = senderIds.map((senderId) => ({ senderId, level: "admin" }));
|
|
539
|
+
if (telegramConfig && senderIds.length > 0) {
|
|
540
|
+
const restrictBot = await prompter.confirm({
|
|
541
|
+
message: "Restrict Telegram bot to only respond to these senders?",
|
|
542
|
+
});
|
|
543
|
+
if (restrictBot) {
|
|
544
|
+
telegramConfig.allowFrom = senderIds;
|
|
545
|
+
}
|
|
546
|
+
}
|
|
470
547
|
return updateState(state, { channels: configs, senderTrustEntries: entries });
|
|
471
548
|
}
|
|
472
549
|
}
|
|
@@ -131,6 +131,10 @@ function buildConfigObject(state) {
|
|
|
131
131
|
if (ch.type === "discord" && ch.guildIds && ch.guildIds.length > 0) {
|
|
132
132
|
entry.guildIds = ch.guildIds;
|
|
133
133
|
}
|
|
134
|
+
// Sender allowlist
|
|
135
|
+
if (ch.allowFrom && ch.allowFrom.length > 0) {
|
|
136
|
+
entry.allowFrom = ch.allowFrom;
|
|
137
|
+
}
|
|
134
138
|
channels[ch.type] = entry;
|
|
135
139
|
}
|
|
136
140
|
config.channels = channels;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "comisai",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"author": "Moshe Anconina",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"description": "Security-first AI agent platform — connects AI agents to Discord, Telegram, Slack, WhatsApp, and more",
|
|
@@ -115,17 +115,17 @@
|
|
|
115
115
|
"@comis/daemon"
|
|
116
116
|
],
|
|
117
117
|
"dependencies": {
|
|
118
|
-
"@comis/shared": "1.0.
|
|
119
|
-
"@comis/core": "1.0.
|
|
120
|
-
"@comis/infra": "1.0.
|
|
121
|
-
"@comis/memory": "1.0.
|
|
122
|
-
"@comis/gateway": "1.0.
|
|
123
|
-
"@comis/skills": "1.0.
|
|
124
|
-
"@comis/scheduler": "1.0.
|
|
125
|
-
"@comis/agent": "1.0.
|
|
126
|
-
"@comis/channels": "1.0.
|
|
127
|
-
"@comis/cli": "1.0.
|
|
128
|
-
"@comis/daemon": "1.0.
|
|
118
|
+
"@comis/shared": "1.0.11",
|
|
119
|
+
"@comis/core": "1.0.11",
|
|
120
|
+
"@comis/infra": "1.0.11",
|
|
121
|
+
"@comis/memory": "1.0.11",
|
|
122
|
+
"@comis/gateway": "1.0.11",
|
|
123
|
+
"@comis/skills": "1.0.11",
|
|
124
|
+
"@comis/scheduler": "1.0.11",
|
|
125
|
+
"@comis/agent": "1.0.11",
|
|
126
|
+
"@comis/channels": "1.0.11",
|
|
127
|
+
"@comis/cli": "1.0.11",
|
|
128
|
+
"@comis/daemon": "1.0.11",
|
|
129
129
|
"@agentclientprotocol/sdk": "^0.15.0",
|
|
130
130
|
"@clack/core": "^1.1.0",
|
|
131
131
|
"@clack/prompts": "^1.1.0",
|