@songsid/agend 2.4.0-beta.13 → 2.4.0-beta.15
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 +28 -6
- package/dist/agent-endpoint.js.map +1 -1
- package/dist/auth-api.js +1 -0
- package/dist/auth-api.js.map +1 -1
- package/dist/backend/claude-code.d.ts +9 -0
- package/dist/backend/claude-code.js +60 -4
- package/dist/backend/claude-code.js.map +1 -1
- package/dist/backend/grok.js +11 -0
- package/dist/backend/grok.js.map +1 -1
- package/dist/backend/types.d.ts +3 -0
- package/dist/backend/types.js.map +1 -1
- package/dist/backend-availability.d.ts +1 -16
- package/dist/backend-availability.js +2 -91
- package/dist/backend-availability.js.map +1 -1
- package/dist/backend-version-static.d.ts +15 -0
- package/dist/backend-version-static.js +95 -0
- package/dist/backend-version-static.js.map +1 -0
- package/dist/build-provenance.json +1 -1
- package/dist/channel/adapters/telegram.js +3 -1
- package/dist/channel/adapters/telegram.js.map +1 -1
- package/dist/channel/mcp-server.js +18 -1
- package/dist/channel/mcp-server.js.map +1 -1
- package/dist/channel/tool-router.d.ts +4 -0
- package/dist/channel/tool-router.js +43 -19
- package/dist/channel/tool-router.js.map +1 -1
- package/dist/classic-channel-manager.d.ts +3 -0
- package/dist/classic-channel-manager.js +18 -0
- package/dist/classic-channel-manager.js.map +1 -1
- package/dist/classic-cli-guard.d.ts +66 -0
- package/dist/classic-cli-guard.js +209 -0
- package/dist/classic-cli-guard.js.map +1 -0
- package/dist/cli-audited.js +7 -5
- package/dist/cli-audited.js.map +1 -1
- package/dist/config-validator.js +3 -0
- package/dist/config-validator.js.map +1 -1
- package/dist/contact-auth-api.d.ts +17 -0
- package/dist/contact-auth-api.js +88 -0
- package/dist/contact-auth-api.js.map +1 -0
- package/dist/contact-auth-files.d.ts +6 -0
- package/dist/contact-auth-files.js +29 -0
- package/dist/contact-auth-files.js.map +1 -0
- package/dist/contact-auth-policy.d.ts +80 -0
- package/dist/contact-auth-policy.js +25 -0
- package/dist/contact-auth-policy.js.map +1 -0
- package/dist/contact-auth-service.d.ts +32 -0
- package/dist/contact-auth-service.js +99 -0
- package/dist/contact-auth-service.js.map +1 -0
- package/dist/contact-auth-store.d.ts +86 -0
- package/dist/contact-auth-store.js +357 -0
- package/dist/contact-auth-store.js.map +1 -0
- package/dist/contact-auth-types.d.ts +196 -0
- package/dist/contact-auth-types.js +7 -0
- package/dist/contact-auth-types.js.map +1 -0
- package/dist/daemon.d.ts +8 -0
- package/dist/daemon.js +93 -4
- package/dist/daemon.js.map +1 -1
- package/dist/delivery-outbox.d.ts +6 -0
- package/dist/delivery-outbox.js +19 -0
- package/dist/delivery-outbox.js.map +1 -1
- package/dist/fleet-manager.d.ts +48 -0
- package/dist/fleet-manager.js +484 -22
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/concepts/SKILL.md +18 -0
- package/dist/general-knowledge/skills/credential-profiles/SKILL.md +5 -0
- package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +38 -0
- package/dist/general-knowledge/skills/hub/SKILL.md +6 -0
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +5 -0
- package/dist/hub/audit/index.d.ts +3 -1
- package/dist/hub/audit/index.js +35 -3
- package/dist/hub/audit/index.js.map +1 -1
- package/dist/hub/catalog.d.ts +8 -0
- package/dist/hub/catalog.js +39 -4
- package/dist/hub/catalog.js.map +1 -1
- package/dist/hub/compose/server.d.ts +2 -0
- package/dist/hub/compose/server.js +11 -1
- package/dist/hub/compose/server.js.map +1 -1
- package/dist/hub/directory/directory.js +5 -2
- package/dist/hub/directory/directory.js.map +1 -1
- package/dist/hub/directory/types.d.ts +5 -1
- package/dist/hub/directory/types.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 +123 -6
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/http/deps.d.ts +2 -0
- package/dist/hub/http/schema.js +6 -1
- package/dist/hub/http/schema.js.map +1 -1
- package/dist/hub/invitations.js +15 -7
- package/dist/hub/invitations.js.map +1 -1
- package/dist/hub/roles/cutover-inventory.d.ts +3 -0
- package/dist/hub/roles/cutover-inventory.js +20 -4
- package/dist/hub/roles/cutover-inventory.js.map +1 -1
- package/dist/hub/roles/cutover-marker.d.ts +18 -2
- package/dist/hub/roles/cutover-marker.js +6 -2
- package/dist/hub/roles/cutover-marker.js.map +1 -1
- package/dist/hub/room-agent-discovery-model.d.ts +29 -0
- package/dist/hub/room-agent-discovery-model.js +33 -0
- package/dist/hub/room-agent-discovery-model.js.map +1 -0
- package/dist/hub/room-agent-discovery.d.ts +14 -0
- package/dist/hub/room-agent-discovery.js +65 -0
- package/dist/hub/room-agent-discovery.js.map +1 -0
- package/dist/hub/room-agent-requests.d.ts +71 -0
- package/dist/hub/room-agent-requests.js +377 -0
- package/dist/hub/room-agent-requests.js.map +1 -0
- package/dist/hub/rooms/directory.d.ts +13 -0
- package/dist/hub/rooms/directory.js +12 -3
- package/dist/hub/rooms/directory.js.map +1 -1
- package/dist/hub/rooms/schema.d.ts +5 -0
- package/dist/hub/rooms/schema.js +9 -0
- package/dist/hub/rooms/schema.js.map +1 -1
- package/dist/hub/rooms/service.d.ts +43 -19
- package/dist/hub/rooms/service.js +67 -11
- package/dist/hub/rooms/service.js.map +1 -1
- package/dist/hub/rooms/types.d.ts +1 -1
- package/dist/instance-lifecycle.d.ts +3 -1
- package/dist/instance-lifecycle.js +4 -1
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/locale.js +34 -4
- package/dist/locale.js.map +1 -1
- package/dist/needs-you-hub.d.ts +1 -0
- package/dist/needs-you-hub.js +9 -0
- package/dist/needs-you-hub.js.map +1 -1
- package/dist/needs-you.d.ts +12 -2
- package/dist/needs-you.js.map +1 -1
- package/dist/outbound-handlers.d.ts +9 -0
- package/dist/outbound-handlers.js +46 -10
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/runtime-cli-install.js +7 -7
- package/dist/runtime-cli-install.js.map +1 -1
- package/dist/topic-commands.d.ts +1 -1
- package/dist/topic-commands.js +4 -6
- package/dist/topic-commands.js.map +1 -1
- package/dist/ui/agent-details-settings.js +7 -5
- package/dist/ui/contact-auth-client.js +50 -0
- package/dist/ui/contact-auth-strings.js +195 -0
- package/dist/ui/contact-authorizations.js +125 -0
- package/dist/ui/contact-needs.js +100 -0
- package/dist/ui/contact-permissions.js +238 -0
- package/dist/ui/contact-ticket-badge.js +54 -0
- package/dist/ui/contact-tool-groups.js +39 -0
- package/dist/ui/hub-client.js +30 -7
- package/dist/ui/hub-invitations.js +5 -1
- package/dist/ui/hub-room-new.js +10 -3
- package/dist/ui/hub-room-owner-requests-strings.js +114 -0
- package/dist/ui/hub-room-owner-requests.js +264 -0
- package/dist/ui/hub-room-pins.js +43 -0
- package/dist/ui/hub-room-settings.js +11 -2
- package/dist/ui/hub-room-strings.js +3 -0
- package/dist/ui/hub-room-thread.js +47 -5
- package/dist/ui/panel-chat.js +2 -0
- package/dist/ui/panel-details.js +2 -0
- package/dist/ui/panel-fleet.js +3 -2
- package/dist/ui/panel-hub.js +7 -1
- package/dist/ui/panel-needs.js +11 -4
- package/dist/ui/panel-settings.js +3 -0
- package/dist/ui/settings-appearance.js +6 -1
- package/dist/ui/settings-registry.js +1 -1
- package/dist/ui/shared/app-i18n.js +4 -0
- package/dist/ui/shared/app-route.js +1 -1
- package/dist/ui/shared/app-shell.js +18 -7
- package/dist/ui/shared/app-stream.js +3 -1
- package/dist/ui/shared/app.css +86 -0
- package/dist/ui/shared/chat-quote.js +26 -2
- package/dist/ui/shared/chat-thread.js +6 -2
- package/dist/ui/shared/hub-rooms-u2.css +22 -0
- package/dist/ui/shared/text-undo.js +17 -3
- package/dist/ui/shared/theme-picker.js +46 -0
- package/dist/ui/shared/theme.js +36 -3
- package/dist/ui/shared/tokens.css +273 -0
- package/dist/ui/shared/ui-confirm.js +5 -2
- package/dist/web-api.d.ts +10 -0
- package/dist/web-api.js +55 -3
- package/dist/web-api.js.map +1 -1
- package/dist/web-chat-history.d.ts +5 -0
- package/dist/web-chat-history.js +26 -0
- package/dist/web-chat-history.js.map +1 -1
- package/dist/web-reply-files.d.ts +1 -0
- package/dist/web-reply-files.js +2 -0
- package/dist/web-reply-files.js.map +1 -1
- package/dist/web-shell-routes.d.ts +1 -1
- package/dist/web-shell-routes.js +2 -1
- package/dist/web-shell-routes.js.map +1 -1
- package/package.json +1 -1
|
@@ -27,6 +27,8 @@ export declare function searchSnippet(text: string, terms: string[], width?: num
|
|
|
27
27
|
};
|
|
28
28
|
/** M-3127: the most distinct emoji one post carries. */
|
|
29
29
|
export declare const ROOM_REACTION_LIMIT = 12;
|
|
30
|
+
/** M-3340: a person's pins per room (the Fleet chat's own limit, chat-pins.js PINS_MAX). */
|
|
31
|
+
export declare const ROOM_PINS_MAX = 50;
|
|
30
32
|
/** One emoji as a person picks it: one grapheme, a pictograph (ZWJ sequences, FE0F and skin tones kept), no controls. */
|
|
31
33
|
export declare function validRoomEmoji(s: unknown): s is string;
|
|
32
34
|
export declare class HubRoomRefusal extends Error {
|
|
@@ -138,18 +140,16 @@ export declare class HubGroupRooms {
|
|
|
138
140
|
};
|
|
139
141
|
invitations: number;
|
|
140
142
|
}>;
|
|
141
|
-
candidates(ctx: HubRequestContext, q: string, kind: string): Promise<{
|
|
143
|
+
candidates(ctx: HubRequestContext, q: string, kind: string, discovery?: boolean): Promise<{
|
|
142
144
|
kind: "person";
|
|
143
145
|
id: string;
|
|
144
146
|
name: string;
|
|
147
|
+
detail?: string | undefined;
|
|
145
148
|
}[] | {
|
|
146
149
|
kind: "group";
|
|
147
150
|
id: string;
|
|
148
151
|
name: string;
|
|
149
152
|
}[] | {
|
|
150
|
-
intro: string;
|
|
151
|
-
introBy?: "owner" | "agent" | "default";
|
|
152
|
-
introAt?: number;
|
|
153
153
|
kind: "agent";
|
|
154
154
|
id: string;
|
|
155
155
|
name: string;
|
|
@@ -157,6 +157,9 @@ export declare class HubGroupRooms {
|
|
|
157
157
|
owner: {
|
|
158
158
|
name: string;
|
|
159
159
|
};
|
|
160
|
+
intro: string;
|
|
161
|
+
introBy?: "owner" | "agent" | "default";
|
|
162
|
+
introAt?: number;
|
|
160
163
|
}[] | {
|
|
161
164
|
id: string;
|
|
162
165
|
name: string;
|
|
@@ -254,9 +257,6 @@ export declare class HubGroupRooms {
|
|
|
254
257
|
presence: "idle" | "paused" | "working";
|
|
255
258
|
signedIn?: undefined;
|
|
256
259
|
} | {
|
|
257
|
-
intro: string;
|
|
258
|
-
introBy?: "owner" | "agent" | "default";
|
|
259
|
-
introAt?: number;
|
|
260
260
|
presence: "idle" | "later" | "offline" | "paused" | "working";
|
|
261
261
|
presenceReason?: undefined;
|
|
262
262
|
id: string;
|
|
@@ -270,10 +270,10 @@ export declare class HubGroupRooms {
|
|
|
270
270
|
};
|
|
271
271
|
canAsk: boolean;
|
|
272
272
|
signedIn?: undefined;
|
|
273
|
-
} | {
|
|
274
273
|
intro: string;
|
|
275
274
|
introBy?: "owner" | "agent" | "default";
|
|
276
275
|
introAt?: number;
|
|
276
|
+
} | {
|
|
277
277
|
presence: "offline";
|
|
278
278
|
presenceReason: "update";
|
|
279
279
|
id: string;
|
|
@@ -287,10 +287,10 @@ export declare class HubGroupRooms {
|
|
|
287
287
|
};
|
|
288
288
|
canAsk: boolean;
|
|
289
289
|
signedIn?: undefined;
|
|
290
|
-
} | {
|
|
291
290
|
intro: string;
|
|
292
291
|
introBy?: "owner" | "agent" | "default";
|
|
293
292
|
introAt?: number;
|
|
293
|
+
} | {
|
|
294
294
|
presence: "idle" | "paused" | "working";
|
|
295
295
|
presenceReason?: import("../types.js").HubAgentStateReason | undefined;
|
|
296
296
|
presenceNote?: string | undefined;
|
|
@@ -305,6 +305,9 @@ export declare class HubGroupRooms {
|
|
|
305
305
|
};
|
|
306
306
|
canAsk: boolean;
|
|
307
307
|
signedIn?: undefined;
|
|
308
|
+
intro: string;
|
|
309
|
+
introBy?: "owner" | "agent" | "default";
|
|
310
|
+
introAt?: number;
|
|
308
311
|
} | {
|
|
309
312
|
id: string;
|
|
310
313
|
kind: "person";
|
|
@@ -369,9 +372,6 @@ export declare class HubGroupRooms {
|
|
|
369
372
|
presence: "idle" | "paused" | "working";
|
|
370
373
|
signedIn?: undefined;
|
|
371
374
|
} | {
|
|
372
|
-
intro: string;
|
|
373
|
-
introBy?: "owner" | "agent" | "default";
|
|
374
|
-
introAt?: number;
|
|
375
375
|
presence: "idle" | "later" | "offline" | "paused" | "working";
|
|
376
376
|
presenceReason?: undefined;
|
|
377
377
|
id: string;
|
|
@@ -385,10 +385,10 @@ export declare class HubGroupRooms {
|
|
|
385
385
|
};
|
|
386
386
|
canAsk: boolean;
|
|
387
387
|
signedIn?: undefined;
|
|
388
|
-
} | {
|
|
389
388
|
intro: string;
|
|
390
389
|
introBy?: "owner" | "agent" | "default";
|
|
391
390
|
introAt?: number;
|
|
391
|
+
} | {
|
|
392
392
|
presence: "offline";
|
|
393
393
|
presenceReason: "update";
|
|
394
394
|
id: string;
|
|
@@ -402,10 +402,10 @@ export declare class HubGroupRooms {
|
|
|
402
402
|
};
|
|
403
403
|
canAsk: boolean;
|
|
404
404
|
signedIn?: undefined;
|
|
405
|
-
} | {
|
|
406
405
|
intro: string;
|
|
407
406
|
introBy?: "owner" | "agent" | "default";
|
|
408
407
|
introAt?: number;
|
|
408
|
+
} | {
|
|
409
409
|
presence: "idle" | "paused" | "working";
|
|
410
410
|
presenceReason?: import("../types.js").HubAgentStateReason | undefined;
|
|
411
411
|
presenceNote?: string | undefined;
|
|
@@ -420,6 +420,9 @@ export declare class HubGroupRooms {
|
|
|
420
420
|
};
|
|
421
421
|
canAsk: boolean;
|
|
422
422
|
signedIn?: undefined;
|
|
423
|
+
intro: string;
|
|
424
|
+
introBy?: "owner" | "agent" | "default";
|
|
425
|
+
introAt?: number;
|
|
423
426
|
} | {
|
|
424
427
|
id: string;
|
|
425
428
|
kind: "person";
|
|
@@ -484,9 +487,6 @@ export declare class HubGroupRooms {
|
|
|
484
487
|
presence: "idle" | "paused" | "working";
|
|
485
488
|
signedIn?: undefined;
|
|
486
489
|
} | {
|
|
487
|
-
intro: string;
|
|
488
|
-
introBy?: "owner" | "agent" | "default";
|
|
489
|
-
introAt?: number;
|
|
490
490
|
presence: "idle" | "later" | "offline" | "paused" | "working";
|
|
491
491
|
presenceReason?: undefined;
|
|
492
492
|
id: string;
|
|
@@ -500,10 +500,10 @@ export declare class HubGroupRooms {
|
|
|
500
500
|
};
|
|
501
501
|
canAsk: boolean;
|
|
502
502
|
signedIn?: undefined;
|
|
503
|
-
} | {
|
|
504
503
|
intro: string;
|
|
505
504
|
introBy?: "owner" | "agent" | "default";
|
|
506
505
|
introAt?: number;
|
|
506
|
+
} | {
|
|
507
507
|
presence: "offline";
|
|
508
508
|
presenceReason: "update";
|
|
509
509
|
id: string;
|
|
@@ -517,10 +517,10 @@ export declare class HubGroupRooms {
|
|
|
517
517
|
};
|
|
518
518
|
canAsk: boolean;
|
|
519
519
|
signedIn?: undefined;
|
|
520
|
-
} | {
|
|
521
520
|
intro: string;
|
|
522
521
|
introBy?: "owner" | "agent" | "default";
|
|
523
522
|
introAt?: number;
|
|
523
|
+
} | {
|
|
524
524
|
presence: "idle" | "paused" | "working";
|
|
525
525
|
presenceReason?: import("../types.js").HubAgentStateReason | undefined;
|
|
526
526
|
presenceNote?: string | undefined;
|
|
@@ -535,6 +535,9 @@ export declare class HubGroupRooms {
|
|
|
535
535
|
};
|
|
536
536
|
canAsk: boolean;
|
|
537
537
|
signedIn?: undefined;
|
|
538
|
+
intro: string;
|
|
539
|
+
introBy?: "owner" | "agent" | "default";
|
|
540
|
+
introAt?: number;
|
|
538
541
|
} | {
|
|
539
542
|
id: string;
|
|
540
543
|
kind: "person";
|
|
@@ -572,6 +575,27 @@ export declare class HubGroupRooms {
|
|
|
572
575
|
react(ctx: HubRequestContext, id: string, postId: unknown, input: unknown): Promise<{
|
|
573
576
|
reactions: NonNullable<RoomMessage["reactions"]>;
|
|
574
577
|
}>;
|
|
578
|
+
/**
|
|
579
|
+
* M-3340: the signed-in person's own pins in a group room — newest first, each with the message as messages() shows it to
|
|
580
|
+
* them now. A pin whose message they can no longer see (it is older than their joining, or its question is not theirs)
|
|
581
|
+
* is left out. Nobody else's pins are ever read, and nobody else learns of these.
|
|
582
|
+
*/
|
|
583
|
+
pins(ctx: HubRequestContext, id: string): Promise<{
|
|
584
|
+
pins: Array<{
|
|
585
|
+
messageId: string;
|
|
586
|
+
pinnedAt: number;
|
|
587
|
+
message: RoomMessage;
|
|
588
|
+
}>;
|
|
589
|
+
}>;
|
|
590
|
+
/** M-3340: pin (on) or unpin a message the person can see; answers with their pins. Past ROOM_PINS_MAX: 409 pins-full. */
|
|
591
|
+
pin(ctx: HubRequestContext, id: string, postId: unknown, on: boolean): Promise<{
|
|
592
|
+
pins: {
|
|
593
|
+
messageId: string;
|
|
594
|
+
pinnedAt: number;
|
|
595
|
+
message: RoomMessage;
|
|
596
|
+
}[];
|
|
597
|
+
}>;
|
|
598
|
+
private pinList;
|
|
575
599
|
/**
|
|
576
600
|
* M-3127: a post exactly as messages() shows it to `member` — since their joined_sequence, its lineage's audience floor
|
|
577
601
|
* too (Ridge, M-3118: the descendants of a question older than them stay hidden), and an answer only when its question
|
|
@@ -21,7 +21,7 @@ import { RoomButtons } from "./buttons.js";
|
|
|
21
21
|
import { HUB_ROOM_REACT_CAPABILITY, roomReactSchema } from "../protocol.js";
|
|
22
22
|
import { replyButtonClickText } from "../../reply-buttons.js";
|
|
23
23
|
import { pollResultsText } from "../../reply-polls.js";
|
|
24
|
-
import { RoomDirectoryCandidates, rememberRoomPeople } from "./directory.js";
|
|
24
|
+
import { RoomDirectoryCandidates, rememberRoomPeople, roomPersonLabels } from "./directory.js";
|
|
25
25
|
import { isInlineImage } from "../attachments/limits.js";
|
|
26
26
|
import { HUB_ROOM_MENTION_FEEDBACK_CAPABILITY } from "../room-mention-feedback-model.js";
|
|
27
27
|
import { personalMentionRefusals, recordPersonalMentionRefusals } from "../personal/refusals.js";
|
|
@@ -71,6 +71,8 @@ export function searchSnippet(text, terms, width = 120) {
|
|
|
71
71
|
const reactSchema = z.strictObject({ emoji: z.string().min(1).max(16), on: z.boolean() });
|
|
72
72
|
/** M-3127: the most distinct emoji one post carries. */
|
|
73
73
|
export const ROOM_REACTION_LIMIT = 12;
|
|
74
|
+
/** M-3340: a person's pins per room (the Fleet chat's own limit, chat-pins.js PINS_MAX). */
|
|
75
|
+
export const ROOM_PINS_MAX = 50;
|
|
74
76
|
/** One emoji as a person picks it: one grapheme, a pictograph (ZWJ sequences, FE0F and skin tones kept), no controls. */
|
|
75
77
|
export function validRoomEmoji(s) {
|
|
76
78
|
if (typeof s !== "string" || s.length < 1 || s.length > 16 || /[\u0000-\u001f\u007f\s]/u.test(s))
|
|
@@ -602,7 +604,7 @@ export class HubGroupRooms {
|
|
|
602
604
|
me: { canCreateRooms: canCreateRoom(this.core, db, me), assistant: this.assistant.availability()?.enabled === true }, invitations: 0 };
|
|
603
605
|
}, this.fence(ctx));
|
|
604
606
|
}
|
|
605
|
-
async candidates(ctx, q, kind) {
|
|
607
|
+
async candidates(ctx, q, kind, discovery = false) {
|
|
606
608
|
if (q.length > 64 || /[\u0000-\u001f\u007f]/.test(q) || !["person", "team", "group", "agent"].includes(kind))
|
|
607
609
|
throw new HubProtocolError("invalid");
|
|
608
610
|
const me = await this.who(ctx);
|
|
@@ -611,12 +613,19 @@ export class HubGroupRooms {
|
|
|
611
613
|
if (kind === "agent") {
|
|
612
614
|
this.core.atomic(db => { if (!allowed(db))
|
|
613
615
|
throw new HubRoomRefusal(403, "denied"); }, this.fence(ctx));
|
|
614
|
-
const
|
|
615
|
-
|
|
616
|
-
...view.
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
616
|
+
const catalog = new HubCatalogService(this.core);
|
|
617
|
+
return (discovery ? catalog.withRoomVisible.bind(catalog) : catalog.withVisible.bind(catalog))(ctx, view => {
|
|
618
|
+
const hits = [...view.mine.map(e => ({ kind: "agent", id: e.id, name: e.displayName, mine: true, owner: { name: this.core.atomic(db => this.name(db, me)) } })),
|
|
619
|
+
...view.askable.map(({ exposure: e, ownerName }) => ({ kind: "agent", id: e.id, name: e.displayName, mine: false, owner: { name: ownerName } })),
|
|
620
|
+
...(view.findable ?? []).map(({ exposure: e, ownerName }) => ({ kind: "agent", id: e.id, name: e.displayName, mine: false, discoverable: true, owner: { name: ownerName } }))]
|
|
621
|
+
.filter(e => e.name.toLowerCase().startsWith(q.trim().toLowerCase())).slice(0, 20);
|
|
622
|
+
this.fence(ctx).assertCurrent();
|
|
623
|
+
return this.core.atomic(db => {
|
|
624
|
+
if (!allowed(db))
|
|
625
|
+
throw new HubRoomRefusal(403, "denied");
|
|
626
|
+
return hits.map(row => ({ ...row, ...agentIntro(db, row.id) }));
|
|
627
|
+
}, this.fence(ctx));
|
|
628
|
+
});
|
|
620
629
|
}
|
|
621
630
|
if (q.trim().length >= 2 && (kind === "group" && this.core.deps.directory.searchPolicyGroups || kind === "person" && this.core.deps.directory.searchGrantPeople)) {
|
|
622
631
|
return this.directory.search(ctx, me, q.trim(), kind, () => this.core.atomic(db => {
|
|
@@ -632,17 +641,17 @@ export class HubGroupRooms {
|
|
|
632
641
|
if (kind !== "person")
|
|
633
642
|
return [];
|
|
634
643
|
const prefix = `${q.trim().replace(/[\\%_]/g, c => `\\${c}`)}%`;
|
|
635
|
-
return db.prepare("SELECT person,display_name FROM hub_people WHERE status='active' AND (display_name LIKE ? ESCAPE '\\' OR login_label LIKE ? ESCAPE '\\') ORDER BY display_name,person LIMIT 20")
|
|
644
|
+
return db.prepare("SELECT person,display_name,login_label FROM hub_people WHERE status='active' AND (display_name LIKE ? ESCAPE '\\' OR login_label LIKE ? ESCAPE '\\') ORDER BY display_name,person LIMIT 20")
|
|
636
645
|
.all(prefix, prefix);
|
|
637
646
|
}, this.fence(ctx));
|
|
638
647
|
const hits = [];
|
|
639
648
|
for (const row of rows)
|
|
640
649
|
if (await this.core.eligible(personFromString(row.person)))
|
|
641
|
-
hits.push({
|
|
650
|
+
hits.push({ id: row.person, name: row.display_name, account: row.login_label });
|
|
642
651
|
return this.core.atomic(db => {
|
|
643
652
|
if (!allowed(db))
|
|
644
653
|
throw new HubRoomRefusal(403, "denied");
|
|
645
|
-
return kind === "team" ? (this.core.deps.roomTeamCandidates?.(db, q.trim()) ?? []).slice(0, 20).map(row => ({ kind: "team", ...row })) : hits;
|
|
654
|
+
return kind === "team" ? (this.core.deps.roomTeamCandidates?.(db, q.trim()) ?? []).slice(0, 20).map(row => ({ kind: "team", ...row })) : roomPersonLabels(hits);
|
|
646
655
|
}, this.fence(ctx));
|
|
647
656
|
}
|
|
648
657
|
candidateAllowed(ctx, me) {
|
|
@@ -1046,6 +1055,53 @@ export class HubGroupRooms {
|
|
|
1046
1055
|
this.emit({ type: "message.updated", roomId: id, data: { roomId: id, message: this.projection(done.post) }, sequence: done.post.sequence });
|
|
1047
1056
|
return { reactions: done.reactions };
|
|
1048
1057
|
}
|
|
1058
|
+
/**
|
|
1059
|
+
* M-3340: the signed-in person's own pins in a group room — newest first, each with the message as messages() shows it to
|
|
1060
|
+
* them now. A pin whose message they can no longer see (it is older than their joining, or its question is not theirs)
|
|
1061
|
+
* is left out. Nobody else's pins are ever read, and nobody else learns of these.
|
|
1062
|
+
*/
|
|
1063
|
+
async pins(ctx, id) {
|
|
1064
|
+
const me = await this.who(ctx);
|
|
1065
|
+
return this.core.atomic(db => ({ pins: this.pinList(db, id, this.member(db, id, me), me) }), this.fence(ctx));
|
|
1066
|
+
}
|
|
1067
|
+
/** M-3340: pin (on) or unpin a message the person can see; answers with their pins. Past ROOM_PINS_MAX: 409 pins-full. */
|
|
1068
|
+
async pin(ctx, id, postId, on) {
|
|
1069
|
+
const target = validated(uuid, postId), me = await this.who(ctx);
|
|
1070
|
+
const out = this.core.atomic(db => {
|
|
1071
|
+
const member = this.member(db, id, me);
|
|
1072
|
+
if (on) {
|
|
1073
|
+
const post = this.visiblePost(db, id, member, target);
|
|
1074
|
+
if (post.author_kind === "system")
|
|
1075
|
+
throw new HubRoomRefusal(409, "invalid");
|
|
1076
|
+
const has = db.prepare("SELECT 1 FROM hub_room_pins WHERE room_id=? AND person=? AND post_id=?").get(id, me, post.id);
|
|
1077
|
+
if (!has && db.prepare("SELECT COUNT(*) n FROM hub_room_pins WHERE room_id=? AND person=?").get(id, me).n >= ROOM_PINS_MAX)
|
|
1078
|
+
throw new HubRoomRefusal(409, "pins-full");
|
|
1079
|
+
if (!has)
|
|
1080
|
+
db.prepare("INSERT INTO hub_room_pins(room_id,person,post_id,pinned_at) VALUES(?,?,?,?)").run(id, me, post.id, this.core.now());
|
|
1081
|
+
}
|
|
1082
|
+
else
|
|
1083
|
+
db.prepare("DELETE FROM hub_room_pins WHERE room_id=? AND person=? AND post_id=?").run(id, me, target);
|
|
1084
|
+
return { pins: this.pinList(db, id, member, me) };
|
|
1085
|
+
}, this.fence(ctx));
|
|
1086
|
+
// The person's other tabs and devices read their pins again; the event says only which room.
|
|
1087
|
+
this.emit({ type: "pins.changed", roomId: id, data: { roomId: id }, audiencePerson: me });
|
|
1088
|
+
return out;
|
|
1089
|
+
}
|
|
1090
|
+
pinList(db, id, member, me) {
|
|
1091
|
+
const rows = db.prepare("SELECT post_id,pinned_at FROM hub_room_pins WHERE room_id=? AND person=? ORDER BY pinned_at DESC,rowid DESC").all(id, me);
|
|
1092
|
+
const out = [];
|
|
1093
|
+
for (const row of rows) {
|
|
1094
|
+
let post;
|
|
1095
|
+
try {
|
|
1096
|
+
post = this.visiblePost(db, id, member, row.post_id);
|
|
1097
|
+
}
|
|
1098
|
+
catch {
|
|
1099
|
+
continue;
|
|
1100
|
+
}
|
|
1101
|
+
out.push({ messageId: row.post_id, pinnedAt: row.pinned_at, message: this.projection(post) });
|
|
1102
|
+
}
|
|
1103
|
+
return out;
|
|
1104
|
+
}
|
|
1049
1105
|
/**
|
|
1050
1106
|
* M-3127: a post exactly as messages() shows it to `member` — since their joined_sequence, its lineage's audience floor
|
|
1051
1107
|
* too (Ridge, M-3118: the descendants of a question older than them stay hidden), and an answer only when its question
|