@songsid/agend 2.2.0-beta.10 → 2.2.0-beta.12
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/agent-endpoint.js +3 -0
- package/dist/agent-endpoint.js.map +1 -1
- package/dist/agent-whats-new.js +4 -0
- package/dist/agent-whats-new.js.map +1 -1
- package/dist/auth-api.d.ts +3 -1
- package/dist/auth-api.js +15 -1
- package/dist/auth-api.js.map +1 -1
- package/dist/backend/antigravity.d.ts +5 -0
- package/dist/backend/antigravity.js +27 -13
- package/dist/backend/antigravity.js.map +1 -1
- package/dist/backend/effort-metadata.d.ts +36 -0
- package/dist/backend/effort-metadata.js +83 -13
- package/dist/backend/effort-metadata.js.map +1 -1
- package/dist/backend/launch-effort.d.ts +29 -1
- package/dist/backend/launch-effort.js +53 -6
- package/dist/backend/launch-effort.js.map +1 -1
- package/dist/backend/types.d.ts +14 -0
- package/dist/backend/types.js +10 -0
- package/dist/backend/types.js.map +1 -1
- package/dist/channel/adapters/discord.d.ts +12 -0
- package/dist/channel/adapters/discord.js +39 -2
- package/dist/channel/adapters/discord.js.map +1 -1
- package/dist/channel/adapters/telegram.d.ts +18 -0
- package/dist/channel/adapters/telegram.js +24 -3
- package/dist/channel/adapters/telegram.js.map +1 -1
- package/dist/channel/mcp-tools.js +2 -0
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/channel/tool-router.d.ts +2 -0
- package/dist/channel/tool-router.js +1 -1
- package/dist/channel/tool-router.js.map +1 -1
- package/dist/channel/types.d.ts +16 -0
- package/dist/cli.js +34 -11
- package/dist/cli.js.map +1 -1
- package/dist/daemon.js +9 -0
- package/dist/daemon.js.map +1 -1
- package/dist/delivery-outbox.d.ts +8 -1
- package/dist/delivery-outbox.js +6 -2
- package/dist/delivery-outbox.js.map +1 -1
- package/dist/fleet-manager.d.ts +59 -3
- package/dist/fleet-manager.js +157 -22
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/model-discovery/SKILL.md +4 -1
- package/dist/instructions.js +2 -2
- package/dist/instructions.js.map +1 -1
- package/dist/locale.js +26 -0
- package/dist/locale.js.map +1 -1
- package/dist/outbound-handlers.js +21 -1
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/outbound-schemas.d.ts +12 -0
- package/dist/outbound-schemas.js +12 -1
- package/dist/outbound-schemas.js.map +1 -1
- package/dist/public-web-gateway.js +3 -0
- package/dist/public-web-gateway.js.map +1 -1
- package/dist/reply-buttons-controller.d.ts +86 -5
- package/dist/reply-buttons-controller.js +271 -7
- package/dist/reply-buttons-controller.js.map +1 -1
- package/dist/reply-buttons.d.ts +48 -3
- package/dist/reply-buttons.js +105 -10
- package/dist/reply-buttons.js.map +1 -1
- package/dist/reply-polls.d.ts +85 -0
- package/dist/reply-polls.js +154 -0
- package/dist/reply-polls.js.map +1 -0
- package/dist/tool-permissions.js +3 -3
- package/dist/tool-permissions.js.map +1 -1
- package/dist/topic-commands.js +9 -4
- package/dist/topic-commands.js.map +1 -1
- package/dist/ui/chat-render.js +19 -2
- package/dist/ui/chat-store.js +35 -1
- package/dist/ui/chat-strings.js +2 -0
- package/dist/ui/chat-thread.js +42 -0
- package/dist/ui/panel-chat.js +2 -0
- package/dist/ui/panel-log.js +2 -2
- package/dist/ui/panel-settings.js +48 -1
- package/dist/ui/settings-strings.js +10 -0
- package/dist/ui/shared/app-i18n.js +1 -1
- package/dist/ui/shared/app-stream.js +4 -1
- package/dist/ui/shared/app.css +28 -5
- package/dist/ui/shared/header-tools.js +12 -4
- package/dist/ui/shared/instance-switch.js +5 -2
- package/dist/ui/shared/view-strings.js +2 -2
- package/dist/update-check.d.ts +31 -0
- package/dist/update-check.js +47 -0
- package/dist/update-check.js.map +1 -1
- package/dist/update-launch.d.ts +46 -1
- package/dist/update-launch.js +146 -3
- package/dist/update-launch.js.map +1 -1
- package/dist/web-api.d.ts +40 -2
- package/dist/web-api.js +130 -14
- package/dist/web-api.js.map +1 -1
- package/dist/web-chat-history.d.ts +12 -1
- package/dist/web-chat-history.js +29 -7
- package/dist/web-chat-history.js.map +1 -1
- package/dist/web-login.d.ts +14 -0
- package/dist/web-login.js +4 -2
- package/dist/web-login.js.map +1 -1
- package/dist/web-prefs.d.ts +18 -0
- package/dist/web-prefs.js +36 -4
- package/dist/web-prefs.js.map +1 -1
- package/dist/web-profile.d.ts +32 -0
- package/dist/web-profile.js +132 -0
- package/dist/web-profile.js.map +1 -0
- package/dist/web-session.d.ts +14 -0
- package/dist/web-session.js +10 -0
- package/dist/web-session.js.map +1 -1
- package/package.json +1 -1
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import type { ChannelAdapter } from "./channel/types.js";
|
|
7
7
|
import { type HumanOrigin } from "./human-delivery-receipts.js";
|
|
8
8
|
import { type ReplyButton, type ReplyButtonSet, type ReplyButtonStore } from "./reply-buttons.js";
|
|
9
|
+
import { type PollConfig, type PollRender } from "./reply-polls.js";
|
|
9
10
|
/** A click from a platform adapter (the fleet's callback shape). */
|
|
10
11
|
export interface ReplyButtonClick {
|
|
11
12
|
humanOrigin?: HumanOrigin;
|
|
@@ -21,9 +22,24 @@ export interface ReplyButtonClick {
|
|
|
21
22
|
export interface ReplyButtonsView {
|
|
22
23
|
id: string;
|
|
23
24
|
labels: string[];
|
|
24
|
-
state: "open" | "chosen" | "expired";
|
|
25
|
+
state: "open" | "chosen" | "expired" | "closed";
|
|
25
26
|
chosen?: number;
|
|
26
27
|
by?: string;
|
|
28
|
+
/** #1823: the set is a poll ("closed" once its deadline came). */
|
|
29
|
+
poll?: PollView;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* #1823: a poll as a page shows it. Counts only when revealed (`reveal: "live"`, or closed); voters' names only when
|
|
33
|
+
* closed with `show_voters`. `rev` orders views of one poll (a page keeps the newest).
|
|
34
|
+
*/
|
|
35
|
+
export interface PollView {
|
|
36
|
+
deadline: number;
|
|
37
|
+
answered: number;
|
|
38
|
+
multi: boolean;
|
|
39
|
+
reveal: "close" | "live";
|
|
40
|
+
rev: number;
|
|
41
|
+
counts?: number[];
|
|
42
|
+
voters?: string[][];
|
|
27
43
|
}
|
|
28
44
|
export interface ReplyButtonsDeps {
|
|
29
45
|
store: ReplyButtonStore;
|
|
@@ -41,6 +57,13 @@ export interface ReplyButtonsDeps {
|
|
|
41
57
|
}): Promise<boolean>;
|
|
42
58
|
/** Tell the web pages a set changed. */
|
|
43
59
|
publish(instance: string, view: ReplyButtonsView): void;
|
|
60
|
+
/**
|
|
61
|
+
* #1823: hand a closed poll's results to the instance, durably and once per `key` (the delivery outbox's system
|
|
62
|
+
* notice): true when the outbox holds them (newly, or from an earlier call), false when it cannot take them now.
|
|
63
|
+
*/
|
|
64
|
+
admitResults(set: ReplyButtonSet, key: string, text: string): boolean;
|
|
65
|
+
/** #1823: a monotonic clock, for the redraw throttle (a deadline is wall clock; spacing edits is a duration). */
|
|
66
|
+
monotonic(): number;
|
|
44
67
|
logger: {
|
|
45
68
|
info(obj: object, msg?: string): void;
|
|
46
69
|
warn(obj: object, msg?: string): void;
|
|
@@ -54,32 +77,61 @@ export declare class ReplyButtonsController {
|
|
|
54
77
|
private stopped;
|
|
55
78
|
/** Claims this process is delivering right now (a sweep leaves them alone). */
|
|
56
79
|
private readonly inFlight;
|
|
80
|
+
/** #1823: per poll, its pending redraw and countdown tick. */
|
|
81
|
+
private readonly pace;
|
|
82
|
+
/** #1823: per chat, the earliest a next poll redraw may go out (monotonic): polls in one chat share its edit limit. */
|
|
83
|
+
private readonly chatNextFree;
|
|
84
|
+
private resultsRetry;
|
|
57
85
|
constructor(deps: ReplyButtonsDeps);
|
|
58
|
-
/**
|
|
86
|
+
/**
|
|
87
|
+
* Before the send: a set for these buttons, and the callbacks the platform will carry. A poll (#1823) opens here: its
|
|
88
|
+
* deadline is fixed now, and `poll` is how it looks when posted.
|
|
89
|
+
*/
|
|
59
90
|
prepare(where: {
|
|
60
91
|
instance: string;
|
|
61
92
|
adapterId: string;
|
|
62
93
|
chatId: string;
|
|
63
94
|
threadId?: string;
|
|
64
|
-
}, buttons: readonly ReplyButton[]): {
|
|
95
|
+
}, buttons: readonly ReplyButton[], poll?: PollConfig | null): {
|
|
65
96
|
id: string;
|
|
66
97
|
callbacks: Array<{
|
|
67
98
|
id: string;
|
|
68
99
|
label: string;
|
|
69
100
|
}>;
|
|
101
|
+
poll?: PollRender;
|
|
70
102
|
};
|
|
71
103
|
/** After a confirmed send: the message the buttons are on. From now on a click there can match. */
|
|
72
104
|
bind(id: string, messageId: string): void;
|
|
73
105
|
/** A send that failed: the set never existed. */
|
|
74
106
|
discard(id: string): void;
|
|
107
|
+
/** #1823: how a poll looks now (open: "N answered"; closed: the tally). */
|
|
108
|
+
private pollRenderOf;
|
|
75
109
|
view(set: ReplyButtonSet, now?: number): ReplyButtonsView;
|
|
76
110
|
viewOf(id: string): ReplyButtonsView | null;
|
|
77
111
|
/** A platform click. True when the callback is a reply button's (handled here, whatever the outcome). */
|
|
78
112
|
handleCallback(data: ReplyButtonClick, adapterId: string): Promise<boolean>;
|
|
79
|
-
/**
|
|
80
|
-
|
|
113
|
+
/**
|
|
114
|
+
* #1823: one vote. The voter alone is told what their ballot is now (Discord: ephemeral; Telegram: a toast); the
|
|
115
|
+
* message shows only "N answered" (or the counts, with `reveal: "live"`), redrawn within the platform's limits.
|
|
116
|
+
*/
|
|
117
|
+
vote(id: string, voter: string, name: string, index: number, ack?: (notice?: string) => void): {
|
|
118
|
+
ok: boolean;
|
|
119
|
+
options?: number[];
|
|
120
|
+
error?: string;
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* A click in the web chat (the caller has passed the /ui gate: a session, or the public link). On a poll (#1823) it
|
|
124
|
+
* is `voter`'s vote — a session's public handle, so each signed-in device is one voter — and the answer carries the
|
|
125
|
+
* ballot, for the page to mark the voter's own choice.
|
|
126
|
+
*/
|
|
127
|
+
clickWeb(instance: string, id: string, index: number, voter?: {
|
|
128
|
+
key: string;
|
|
129
|
+
userId: string;
|
|
130
|
+
name: string;
|
|
131
|
+
}): Promise<{
|
|
81
132
|
status: 200 | 400 | 403 | 409;
|
|
82
133
|
error?: string;
|
|
134
|
+
options?: number[];
|
|
83
135
|
}>;
|
|
84
136
|
/** Consume, deliver, then show it everywhere. A choice the agent could not be given is undone (the set reopens). */
|
|
85
137
|
private choose;
|
|
@@ -95,6 +147,35 @@ export declare class ReplyButtonsController {
|
|
|
95
147
|
* second choice.
|
|
96
148
|
*/
|
|
97
149
|
sweep(): Promise<void>;
|
|
150
|
+
/**
|
|
151
|
+
* #1823: polls whose deadline came are closed (no vote counts after that), their results handed to the outbox once,
|
|
152
|
+
* and their message redrawn as closed. After a restart this also catches up: a deadline passed while AgEnD was down
|
|
153
|
+
* closes now (the results say how late), and an open poll's countdown is drawn again.
|
|
154
|
+
*/
|
|
155
|
+
private sweepPolls;
|
|
156
|
+
/**
|
|
157
|
+
* #1823: `instance` closes its own open poll before the deadline (close_poll). The close is the same one the deadline
|
|
158
|
+
* makes — once, results through the outbox, the message redrawn — and the results say it closed early.
|
|
159
|
+
*/
|
|
160
|
+
closeEarly(instance: string, id: string): Promise<{
|
|
161
|
+
ok: true;
|
|
162
|
+
voted: number;
|
|
163
|
+
} | {
|
|
164
|
+
ok: false;
|
|
165
|
+
error: string;
|
|
166
|
+
}>;
|
|
167
|
+
/** #1823: a closed poll's message shows the tally, once (a failed edit is logged, not retried); with show_voters, who. */
|
|
168
|
+
private settlePoll;
|
|
169
|
+
/**
|
|
170
|
+
* #1823: redraw a poll soon, coalesced: one pending redraw per poll, and per chat no closer than the adapter's edit
|
|
171
|
+
* interval to the last one (polls in one chat share it). What is drawn is read when it goes out, not now.
|
|
172
|
+
*/
|
|
173
|
+
private requestRedraw;
|
|
174
|
+
private redraw;
|
|
175
|
+
/** #1823: a platform that cannot count down by itself is redrawn as time passes, coarser the more is left. */
|
|
176
|
+
private scheduleTick;
|
|
177
|
+
private paceOf;
|
|
178
|
+
private dropPace;
|
|
98
179
|
/** One timer, for the next expiry. A wall-clock jump makes it fire early or late; the sweep re-reads the clock. */
|
|
99
180
|
arm(): void;
|
|
100
181
|
stop(): void;
|
|
@@ -1,34 +1,67 @@
|
|
|
1
1
|
import { webHumanOrigin } from "./human-delivery-receipts.js";
|
|
2
2
|
import { t } from "./locale.js";
|
|
3
3
|
import { REPLY_BUTTON_PREFIX, newReplyButtonsId, parseReplyButtonCallback, replyButtonCallback, replyButtonsClickPlace, } from "./reply-buttons.js";
|
|
4
|
+
import { POLL_CLOSED_CALLBACK, POLL_STATUS_CALLBACK, pollCounts, pollRender, pollResultsText, pollTickMs, pollVoteNotice, pollVotersText, } from "./reply-polls.js";
|
|
4
5
|
/** Settled sets are kept a week (a page may still show the reply), then pruned. */
|
|
5
6
|
const KEEP_SETTLED_MS = 7 * 24 * 60 * 60 * 1000;
|
|
6
7
|
/** setTimeout's ceiling; a later expiry is reached by re-arming. */
|
|
7
8
|
const MAX_TIMER_MS = 2_147_483_647;
|
|
9
|
+
/** #1823: redraw spacing for an adapter that names none. */
|
|
10
|
+
const DEFAULT_POLL_EDIT_INTERVAL_MS = 3_000;
|
|
11
|
+
/** #1823: how often a web-only poll's pages are told about new votes. */
|
|
12
|
+
const WEB_POLL_PUBLISH_MS = 1_000;
|
|
13
|
+
/** #1823: how soon results the outbox could not take are offered again. */
|
|
14
|
+
const RESULTS_RETRY_MS = 30_000;
|
|
8
15
|
export class ReplyButtonsController {
|
|
9
16
|
deps;
|
|
10
17
|
timer = null;
|
|
11
18
|
stopped = false;
|
|
12
19
|
/** Claims this process is delivering right now (a sweep leaves them alone). */
|
|
13
20
|
inFlight = new Set();
|
|
21
|
+
/** #1823: per poll, its pending redraw and countdown tick. */
|
|
22
|
+
pace = new Map();
|
|
23
|
+
/** #1823: per chat, the earliest a next poll redraw may go out (monotonic): polls in one chat share its edit limit. */
|
|
24
|
+
chatNextFree = new Map();
|
|
25
|
+
resultsRetry = null;
|
|
14
26
|
constructor(deps) {
|
|
15
27
|
this.deps = deps;
|
|
16
28
|
}
|
|
17
|
-
/**
|
|
18
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Before the send: a set for these buttons, and the callbacks the platform will carry. A poll (#1823) opens here: its
|
|
31
|
+
* deadline is fixed now, and `poll` is how it looks when posted.
|
|
32
|
+
*/
|
|
33
|
+
prepare(where, buttons, poll = null) {
|
|
19
34
|
const id = newReplyButtonsId();
|
|
20
|
-
this.deps.store.create({ id, instance: where.instance, adapterId: where.adapterId, chatId: where.chatId, threadId: where.threadId ?? "", buttons: [...buttons] }, this.deps.now());
|
|
21
|
-
|
|
35
|
+
const set = this.deps.store.create({ id, instance: where.instance, adapterId: where.adapterId, chatId: where.chatId, threadId: where.threadId ?? "", buttons: [...buttons], poll }, this.deps.now());
|
|
36
|
+
const callbacks = buttons.map((b, i) => ({ id: replyButtonCallback(id, i), label: b.label }));
|
|
37
|
+
return { id, callbacks, ...(poll ? { poll: this.pollRenderOf(set, false) } : {}) };
|
|
22
38
|
}
|
|
23
39
|
/** After a confirmed send: the message the buttons are on. From now on a click there can match. */
|
|
24
40
|
bind(id, messageId) {
|
|
25
41
|
this.deps.store.bind(id, messageId);
|
|
42
|
+
const set = this.deps.store.get(id);
|
|
43
|
+
if (set?.poll)
|
|
44
|
+
this.scheduleTick(set);
|
|
26
45
|
this.arm();
|
|
27
46
|
}
|
|
28
47
|
/** A send that failed: the set never existed. */
|
|
29
48
|
discard(id) { this.deps.store.remove(id); }
|
|
49
|
+
/** #1823: how a poll looks now (open: "N answered"; closed: the tally). */
|
|
50
|
+
pollRenderOf(set, closed) {
|
|
51
|
+
return pollRender(set.buttons.map(b => b.label), set.buttons.map((_, i) => replyButtonCallback(set.id, i)), set.poll, this.deps.store.ballots(set.id), set.expiresAt, closed);
|
|
52
|
+
}
|
|
30
53
|
view(set, now = this.deps.now()) {
|
|
31
54
|
const labels = set.buttons.map(b => b.label);
|
|
55
|
+
if (set.poll) {
|
|
56
|
+
const ballots = this.deps.store.ballots(set.id);
|
|
57
|
+
const closed = set.closedAt !== null;
|
|
58
|
+
const counts = closed || set.poll.reveal === "live" ? pollCounts(labels.length, ballots) : undefined;
|
|
59
|
+
const voters = closed && set.poll.showVoters ? labels.map((_, i) => ballots.filter(b => b.options.includes(i)).map(b => b.name)) : undefined;
|
|
60
|
+
return {
|
|
61
|
+
id: set.id, labels, state: closed ? "closed" : "open",
|
|
62
|
+
poll: { deadline: set.expiresAt, answered: ballots.length, multi: set.poll.multi, reveal: set.poll.reveal, rev: now, ...(counts ? { counts } : {}), ...(voters ? { voters } : {}) },
|
|
63
|
+
};
|
|
64
|
+
}
|
|
32
65
|
if (set.deliveredAt !== null && set.chosenIndex !== null)
|
|
33
66
|
return { id: set.id, labels, state: "chosen", chosen: set.chosenIndex, by: set.chosenBy ?? "" };
|
|
34
67
|
// Settled without a delivered choice: expired, or a claim a stopped process never delivered (closed as expired).
|
|
@@ -44,6 +77,15 @@ export class ReplyButtonsController {
|
|
|
44
77
|
async handleCallback(data, adapterId) {
|
|
45
78
|
if (!data.callbackData.startsWith(REPLY_BUTTON_PREFIX))
|
|
46
79
|
return false;
|
|
80
|
+
// #1823: a poll's status button says something, it does nothing; a closed poll's options say it is closed.
|
|
81
|
+
if (data.callbackData === POLL_STATUS_CALLBACK) {
|
|
82
|
+
data.ack?.();
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
if (data.callbackData.startsWith(`${POLL_CLOSED_CALLBACK}:`)) {
|
|
86
|
+
data.ack?.(t("poll.closed"));
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
47
89
|
const parsed = parseReplyButtonCallback(data.callbackData);
|
|
48
90
|
const set = parsed ? this.deps.store.get(parsed.id) : null;
|
|
49
91
|
if (!parsed || !set) {
|
|
@@ -60,11 +102,38 @@ export class ReplyButtonsController {
|
|
|
60
102
|
data.ack?.(t("buttons.not_allowed"));
|
|
61
103
|
return true;
|
|
62
104
|
}
|
|
105
|
+
if (set.poll) {
|
|
106
|
+
this.vote(set.id, `${adapterId}:${data.userId}`, data.username || data.userId, parsed.index, data.ack);
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
63
109
|
await this.choose(set.id, parsed.index, { userId: data.userId, username: data.username || data.userId, source: "platform", humanOrigin: data.humanOrigin }, data.ack);
|
|
64
110
|
return true;
|
|
65
111
|
}
|
|
66
|
-
/**
|
|
67
|
-
|
|
112
|
+
/**
|
|
113
|
+
* #1823: one vote. The voter alone is told what their ballot is now (Discord: ephemeral; Telegram: a toast); the
|
|
114
|
+
* message shows only "N answered" (or the counts, with `reveal: "live"`), redrawn within the platform's limits.
|
|
115
|
+
*/
|
|
116
|
+
vote(id, voter, name, index, ack) {
|
|
117
|
+
const result = this.deps.store.vote(id, voter, name, index, this.deps.now());
|
|
118
|
+
if (!result.ok) {
|
|
119
|
+
// Sent but not yet bound to its message (a click in that instant): not closed — try again in a moment.
|
|
120
|
+
const error = result.reason === "pending" ? t("poll.not_ready") : t("poll.closed");
|
|
121
|
+
ack?.(error);
|
|
122
|
+
if (result.reason === "closed")
|
|
123
|
+
void this.sweep(); // a deadline the timer has not reached yet
|
|
124
|
+
return { ok: false, error };
|
|
125
|
+
}
|
|
126
|
+
ack?.(pollVoteNotice(result.set.buttons.map(b => b.label), result.options));
|
|
127
|
+
if (result.changed)
|
|
128
|
+
this.requestRedraw(result.set);
|
|
129
|
+
return { ok: true, options: result.options };
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* A click in the web chat (the caller has passed the /ui gate: a session, or the public link). On a poll (#1823) it
|
|
133
|
+
* is `voter`'s vote — a session's public handle, so each signed-in device is one voter — and the answer carries the
|
|
134
|
+
* ballot, for the page to mark the voter's own choice.
|
|
135
|
+
*/
|
|
136
|
+
async clickWeb(instance, id, index, voter) {
|
|
68
137
|
if (!/^[0-9a-f]{32}$/.test(id) || !Number.isInteger(index) || index < 0)
|
|
69
138
|
return { status: 400, error: "Malformed button" };
|
|
70
139
|
const set = this.deps.store.get(id);
|
|
@@ -72,8 +141,16 @@ export class ReplyButtonsController {
|
|
|
72
141
|
return { status: 409, error: t("reply_buttons.closed") };
|
|
73
142
|
if (set.instance !== instance)
|
|
74
143
|
return { status: 403, error: "This button belongs to another instance" };
|
|
144
|
+
if (set.poll) {
|
|
145
|
+
if (!voter)
|
|
146
|
+
return { status: 403, error: "A vote needs a signed-in session" };
|
|
147
|
+
const r = this.vote(id, voter.key, voter.name, index);
|
|
148
|
+
return r.ok ? { status: 200, options: r.options } : { status: 409, error: r.error };
|
|
149
|
+
}
|
|
75
150
|
let notice;
|
|
76
|
-
|
|
151
|
+
// #1827: the choice is the web person's (their web id and name; "web-user" when there is none) — still `via web`
|
|
152
|
+
// with no verified actor (webHumanOrigin).
|
|
153
|
+
const ok = await this.choose(id, index, { userId: voter?.userId ?? "web-user", username: voter?.name ?? "web-user", source: "web", humanOrigin: webHumanOrigin(true) }, n => { notice = n; });
|
|
77
154
|
return ok ? { status: 200 } : { status: 409, error: notice ?? t("reply_buttons.closed") };
|
|
78
155
|
}
|
|
79
156
|
/** Consume, deliver, then show it everywhere. A choice the agent could not be given is undone (the set reopens). */
|
|
@@ -149,9 +226,191 @@ export class ReplyButtonsController {
|
|
|
149
226
|
for (const set of this.deps.store.undeliveredClaims())
|
|
150
227
|
if (!this.inFlight.has(set.id))
|
|
151
228
|
await this.settle(set, true);
|
|
229
|
+
await this.sweepPolls();
|
|
152
230
|
this.deps.store.prune(now - KEEP_SETTLED_MS);
|
|
153
231
|
this.arm();
|
|
154
232
|
}
|
|
233
|
+
/**
|
|
234
|
+
* #1823: polls whose deadline came are closed (no vote counts after that), their results handed to the outbox once,
|
|
235
|
+
* and their message redrawn as closed. After a restart this also catches up: a deadline passed while AgEnD was down
|
|
236
|
+
* closes now (the results say how late), and an open poll's countdown is drawn again.
|
|
237
|
+
*/
|
|
238
|
+
async sweepPolls() {
|
|
239
|
+
for (const set of this.deps.store.pollsDue(this.deps.now())) {
|
|
240
|
+
if (this.deps.store.closePoll(set.id, this.deps.now()))
|
|
241
|
+
this.deps.logger.info({ set: set.id, instance: set.instance }, "Poll closed");
|
|
242
|
+
}
|
|
243
|
+
let owed = false;
|
|
244
|
+
for (const set of this.deps.store.pollsAwaitingResults()) {
|
|
245
|
+
const ballots = this.deps.store.ballots(set.id);
|
|
246
|
+
let admitted = false;
|
|
247
|
+
try {
|
|
248
|
+
admitted = this.deps.admitResults(set, `poll:${set.id}`, pollResultsText(set, set.poll, ballots, set.closedAt));
|
|
249
|
+
}
|
|
250
|
+
catch (err) {
|
|
251
|
+
this.deps.logger.warn({ err: err.message, set: set.id }, "Poll results could not be handed to the outbox");
|
|
252
|
+
}
|
|
253
|
+
if (admitted)
|
|
254
|
+
this.deps.store.markResults(set.id, this.deps.now());
|
|
255
|
+
else
|
|
256
|
+
owed = true;
|
|
257
|
+
}
|
|
258
|
+
for (const set of this.deps.store.pollsUnsettled())
|
|
259
|
+
await this.settlePoll(set);
|
|
260
|
+
// Drawn again once per process (after a restart its countdown is stale), then paced by its own ticks.
|
|
261
|
+
for (const set of this.deps.store.openPolls())
|
|
262
|
+
if (!this.pace.has(set.id))
|
|
263
|
+
this.requestRedraw(set);
|
|
264
|
+
if (owed && this.resultsRetry === null && !this.stopped) {
|
|
265
|
+
this.resultsRetry = this.deps.setTimer(() => { this.resultsRetry = null; void this.sweep(); }, RESULTS_RETRY_MS);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* #1823: `instance` closes its own open poll before the deadline (close_poll). The close is the same one the deadline
|
|
270
|
+
* makes — once, results through the outbox, the message redrawn — and the results say it closed early.
|
|
271
|
+
*/
|
|
272
|
+
async closeEarly(instance, id) {
|
|
273
|
+
const set = this.deps.store.get(id);
|
|
274
|
+
if (!set?.poll || set.instance !== instance)
|
|
275
|
+
return { ok: false, error: "no open poll of yours has that id" };
|
|
276
|
+
if (set.messageId === null)
|
|
277
|
+
return { ok: false, error: "that poll is still being posted; try again in a moment" };
|
|
278
|
+
// The close itself is the check: of two closes (or a close and the deadline) only one changes the row.
|
|
279
|
+
if (!this.deps.store.closePoll(id, this.deps.now()))
|
|
280
|
+
return { ok: false, error: "that poll is already closed" };
|
|
281
|
+
this.deps.logger.info({ set: id, instance }, "Poll closed early");
|
|
282
|
+
await this.sweep();
|
|
283
|
+
return { ok: true, voted: this.deps.store.ballots(id).length };
|
|
284
|
+
}
|
|
285
|
+
/** #1823: a closed poll's message shows the tally, once (a failed edit is logged, not retried); with show_voters, who. */
|
|
286
|
+
async settlePoll(set) {
|
|
287
|
+
const fresh = this.deps.store.get(set.id);
|
|
288
|
+
if (!fresh?.poll || fresh.closedAt === null || fresh.settledAt !== null || fresh.messageId === null)
|
|
289
|
+
return;
|
|
290
|
+
this.deps.store.markSettled(fresh.id, this.deps.now()); // first: a concurrent settle does nothing
|
|
291
|
+
const pace = this.pace.get(fresh.id);
|
|
292
|
+
this.dropPace(fresh.id); // a redraw waiting to go now stands down
|
|
293
|
+
while (pace?.inflight)
|
|
294
|
+
await pace.inflight; // the one going lands before the closed one
|
|
295
|
+
this.deps.publish(fresh.instance, this.view(fresh));
|
|
296
|
+
const adapter = this.deps.adapterFor(fresh.adapterId);
|
|
297
|
+
if (!adapter?.renderPoll)
|
|
298
|
+
return;
|
|
299
|
+
try {
|
|
300
|
+
await adapter.renderPoll(fresh.chatId, fresh.messageId, fresh.threadId || undefined, this.pollRenderOf(fresh, true));
|
|
301
|
+
}
|
|
302
|
+
catch (err) {
|
|
303
|
+
this.deps.logger.warn({ err: err.message, set: fresh.id }, "Could not show a closed poll on the platform");
|
|
304
|
+
}
|
|
305
|
+
if (!fresh.poll.showVoters)
|
|
306
|
+
return;
|
|
307
|
+
const ballots = this.deps.store.ballots(fresh.id);
|
|
308
|
+
if (!ballots.length)
|
|
309
|
+
return;
|
|
310
|
+
try {
|
|
311
|
+
await adapter.sendText(fresh.chatId, pollVotersText(fresh.buttons.map(b => b.label), ballots), { threadId: fresh.threadId || undefined, replyTo: fresh.messageId, allowedMentions: { parse: [] } });
|
|
312
|
+
}
|
|
313
|
+
catch (err) {
|
|
314
|
+
this.deps.logger.warn({ err: err.message, set: fresh.id }, "Could not post a closed poll's voters");
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* #1823: redraw a poll soon, coalesced: one pending redraw per poll, and per chat no closer than the adapter's edit
|
|
319
|
+
* interval to the last one (polls in one chat share it). What is drawn is read when it goes out, not now.
|
|
320
|
+
*/
|
|
321
|
+
requestRedraw(set) {
|
|
322
|
+
if (this.stopped)
|
|
323
|
+
return;
|
|
324
|
+
const pace = this.paceOf(set.id);
|
|
325
|
+
pace.dirty = true;
|
|
326
|
+
if (pace.timer !== null)
|
|
327
|
+
return;
|
|
328
|
+
const adapter = this.deps.adapterFor(set.adapterId);
|
|
329
|
+
// Only the web chat (no platform message to edit): its pages are told as often as once a second.
|
|
330
|
+
const interval = adapter ? adapter.pollEditIntervalMs ?? DEFAULT_POLL_EDIT_INTERVAL_MS : WEB_POLL_PUBLISH_MS;
|
|
331
|
+
// The platform's limit is per chat (Telegram: the whole group, its topics included) or per thread (Discord: each
|
|
332
|
+
// channel or thread has its own bucket) — the adapter says which (#1824 review).
|
|
333
|
+
const chat = adapter?.pollRateScope === "chat" ? `${set.adapterId}\u0000${set.chatId}` : `${set.adapterId}\u0000${set.chatId}\u0000${set.threadId}`;
|
|
334
|
+
const now = this.deps.monotonic();
|
|
335
|
+
for (const [k, free] of this.chatNextFree)
|
|
336
|
+
if (free <= now)
|
|
337
|
+
this.chatNextFree.delete(k); // past slots: forgotten
|
|
338
|
+
const slot = Math.max(now, this.chatNextFree.get(chat) ?? 0, pace.lastAt ? pace.lastAt + interval : 0);
|
|
339
|
+
this.chatNextFree.set(chat, slot + interval);
|
|
340
|
+
pace.timer = this.deps.setTimer(() => { pace.timer = null; void this.redraw(set.id); }, slot - now);
|
|
341
|
+
}
|
|
342
|
+
async redraw(id) {
|
|
343
|
+
const pace = this.pace.get(id);
|
|
344
|
+
if (!pace || !pace.dirty)
|
|
345
|
+
return;
|
|
346
|
+
pace.dirty = false;
|
|
347
|
+
pace.lastAt = this.deps.monotonic();
|
|
348
|
+
// One edit at a time per poll, in order: every waiter re-checks after waking (two woken by the same edit must not
|
|
349
|
+
// both go — #1824 review).
|
|
350
|
+
while (pace.inflight)
|
|
351
|
+
await pace.inflight;
|
|
352
|
+
if (this.pace.get(id) !== pace)
|
|
353
|
+
return; // the close took it over meanwhile
|
|
354
|
+
const set = this.deps.store.get(id);
|
|
355
|
+
if (!set?.poll || set.closedAt !== null || set.messageId === null)
|
|
356
|
+
return; // closing draws its own final state
|
|
357
|
+
if (this.deps.now() >= set.expiresAt) {
|
|
358
|
+
void this.sweep();
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
this.deps.publish(set.instance, this.view(set)); // the web chat, whatever the platform
|
|
362
|
+
const adapter = this.deps.adapterFor(set.adapterId);
|
|
363
|
+
if (adapter?.renderPoll) {
|
|
364
|
+
// Kept while in flight: the close waits for it, so an open redraw never lands on top of the closed one.
|
|
365
|
+
const run = adapter.renderPoll(set.chatId, set.messageId, set.threadId || undefined, this.pollRenderOf(set, false))
|
|
366
|
+
.catch(err => { this.deps.logger.warn({ err: err.message, set: id }, "Could not redraw a poll on the platform"); });
|
|
367
|
+
pace.inflight = run;
|
|
368
|
+
await run;
|
|
369
|
+
if (pace.inflight === run)
|
|
370
|
+
pace.inflight = null;
|
|
371
|
+
}
|
|
372
|
+
if (this.pace.get(id) === pace)
|
|
373
|
+
this.scheduleTick(set); // not if the close took it over meanwhile
|
|
374
|
+
}
|
|
375
|
+
/** #1823: a platform that cannot count down by itself is redrawn as time passes, coarser the more is left. */
|
|
376
|
+
scheduleTick(set) {
|
|
377
|
+
if (this.stopped)
|
|
378
|
+
return;
|
|
379
|
+
const pace = this.paceOf(set.id);
|
|
380
|
+
if (pace.tick !== null) {
|
|
381
|
+
this.deps.clearTimer(pace.tick);
|
|
382
|
+
pace.tick = null;
|
|
383
|
+
}
|
|
384
|
+
if (!this.deps.adapterFor(set.adapterId)?.pollCountdownTicks)
|
|
385
|
+
return;
|
|
386
|
+
const left = set.expiresAt - this.deps.now();
|
|
387
|
+
if (left <= 0)
|
|
388
|
+
return;
|
|
389
|
+
// On the step's boundaries of the time left (…0:15, 0:10…), so a redraw that went out late does not shift the next.
|
|
390
|
+
const step = pollTickMs(left);
|
|
391
|
+
const delay = left % step || step;
|
|
392
|
+
if (delay >= left)
|
|
393
|
+
return; // the close draws the rest
|
|
394
|
+
pace.tick = this.deps.setTimer(() => { pace.tick = null; this.requestRedraw(set); }, delay);
|
|
395
|
+
}
|
|
396
|
+
paceOf(id) {
|
|
397
|
+
let pace = this.pace.get(id);
|
|
398
|
+
if (!pace) {
|
|
399
|
+
pace = { timer: null, tick: null, dirty: false, lastAt: 0, inflight: null };
|
|
400
|
+
this.pace.set(id, pace);
|
|
401
|
+
}
|
|
402
|
+
return pace;
|
|
403
|
+
}
|
|
404
|
+
dropPace(id) {
|
|
405
|
+
const pace = this.pace.get(id);
|
|
406
|
+
if (!pace)
|
|
407
|
+
return;
|
|
408
|
+
if (pace.timer !== null)
|
|
409
|
+
this.deps.clearTimer(pace.timer);
|
|
410
|
+
if (pace.tick !== null)
|
|
411
|
+
this.deps.clearTimer(pace.tick);
|
|
412
|
+
this.pace.delete(id);
|
|
413
|
+
}
|
|
155
414
|
/** One timer, for the next expiry. A wall-clock jump makes it fire early or late; the sweep re-reads the clock. */
|
|
156
415
|
arm() {
|
|
157
416
|
if (this.stopped)
|
|
@@ -170,6 +429,11 @@ export class ReplyButtonsController {
|
|
|
170
429
|
if (this.timer !== null)
|
|
171
430
|
this.deps.clearTimer(this.timer);
|
|
172
431
|
this.timer = null;
|
|
432
|
+
if (this.resultsRetry !== null)
|
|
433
|
+
this.deps.clearTimer(this.resultsRetry);
|
|
434
|
+
this.resultsRetry = null;
|
|
435
|
+
for (const id of [...this.pace.keys()])
|
|
436
|
+
this.dropPace(id);
|
|
173
437
|
}
|
|
174
438
|
}
|
|
175
439
|
//# sourceMappingURL=reply-buttons-controller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reply-buttons-controller.js","sourceRoot":"","sources":["../src/reply-buttons-controller.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAoB,MAAM,8BAA8B,CAAC;AAChF,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAChC,OAAO,EACL,mBAAmB,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,sBAAsB,GAE9G,MAAM,oBAAoB,CAAC;AAuC5B,mFAAmF;AACnF,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAChD,oEAAoE;AACpE,MAAM,YAAY,GAAG,aAAa,CAAC;AAEnC,MAAM,OAAO,sBAAsB;IAKJ;IAJrB,KAAK,GAAY,IAAI,CAAC;IACtB,OAAO,GAAG,KAAK,CAAC;IACxB,+EAA+E;IAC9D,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;IAC9C,YAA6B,IAAsB;QAAtB,SAAI,GAAJ,IAAI,CAAkB;IAAG,CAAC;IAEvD,2FAA2F;IAC3F,OAAO,CAAC,KAAiF,EAAE,OAA+B;QACxH,MAAM,EAAE,GAAG,iBAAiB,EAAE,CAAC;QAC/B,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QACnL,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC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IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC5D,CAAC;CACF"}
|
package/dist/reply-buttons.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type PollBallot, type PollConfig } from "./reply-polls.js";
|
|
1
2
|
export declare const REPLY_BUTTONS_MAX = 10;
|
|
2
3
|
/** Discord's limit per label (the strictest of the three); counted in UTF-16 units, as Discord counts. */
|
|
3
4
|
export declare const REPLY_BUTTON_LABEL_MAX = 80;
|
|
@@ -64,7 +65,27 @@ export interface ReplyButtonSet {
|
|
|
64
65
|
deliveredAt: number | null;
|
|
65
66
|
/** Set when the platform message was updated to its final state (chosen / expired). */
|
|
66
67
|
settledAt: number | null;
|
|
68
|
+
/**
|
|
69
|
+
* #1823: a poll — everyone may vote until `expiresAt` (its deadline; `createdAt` is when it opened). Null: ordinary
|
|
70
|
+
* buttons, the first click answers for everyone.
|
|
71
|
+
*/
|
|
72
|
+
poll: PollConfig | null;
|
|
73
|
+
/** #1823: when the poll stopped taking votes (at or after its deadline). */
|
|
74
|
+
closedAt: number | null;
|
|
75
|
+
/** #1823: when the results were handed to the delivery outbox (idempotent per poll: the agent gets them once). */
|
|
76
|
+
resultsAt: number | null;
|
|
67
77
|
}
|
|
78
|
+
/** #1823: one click on a poll. */
|
|
79
|
+
export type VoteResult = {
|
|
80
|
+
ok: true;
|
|
81
|
+
set: ReplyButtonSet;
|
|
82
|
+
options: number[];
|
|
83
|
+
changed: boolean;
|
|
84
|
+
} | {
|
|
85
|
+
ok: false;
|
|
86
|
+
reason: "missing" | "pending" | "closed";
|
|
87
|
+
set?: ReplyButtonSet;
|
|
88
|
+
};
|
|
68
89
|
export type ConsumeResult = {
|
|
69
90
|
ok: true;
|
|
70
91
|
set: ReplyButtonSet;
|
|
@@ -79,8 +100,13 @@ export declare class ReplyButtonStore {
|
|
|
79
100
|
private db;
|
|
80
101
|
constructor(path: string);
|
|
81
102
|
close(): void;
|
|
82
|
-
/**
|
|
83
|
-
|
|
103
|
+
/**
|
|
104
|
+
* Before the send: the set exists, unbound (a click cannot match it until the platform message is known). A poll
|
|
105
|
+
* opens now: its deadline is `seconds` from here, and its votes are timed from here.
|
|
106
|
+
*/
|
|
107
|
+
create(set: Pick<ReplyButtonSet, "id" | "instance" | "adapterId" | "chatId" | "threadId" | "buttons"> & {
|
|
108
|
+
poll?: PollConfig | null;
|
|
109
|
+
}, now: number): ReplyButtonSet;
|
|
84
110
|
/** After the send: the message the buttons are on. Only an unbound set can be bound. */
|
|
85
111
|
bind(id: string, messageId: string): boolean;
|
|
86
112
|
/** A send that failed: the set never existed for anyone. */
|
|
@@ -104,8 +130,27 @@ export declare class ReplyButtonStore {
|
|
|
104
130
|
* still being delivered is neither (#1500 review): it may yet be released.
|
|
105
131
|
*/
|
|
106
132
|
unsettled(now: number): ReplyButtonSet[];
|
|
107
|
-
/** The next expiry still to come, for the one sweep timer. */
|
|
133
|
+
/** The next expiry or poll deadline still to come, for the one sweep timer. */
|
|
108
134
|
nextExpiry(now: number): number | null;
|
|
135
|
+
/**
|
|
136
|
+
* One voter's click on a poll, already placed on its message and permitted by the caller. In one transaction: the poll
|
|
137
|
+
* must be bound, not closed and before its deadline; the voter's ballot becomes `nextBallot` of it, timed `now` when
|
|
138
|
+
* it changed (an unchanged ballot keeps its time). An emptied ballot withdraws the voter.
|
|
139
|
+
*/
|
|
140
|
+
vote(id: string, voter: string, name: string, index: number, now: number): VoteResult;
|
|
141
|
+
/** A poll's ballots, earliest change first. */
|
|
142
|
+
ballots(id: string): PollBallot[];
|
|
143
|
+
/** Stop taking votes, once: true for the one call that closed it. */
|
|
144
|
+
closePoll(id: string, now: number): boolean;
|
|
145
|
+
/** Bound polls still open whose deadline has come. */
|
|
146
|
+
pollsDue(now: number): ReplyButtonSet[];
|
|
147
|
+
/** Bound polls still taking votes (their countdowns are redrawn after a restart). */
|
|
148
|
+
openPolls(): ReplyButtonSet[];
|
|
149
|
+
/** Closed polls whose results the outbox has not taken yet (a crash, or an outbox that was not open). */
|
|
150
|
+
pollsAwaitingResults(): ReplyButtonSet[];
|
|
151
|
+
markResults(id: string, now: number): void;
|
|
152
|
+
/** Closed polls whose platform message does not show it yet. */
|
|
153
|
+
pollsUnsettled(): ReplyButtonSet[];
|
|
109
154
|
/** Sets on these messages, for the web chat's view of a reply's buttons. */
|
|
110
155
|
forMessages(instance: string, messageIds: readonly string[]): ReplyButtonSet[];
|
|
111
156
|
/** Settled sets older than `before` are history the store no longer needs. */
|