shadok-ai 0.19.19 → 0.19.21
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 +21 -5
- package/dist/config.d.ts +24 -11
- package/dist/config.js +20 -14
- package/dist/config.js.map +1 -1
- package/dist/server.js +13 -9
- package/dist/server.js.map +1 -1
- package/dist/telegram.d.ts +7 -1
- package/dist/telegram.js +99 -16
- package/dist/telegram.js.map +1 -1
- package/dist/tg-guests.d.ts +76 -5
- package/dist/tg-guests.js +87 -17
- package/dist/tg-guests.js.map +1 -1
- package/package.json +1 -1
- package/public/index.html +51 -24
package/README.md
CHANGED
|
@@ -303,11 +303,22 @@ Enter to skip; you can add it later from the web UI).
|
|
|
303
303
|
the audio was left unheard — ask and the agent can listen. Telegram caps what
|
|
304
304
|
a bot may download at 20 MB; past that you get a clear notice instead of
|
|
305
305
|
silence.
|
|
306
|
+
- **Choose where the bot works** (admin, Telegram panel) — **Where the bot
|
|
307
|
+
works** has three answers. **Board group** is the default and leaves
|
|
308
|
+
everything as it was: a group you pair with `/setup <code>`, one topic per
|
|
309
|
+
agent, and private messages that belong to you alone. **Board group + open
|
|
310
|
+
DMs** adds the door below to it. **Open DMs only** removes the group
|
|
311
|
+
entirely: a group that adds the bot is told it only works in private,
|
|
312
|
+
`/setup` is refused everywhere, nobody pairs — and your own private chat with
|
|
313
|
+
the bot becomes one guest conversation among the others, with no commands.
|
|
314
|
+
Updating changes nothing on its own: an instance that never touched this
|
|
315
|
+
reads as **Board group**.
|
|
306
316
|
- **Open the bot to other people** (admin, Telegram panel, privileged
|
|
307
317
|
deployment only) — normally the bot's private messages belong to you alone and
|
|
308
|
-
anyone else is told it is private.
|
|
309
|
-
first
|
|
310
|
-
do NOT need a board group)
|
|
318
|
+
anyone else is told it is private. Pick **Board group + open DMs** (pair the
|
|
319
|
+
bot's DMs first — **Pair Telegram**, then `/setup <code>` in a private chat
|
|
320
|
+
with it; you do NOT need a board group) or **Open DMs only** (no pairing at
|
|
321
|
+
all), then a **restricted
|
|
311
322
|
group** and a **profile**: anyone who writes to the bot then gets their own
|
|
312
323
|
agent instead, on that profile, inside that group, and always the same agent
|
|
313
324
|
for the same person. The profile is what decides the job — support, a front
|
|
@@ -315,11 +326,16 @@ Enter to skip; you can add it later from the web UI).
|
|
|
315
326
|
driving, so choose it deliberately. You read and take over those conversations
|
|
316
327
|
from the cockpit, in that group; the group runs under its own Unix user, and
|
|
317
328
|
only its members see it, so whoever you add to the group can read them too.
|
|
329
|
+
Opening the bot is enough to be greeted: Telegram's own **START** button
|
|
330
|
+
wakes that person's agent, which introduces itself in the words its profile
|
|
331
|
+
gives it — so the welcome is something you write, by writing the role. If you
|
|
332
|
+
delete someone's agent from the cockpit, their next message simply starts a
|
|
333
|
+
new one.
|
|
318
334
|
They can talk and answer their agent's questions, and nothing else: no
|
|
319
335
|
command reaches the bot. Two things worth knowing before you open it — every
|
|
320
336
|
conversation is a real agent that stays resident, and they all draw on **your**
|
|
321
|
-
Claude subscription, so there is no cap and no queue by design.
|
|
322
|
-
every such conversation is closed at once.
|
|
337
|
+
Claude subscription, so there is no cap and no queue by design. Go back to
|
|
338
|
+
**Board group** and every such conversation is closed at once.
|
|
323
339
|
- **Link to a message** — every message (yours and the agent's) has a 🔗 link
|
|
324
340
|
button beside copy. It copies a URL like `…/#agent=<session>&msg=<id>`;
|
|
325
341
|
whoever opens it — someone who already has access to this cockpit, after the
|
package/dist/config.d.ts
CHANGED
|
@@ -22,11 +22,17 @@ export interface Config {
|
|
|
22
22
|
/** Per launch-directory on/off switch for the Telegram bridge (default on). */
|
|
23
23
|
telegramEnabled?: Record<string, boolean>;
|
|
24
24
|
/**
|
|
25
|
-
* Per launch-directory
|
|
26
|
-
* guests' agents are born into,
|
|
27
|
-
* (`src/tg-guests.ts`). Absent =
|
|
25
|
+
* Per launch-directory Telegram mode: where the bot works (`group`,
|
|
26
|
+
* `group+dm`, `dm-only`), the restricted group guests' agents are born into,
|
|
27
|
+
* and the profile they run on (`src/tg-guests.ts`). Absent = `group`, the
|
|
28
|
+
* classic instance, which is every instance's default.
|
|
29
|
+
*
|
|
30
|
+
* `on` is the pre-mode spelling, still WRITTEN for one reason: a downgrade to
|
|
31
|
+
* a server that only knows that field must not read an open instance as a
|
|
32
|
+
* closed one.
|
|
28
33
|
*/
|
|
29
34
|
telegramGuests?: Record<string, {
|
|
35
|
+
mode?: string;
|
|
30
36
|
on?: boolean;
|
|
31
37
|
group?: string | null;
|
|
32
38
|
profile?: string | null;
|
|
@@ -187,21 +193,28 @@ export interface TelegramConfig {
|
|
|
187
193
|
/** Resolve the effective Telegram config for `cwd`: env overrides config. */
|
|
188
194
|
export declare function telegramConfig(cfg: Config, cwd: string, env?: NodeJS.ProcessEnv): TelegramConfig;
|
|
189
195
|
/**
|
|
190
|
-
* This directory's open-DM setup
|
|
196
|
+
* This directory's Telegram mode and open-DM setup — the classic `group`
|
|
197
|
+
* whenever the row is absent or malformed.
|
|
191
198
|
*
|
|
192
|
-
* The file is hand-editable, so a half-written row must read as
|
|
193
|
-
* than throw or — far worse — open the bot's DMs with a group
|
|
199
|
+
* The file is hand-editable, so a half-written row must read as the classic
|
|
200
|
+
* instance rather than throw or — far worse — open the bot's DMs with a group
|
|
201
|
+
* it cannot honour (`normalizeGuestSetup` holds that solidarity rule).
|
|
202
|
+
*
|
|
203
|
+
* A row written before the mode existed carries `on` instead: `on: true` was
|
|
204
|
+
* exactly today's `group+dm`, so it is read as one. That migration is a READ,
|
|
205
|
+
* not a rewrite — nothing touches the file until the panel saves.
|
|
194
206
|
*/
|
|
195
207
|
export declare function guestSetupForCwd(cfg: Config, cwd: string): GuestSetup;
|
|
196
208
|
/**
|
|
197
|
-
* Pure: set this directory's open-DM setup on `cfg` (caller
|
|
209
|
+
* Pure: set this directory's Telegram mode and open-DM setup on `cfg` (caller
|
|
210
|
+
* persists).
|
|
198
211
|
*
|
|
199
|
-
* The group and the profile are kept when the
|
|
200
|
-
* needs no retyping — and clearing them is done by saving them as
|
|
201
|
-
* as a side effect of
|
|
212
|
+
* The group and the profile are kept when the mode goes back to `group`, so
|
|
213
|
+
* re-opening needs no retyping — and clearing them is done by saving them as
|
|
214
|
+
* null, never as a side effect of changing mode.
|
|
202
215
|
*/
|
|
203
216
|
export declare function applyGuestSetup(cfg: Config, cwd: string, s: GuestSetup): Config;
|
|
204
|
-
/** Set this directory's open-DM setup and persist. */
|
|
217
|
+
/** Set this directory's Telegram mode and open-DM setup, and persist. */
|
|
205
218
|
export declare function setGuestSetupForCwd(cfg: Config, cwd: string, s: GuestSetup): void;
|
|
206
219
|
export interface TelegramPatch {
|
|
207
220
|
token?: string | null;
|
package/dist/config.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import { GUEST_SETUP_OFF } from "./tg-guests.js";
|
|
4
|
+
import { GUEST_SETUP_OFF, guestsOpen, normalizeGuestSetup, normalizeTgMode, } from "./tg-guests.js";
|
|
5
5
|
export const SHADOK_DIR = path.join(os.homedir(), ".shadok-ai");
|
|
6
6
|
const CONFIG_FILE = path.join(SHADOK_DIR, "config.json");
|
|
7
7
|
const LEGACY_ENV = path.join(SHADOK_DIR, "telegram.env");
|
|
@@ -170,10 +170,16 @@ export function telegramConfig(cfg, cwd, env = process.env) {
|
|
|
170
170
|
};
|
|
171
171
|
}
|
|
172
172
|
/**
|
|
173
|
-
* This directory's open-DM setup
|
|
173
|
+
* This directory's Telegram mode and open-DM setup — the classic `group`
|
|
174
|
+
* whenever the row is absent or malformed.
|
|
174
175
|
*
|
|
175
|
-
* The file is hand-editable, so a half-written row must read as
|
|
176
|
-
* than throw or — far worse — open the bot's DMs with a group
|
|
176
|
+
* The file is hand-editable, so a half-written row must read as the classic
|
|
177
|
+
* instance rather than throw or — far worse — open the bot's DMs with a group
|
|
178
|
+
* it cannot honour (`normalizeGuestSetup` holds that solidarity rule).
|
|
179
|
+
*
|
|
180
|
+
* A row written before the mode existed carries `on` instead: `on: true` was
|
|
181
|
+
* exactly today's `group+dm`, so it is read as one. That migration is a READ,
|
|
182
|
+
* not a rewrite — nothing touches the file until the panel saves.
|
|
177
183
|
*/
|
|
178
184
|
export function guestSetupForCwd(cfg, cwd) {
|
|
179
185
|
const row = cfg.telegramGuests?.[cwd];
|
|
@@ -181,24 +187,24 @@ export function guestSetupForCwd(cfg, cwd) {
|
|
|
181
187
|
return { ...GUEST_SETUP_OFF };
|
|
182
188
|
const group = typeof row.group === "string" && row.group.trim() ? row.group.trim() : null;
|
|
183
189
|
const profile = typeof row.profile === "string" && row.profile.trim() ? row.profile.trim() : null;
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
const on = row.on === true && !!group && !!profile;
|
|
187
|
-
return { on, group, profile };
|
|
190
|
+
const mode = row.mode === undefined && row.on === true ? "group+dm" : normalizeTgMode(row.mode);
|
|
191
|
+
return normalizeGuestSetup({ mode, group, profile });
|
|
188
192
|
}
|
|
189
193
|
/**
|
|
190
|
-
* Pure: set this directory's open-DM setup on `cfg` (caller
|
|
194
|
+
* Pure: set this directory's Telegram mode and open-DM setup on `cfg` (caller
|
|
195
|
+
* persists).
|
|
191
196
|
*
|
|
192
|
-
* The group and the profile are kept when the
|
|
193
|
-
* needs no retyping — and clearing them is done by saving them as
|
|
194
|
-
* as a side effect of
|
|
197
|
+
* The group and the profile are kept when the mode goes back to `group`, so
|
|
198
|
+
* re-opening needs no retyping — and clearing them is done by saving them as
|
|
199
|
+
* null, never as a side effect of changing mode.
|
|
195
200
|
*/
|
|
196
201
|
export function applyGuestSetup(cfg, cwd, s) {
|
|
197
202
|
cfg.telegramGuests ??= {};
|
|
198
|
-
|
|
203
|
+
// `on` rides along for a server that predates the mode: see the field's doc.
|
|
204
|
+
cfg.telegramGuests[cwd] = { mode: s.mode, on: guestsOpen(s), group: s.group, profile: s.profile };
|
|
199
205
|
return cfg;
|
|
200
206
|
}
|
|
201
|
-
/** Set this directory's open-DM setup and persist. */
|
|
207
|
+
/** Set this directory's Telegram mode and open-DM setup, and persist. */
|
|
202
208
|
export function setGuestSetupForCwd(cfg, cwd, s) {
|
|
203
209
|
saveConfig(applyGuestSetup(cfg, cwd, s));
|
|
204
210
|
}
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EAEL,eAAe,EACf,UAAU,EACV,mBAAmB,EACnB,eAAe,GAChB,MAAM,gBAAgB,CAAC;AA8HxB,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,YAAY,CAAC,CAAC;AAChE,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;AACzD,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;AAEzD,MAAM,UAAU,UAAU;IACxB,IAAI,CAAC;QACH,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;QAC3D,OAAO,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO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AQ;QAAE,KAAK,GAAG,GAAG,CAAC,aAAa,CAAC;IAC/E,IAAI,CAAC,KAAK;QAAE,OAAO;IACnB,CAAC,GAAG,CAAC,MAAM,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACjC,OAAO,GAAG,CAAC,aAAa,CAAC,CAAC,2BAA2B;IACrD,IAAI,CAAC;QACH,EAAE,CAAC,UAAU,CAAC,UAAU,EAAE,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC,0BAA0B;IACjF,CAAC;IAAC,MAAM,CAAC;QACP,iBAAiB;IACnB,CAAC;IACD,UAAU,CAAC,GAAG,CAAC,CAAC;AAClB,CAAC"}
|
package/dist/server.js
CHANGED
|
@@ -58,7 +58,7 @@ import { deliverWithRetry } from "./reload.js";
|
|
|
58
58
|
import { startTelegram, renameTelegramTopic, closeTelegramTopic, probeToken, isStalePreface, announceLoggedOut, resetLoggedOutNotice, attachmentPrompt, pasteFileName, mediaDir, } from "./telegram.js";
|
|
59
59
|
import { transcribe, audioClipExtension } from "./whisper.js";
|
|
60
60
|
import { cancelPairingCode, issuePairingCode, pairingStatus } from "./tg-pairing.js";
|
|
61
|
-
import { GUEST_SETUP_OFF, guestGroupChoices, guestPatchFlow, guestSpawnPlan } from "./tg-guests.js";
|
|
61
|
+
import { GUEST_SETUP_OFF, guestGroupChoices, guestPatchFlow, guestSpawnPlan, normalizeTgMode, } from "./tg-guests.js";
|
|
62
62
|
import { migrateTgBindings } from "./channels.js";
|
|
63
63
|
import { RoomStore, canSeeRoom, isRoomId, newRoomId, pageMessages, patchRoomIn, postRefusal, roomGroupFor, roomName, unreadCount, visibleRooms, ROOM_PAGE, } from "./rooms.js";
|
|
64
64
|
import { viewerFor, canResumeAs, canRestartInto, canSeeGroup, membershipVerdict, canSeeSession, spawnGroupFor, listableGroups, visibleChannels, secretOwnGroupIds, ledgerGroupsFor, groupsPutFlow, privateGroupFor, newPrivateGroup, accountDeleteGroups, MAIN_GROUP_ID, groupMoveRefusal, isAgentViewer, canWriteSecretGroup, } from "./groups.js";
|
|
@@ -6296,8 +6296,8 @@ async function telegramState(viewer = null) {
|
|
|
6296
6296
|
return {
|
|
6297
6297
|
guests,
|
|
6298
6298
|
guestGroups,
|
|
6299
|
-
// Whether the bot's DMs have an owner: a prerequisite for
|
|
6300
|
-
// panel must be able to say so instead of letting the save fail.
|
|
6299
|
+
// Whether the bot's DMs have an owner: a prerequisite for `group+dm`, and
|
|
6300
|
+
// the panel must be able to say so instead of letting the save fail.
|
|
6301
6301
|
dmOwned: loadTgOwner() !== null,
|
|
6302
6302
|
hasToken: Boolean(tc.token),
|
|
6303
6303
|
enabled: tc.enabled,
|
|
@@ -6355,10 +6355,14 @@ app.put("/telegram", async (req, res) => {
|
|
|
6355
6355
|
// afterwards refused.
|
|
6356
6356
|
let guestsChanged = false;
|
|
6357
6357
|
if (b.guests && typeof b.guests === "object") {
|
|
6358
|
+
const g = b.guests;
|
|
6358
6359
|
const want = {
|
|
6359
|
-
|
|
6360
|
-
|
|
6361
|
-
|
|
6360
|
+
// Anything the body does not spell as one of the three modes is the
|
|
6361
|
+
// classic one: the panel sends the mode it painted, and a hand-made
|
|
6362
|
+
// request must never open a door by omitting a field.
|
|
6363
|
+
mode: normalizeTgMode(g.mode),
|
|
6364
|
+
group: typeof g.group === "string" ? String(g.group) : null,
|
|
6365
|
+
profile: typeof g.profile === "string" ? String(g.profile) : null,
|
|
6362
6366
|
};
|
|
6363
6367
|
const flow = guestPatchFlow({
|
|
6364
6368
|
mode: DEPLOYMENT_MODE,
|
|
@@ -6366,9 +6370,9 @@ app.put("/telegram", async (req, res) => {
|
|
|
6366
6370
|
want,
|
|
6367
6371
|
groups: loadGroups(),
|
|
6368
6372
|
profileExists: (n) => !!getProfile(n),
|
|
6369
|
-
// `dmGate` answers `pair` while the bot has no owner, so
|
|
6370
|
-
//
|
|
6371
|
-
//
|
|
6373
|
+
// `dmGate` answers `pair` while the bot has no owner, so `group+dm`
|
|
6374
|
+
// cannot be saved before the DMs are paired — it would be a door that
|
|
6375
|
+
// cannot open. `dm-only` has no owner at all and is exempt.
|
|
6372
6376
|
hasOwner: loadTgOwner() !== null,
|
|
6373
6377
|
});
|
|
6374
6378
|
if (!flow.ok)
|