@songsid/agend 2.2.0-alpha.3 → 2.2.0-alpha.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.
Files changed (44) hide show
  1. package/dist/discord-general.d.ts +15 -0
  2. package/dist/discord-general.js +24 -0
  3. package/dist/discord-general.js.map +1 -0
  4. package/dist/fleet-manager.js +11 -15
  5. package/dist/fleet-manager.js.map +1 -1
  6. package/dist/locale.js +8 -2
  7. package/dist/locale.js.map +1 -1
  8. package/dist/public-link-progress.d.ts +3 -1
  9. package/dist/public-link-progress.js +15 -1
  10. package/dist/public-link-progress.js.map +1 -1
  11. package/dist/public-web-gateway.js +3 -0
  12. package/dist/public-web-gateway.js.map +1 -1
  13. package/dist/public-web-link.d.ts +4 -2
  14. package/dist/public-web-link.js +10 -8
  15. package/dist/public-web-link.js.map +1 -1
  16. package/dist/quickstart-api.js +4 -1
  17. package/dist/quickstart-api.js.map +1 -1
  18. package/dist/topic-commands.js +4 -2
  19. package/dist/topic-commands.js.map +1 -1
  20. package/dist/tunnel/cloudflared-install.d.ts +25 -1
  21. package/dist/tunnel/cloudflared-install.js +181 -10
  22. package/dist/tunnel/cloudflared-install.js.map +1 -1
  23. package/dist/tunnel/deb-extract.d.ts +9 -0
  24. package/dist/tunnel/deb-extract.js +94 -0
  25. package/dist/tunnel/deb-extract.js.map +1 -0
  26. package/dist/ui/app.html +3 -0
  27. package/dist/ui/chat-strings.js +37 -0
  28. package/dist/ui/chat-thread.js +1 -1
  29. package/dist/ui/icons/apple-touch-icon.png +0 -0
  30. package/dist/ui/icons/favicon.ico +0 -0
  31. package/dist/ui/icons/favicon.svg +8 -0
  32. package/dist/ui/panel-chat.js +3 -2
  33. package/dist/ui/preview-panel.js +9 -4
  34. package/dist/ui/preview.js +36 -13
  35. package/dist/ui/signin.html +3 -0
  36. package/dist/web-api.js +3 -1
  37. package/dist/web-api.js.map +1 -1
  38. package/dist/web-icons.d.ts +21 -0
  39. package/dist/web-icons.js +38 -0
  40. package/dist/web-icons.js.map +1 -0
  41. package/dist/web-preview.d.ts +9 -0
  42. package/dist/web-preview.js +15 -9
  43. package/dist/web-preview.js.map +1 -1
  44. package/package.json +1 -1
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Discord general_channel_id location helper.
3
+ *
4
+ * The wizard wrote general_channel_id at the connection top level from c25045b0
5
+ * until #1552 fixed it to write under channel.options. Runtime code uses this
6
+ * helper so that existing fleet.yaml files with the old top-level field keep
7
+ * working; options is authoritative when both are present.
8
+ */
9
+ /**
10
+ * Return the Discord General channel id from a connection, or null.
11
+ * Reads channel.options.general_channel_id first (canonical location),
12
+ * falls back to the legacy top-level channel.general_channel_id for files
13
+ * written by the wizard from c25045b0 until #1552.
14
+ */
15
+ export declare function discordGeneralChannelId(ch: Record<string, unknown>): string | null;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Discord general_channel_id location helper.
3
+ *
4
+ * The wizard wrote general_channel_id at the connection top level from c25045b0
5
+ * until #1552 fixed it to write under channel.options. Runtime code uses this
6
+ * helper so that existing fleet.yaml files with the old top-level field keep
7
+ * working; options is authoritative when both are present.
8
+ */
9
+ /**
10
+ * Return the Discord General channel id from a connection, or null.
11
+ * Reads channel.options.general_channel_id first (canonical location),
12
+ * falls back to the legacy top-level channel.general_channel_id for files
13
+ * written by the wizard from c25045b0 until #1552.
14
+ */
15
+ export function discordGeneralChannelId(ch) {
16
+ const fromOptions = ch.options?.general_channel_id;
17
+ if (fromOptions != null && String(fromOptions))
18
+ return String(fromOptions);
19
+ const legacy = ch.general_channel_id;
20
+ if (legacy != null && String(legacy))
21
+ return String(legacy);
22
+ return null;
23
+ }
24
+ //# sourceMappingURL=discord-general.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discord-general.js","sourceRoot":"","sources":["../src/discord-general.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CAAC,EAA2B;IACjE,MAAM,WAAW,GAAI,EAAE,CAAC,OAA+C,EAAE,kBAAkB,CAAC;IAC5F,IAAI,WAAW,IAAI,IAAI,IAAI,MAAM,CAAC,WAAW,CAAC;QAAE,OAAO,MAAM,CAAC,WAAW,CAAC,CAAC;IAC3E,MAAM,MAAM,GAAG,EAAE,CAAC,kBAAkB,CAAC;IACrC,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC;QAAE,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC;IAC5D,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -6,6 +6,7 @@ import { SettingsExecution, settingsRevision, noteSettingsWrite, settingsFileRes
6
6
  import { performance } from "node:perf_hooks";
7
7
  import { gatewayRequestContext } from "./web-request-context.js";
8
8
  import { createPublicWebGateway } from "./public-web-gateway.js";
9
+ import { handleWebIconRequest } from "./web-icons.js";
9
10
  import { renderPublicLinkProgress, ThrottledMessageEditor } from "./public-link-progress.js";
10
11
  import { PublicWebLink, publicLinkSettings } from "./public-web-link.js";
11
12
  import { TunnelPurposeLane } from "./tunnel/purpose-lane.js";
@@ -130,6 +131,7 @@ import { ReplyButtonsController } from "./reply-buttons-controller.js";
130
131
  import { publicAttachment, sweepOrphanedUploads, WebFileLedger } from "./web-upload.js";
131
132
  import { handleViewRequest, isViewPath, profileIdentities, resolveInstanceIdentity } from "./view-api.js";
132
133
  import { envFileKeys } from "./token-env-name.js";
134
+ import { discordGeneralChannelId } from "./discord-general.js";
133
135
  import { parseEnvText } from "./env-file.js";
134
136
  import { isDisallowedIntentsError, isRejectedTokenError } from "./discord-permissions.js";
135
137
  import { filterUsageProviders, formatDiscordUsageActivity, getUsageSnapshot, handleUsageRequest, isUsagePath, usageProviderIdForBackend } from "./usage/usage-api.js";
@@ -5199,8 +5201,8 @@ export class FleetManager {
5199
5201
  for (const need of [...needsGeneral]) {
5200
5202
  const matchIdx = unboundGenerals.findIndex(([, inst]) => {
5201
5203
  const topicId = String(inst.topic_id ?? "");
5202
- if (need.ch.type === "discord" && need.ch.options?.general_channel_id) {
5203
- return topicId === String(need.ch.options.general_channel_id);
5204
+ if (need.ch.type === "discord" && discordGeneralChannelId(need.ch)) {
5205
+ return topicId === discordGeneralChannelId(need.ch);
5204
5206
  }
5205
5207
  if (need.ch.type === "telegram") {
5206
5208
  return topicId === "1" || topicId === "";
@@ -10208,9 +10210,9 @@ export class FleetManager {
10208
10210
  if (generalTopic != null)
10209
10211
  return { chatId, opts: { threadId: String(generalTopic) } };
10210
10212
  if (cfg?.type === "discord") {
10211
- const configured = cfg.options?.general_channel_id;
10212
- if (configured != null && String(configured)) {
10213
- return { chatId, opts: { threadId: String(configured) } };
10213
+ const configured = discordGeneralChannelId(cfg);
10214
+ if (configured) {
10215
+ return { chatId, opts: { threadId: configured } };
10214
10216
  }
10215
10217
  return null; // a guild id is not a channel; sending would always fail
10216
10218
  }
@@ -15968,9 +15970,7 @@ Plus the operational skills (fleet-health, instance-lifecycle, scheduling, sessi
15968
15970
  token_env: channel.bot_token_env,
15969
15971
  token_present: !!process.env[channel.bot_token_env] || stored.has(channel.bot_token_env),
15970
15972
  group_id: channel.group_id != null ? String(channel.group_id) : null,
15971
- general_channel_id: channel.options?.general_channel_id != null
15972
- ? String(channel.options.general_channel_id)
15973
- : null,
15973
+ general_channel_id: discordGeneralChannelId(channel),
15974
15974
  ...this.connectionStatus(id, state, world),
15975
15975
  ...(world ? { identity: { id: world.botUserId ?? null, username: world.botUsername ?? null } } : {}),
15976
15976
  };
@@ -17354,14 +17354,10 @@ Plus the operational skills (fleet-health, instance-lifecycle, scheduling, sessi
17354
17354
  return;
17355
17355
  }
17356
17356
  const requestPath = new URL(req.url ?? "/", `http://localhost:${port}`).pathname;
17357
- // Browsers request this automatically and AgEnD does not ship an icon.
17358
- // It is neither user data nor an API route, so do not turn the harmless
17359
- // probe into a noisy web-token 401 in the browser console.
17360
- if (req.method === "GET" && requestPath === "/favicon.ico") {
17361
- res.writeHead(204);
17362
- res.end();
17357
+ // Branding is public, after Host admission: automatic favicon requests
17358
+ // must not become noisy web-token 401s in the browser console.
17359
+ if (handleWebIconRequest(req, res, requestPath))
17363
17360
  return;
17364
- }
17365
17361
  // Public: the health probe, /agent (instance-token auth of its own), the
17366
17362
  // sign-in surface, and /view's reads unless web.view_access says otherwise.
17367
17363
  if (bypassesWebGate(req, requestPath, this.fleetConfig, p => !gatewayRequestContext(req) && (isViewPath(p) || isUsagePath(p)))) {