@songsid/agend 2.3.4-beta.3 → 2.3.4-beta.5

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 (73) hide show
  1. package/dist/backend/claude-code.js +1 -1
  2. package/dist/backend/claude-code.js.map +1 -1
  3. package/dist/backend/codex-session-lookup.d.ts +35 -0
  4. package/dist/backend/codex-session-lookup.js +93 -0
  5. package/dist/backend/codex-session-lookup.js.map +1 -1
  6. package/dist/backend/codex.d.ts +27 -0
  7. package/dist/backend/codex.js +116 -20
  8. package/dist/backend/codex.js.map +1 -1
  9. package/dist/backend/grok.d.ts +0 -2
  10. package/dist/backend/grok.js +0 -22
  11. package/dist/backend/grok.js.map +1 -1
  12. package/dist/backend/types.d.ts +0 -2
  13. package/dist/backend/types.js.map +1 -1
  14. package/dist/daemon.d.ts +10 -1
  15. package/dist/daemon.js +122 -80
  16. package/dist/daemon.js.map +1 -1
  17. package/dist/delivery-outbox.test.js +2 -2
  18. package/dist/delivery-outbox.test.js.map +1 -1
  19. package/dist/dialog-screen-text.d.ts +16 -0
  20. package/dist/dialog-screen-text.js +51 -0
  21. package/dist/dialog-screen-text.js.map +1 -0
  22. package/dist/fleet-manager.d.ts +4 -0
  23. package/dist/fleet-manager.js +46 -12
  24. package/dist/fleet-manager.js.map +1 -1
  25. package/dist/install-stream.d.ts +53 -0
  26. package/dist/install-stream.js +134 -0
  27. package/dist/install-stream.js.map +1 -0
  28. package/dist/instance-lifecycle.d.ts +12 -0
  29. package/dist/instance-lifecycle.js +31 -2
  30. package/dist/instance-lifecycle.js.map +1 -1
  31. package/dist/locale.js +26 -6
  32. package/dist/locale.js.map +1 -1
  33. package/dist/log-service.d.ts +2 -0
  34. package/dist/log-service.js +7 -3
  35. package/dist/log-service.js.map +1 -1
  36. package/dist/login-manager.d.ts +6 -0
  37. package/dist/login-manager.js +10 -1
  38. package/dist/login-manager.js.map +1 -1
  39. package/dist/outbound-handlers.js +56 -0
  40. package/dist/outbound-handlers.js.map +1 -1
  41. package/dist/outbound-schemas.d.ts +1 -0
  42. package/dist/outbound-schemas.js +3 -0
  43. package/dist/outbound-schemas.js.map +1 -1
  44. package/dist/selection-card.d.ts +2 -3
  45. package/dist/selection-card.js +99 -26
  46. package/dist/selection-card.js.map +1 -1
  47. package/dist/tmux-manager.d.ts +6 -0
  48. package/dist/tmux-manager.js +17 -0
  49. package/dist/tmux-manager.js.map +1 -1
  50. package/dist/ui/chat-store.js +20 -3
  51. package/dist/ui/fleet-canvas.js +4 -3
  52. package/dist/ui/fleet-office-model.js +55 -22
  53. package/dist/ui/fleet-office-overview.js +6 -38
  54. package/dist/ui/fleet-office-skin.js +12 -4
  55. package/dist/ui/fleet-office-store.js +5 -0
  56. package/dist/ui/fleet-office-zones.js +2 -2
  57. package/dist/ui/fleet-office.js +31 -1
  58. package/dist/ui/panel-log.js +7 -1
  59. package/dist/ui/shared/app-i18n.js +2 -2
  60. package/dist/ui/shared/app-shell.js +4 -2
  61. package/dist/ui/shared/app-stream.js +26 -0
  62. package/dist/ui/shared/app.css +6 -0
  63. package/dist/unattended-install.d.ts +6 -0
  64. package/dist/unattended-install.js +65 -0
  65. package/dist/unattended-install.js.map +1 -0
  66. package/dist/web-api.js +7 -2
  67. package/dist/web-api.js.map +1 -1
  68. package/dist/web-chat-history.d.ts +20 -0
  69. package/dist/web-chat-history.js +21 -0
  70. package/dist/web-chat-history.js.map +1 -1
  71. package/dist/web-guest-access.js +5 -1
  72. package/dist/web-guest-access.js.map +1 -1
  73. package/package.json +1 -1
@@ -0,0 +1,65 @@
1
+ /**
2
+ * M-2281 (#2980): how `/login` runs a CLI's installer in its window — nobody types there, so nothing may wait for
3
+ * an answer, and the install must not starve the fleet that is still serving every chat.
4
+ *
5
+ * - **No terminal to ask on.** `setsid -w` gives the install a session of its own with no controlling terminal, so
6
+ * `/dev/tty` cannot be opened, and stdin is `/dev/null`. A prompt that asks there (codex's "Start Codex now?",
7
+ * kiro's "replace it?", sudo's password) fails at once instead of waiting out the session timeout. Without
8
+ * `setsid` (macOS has none), stdin is still `/dev/null`. The same wrapper install-agend.ps1 uses (#2583).
9
+ * - **Low priority.** `nice -n 10`, plus `ionice -c2 -n7` where it exists and is permitted: a ~0.5 GB download and
10
+ * unpack (codex 0.166) yields CPU and disk to the fleet and its CLIs.
11
+ * - **Stoppable.** The install's own session is not the window's, so closing the window (cancel, timeout, fleet
12
+ * stop) would not reach it: the window's shell forwards HUP/INT/TERM to the install's whole process group.
13
+ * - **The user's shell.** Installers pick the rc file for their PATH line from `$SHELL`; the window inherits the
14
+ * tmux server's environment, where it may be missing (a service). The account's login shell is passed, so the
15
+ * line lands in the file the user's own terminals read.
16
+ *
17
+ * - **Its verdict is kept.** In a tmux pane it starts once remain-on-exit is on (see the script): an install that ends
18
+ * at once still leaves a dead pane with its exit code and output for the session to judge.
19
+ *
20
+ * The exit code is the install's own: the session judges success by it.
21
+ */
22
+ import { accessSync, constants as fsConstants } from "node:fs";
23
+ import { userInfo } from "node:os";
24
+ import { isAbsolute } from "node:path";
25
+ import { shellQuote } from "./backend/types.js";
26
+ /** Runs `$1` detached from any terminal, at low priority; HUP/INT/TERM on this shell reach its whole process group. */
27
+ export const UNATTENDED_INSTALL_SCRIPT = [
28
+ // In a tmux pane, start only once AgEnD has set remain-on-exit on the window (at most ~10 s): an install that fails
29
+ // at once — a prompt with no terminal does — would otherwise close the window before it is set, taking its exit code
30
+ // and output with it. Outside tmux ($TMUX_PANE unset) there is nothing to wait for.
31
+ 'if [ -n "${TMUX_PANE:-}" ] && command -v tmux >/dev/null 2>&1; then i=0; while [ "$(tmux show-options -wqv -t "$TMUX_PANE" remain-on-exit 2>/dev/null)" != on ] && [ $i -lt 100 ]; do sleep 0.1; i=$((i+1)); done; fi',
32
+ 'P=""',
33
+ 'if command -v ionice >/dev/null 2>&1 && ionice -c2 -n7 true >/dev/null 2>&1; then P="ionice -c2 -n7"; fi',
34
+ 'if command -v setsid >/dev/null 2>&1; then setsid -w nice -n 10 $P sh -c "$1" </dev/null & else nice -n 10 $P sh -c "$1" </dev/null & fi',
35
+ "pid=$!",
36
+ // `kill -TERM -$pid`, not `kill -- -$pid`: dash's kill refuses `--` ("Illegal number"). Before setsid has run there is
37
+ // no such group yet, and the plain pid is what exists.
38
+ "trap 'kill -TERM -$pid 2>/dev/null || kill -TERM $pid 2>/dev/null; exit 129' HUP INT TERM",
39
+ 'wait "$pid"',
40
+ ].join("\n");
41
+ /** The account's login shell, when it is an absolute path to an executable; else undefined (keep the inherited one). */
42
+ export function loginShell(read = () => userInfo().shell) {
43
+ let shell;
44
+ try {
45
+ shell = read();
46
+ }
47
+ catch {
48
+ return undefined;
49
+ }
50
+ if (!shell || !isAbsolute(shell))
51
+ return undefined;
52
+ try {
53
+ accessSync(shell, fsConstants.X_OK);
54
+ return shell;
55
+ }
56
+ catch {
57
+ return undefined;
58
+ }
59
+ }
60
+ /** The window's command for an install command. `shell`: the $SHELL to give it; null keeps the inherited one. */
61
+ export function unattendedInstallCommand(command, shell = loginShell() ?? null) {
62
+ const env = shell ? `SHELL=${shellQuote(shell)} ` : "";
63
+ return `${env}sh -c ${shellQuote(UNATTENDED_INSTALL_SCRIPT)} agend-install ${shellQuote(command)}`;
64
+ }
65
+ //# sourceMappingURL=unattended-install.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unattended-install.js","sourceRoot":"","sources":["../src/unattended-install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,UAAU,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,uHAAuH;AACvH,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,oHAAoH;IACpH,qHAAqH;IACrH,oFAAoF;IACpF,uNAAuN;IACvN,MAAM;IACN,0GAA0G;IAC1G,0IAA0I;IAC1I,QAAQ;IACR,uHAAuH;IACvH,uDAAuD;IACvD,2FAA2F;IAC3F,aAAa;CACd,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb,wHAAwH;AACxH,MAAM,UAAU,UAAU,CAAC,IAAI,GAAoC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK;IACvF,IAAI,KAAgC,CAAC;IACrC,IAAI,CAAC;QAAC,KAAK,GAAG,IAAI,EAAE,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC;QAAC,OAAO,SAAS,CAAC;IAAC,CAAC;IACnD,IAAI,CAAC,KAAK,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IACnD,IAAI,CAAC;QAAC,UAAU,CAAC,KAAK,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;QAAC,OAAO,KAAK,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC;QAAC,OAAO,SAAS,CAAC;IAAC,CAAC;AACxF,CAAC;AAED,iHAAiH;AACjH,MAAM,UAAU,wBAAwB,CAAC,OAAe,EAAE,KAAK,GAAkB,UAAU,EAAE,IAAI,IAAI;IACnG,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,SAAS,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IACvD,OAAO,GAAG,GAAG,SAAS,UAAU,CAAC,yBAAyB,CAAC,kBAAkB,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;AACrG,CAAC"}
package/dist/web-api.js CHANGED
@@ -40,7 +40,7 @@ import { readStatuslineModel, resolveInstanceContext } from "./topic-commands.js
40
40
  import { z } from "zod";
41
41
  import { evaluateWebRequest, isPassiveWebRead, isSecureRequest, isWebRequestAuthorized, WEB_TOKEN_INVALID_MESSAGE } from "./web-auth.js";
42
42
  import { dashboardOriginFor } from "./web-preview.js";
43
- import { WEB_CHAT_CARDS_OVERFLOW, newWebMessageId, parseLastEventId, webChatReplyRef, webChatReplyText } from "./web-chat-history.js";
43
+ import { WEB_CHAT_CARDS_OVERFLOW, catchUpWindow, newWebMessageId, parseLastEventId, webChatReplyRef, webChatReplyText } from "./web-chat-history.js";
44
44
  import { PAGE_SHARE_LIMITS, htmlFences, htmlTitle } from "./page-share.js";
45
45
  import { attachmentDelivery, createPartFile, displayName, fileTooLargeText, INLINE_MIME, isFileId, MEDIA_RANGE_MAX, publicAttachment, UPLOAD_LIMITS, UPLOAD_MAX_MS, UPLOAD_STALL_MS, UploadSniffer, uploadLimits, wellFormed } from "./web-upload.js";
46
46
  import { getAgendHome } from "./paths.js";
@@ -1991,7 +1991,12 @@ export function handleWebRequest(req, res, url, ctx) {
1991
1991
  json(res, 200, {
1992
1992
  status: ctx.getUiStatus(),
1993
1993
  // #2341 review: over the public link, without a summary line that names a card hidden there.
1994
- messages: history ? visibleMessages(ctx, !!gatewayRequestContext(req), fresh ? history.after(0) : history.replayFor(parseLastEventId(after))) : [],
1994
+ // M-2260: the newest within the catch-up budget; `truncated` when older ones were left out (the page re-reads its
1995
+ // chats' newest history, as a reload would) — never megabytes that a slow link cannot bring in time.
1996
+ ...(() => {
1997
+ const w = catchUpWindow(history ? visibleMessages(ctx, !!gatewayRequestContext(req), fresh ? history.after(0) : history.replayFor(parseLastEventId(after))) : []);
1998
+ return w.truncated ? { messages: w.messages, truncated: true } : { messages: w.messages };
1999
+ })(),
1995
2000
  // The ticks too, so polling never has to re-read a chat's history — that read would count as the person's
1996
2001
  // activity; this poll does not (isPassiveWebRead).
1997
2002
  deliveries: history ? history.deliveries() : [],