@songsid/agend 2.4.0-beta.32 → 2.4.0-beta.35
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/build-provenance.json +1 -1
- package/dist/delivery-outbox.d.ts +12 -0
- package/dist/delivery-outbox.js +26 -2
- package/dist/delivery-outbox.js.map +1 -1
- package/dist/fleet-context.d.ts +11 -0
- package/dist/fleet-manager.d.ts +54 -2
- package/dist/fleet-manager.js +324 -49
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/concepts/SKILL.md +60 -0
- package/dist/general-knowledge/skills/hub/SKILL.md +10 -4
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +15 -40
- package/dist/hub/client.js +16 -6
- package/dist/hub/client.js.map +1 -1
- package/dist/hub/compose/member.js +3 -2
- package/dist/hub/compose/member.js.map +1 -1
- package/dist/hub/compose/server.js +2 -1
- package/dist/hub/compose/server.js.map +1 -1
- package/dist/hub/group-policy/resources.d.ts +1 -1
- package/dist/hub/http/compose.d.ts +2 -0
- package/dist/hub/http/compose.js +45 -6
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/member-reconciliation.d.ts +2 -0
- package/dist/hub/member-reconciliation.js +3 -1
- package/dist/hub/member-reconciliation.js.map +1 -1
- package/dist/hub/protocol.d.ts +8 -8
- package/dist/hub/protocol.js +7 -2
- package/dist/hub/protocol.js.map +1 -1
- package/dist/hub/receipt-reason.d.ts +6 -0
- package/dist/hub/receipt-reason.js +12 -0
- package/dist/hub/receipt-reason.js.map +1 -0
- package/dist/hub/representative.d.ts +2 -0
- package/dist/hub/representative.js +7 -3
- package/dist/hub/representative.js.map +1 -1
- package/dist/hub/rooms/direct-view.js +2 -0
- package/dist/hub/rooms/direct-view.js.map +1 -1
- package/dist/hub/rooms/types.d.ts +2 -0
- package/dist/hub/rooms.d.ts +12 -0
- package/dist/hub/rooms.js +14 -3
- package/dist/hub/rooms.js.map +1 -1
- package/dist/hub/server.js +4 -1
- package/dist/hub/server.js.map +1 -1
- package/dist/hub/settings-member-address-decision.js +1 -1
- package/dist/hub/settings-member-address-decision.js.map +1 -1
- package/dist/hub/settings-web-address-decision.js +2 -2
- package/dist/hub/settings-web-address-decision.js.map +1 -1
- package/dist/instance-lifecycle.d.ts +2 -0
- package/dist/instance-lifecycle.js +4 -0
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/locale.js +36 -6
- package/dist/locale.js.map +1 -1
- package/dist/request-context-control-api.d.ts +18 -0
- package/dist/request-context-control-api.js +9 -1
- package/dist/request-context-control-api.js.map +1 -1
- package/dist/settings-effect.js +5 -2
- package/dist/settings-effect.js.map +1 -1
- package/dist/tips.js +1 -1
- package/dist/tips.js.map +1 -1
- package/dist/topic-commands.js +10 -1
- package/dist/topic-commands.js.map +1 -1
- package/dist/turn-reply-guard.js +4 -1
- package/dist/turn-reply-guard.js.map +1 -1
- package/dist/ui/hub-assistant-admin.js +10 -3
- package/dist/ui/hub-assistant-usage-strings.js +8 -0
- package/dist/ui/hub-owner-strings.js +2 -2
- package/dist/ui/hub-room-composer.js +9 -2
- package/dist/ui/hub-room-strings.js +2 -2
- package/dist/ui/hub-room-thread.js +37 -9
- package/dist/ui/panel-chat.js +3 -3
- package/dist/ui/panel-hub.js +1 -1
- package/dist/ui/request-context-control.js +72 -12
- package/dist/ui/shared/app-update.js +35 -5
- package/dist/ui/shared/app.css +21 -0
- package/dist/ui/shared/chat-msg-actions.js +1 -1
- package/dist/ui/shared/chat-strings.js +2 -2
- package/dist/ui/shared/chat-thread.js +1 -1
- package/dist/ui/shared/hub-owner.css +12 -0
- package/dist/ui/shared/update-card-ui.js +21 -7
- package/dist/update-card.d.ts +17 -2
- package/dist/update-card.js +58 -9
- package/dist/update-card.js.map +1 -1
- package/package.json +1 -1
package/dist/hub/http/compose.js
CHANGED
|
@@ -93,7 +93,7 @@ export const HUB_UI_MODULES = Object.freeze(["panel-hub.js", "hub-notify-keep.js
|
|
|
93
93
|
// 管理 → 房間.
|
|
94
94
|
"hub-room-new.js", "hub-room-purpose.js", "hub-room-new-strings.js", "hub-room-settings.js", "hub-room-owner-requests.js", "hub-room-owner-requests-strings.js", "hub-room-settings-strings.js", "hub-room-members.js", "hub-room-members-strings.js", "hub-invitations.js", "hub-invitations-strings.js", "hub-admin-rooms.js", "hub-admin-rooms-strings.js",
|
|
95
95
|
// M-3092 (Hub rooms, track U): the conversation list, a room on the shared thread, its composer.
|
|
96
|
-
"hub-room-list.js", "hub-room-thread.js", "hub-room-agent-strings.js", "hub-room-composer.js", "hub-assistant-admin.js", "hub-assistant-admin-strings.js",
|
|
96
|
+
"hub-room-list.js", "hub-room-thread.js", "hub-room-agent-strings.js", "hub-room-composer.js", "hub-assistant-admin.js", "hub-assistant-admin-strings.js", "hub-assistant-usage-strings.js",
|
|
97
97
|
// M-3092 S-145: the list's favourites (the Fleet sidebar's #1664 rules; synced per person by the Hub).
|
|
98
98
|
"hub-room-favorites.js",
|
|
99
99
|
// M-3340: personal pins in a room (its list and 📌; the store keeps them in hub-room-thread.js).
|
|
@@ -197,6 +197,8 @@ const uuid = (v) => { if (typeof v !== "string" || !UUID.test(v))
|
|
|
197
197
|
const int = (v) => { const n = typeof v === "string" && /^\d{1,15}$/.test(v) ? Number(v) : v; if (!Number.isSafeInteger(n) || n < 0)
|
|
198
198
|
throw new HubProtocolError("invalid"); return n; };
|
|
199
199
|
/** Build S3's HTTP handler and member receiver over S5's deps. `sql` is S5's `hubTxDatabase`. */
|
|
200
|
+
/** M-3955: open event streams per sign-in session (see streamSlot). */
|
|
201
|
+
export const STREAMS_PER_SESSION = 4;
|
|
200
202
|
export function createHubHttp(deps, sql) {
|
|
201
203
|
let closed = false;
|
|
202
204
|
const teamFactory = deps.teams;
|
|
@@ -292,6 +294,28 @@ export function createHubHttp(deps, sql) {
|
|
|
292
294
|
const uploading = new Map();
|
|
293
295
|
let uploadingTotal = 0;
|
|
294
296
|
const streams = new Set();
|
|
297
|
+
// M-3955 (Fable): at most STREAMS_PER_SESSION open event streams (rooms and notices alike) per sign-in session. A page
|
|
298
|
+
// opens one per tab. A stream's message projection is not charged to the session's polling allowance, so this bounds
|
|
299
|
+
// how far one session's events fan out, and keeps one person from taking the Hub-wide 64. Past it a new stream is
|
|
300
|
+
// refused (backpressure; the page retries), never by closing an older one (two tabs would take turns closing each other).
|
|
301
|
+
const sessionStreams = new Map();
|
|
302
|
+
const streamSlot = (sessionId) => {
|
|
303
|
+
const open = sessionStreams.get(sessionId) ?? 0;
|
|
304
|
+
if (open >= STREAMS_PER_SESSION)
|
|
305
|
+
throw new HubProtocolError("backpressure");
|
|
306
|
+
sessionStreams.set(sessionId, open + 1);
|
|
307
|
+
let released = false;
|
|
308
|
+
return () => {
|
|
309
|
+
if (released)
|
|
310
|
+
return;
|
|
311
|
+
released = true;
|
|
312
|
+
const left = (sessionStreams.get(sessionId) ?? 1) - 1;
|
|
313
|
+
if (left > 0)
|
|
314
|
+
sessionStreams.set(sessionId, left);
|
|
315
|
+
else
|
|
316
|
+
sessionStreams.delete(sessionId);
|
|
317
|
+
};
|
|
318
|
+
};
|
|
295
319
|
/** One API request: method and path enumerated, mutations same-origin with the session's CSRF token. */
|
|
296
320
|
async function api(req, res, path, query) {
|
|
297
321
|
const method = req.method ?? "GET";
|
|
@@ -663,16 +687,17 @@ export function createHubHttp(deps, sql) {
|
|
|
663
687
|
if (path === "/hub/v1/notices/events") {
|
|
664
688
|
if (method !== "GET")
|
|
665
689
|
throw new HttpError(405, "method");
|
|
666
|
-
signedIn();
|
|
690
|
+
const noticeSession = signedIn();
|
|
667
691
|
if (streams.size >= 64)
|
|
668
692
|
throw new HubProtocolError("backpressure");
|
|
669
693
|
const initial = await guard(() => notices.forSession(ctx, query.get("v") === "3" ? 3 : query.get("v") === "2" ? 2 : 1));
|
|
670
694
|
if (streams.size >= 64 || !live() || ctx.isCurrent?.() !== true)
|
|
671
695
|
throw new HubProtocolError("backpressure");
|
|
696
|
+
const releaseSlot = streamSlot(noticeSession.sessionId);
|
|
672
697
|
res.writeHead(200, { ...API_HEADERS, "Content-Type": "text/event-stream; charset=utf-8", Connection: "keep-alive", "X-Accel-Buffering": "no" });
|
|
673
698
|
let ended = false, running = false, dirty = false;
|
|
674
699
|
const close = () => { if (ended)
|
|
675
|
-
return; ended = true; off(); clearInterval(heartbeat); streams.delete(close); res.end(); };
|
|
700
|
+
return; ended = true; off(); clearInterval(heartbeat); streams.delete(close); releaseSlot(); res.end(); };
|
|
676
701
|
const push = async () => {
|
|
677
702
|
if (ended)
|
|
678
703
|
return;
|
|
@@ -1140,11 +1165,17 @@ export function createHubHttp(deps, sql) {
|
|
|
1140
1165
|
const initialNotices = notices && noticeVersion ? await guard(() => notices.forSession(ctx, noticeVersion)) : null;
|
|
1141
1166
|
if (streams.size >= 64 || !ctx.isCurrent?.())
|
|
1142
1167
|
throw new HubProtocolError("backpressure");
|
|
1168
|
+
const releaseSlot = streamSlot(streamSession.sessionId);
|
|
1143
1169
|
res.writeHead(200, { ...API_HEADERS, "Content-Type": "text/event-stream; charset=utf-8", Connection: "keep-alive", "X-Accel-Buffering": "no" });
|
|
1144
1170
|
let ended = false, queued = 0, tail = Promise.resolve(), noticesRunning = false, noticesDirty = false;
|
|
1145
1171
|
let offNotices = () => { };
|
|
1146
1172
|
const close = () => { if (ended)
|
|
1147
|
-
return; ended = true; off(); offNotices(); clearInterval(heartbeat); streams.delete(close); res.end(); };
|
|
1173
|
+
return; ended = true; off(); offNotices(); clearInterval(heartbeat); streams.delete(close); releaseSlot(); res.end(); };
|
|
1174
|
+
// M-3951 S-1: a viewer-addressed event carries only which room/message; its projection reads the current state when
|
|
1175
|
+
// it runs. One such event still waiting in this stream's queue therefore already covers a later identical one: the
|
|
1176
|
+
// later one is dropped, never projected twice (each projection re-checks the viewer's authority). It is forgotten
|
|
1177
|
+
// as its projection starts, so a change made during a projection is always read again.
|
|
1178
|
+
const waiting = new Set();
|
|
1148
1179
|
const off = groupRooms.subscribe(event => {
|
|
1149
1180
|
if (ended)
|
|
1150
1181
|
return;
|
|
@@ -1152,11 +1183,18 @@ export function createHubHttp(deps, sql) {
|
|
|
1152
1183
|
return;
|
|
1153
1184
|
if (!event.audiencePerson && !groupRooms.interested(streamPerson, event))
|
|
1154
1185
|
return;
|
|
1186
|
+
const key = event.audiencePerson ? `${event.type}\0${event.roomId}\0${typeof event.data.messageId === "string" ? event.data.messageId : ""}` : null;
|
|
1187
|
+
if (key !== null && waiting.has(key))
|
|
1188
|
+
return;
|
|
1155
1189
|
if (++queued > 64) {
|
|
1156
1190
|
close();
|
|
1157
1191
|
return;
|
|
1158
1192
|
}
|
|
1193
|
+
if (key !== null)
|
|
1194
|
+
waiting.add(key);
|
|
1159
1195
|
tail = tail.then(async () => {
|
|
1196
|
+
if (key !== null)
|
|
1197
|
+
waiting.delete(key);
|
|
1160
1198
|
if (ended)
|
|
1161
1199
|
return;
|
|
1162
1200
|
const finishTiming = core.sendTiming?.start("sse.project");
|
|
@@ -1188,7 +1226,8 @@ export function createHubHttp(deps, sql) {
|
|
|
1188
1226
|
// unused room proof before it; nothing is retained across this event or its viewer's session.
|
|
1189
1227
|
if (typeof event.data.messageId !== "string")
|
|
1190
1228
|
throw new HubProtocolError("invalid");
|
|
1191
|
-
|
|
1229
|
+
// M-3955: outside the session's polling allowance (a live stream's projection, not a poll).
|
|
1230
|
+
const page = await rooms.readStreamMessage(ctx, event.roomId, event.data.messageId);
|
|
1192
1231
|
const message = directMessages(page.room, page.entries, streamSession.displayName).find(m => m.id === event.data.messageId);
|
|
1193
1232
|
data = message ? { roomId: event.roomId, message } : null;
|
|
1194
1233
|
}
|
|
@@ -1451,7 +1490,7 @@ export function createHubHttp(deps, sql) {
|
|
|
1451
1490
|
const room = await guard(() => rooms.view(ctx, roomId));
|
|
1452
1491
|
groupRooms.publish({ type: "message.added", roomId, data: { roomId, messageId: receipt.messageId }, audiencePerson: personKeyString(room.asker) });
|
|
1453
1492
|
return send(res, 200, { id: receipt.messageId, roomId, at: receipt.at, author: { kind: "person", id: personKeyString(room.asker), name: signedIn().displayName },
|
|
1454
|
-
text: typeof b.text === "string" ? b.text : "", mentions: [], idempotencyKey: b.idempotencyKey, receipt });
|
|
1493
|
+
text: typeof b.text === "string" ? b.text : "", mentions: [], idempotencyKey: b.idempotencyKey, receiptStage: receipt.stage, receipt });
|
|
1455
1494
|
}
|
|
1456
1495
|
finally {
|
|
1457
1496
|
finishTiming?.();
|