@songsid/agend 2.4.0-beta.2 → 2.4.0-beta.4
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-cli.js +1 -1
- package/dist/agent-endpoint.d.ts +1 -1
- package/dist/agent-endpoint.js +8 -2
- package/dist/agent-endpoint.js.map +1 -1
- package/dist/agent-token-header.d.ts +1 -1
- package/dist/agent-token-header.js +1 -1
- package/dist/auth-api.d.ts +3 -0
- package/dist/auth-api.js +15 -1
- package/dist/auth-api.js.map +1 -1
- package/dist/backend/agy-model-switch.d.ts +22 -0
- package/dist/backend/agy-model-switch.js +62 -0
- package/dist/backend/agy-model-switch.js.map +1 -0
- package/dist/backend/antigravity.js +60 -3
- package/dist/backend/antigravity.js.map +1 -1
- package/dist/backend/cli-runtime-switch.d.ts +71 -0
- package/dist/backend/cli-runtime-switch.js +176 -0
- package/dist/backend/cli-runtime-switch.js.map +1 -0
- package/dist/backend/codex-model-switch.d.ts +41 -0
- package/dist/backend/codex-model-switch.js +170 -0
- package/dist/backend/codex-model-switch.js.map +1 -0
- package/dist/backend/credential-profile.js +1 -1
- package/dist/backend/credential-profile.js.map +1 -1
- package/dist/backend/grok-model-switch.d.ts +16 -0
- package/dist/backend/grok-model-switch.js +45 -0
- package/dist/backend/grok-model-switch.js.map +1 -0
- package/dist/backend/grok.js +1 -1
- package/dist/backend/grok.js.map +1 -1
- package/dist/backend/muse.d.ts +2 -0
- package/dist/backend/muse.js +7 -3
- package/dist/backend/muse.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/channel/mcp-server.js +10 -1
- package/dist/channel/mcp-server.js.map +1 -1
- package/dist/channel/mcp-tools.js +8 -0
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/classic-channel-manager.d.ts +1 -1
- package/dist/classic-channel-manager.js +1 -1
- package/dist/cli-audited.js +12 -12
- package/dist/cli-audited.js.map +1 -1
- package/dist/daemon.d.ts +48 -2
- package/dist/daemon.js +302 -21
- package/dist/daemon.js.map +1 -1
- package/dist/delivery-consumed-watch.js +3 -0
- package/dist/delivery-consumed-watch.js.map +1 -1
- package/dist/event-log.d.ts +1 -1
- package/dist/event-log.js +1 -1
- package/dist/fleet-manager.d.ts +104 -2
- package/dist/fleet-manager.js +665 -27
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/credential-profiles/SKILL.md +10 -0
- package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +2 -0
- package/dist/general-knowledge/skills/fleet-health/SKILL.md +18 -0
- package/dist/general-knowledge/skills/hub/SKILL.md +154 -0
- package/dist/general-knowledge/skills/model-discovery/SKILL.md +4 -0
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +17 -3
- package/dist/hub/admin-dashboard.d.ts +85 -0
- package/dist/hub/admin-dashboard.js +161 -0
- package/dist/hub/admin-dashboard.js.map +1 -0
- package/dist/hub/attachments/store.d.ts +2 -0
- package/dist/hub/attachments/store.js +6 -0
- package/dist/hub/attachments/store.js.map +1 -1
- package/dist/hub/client.d.ts +10 -0
- package/dist/hub/client.js +72 -10
- package/dist/hub/client.js.map +1 -1
- package/dist/hub/compose/member.d.ts +20 -0
- package/dist/hub/compose/member.js +212 -17
- package/dist/hub/compose/member.js.map +1 -1
- package/dist/hub/compose/server.d.ts +8 -0
- package/dist/hub/compose/server.js +13 -2
- package/dist/hub/compose/server.js.map +1 -1
- package/dist/hub/display-name.d.ts +10 -0
- package/dist/hub/display-name.js +35 -0
- package/dist/hub/display-name.js.map +1 -0
- package/dist/hub/execution/service.d.ts +1 -0
- package/dist/hub/execution/service.js +1 -1
- package/dist/hub/execution/service.js.map +1 -1
- package/dist/hub/fleet-info.d.ts +12 -0
- package/dist/hub/fleet-info.js +14 -0
- package/dist/hub/fleet-info.js.map +1 -0
- package/dist/hub/fleet-update-model.d.ts +100 -0
- package/dist/hub/fleet-update-model.js +15 -0
- package/dist/hub/fleet-update-model.js.map +1 -0
- package/dist/hub/fleet-updates.d.ts +46 -0
- package/dist/hub/fleet-updates.js +282 -0
- package/dist/hub/fleet-updates.js.map +1 -0
- package/dist/hub/fleet-versions.d.ts +28 -0
- package/dist/hub/fleet-versions.js +80 -0
- package/dist/hub/fleet-versions.js.map +1 -0
- package/dist/hub/http/compose.d.ts +2 -0
- package/dist/hub/http/compose.js +192 -16
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/http/deps.d.ts +1 -0
- package/dist/hub/http/schema.js +13 -1
- package/dist/hub/http/schema.js.map +1 -1
- package/dist/hub/member/display-name.d.ts +9 -0
- package/dist/hub/member/display-name.js +71 -0
- package/dist/hub/member/display-name.js.map +1 -0
- package/dist/hub/member/exposure-api.d.ts +4 -0
- package/dist/hub/member/exposure-api.js +8 -3
- package/dist/hub/member/exposure-api.js.map +1 -1
- package/dist/hub/member/exposures.d.ts +4 -0
- package/dist/hub/member/exposures.js +20 -0
- package/dist/hub/member/exposures.js.map +1 -1
- package/dist/hub/member/pairing-api.js +3 -2
- package/dist/hub/member/pairing-api.js.map +1 -1
- package/dist/hub/member/recommendations.d.ts +37 -0
- package/dist/hub/member/recommendations.js +129 -0
- package/dist/hub/member/recommendations.js.map +1 -0
- package/dist/hub/member/room-ask.d.ts +60 -1
- package/dist/hub/member/room-ask.js +254 -24
- package/dist/hub/member/room-ask.js.map +1 -1
- package/dist/hub/member/room-post-answers.d.ts +52 -0
- package/dist/hub/member/room-post-answers.js +152 -0
- package/dist/hub/member/room-post-answers.js.map +1 -0
- package/dist/hub/member/room-post-receipt.d.ts +21 -0
- package/dist/hub/member/room-post-receipt.js +49 -0
- package/dist/hub/member/room-post-receipt.js.map +1 -0
- package/dist/hub/member/room-post.d.ts +100 -0
- package/dist/hub/member/room-post.js +223 -0
- package/dist/hub/member/room-post.js.map +1 -0
- package/dist/hub/member/updates.d.ts +92 -0
- package/dist/hub/member/updates.js +316 -0
- package/dist/hub/member/updates.js.map +1 -0
- package/dist/hub/protocol.d.ts +658 -1
- package/dist/hub/protocol.js +90 -13
- package/dist/hub/protocol.js.map +1 -1
- package/dist/hub/published-version.d.ts +3 -0
- package/dist/hub/published-version.js +35 -0
- package/dist/hub/published-version.js.map +1 -0
- package/dist/hub/recommendation-model.d.ts +36 -0
- package/dist/hub/recommendation-model.js +9 -0
- package/dist/hub/recommendation-model.js.map +1 -0
- package/dist/hub/recommendations.d.ts +58 -0
- package/dist/hub/recommendations.js +211 -0
- package/dist/hub/recommendations.js.map +1 -0
- package/dist/hub/representative.d.ts +3 -0
- package/dist/hub/representative.js +2 -1
- package/dist/hub/representative.js.map +1 -1
- package/dist/hub/room-context-model.d.ts +43 -0
- package/dist/hub/room-context-model.js +12 -0
- package/dist/hub/room-context-model.js.map +1 -0
- package/dist/hub/rooms/agents.d.ts +41 -9
- package/dist/hub/rooms/agents.js +183 -21
- package/dist/hub/rooms/agents.js.map +1 -1
- package/dist/hub/rooms/assistant.d.ts +1 -6
- package/dist/hub/rooms/assistant.js +7 -2
- package/dist/hub/rooms/assistant.js.map +1 -1
- package/dist/hub/rooms/automation.d.ts +24 -0
- package/dist/hub/rooms/automation.js +66 -0
- package/dist/hub/rooms/automation.js.map +1 -0
- package/dist/hub/rooms/buttons.d.ts +85 -0
- package/dist/hub/rooms/buttons.js +62 -0
- package/dist/hub/rooms/buttons.js.map +1 -0
- package/dist/hub/rooms/context-cursor.d.ts +18 -0
- package/dist/hub/rooms/context-cursor.js +61 -0
- package/dist/hub/rooms/context-cursor.js.map +1 -0
- package/dist/hub/rooms/context.d.ts +1 -1
- package/dist/hub/rooms/context.js +4 -4
- package/dist/hub/rooms/context.js.map +1 -1
- package/dist/hub/rooms/mentions.d.ts +15 -0
- package/dist/hub/rooms/mentions.js +43 -0
- package/dist/hub/rooms/mentions.js.map +1 -0
- package/dist/hub/rooms/post-replies.d.ts +23 -0
- package/dist/hub/rooms/post-replies.js +114 -0
- package/dist/hub/rooms/post-replies.js.map +1 -0
- package/dist/hub/rooms/schema.d.ts +9 -0
- package/dist/hub/rooms/schema.js +43 -0
- package/dist/hub/rooms/schema.js.map +1 -1
- package/dist/hub/rooms/service.d.ts +136 -1
- package/dist/hub/rooms/service.js +727 -18
- package/dist/hub/rooms/service.js.map +1 -1
- package/dist/hub/rooms/types.d.ts +27 -3
- package/dist/hub/rooms.js +1 -1
- package/dist/hub/rooms.js.map +1 -1
- package/dist/hub/runtime.d.ts +1 -1
- package/dist/hub/runtime.js +12 -0
- package/dist/hub/runtime.js.map +1 -1
- package/dist/hub/server.d.ts +6 -1
- package/dist/hub/server.js +75 -5
- package/dist/hub/server.js.map +1 -1
- package/dist/hub/settings-directory-proof.js +22 -1
- package/dist/hub/settings-directory-proof.js.map +1 -1
- package/dist/hub/types.d.ts +133 -2
- package/dist/hub-contact-windows.d.ts +11 -0
- package/dist/hub-contact-windows.js +56 -0
- package/dist/hub-contact-windows.js.map +1 -0
- package/dist/hub-pairing-summary.d.ts +1 -1
- package/dist/hub-room-conversation.d.ts +14 -0
- package/dist/hub-room-conversation.js +60 -0
- package/dist/hub-room-conversation.js.map +1 -0
- package/dist/hub-update-notice.d.ts +12 -0
- package/dist/hub-update-notice.js +35 -0
- package/dist/hub-update-notice.js.map +1 -0
- package/dist/locale.js +58 -2
- package/dist/locale.js.map +1 -1
- package/dist/native-mcp.js +9 -6
- package/dist/native-mcp.js.map +1 -1
- package/dist/outbound-handlers.d.ts +14 -4
- package/dist/outbound-handlers.js +54 -1
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/outbound-schemas.d.ts +12 -0
- package/dist/outbound-schemas.js +12 -0
- package/dist/outbound-schemas.js.map +1 -1
- package/dist/pane-port.d.ts +2 -0
- package/dist/queued-handoffs.d.ts +16 -4
- package/dist/queued-handoffs.js +18 -1
- package/dist/queued-handoffs.js.map +1 -1
- package/dist/runtime-cli-install.js +13 -10
- package/dist/runtime-cli-install.js.map +1 -1
- package/dist/settings-api.d.ts +1 -0
- package/dist/settings-api.js +87 -0
- package/dist/settings-api.js.map +1 -1
- package/dist/tmux-manager.d.ts +2 -0
- package/dist/tmux-manager.js +2 -0
- package/dist/tmux-manager.js.map +1 -1
- package/dist/tool-permissions.js +3 -0
- package/dist/tool-permissions.js.map +1 -1
- package/dist/ui/chat-msg-actions.js +3 -222
- package/dist/ui/hub-admin-overview.js +189 -0
- package/dist/ui/hub-client.js +36 -4
- package/dist/ui/hub-fleet-versions.js +393 -0
- package/dist/ui/hub-room-agent-strings.js +28 -0
- package/dist/ui/hub-room-composer.js +16 -8
- package/dist/ui/hub-room-members-strings.js +2 -2
- package/dist/ui/hub-room-members.js +3 -2
- package/dist/ui/hub-room-notify.js +161 -0
- package/dist/ui/hub-room-search.js +126 -0
- package/dist/ui/hub-room-strings.js +47 -1
- package/dist/ui/hub-room-thread.js +243 -35
- package/dist/ui/hub-room-unread.js +2 -1
- package/dist/ui/hub-strings.js +8 -0
- package/dist/ui/image-annotate.js +2 -283
- package/dist/ui/image-lightbox.js +2 -176
- package/dist/ui/image-zoom.js +2 -242
- package/dist/ui/notice-hub-update.js +94 -0
- package/dist/ui/panel-chat.js +121 -12
- package/dist/ui/panel-hub.js +133 -19
- package/dist/ui/panel-notices.js +3 -1
- package/dist/ui/panel-settings.js +1 -1
- package/dist/ui/settings-hub-updates.js +67 -0
- package/dist/ui/settings-hub.js +28 -3
- package/dist/ui/settings-registry.js +1 -0
- package/dist/ui/settings-update.js +11 -5
- package/dist/ui/settings-web-authority.js +1 -1
- package/dist/ui/shared/app-i18n.js +2 -0
- package/dist/ui/shared/app-nav.js +6 -2
- package/dist/ui/shared/app-prefs.js +2 -1
- package/dist/ui/shared/app-shell.js +29 -4
- package/dist/ui/shared/app-update.js +90 -8
- package/dist/ui/shared/app.css +33 -0
- package/dist/ui/shared/chat-composer.js +6 -3
- package/dist/ui/shared/chat-msg-actions.js +225 -0
- package/dist/ui/shared/chat-thread.js +70 -5
- package/dist/ui/shared/chat-work-bar.css +48 -0
- package/dist/ui/shared/hub-chat.css +16 -2
- package/dist/ui/shared/hub-owner.css +104 -0
- package/dist/ui/shared/hub-rooms-u2.css +16 -0
- package/dist/ui/shared/hub.css +5 -0
- package/dist/ui/shared/image-annotate.js +306 -0
- package/dist/ui/shared/image-lightbox.js +183 -0
- package/dist/ui/shared/image-zoom.js +242 -0
- package/dist/ui/shared/instance-nav.js +36 -7
- package/dist/ui/shared/model-picker.css +4 -3
- package/dist/ui/shared/view-strings.js +8 -0
- package/dist/ui/shared/web-authorize.js +2 -2
- package/dist/update-dispatch.d.ts +8 -1
- package/dist/update-dispatch.js +16 -1
- package/dist/update-dispatch.js.map +1 -1
- package/dist/update-idle.d.ts +65 -0
- package/dist/update-idle.js +190 -0
- package/dist/update-idle.js.map +1 -0
- package/dist/update-launch.d.ts +1 -1
- package/dist/update-launch.js +9 -2
- package/dist/update-launch.js.map +1 -1
- package/dist/usage/i18n-keys.d.ts +1 -1
- package/dist/usage/i18n-keys.js +1 -1
- package/dist/usage/i18n-keys.js.map +1 -1
- package/dist/usage/profile-timeline.d.ts +2 -0
- package/dist/usage/profile-timeline.js +4 -0
- package/dist/usage/profile-timeline.js.map +1 -1
- package/dist/usage/providers.js +4 -4
- package/dist/usage/providers.js.map +1 -1
- package/dist/usage/quota-history.d.ts +1 -1
- package/dist/view-api.js +1 -1
- package/dist/view-api.js.map +1 -1
- package/dist/web-api.js +19 -2
- package/dist/web-api.js.map +1 -1
- package/dist/web-notices.d.ts +3 -0
- package/dist/web-notices.js +17 -2
- package/dist/web-notices.js.map +1 -1
- package/dist/web-prefs.js +1 -0
- package/dist/web-prefs.js.map +1 -1
- package/dist/web-update.d.ts +15 -1
- package/package.json +1 -1
package/dist/hub/http/compose.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { HUB_ROOM_CONTEXT_CAPABILITY } from "../room-context-model.js";
|
|
1
2
|
/**
|
|
2
3
|
* AgEnD Hub P1, slice 3 (server side): S3's composition entry (docs/design/hub-composition.md §5 step 5, §6).
|
|
3
4
|
*
|
|
@@ -13,6 +14,10 @@
|
|
|
13
14
|
* - `receive(frame, link)` is S1's HubServer callback for an authenticated member link.
|
|
14
15
|
* - `close()` forgets the links. S5 closes the DB.
|
|
15
16
|
*/
|
|
17
|
+
import { HubAdminDashboard } from "../admin-dashboard.js";
|
|
18
|
+
import { HubVersionRecommendations, HubRecommendationRefusal } from "../recommendations.js";
|
|
19
|
+
import { HubFleetUpdates, HubFleetUpdateRefusal } from "../fleet-updates.js";
|
|
20
|
+
import { HubFleetVersions } from "../fleet-versions.js";
|
|
16
21
|
import { HubGroupPolicyError } from "../group-policy/errors.js";
|
|
17
22
|
import { GROUP_POLICY_FEATURE, handleGroupHttp } from "../group-policy/admin-api.js";
|
|
18
23
|
import { handleHubDirectorySettingsHttp, HUB_DIRECTORY_SETTINGS_FEATURE, HUB_DIRECTORY_CA_FEATURE, HUB_DIRECTORY_EDITOR_FEATURE } from "../settings-directory-http.js";
|
|
@@ -55,17 +60,22 @@ export const HUB_UI_MODULES = Object.freeze(["panel-hub.js", "hub-client.js", "h
|
|
|
55
60
|
"hub-enrolment-code.js", "hub-enrolment-code-strings.js", "hub-join-queue.js", "hub-join-approval.js", "hub-joincode-flow-strings.js",
|
|
56
61
|
// Hub rooms (hub-rooms-ux.md §§2,5): the rooms words (#3850) then the presence helper (pure, no DOM).
|
|
57
62
|
"hub-room-strings.js", "hub-room-presence.js",
|
|
58
|
-
// Hub rooms §12: unread counts and the Fleet desktop-notify rule (lazy; screens load it)
|
|
59
|
-
|
|
63
|
+
// Hub rooms §12: unread counts and the Fleet desktop-notify rule (lazy; screens load it),
|
|
64
|
+
// then the notifier that pings on @mention/answer/invitation.
|
|
65
|
+
"hub-room-unread.js", "hub-room-notify.js",
|
|
60
66
|
// Hub rooms, track U2 (dev-claude2; hub-rooms-split.md section 3): new room, room settings, members rail, invitations,
|
|
61
67
|
// 管理 → 房間.
|
|
62
68
|
"hub-room-new.js", "hub-room-new-strings.js", "hub-room-settings.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",
|
|
63
69
|
// M-3092 (Hub rooms, track U): the conversation list, a room on the shared thread, its composer.
|
|
64
|
-
"hub-room-list.js", "hub-room-thread.js", "hub-room-composer.js", "hub-assistant-admin.js", "hub-assistant-admin-strings.js",
|
|
70
|
+
"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",
|
|
65
71
|
// M-3092 S-145: the list's favourites (the Fleet sidebar's #1664 rules; synced per person by the Hub).
|
|
66
72
|
"hub-room-favorites.js",
|
|
67
73
|
// S-148: the working bar's words (#3857), shared by the room thread.
|
|
68
|
-
"hub-room-working.js", "hub-teams.js", "hub-teams-strings.js"
|
|
74
|
+
"hub-room-working.js", "hub-teams.js", "hub-teams-strings.js", "hub-room-search.js",
|
|
75
|
+
// M-3137: Fleet versions (Connected fleets' columns and summary, the older-Fleet banner) with its own words.
|
|
76
|
+
"hub-fleet-versions.js",
|
|
77
|
+
// M-3162: Administration → Overview (the counts dashboard), its own words.
|
|
78
|
+
"hub-admin-overview.js"]);
|
|
69
79
|
const BODY_LIMIT = 96 * 1024;
|
|
70
80
|
const UPLOADS_PER_SESSION = 2, UPLOADS_TOTAL = 8;
|
|
71
81
|
const UUID = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;
|
|
@@ -174,6 +184,10 @@ export function createHubHttp(deps, sql) {
|
|
|
174
184
|
const invitations = deps.roomInvitations?.(core, groupRooms.invitationHost());
|
|
175
185
|
const roomAdmin = new HubRoomAdmin(core, event => groupRooms.publish(event), id => { groupRooms.assistant.forget(id); groupRooms.agents.sweep(id); });
|
|
176
186
|
const quota = new HubQuotaService(core);
|
|
187
|
+
const fleetVersions = new HubFleetVersions(core);
|
|
188
|
+
const recommendations = new HubVersionRecommendations(core, fleetVersions);
|
|
189
|
+
const fleetUpdates = new HubFleetUpdates(core, fleetVersions, recommendations);
|
|
190
|
+
const dashboard = new HubAdminDashboard(core, fleetVersions, recommendations);
|
|
177
191
|
const uiDir = join(dirname(fileURLToPath(import.meta.url)), "..", "..", "ui");
|
|
178
192
|
const live = () => !closed && core.live();
|
|
179
193
|
const grantSubjectsOffered = () => !!deps.grantDirectory && deps.directory.groupPolicy === "ad-direct-guid"
|
|
@@ -210,8 +224,23 @@ export function createHubHttp(deps, sql) {
|
|
|
210
224
|
}
|
|
211
225
|
};
|
|
212
226
|
const m = (re) => re.exec(path);
|
|
227
|
+
if (path === "/hub/v1/me/fleets") {
|
|
228
|
+
if (method !== "GET")
|
|
229
|
+
throw new HttpError(405, "method");
|
|
230
|
+
if (query.size)
|
|
231
|
+
throw new HubProtocolError("invalid");
|
|
232
|
+
signedIn();
|
|
233
|
+
const owner = await guard(() => ctx.requirePerson());
|
|
234
|
+
return core.atomic(() => {
|
|
235
|
+
signedIn();
|
|
236
|
+
const recommendedVersion = recommendations.settings().recommendedVersion;
|
|
237
|
+
const fleets = deps.store.read().fleets.filter(f => f.status === "active" && personKeyString(f.owner) === personKeyString(owner))
|
|
238
|
+
.map(f => { const view = fleetVersions.view(f.id, recommendedVersion); return { id: f.id, label: f.label ?? null, version: view.version, versionState: view.versionState }; });
|
|
239
|
+
send(res, 200, { fleets });
|
|
240
|
+
});
|
|
241
|
+
}
|
|
213
242
|
// Composed routes, not enrollment authority or the administrator's on/off switch. Older Hubs omit unsupported cards.
|
|
214
|
-
const offered = ["rooms-v1", "person-prefs-v1", ...(teams ? ["teams-v1"] : []), ...(deps.roomAssistant && deps.assistantAdmin ? ["room-assistant-v1"] : []), ...(deps.refreshAuthorization ? ["sharing-pause-v1"] : []), ...(deps.groupHttp ? [GROUP_POLICY_FEATURE, ...(deps.pairingNotices ? ["quick-pairing-v1"] : [])] : []), ...(grantSubjectsOffered() ? ["grant-subjects-v1"] : []),
|
|
243
|
+
const offered = ["admin-dashboard-v1", "rooms-v1", "person-prefs-v1", ...(teams ? ["teams-v1"] : []), ...(deps.roomAssistant && deps.assistantAdmin ? ["room-assistant-v1"] : []), ...(deps.refreshAuthorization ? ["sharing-pause-v1"] : []), ...(deps.groupHttp ? [GROUP_POLICY_FEATURE, ...(deps.pairingNotices ? ["quick-pairing-v1"] : [])] : []), ...(grantSubjectsOffered() ? ["grant-subjects-v1"] : []),
|
|
215
244
|
...(deps.companyJoin ? ["company-join-v1", "enrolment-code-v1"] : []), ...(deps.directoryNotices ? ["directory-security-notices-v1"] : []), ...(deps.memberAddressNotices ? ["member-address-notices-v1"] : []),
|
|
216
245
|
...(deps.directorySettings ? [HUB_DIRECTORY_SETTINGS_FEATURE, HUB_DIRECTORY_CA_FEATURE, HUB_DIRECTORY_EDITOR_FEATURE] : [])];
|
|
217
246
|
const features = offered.length ? { features: offered } : {};
|
|
@@ -653,6 +682,13 @@ export function createHubHttp(deps, sql) {
|
|
|
653
682
|
}
|
|
654
683
|
throw new HttpError(405, "method");
|
|
655
684
|
}
|
|
685
|
+
// M-3127 C: message search across the group rooms I am in (Ctrl K).
|
|
686
|
+
if (path === "/hub/v1/rooms/search") {
|
|
687
|
+
if (method !== "GET")
|
|
688
|
+
throw new HttpError(405, "method");
|
|
689
|
+
signedIn();
|
|
690
|
+
return send(res, 200, await guard(() => groupRooms.search(ctx, query.get("q") ?? "", query.get("limit") ?? "20", query.get("cursor"))));
|
|
691
|
+
}
|
|
656
692
|
if (path === "/hub/v1/rooms/candidates") {
|
|
657
693
|
if (method !== "GET")
|
|
658
694
|
throw new HttpError(405, "method");
|
|
@@ -888,12 +924,25 @@ export function createHubHttp(deps, sql) {
|
|
|
888
924
|
groupRooms.publish({ type: "unread.changed", roomId, data: { roomId }, audiencePerson: personKeyString(room.asker) });
|
|
889
925
|
return send(res, 200, { ok: true });
|
|
890
926
|
}
|
|
891
|
-
if ((r = m(/^\/hub\/v1\/rooms\/([^/]+)\/
|
|
927
|
+
if ((r = m(/^\/hub\/v1\/rooms\/([^/]+)\/messages\/([^/]+)\/reactions$/))) {
|
|
892
928
|
if (method !== "POST")
|
|
893
929
|
throw new HttpError(405, "method");
|
|
894
930
|
csrf();
|
|
931
|
+
const roomId = uuid(r[1]);
|
|
932
|
+
if (!groupRooms.has(roomId))
|
|
933
|
+
throw new HttpError(404, "not-found");
|
|
895
934
|
const b = await body();
|
|
896
|
-
return send(res, 200,
|
|
935
|
+
return send(res, 200, await guard(() => groupRooms.react(ctx, roomId, r[2], b)));
|
|
936
|
+
}
|
|
937
|
+
if ((r = m(/^\/hub\/v1\/rooms\/([^/]+)\/buttons$/))) {
|
|
938
|
+
if (method !== "POST")
|
|
939
|
+
throw new HttpError(405, "method");
|
|
940
|
+
csrf();
|
|
941
|
+
const b = await body(), roomId = uuid(r[1]);
|
|
942
|
+
// M-3127: a group room's answer buttons and polls (the same body as a direct chat's).
|
|
943
|
+
if (groupRooms.has(roomId))
|
|
944
|
+
return send(res, 200, await guard(() => groupRooms.click(ctx, roomId, b)));
|
|
945
|
+
return send(res, 200, { receipt: await guard(() => rooms.buttons.click(ctx, roomId, b)) });
|
|
897
946
|
}
|
|
898
947
|
if ((r = m(/^\/hub\/v1\/rooms\/([^/]+)\/messages$/))) {
|
|
899
948
|
const roomId = uuid(r[1]);
|
|
@@ -961,13 +1010,15 @@ export function createHubHttp(deps, sql) {
|
|
|
961
1010
|
uploading.set(s.sessionId, (uploading.get(s.sessionId) ?? 0) + 1);
|
|
962
1011
|
uploadingTotal++;
|
|
963
1012
|
try {
|
|
964
|
-
|
|
1013
|
+
// M-3125: a group room's member uploads the same way (HubGroupRooms has the same three methods).
|
|
1014
|
+
const owner = groupRooms.has(roomId) ? groupRooms : rooms;
|
|
1015
|
+
await guard(() => owner.uploadAdmit(ctx, roomId, Number(declared)));
|
|
965
1016
|
const bytes = await readRaw(req, Number(declared));
|
|
966
1017
|
if (!live())
|
|
967
1018
|
throw new HubProtocolError("unavailable");
|
|
968
1019
|
if (bytes.length !== Number(declared))
|
|
969
1020
|
throw new HubProtocolError("invalid");
|
|
970
|
-
return send(res, 200, { file: await guard(() =>
|
|
1021
|
+
return send(res, 200, { file: await guard(() => owner.upload(ctx, roomId, name, bytes)) });
|
|
971
1022
|
}
|
|
972
1023
|
finally {
|
|
973
1024
|
const n = (uploading.get(s.sessionId) ?? 1) - 1;
|
|
@@ -984,7 +1035,7 @@ export function createHubHttp(deps, sql) {
|
|
|
984
1035
|
throw new HttpError(405, "method");
|
|
985
1036
|
const roomId = uuid(r[1]), fileId = uuid(r[2]);
|
|
986
1037
|
signedIn();
|
|
987
|
-
const file = await guard(() => rooms.download(ctx, roomId, fileId));
|
|
1038
|
+
const file = await guard(() => (groupRooms.has(roomId) ? groupRooms : rooms).download(ctx, roomId, fileId));
|
|
988
1039
|
// Never executed or sniffed: a download, in a sandbox; only a magic-checked image may show inline when asked.
|
|
989
1040
|
const inline = (query.get("inline") === "1" || r[3] === "/inline") && file.image;
|
|
990
1041
|
res.writeHead(200, { "Content-Type": file.mime, "Content-Length": String(file.bytes.length), "X-Content-Type-Options": "nosniff",
|
|
@@ -1037,25 +1088,75 @@ export function createHubHttp(deps, sql) {
|
|
|
1037
1088
|
audit: (event) => core.atomic((_db, tx) => core.audit(tx, { requestId: event.requestId, actor: { kind: "person", person: event.actor.person }, action: event.action,
|
|
1038
1089
|
result: event.result, ...(event.reasonCode ? { reasonCode: event.reasonCode } : {}) })) }))
|
|
1039
1090
|
return;
|
|
1091
|
+
if (path === "/hub/v1/admin/dashboard") {
|
|
1092
|
+
if (method !== "GET")
|
|
1093
|
+
throw new HttpError(405, "method");
|
|
1094
|
+
signedIn();
|
|
1095
|
+
const permit = await guard(() => core.management(ctx, "hub.admin"));
|
|
1096
|
+
return send(res, 200, dashboard.view(query, permit));
|
|
1097
|
+
}
|
|
1040
1098
|
if (path.startsWith("/hub/v1/admin/"))
|
|
1041
1099
|
return admin(req, res, path, ctx, method, signedIn, csrf, body, guard);
|
|
1042
1100
|
throw new HttpError(404, "not-found");
|
|
1043
1101
|
}
|
|
1044
1102
|
async function admin(req, res, path, ctx, method, signedIn, csrf, body, guard) {
|
|
1045
1103
|
let r;
|
|
1104
|
+
if (path === "/hub/v1/admin/recommended-version" || path === "/hub/v1/admin/recommended-version/preview") {
|
|
1105
|
+
try {
|
|
1106
|
+
if (path.endsWith("/preview")) {
|
|
1107
|
+
if (method !== "POST")
|
|
1108
|
+
throw new HttpError(405, "method");
|
|
1109
|
+
csrf();
|
|
1110
|
+
return send(res, 200, await recommendations.preview(ctx, await body()));
|
|
1111
|
+
}
|
|
1112
|
+
if (method === "GET") {
|
|
1113
|
+
signedIn();
|
|
1114
|
+
const permit = await core.management(ctx, "hub.admin");
|
|
1115
|
+
permit.assertCurrent();
|
|
1116
|
+
return send(res, 200, recommendations.settings());
|
|
1117
|
+
}
|
|
1118
|
+
if (method !== "PUT")
|
|
1119
|
+
throw new HttpError(405, "method");
|
|
1120
|
+
csrf();
|
|
1121
|
+
return send(res, 200, await recommendations.save(ctx, await body()));
|
|
1122
|
+
}
|
|
1123
|
+
catch (error) {
|
|
1124
|
+
if (!(error instanceof HubRecommendationRefusal))
|
|
1125
|
+
throw error;
|
|
1126
|
+
return send(res, error.status, { code: error.code, ...(error.version ? { version: error.version } : {}) });
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
if (path === "/hub/v1/admin/fleet-updates" || /^\/hub\/v1\/admin\/fleet-updates\/[^/]+\/cancel$/.test(path)) {
|
|
1130
|
+
if (method !== "POST")
|
|
1131
|
+
throw new HttpError(405, "method");
|
|
1132
|
+
csrf();
|
|
1133
|
+
try {
|
|
1134
|
+
const b = await body();
|
|
1135
|
+
if (path.endsWith("/cancel") && Object.keys(b).length)
|
|
1136
|
+
throw new HubProtocolError("invalid");
|
|
1137
|
+
return send(res, 200, path.endsWith("/cancel") ? await fleetUpdates.cancel(ctx, path.split("/")[5]) : await fleetUpdates.request(ctx, b));
|
|
1138
|
+
}
|
|
1139
|
+
catch (error) {
|
|
1140
|
+
if (!(error instanceof HubFleetUpdateRefusal))
|
|
1141
|
+
throw error;
|
|
1142
|
+
return send(res, error.status, { code: error.code });
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1046
1145
|
if (path === "/hub/v1/admin/overview") {
|
|
1047
1146
|
if (method !== "GET")
|
|
1048
1147
|
throw new HttpError(405, "method");
|
|
1049
1148
|
signedIn();
|
|
1050
1149
|
await guard(() => ctx.requireAdmin());
|
|
1051
|
-
const state = deps.store.read(), now = core.now();
|
|
1150
|
+
const state = deps.store.read(), now = core.now(), recommendation = recommendations.settings();
|
|
1151
|
+
fleetUpdates.reconcile();
|
|
1052
1152
|
const name = (key) => {
|
|
1053
1153
|
const id = personKeyString(key);
|
|
1054
1154
|
const row = core.atomic((db) => db.prepare("SELECT display_name, login_label FROM hub_people WHERE person=?").get(id));
|
|
1055
1155
|
return row ? { name: row.display_name, login: row.login_label } : null;
|
|
1056
1156
|
};
|
|
1057
1157
|
return send(res, 200, {
|
|
1058
|
-
|
|
1158
|
+
recommendedVersion: recommendation.recommendedVersion, recommendationRevision: recommendation.revision,
|
|
1159
|
+
fleets: state.fleets.map((f) => ({ id: f.id, status: f.status, generation: f.generation, owner: name(f.owner), label: f.label ?? null, ...fleetVersions.view(f.id, recommendation.recommendedVersion), recommendationNotifiedAt: recommendations.notifiedAt(f.id, recommendation), updatesAllowed: fleetUpdates.allowed(f.id), updateRequest: fleetUpdates.view(f.id),
|
|
1059
1160
|
...(deps.companyJoin?.fleetDisplay(f.id) ?? { source: null, createdAt: null }) })),
|
|
1060
1161
|
pairings: state.pairings.filter((p) => p.expiresAt > now && (p.state === "offered" || p.state === "pending"))
|
|
1061
1162
|
.map((p) => ({ id: p.id, state: p.state, expiresAt: p.expiresAt, fingerprint: p.fingerprint, ownerConfirmed: p.ownerConfirmed, adminApproved: p.adminApproved, owner: name(p.owner) })),
|
|
@@ -1185,15 +1286,79 @@ export function createHubHttp(deps, sql) {
|
|
|
1185
1286
|
return servePublicAsset(res, path.slice("/assets/".length));
|
|
1186
1287
|
return false;
|
|
1187
1288
|
}
|
|
1289
|
+
function roomPostCode(error) {
|
|
1290
|
+
switch (error.code) {
|
|
1291
|
+
case "invalid":
|
|
1292
|
+
case "denied":
|
|
1293
|
+
case "revoked":
|
|
1294
|
+
case "not-found":
|
|
1295
|
+
case "stale":
|
|
1296
|
+
case "backpressure": return error.code;
|
|
1297
|
+
default: return "unavailable";
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1188
1300
|
async function receive(frame, link) {
|
|
1189
1301
|
if (!live() || !link.current())
|
|
1190
1302
|
throw new HubProtocolError("stale");
|
|
1303
|
+
fleetVersions.connected(link);
|
|
1191
1304
|
rooms.noteLink(link);
|
|
1192
1305
|
quota.noteLink(link);
|
|
1193
1306
|
groupRooms.agents.noteLink(link);
|
|
1307
|
+
groupRooms.postReplies.noteLink(link);
|
|
1194
1308
|
deps.pairingNotices?.noteLink(link);
|
|
1195
1309
|
const reply = { v: 1, requestId: frame.requestId, linkEpoch: link.linkEpoch };
|
|
1196
1310
|
switch (frame.type) {
|
|
1311
|
+
case "fleet.recommendation-ack":
|
|
1312
|
+
recommendations.acknowledge(frame.payload, link);
|
|
1313
|
+
return;
|
|
1314
|
+
case "fleet.info":
|
|
1315
|
+
fleetVersions.report(frame.payload, link);
|
|
1316
|
+
fleetUpdates.report(frame.payload, link);
|
|
1317
|
+
return;
|
|
1318
|
+
case "fleet.update-status":
|
|
1319
|
+
await fleetUpdates.status(frame.payload, link);
|
|
1320
|
+
return;
|
|
1321
|
+
case "room.list":
|
|
1322
|
+
try {
|
|
1323
|
+
return { ...reply, type: "room.list-result", payload: await groupRooms.agentRooms(frame.payload, link) };
|
|
1324
|
+
}
|
|
1325
|
+
catch (error) {
|
|
1326
|
+
if (!(error instanceof HubProtocolError))
|
|
1327
|
+
throw error;
|
|
1328
|
+
return { ...reply, type: "room.list-result", payload: { ok: false, exposureId: frame.payload.exposureId, code: roomPostCode(error) } };
|
|
1329
|
+
}
|
|
1330
|
+
case "room.post-answer-ack":
|
|
1331
|
+
groupRooms.postReplies.acknowledge(frame.payload, link);
|
|
1332
|
+
return;
|
|
1333
|
+
case "room.members":
|
|
1334
|
+
try {
|
|
1335
|
+
return { ...reply, type: "room.members-result", payload: await groupRooms.agentMembers(frame.payload, link) };
|
|
1336
|
+
}
|
|
1337
|
+
catch (error) {
|
|
1338
|
+
if (!(error instanceof HubProtocolError))
|
|
1339
|
+
throw error;
|
|
1340
|
+
return { ...reply, type: "room.members-result", payload: { ok: false, code: roomPostCode(error) } };
|
|
1341
|
+
}
|
|
1342
|
+
case "people.search":
|
|
1343
|
+
try {
|
|
1344
|
+
return { ...reply, type: "people.search-result", payload: await groupRooms.agentPeople(frame.payload, link) };
|
|
1345
|
+
}
|
|
1346
|
+
catch (error) {
|
|
1347
|
+
if (!(error instanceof HubProtocolError))
|
|
1348
|
+
throw error;
|
|
1349
|
+
return { ...reply, type: "people.search-result", payload: { ok: false, code: roomPostCode(error) } };
|
|
1350
|
+
}
|
|
1351
|
+
case "room.post":
|
|
1352
|
+
try {
|
|
1353
|
+
return { ...reply, type: "room.post-result", payload: await groupRooms.agentPost(frame.payload, link) };
|
|
1354
|
+
}
|
|
1355
|
+
catch (error) {
|
|
1356
|
+
if (!(error instanceof HubProtocolError))
|
|
1357
|
+
throw error;
|
|
1358
|
+
return { ...reply, type: "room.post-result", payload: { ok: false, code: roomPostCode(error) } };
|
|
1359
|
+
}
|
|
1360
|
+
case "room.context-state": return { ...reply, type: "room.context-state-result", payload: groupRooms.agents.contextState(frame.payload, link) };
|
|
1361
|
+
case "room.context-input": return { ...reply, type: "room.context-input-result", payload: groupRooms.agents.contextInput(frame.payload, link) };
|
|
1197
1362
|
case "room.answer":
|
|
1198
1363
|
try {
|
|
1199
1364
|
return { ...reply, type: "room.answer-ack", payload: await groupRooms.agents.answer(frame.payload, link) };
|
|
@@ -1207,6 +1372,16 @@ export function createHubHttp(deps, sql) {
|
|
|
1207
1372
|
case "agent.state":
|
|
1208
1373
|
groupRooms.agents.state(frame.payload, link);
|
|
1209
1374
|
return;
|
|
1375
|
+
// M-3127 (agent reactions, on room-answer-buttons-v1): an agent's reaction to the room question it was asked; the result says why not.
|
|
1376
|
+
case "room.react":
|
|
1377
|
+
try {
|
|
1378
|
+
return { ...reply, type: "room.react-result", payload: await groupRooms.agentReact(frame.payload, link) };
|
|
1379
|
+
}
|
|
1380
|
+
catch (error) {
|
|
1381
|
+
if (!(error instanceof HubProtocolError) || !["invalid", "denied", "not-found", "revoked"].includes(error.code))
|
|
1382
|
+
throw error;
|
|
1383
|
+
return { ...reply, type: "room.react-result", payload: { messageId: frame.payload.messageId, ok: false, code: error.code } };
|
|
1384
|
+
}
|
|
1210
1385
|
case "exposure.snapshot":
|
|
1211
1386
|
await catalog.receiveSnapshot(frame.payload, link, frame.requestId);
|
|
1212
1387
|
quota.prune();
|
|
@@ -1238,7 +1413,8 @@ export function createHubHttp(deps, sql) {
|
|
|
1238
1413
|
flushSoon(link);
|
|
1239
1414
|
return { ...reply, type: "reconcile", payload: page };
|
|
1240
1415
|
}
|
|
1241
|
-
case "attachment.get": return { ...reply, type: "attachment.chunk", payload: await
|
|
1416
|
+
case "attachment.get": return { ...reply, type: "attachment.chunk", payload: await (groupRooms.agents.ownsFile(frame.payload.id)
|
|
1417
|
+
? groupRooms.agents.attachmentGet(frame.payload, link) : rooms.attachmentGet(frame.payload, link)) };
|
|
1242
1418
|
case "attachment.put": return { ...reply, type: "attachment.ack", payload: rooms.attachmentPut(frame.payload, link) };
|
|
1243
1419
|
case "error": return;
|
|
1244
1420
|
}
|
|
@@ -1270,10 +1446,10 @@ export function createHubHttp(deps, sql) {
|
|
|
1270
1446
|
prepareDirectoryRotation: (token, actor) => sessions.prepareDirectoryRotation(token, actor),
|
|
1271
1447
|
completeDirectoryRotation: (rotation, operationId) => sessions.completeDirectoryRotation(rotation, operationId),
|
|
1272
1448
|
}),
|
|
1273
|
-
handle, receive, memberClosed: fleetId => { if (live())
|
|
1274
|
-
groupRooms.agents.disconnected(fleetId); }, features: Object.freeze(["rooms-v1", "room-ask-v1", "person-prefs-v1", ...(teams ? ["teams-v1"] : []), ...(deps.roomAssistant && deps.assistantAdmin ? ["room-assistant-v1"] : []), ...(deps.refreshAuthorization ? ["sharing-pause-v1"] : []), ...(deps.groupHttp ? [GROUP_POLICY_FEATURE, ...(deps.pairingNotices ? ["quick-pairing-v1"] : [])] : []), ...(grantSubjectsOffered() ? ["grant-subjects-v1"] : []),
|
|
1449
|
+
handle, receive, memberReady: link => { recommendations.ready(link); fleetUpdates.ready(link); }, memberConnected: link => fleetVersions.connected(link), memberClosed: fleetId => { if (live())
|
|
1450
|
+
groupRooms.agents.disconnected(fleetId); }, features: Object.freeze(["admin-dashboard-v1", "fleet-update-v1", "rooms-v1", "room-ask-v1", "room-post-v1", HUB_ROOM_CONTEXT_CAPABILITY, "person-prefs-v1", ...(teams ? ["teams-v1"] : []), ...(deps.roomAssistant && deps.assistantAdmin ? ["room-assistant-v1"] : []), ...(deps.refreshAuthorization ? ["sharing-pause-v1"] : []), ...(deps.groupHttp ? [GROUP_POLICY_FEATURE, ...(deps.pairingNotices ? ["quick-pairing-v1"] : [])] : []), ...(grantSubjectsOffered() ? ["grant-subjects-v1"] : []),
|
|
1275
1451
|
...(deps.directoryNotices ? ["directory-security-notices-v1"] : []), ...(deps.memberAddressNotices ? ["member-address-notices-v1"] : []), ...(deps.directorySettings ? [HUB_DIRECTORY_SETTINGS_FEATURE, HUB_DIRECTORY_CA_FEATURE, HUB_DIRECTORY_EDITOR_FEATURE] : [])]),
|
|
1276
|
-
async close() { closed = true; grantSearch.close(); for (const end of streams)
|
|
1452
|
+
async close() { closed = true; fleetUpdates.close(); recommendations.close(); fleetVersions.close(); grantSearch.close(); for (const end of streams)
|
|
1277
1453
|
end(); await groupRooms.close(); await rooms.buttons.close(); rooms.forget(); quota.close(); },
|
|
1278
1454
|
};
|
|
1279
1455
|
}
|