litepaseo 0.3.1 → 0.4.1

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 (108) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/README.md +48 -14
  3. package/dist/server/cli.mjs +271 -8
  4. package/dist/web/assets/{CodeBlockNode-fLbELjCG.js → CodeBlockNode-fA2JfqDc.js} +1 -1
  5. package/dist/web/assets/CodeBlockNode-fA2JfqDc.js.br +0 -0
  6. package/dist/web/assets/CodeBlockNode-fA2JfqDc.js.gz +0 -0
  7. package/dist/web/assets/FileViewer-BNuFtV2I.js +2 -0
  8. package/dist/web/assets/FileViewer-BNuFtV2I.js.br +0 -0
  9. package/dist/web/assets/FileViewer-BNuFtV2I.js.gz +0 -0
  10. package/dist/web/assets/FileViewer-T756VVq4.css +1 -0
  11. package/dist/web/assets/FileViewer-T756VVq4.css.br +0 -0
  12. package/dist/web/assets/FileViewer-T756VVq4.css.gz +0 -0
  13. package/dist/web/assets/{FilesPanel-B1YfdWK8.js → FilesPanel-DSjOF49-.js} +1 -1
  14. package/dist/web/assets/FilesPanel-DSjOF49-.js.br +0 -0
  15. package/dist/web/assets/FilesPanel-DSjOF49-.js.gz +0 -0
  16. package/dist/web/assets/MarkdownMessage-D-TUJHkh.js +199 -0
  17. package/dist/web/assets/MarkdownMessage-D-TUJHkh.js.br +0 -0
  18. package/dist/web/assets/MarkdownMessage-D-TUJHkh.js.gz +0 -0
  19. package/dist/web/assets/{PreCodeBlock-3ozveRNf.js → PreCodeBlock-BW4D63KE.js} +1 -1
  20. package/dist/web/assets/{PreCodeBlock.vue_vue_type_style_index_0_lang-BPnMZFbo.js → PreCodeBlock.vue_vue_type_style_index_0_lang-D4scN_Wl.js} +1 -1
  21. package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-D4scN_Wl.js.br +0 -0
  22. package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-D4scN_Wl.js.gz +0 -0
  23. package/dist/web/assets/{TerminalPanel-BR2okuCE.js → TerminalPanel-CmsmhtfJ.js} +1 -1
  24. package/dist/web/assets/TerminalPanel-CmsmhtfJ.js.br +0 -0
  25. package/dist/web/assets/TerminalPanel-CmsmhtfJ.js.gz +0 -0
  26. package/dist/web/assets/{Tooltip-Dh7ELGI1.js → Tooltip-BQL5bLOR.js} +1 -1
  27. package/dist/web/assets/Tooltip-BQL5bLOR.js.br +0 -0
  28. package/dist/web/assets/Tooltip-BQL5bLOR.js.gz +0 -0
  29. package/dist/web/assets/highlight-BnTrj1LT.js +5 -0
  30. package/dist/web/assets/highlight-BnTrj1LT.js.br +0 -0
  31. package/dist/web/assets/highlight-BnTrj1LT.js.gz +0 -0
  32. package/dist/web/assets/index-B0E-zIZw.js +32 -0
  33. package/dist/web/assets/index-B0E-zIZw.js.br +0 -0
  34. package/dist/web/assets/index-B0E-zIZw.js.gz +0 -0
  35. package/dist/web/assets/index-Dzid_5f9.css +1 -0
  36. package/dist/web/assets/index-Dzid_5f9.css.br +0 -0
  37. package/dist/web/assets/index-Dzid_5f9.css.gz +0 -0
  38. package/dist/web/assets/{index10-BXOnBXXV.js → index10-D4jsjrRO.js} +1 -1
  39. package/dist/web/assets/index10-D4jsjrRO.js.br +0 -0
  40. package/dist/web/assets/index10-D4jsjrRO.js.gz +0 -0
  41. package/dist/web/assets/index3-CnYNShe0.js +1 -0
  42. package/dist/web/assets/index4-C7heBMis.js +1 -0
  43. package/dist/web/assets/{index5-BrR0S3K6.js → index5-C3CXhRn6.js} +1 -1
  44. package/dist/web/assets/index5-C3CXhRn6.js.br +0 -0
  45. package/dist/web/assets/index5-C3CXhRn6.js.gz +0 -0
  46. package/dist/web/assets/{index6-DWBoE2gM.js → index6-cJmwBOxX.js} +1 -1
  47. package/dist/web/assets/index6-cJmwBOxX.js.br +0 -0
  48. package/dist/web/assets/index6-cJmwBOxX.js.gz +0 -0
  49. package/dist/web/assets/{index7-CoJTOvQ5.js → index7-CzuTZoqm.js} +1 -1
  50. package/dist/web/assets/index7-CzuTZoqm.js.br +0 -0
  51. package/dist/web/assets/index7-CzuTZoqm.js.gz +0 -0
  52. package/dist/web/assets/{index8-CQGhir4p.js → index8-COvW1lHu.js} +1 -1
  53. package/dist/web/assets/index8-COvW1lHu.js.br +0 -0
  54. package/dist/web/assets/index8-COvW1lHu.js.gz +0 -0
  55. package/dist/web/assets/{index9-D_kItRZJ.js → index9-CJgpHg38.js} +1 -1
  56. package/dist/web/assets/index9-CJgpHg38.js.br +0 -0
  57. package/dist/web/assets/index9-CJgpHg38.js.gz +0 -0
  58. package/dist/web/assets/rolldown-runtime-XKyaHtl9.js +1 -0
  59. package/dist/web/assets/vue.runtime.esm-bundler-DwGo9CTz.js +4 -0
  60. package/dist/web/assets/vue.runtime.esm-bundler-DwGo9CTz.js.br +0 -0
  61. package/dist/web/assets/vue.runtime.esm-bundler-DwGo9CTz.js.gz +0 -0
  62. package/dist/web/index.html +4 -3
  63. package/dist/web/index.html.br +0 -0
  64. package/dist/web/index.html.gz +0 -0
  65. package/docs/markstream-integration-validation.md +3 -2
  66. package/package.json +3 -2
  67. package/dist/web/assets/CodeBlockNode-fLbELjCG.js.br +0 -0
  68. package/dist/web/assets/CodeBlockNode-fLbELjCG.js.gz +0 -0
  69. package/dist/web/assets/FileViewer-C7zGfiFt.js +0 -2
  70. package/dist/web/assets/FileViewer-C7zGfiFt.js.br +0 -0
  71. package/dist/web/assets/FileViewer-C7zGfiFt.js.gz +0 -0
  72. package/dist/web/assets/FileViewer-CljYTF8J.css +0 -1
  73. package/dist/web/assets/FileViewer-CljYTF8J.css.br +0 -0
  74. package/dist/web/assets/FileViewer-CljYTF8J.css.gz +0 -0
  75. package/dist/web/assets/FilesPanel-B1YfdWK8.js.br +0 -0
  76. package/dist/web/assets/FilesPanel-B1YfdWK8.js.gz +0 -0
  77. package/dist/web/assets/MarkdownMessage-C30PkBRA.js +0 -199
  78. package/dist/web/assets/MarkdownMessage-C30PkBRA.js.br +0 -0
  79. package/dist/web/assets/MarkdownMessage-C30PkBRA.js.gz +0 -0
  80. package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-BPnMZFbo.js.br +0 -0
  81. package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-BPnMZFbo.js.gz +0 -0
  82. package/dist/web/assets/TerminalPanel-BR2okuCE.js.br +0 -0
  83. package/dist/web/assets/TerminalPanel-BR2okuCE.js.gz +0 -0
  84. package/dist/web/assets/Tooltip-Dh7ELGI1.js.br +0 -0
  85. package/dist/web/assets/Tooltip-Dh7ELGI1.js.gz +0 -0
  86. package/dist/web/assets/index-BJ4CkuXT.js +0 -30
  87. package/dist/web/assets/index-BJ4CkuXT.js.br +0 -0
  88. package/dist/web/assets/index-BJ4CkuXT.js.gz +0 -0
  89. package/dist/web/assets/index-CaFqUnEO.css +0 -1
  90. package/dist/web/assets/index-CaFqUnEO.css.br +0 -0
  91. package/dist/web/assets/index-CaFqUnEO.css.gz +0 -0
  92. package/dist/web/assets/index10-BXOnBXXV.js.br +0 -0
  93. package/dist/web/assets/index10-BXOnBXXV.js.gz +0 -0
  94. package/dist/web/assets/index3-C1CbKHXb.js +0 -1
  95. package/dist/web/assets/index4-CE4EA6Rx.js +0 -1
  96. package/dist/web/assets/index5-BrR0S3K6.js.br +0 -0
  97. package/dist/web/assets/index5-BrR0S3K6.js.gz +0 -0
  98. package/dist/web/assets/index6-DWBoE2gM.js.br +0 -0
  99. package/dist/web/assets/index6-DWBoE2gM.js.gz +0 -0
  100. package/dist/web/assets/index7-CoJTOvQ5.js.br +0 -0
  101. package/dist/web/assets/index7-CoJTOvQ5.js.gz +0 -0
  102. package/dist/web/assets/index8-CQGhir4p.js.br +0 -0
  103. package/dist/web/assets/index8-CQGhir4p.js.gz +0 -0
  104. package/dist/web/assets/index9-D_kItRZJ.js.br +0 -0
  105. package/dist/web/assets/index9-D_kItRZJ.js.gz +0 -0
  106. package/dist/web/assets/vue.runtime.esm-bundler-D6xZ1zFq.js +0 -4
  107. package/dist/web/assets/vue.runtime.esm-bundler-D6xZ1zFq.js.br +0 -0
  108. package/dist/web/assets/vue.runtime.esm-bundler-D6xZ1zFq.js.gz +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,58 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.1
4
+
5
+ ### Task board
6
+
7
+ - A new task no longer links itself to whichever conversation was last open. Choose a
8
+ conversation when adding the task (none by default), or link one later from the card.
9
+ - Cards name the conversation they link to, can be unlinked, and say when the conversation
10
+ is no longer available.
11
+ - Tasks open in a detail view: rename them, write a Markdown description, add and delete
12
+ comments, change the column or the linked conversation, or delete the task. Cards show a
13
+ line of the description and the comment count.
14
+ - Task edits are saved per task, so two open tabs no longer overwrite each other's changes.
15
+
16
+ **Upgrading from 0.4.0:** existing tasks keep their columns and links. A task that was linked
17
+ automatically to the wrong conversation can now be unlinked from its card.
18
+
19
+ ## 0.4.0
20
+
21
+ ### Conversation
22
+
23
+ - Messages sent while a turn runs (the **Queue** setting, formerly Steer) wait in a list above
24
+ the composer instead of appearing in the conversation. Each can be edited, removed, or sent at
25
+ once with **Interrupt**; the rest go one per turn when the agent finishes. Queued messages
26
+ stay in the open tab, which warns before closing while any are waiting.
27
+ - Code blocks and opened files are syntax highlighted (highlight.js, common languages, loaded
28
+ on demand; very large text stays plain).
29
+ - Long conversations load earlier and newer messages as you scroll, and return to the live
30
+ tail at the bottom, instead of asking for a click per page. Only about 150 rows stay mounted.
31
+ - Outline rail, as in Paseo: one tick per prompt along the left edge of a wide conversation.
32
+ Resting on it previews the prompt; clicking jumps there, even far back in history.
33
+ - Rewind from a user message (hover it): rewind the conversation, the files, or both, as the
34
+ agent's provider supports. The rewound prompt returns to an empty composer.
35
+ - Finished turns show Copy, the model, the finish time and how long the turn took, with icons,
36
+ as in Paseo. User messages show their time and a copy button on hover.
37
+
38
+ ### Settings without environment variables
39
+
40
+ - `litepaseo config` shows the port, listening address and push contact, and where each value
41
+ comes from. `litepaseo config set <key> <value>` saves one; it applies on every start and is
42
+ included in backups. `LITEPASEO_PORT`, `LITEPASEO_BIND` and `LITEPASEO_PUSH_SUBJECT` still
43
+ work and override the saved value for that run.
44
+
45
+ ### Notifications
46
+
47
+ - In Brave, turning notifications on no longer fails with a bare "push service error": Settings
48
+ says to enable **Use Google services for push messaging** in `brave://settings/privacy`. Other
49
+ browsers that cannot reach their push service get a short explanation too.
50
+
51
+ **Upgrading from 0.3.x:** no data migration; drafts, boards and settings are kept. The
52
+ outline rail needs a Paseo daemon with the prompt index (older daemons simply show no rail),
53
+ and Rewind appears only for providers that support it. The composer's **Steer** setting is
54
+ now called **Queue**: messages wait in this tab until the running turn ends.
55
+
3
56
  ## 0.3.1
4
57
 
5
58
  ### Faster voice input
package/README.md CHANGED
@@ -45,10 +45,17 @@ package, with no separate database service to deploy.
45
45
  - Manage conversations across multiple Paseo hosts in one place.
46
46
  - Create sessions, choose a provider/model, send messages, stop turns, and answer
47
47
  permission requests or structured questions.
48
+ - Queue messages while an agent works, then edit, drop or send one at once as an
49
+ interrupt; rewind a conversation (and, where the provider supports it, its files)
50
+ to an earlier message.
51
+ - Read long conversations without clicking through pages: history loads as you
52
+ scroll, an outline rail previews and jumps to any prompt, and code is
53
+ syntax highlighted.
48
54
  - Attach files and images, with previews and upload status.
49
55
  - Dictate messages through one OpenAI-compatible speech-to-text service set up in
50
56
  LitePaseo, rather than configuring each Paseo host.
51
- - Keep a Todo / Doing / Done board linked to conversations.
57
+ - Keep a Todo / Doing / Done board of tasks with Markdown descriptions and comments,
58
+ each optionally linked to a conversation.
52
59
  - Receive notifications when an agent needs input or finishes, and install the
53
60
  console as a phone or desktop web app.
54
61
  - Keep drafts across reloads and check uncertain message delivery without
@@ -101,8 +108,21 @@ responses (SSE) without buffering.
101
108
  Open your HTTPS address and install from the browser's menu. On iPhone/iPad,
102
109
  use Safari → Share → **Add to Home Screen**, then open the installed app to enable
103
110
  push notifications. Turn them on in **Settings → Notifications** to hear when an
104
- agent needs input or finishes. Set `LITEPASEO_PUSH_SUBJECT=mailto:you@example.com`
105
- before starting the server for Apple push delivery.
111
+ agent needs input or finishes. For Apple devices, set a contact once with
112
+ `litepaseo config set push-subject mailto:you@example.com` and restart (see
113
+ [Configuration](#configuration)).
114
+
115
+ If turning notifications on fails with **"Registration failed - push service error"**,
116
+ the browser could not reach its own push service; LitePaseo is not involved yet.
117
+
118
+ - **Brave** disables push by default. Open `brave://settings/privacy`, turn on
119
+ **Use Google services for push messaging**, restart Brave, and try again.
120
+ - **Chromium builds without Google services** (many Linux distribution packages,
121
+ ungoogled-chromium) cannot receive Web Push. Use Google Chrome, Edge or Firefox.
122
+ - **Chrome or Edge**: open `chrome://gcm-internals` (`edge://gcm-internals`). If
123
+ **Connection State** is not `CONNECTED`, a proxy, VPN or firewall is blocking the push
124
+ service (Chrome needs `mtalk.google.com:5228` and `fcm.googleapis.com`).
125
+ - Private and incognito windows do not support push.
106
126
 
107
127
  Optional two-factor sign-in is under **Settings → Authenticator code**; signed-in
108
128
  devices can be revoked in Settings. If you lose your authenticator, run
@@ -165,21 +185,35 @@ Reinstall the service after changing its environment settings or Node/CLI paths.
165
185
 
166
186
  ### Configuration
167
187
 
168
- Set these variables before starting LitePaseo:
169
-
170
- | Variable | Default | Purpose |
171
- | --- | --- | --- |
172
- | `LITEPASEO_PORT` | `8787` | HTTP port |
173
- | `LITEPASEO_BIND` | `127.0.0.1` | Listening address |
174
- | `LITEPASEO_HOME` | `~/.litepaseo` | Application data directory |
175
- | `LITEPASEO_PUSH_SUBJECT` | — | Contact URL or `mailto:` address for push services |
176
-
177
- For example:
188
+ Save settings once with `litepaseo config`; they apply on every start and are
189
+ included in backups:
178
190
 
179
191
  ```sh
180
- LITEPASEO_PORT=9000 litepaseo start
192
+ litepaseo config # show settings and where each comes from
193
+ litepaseo config set push-subject mailto:you@example.com
194
+ litepaseo config set port 9000
195
+ litepaseo config unset port # back to the default
196
+ litepaseo restart # apply (or: litepaseo service restart)
181
197
  ```
182
198
 
199
+ | Key | Default | Purpose | Environment override |
200
+ | --- | --- | --- | --- |
201
+ | `port` | `8787` | HTTP port | `LITEPASEO_PORT` |
202
+ | `bind` | `127.0.0.1` | Listening address | `LITEPASEO_BIND` |
203
+ | `push-subject` | `mailto:litepaseo@example.com` | Contact for push services (see below) | `LITEPASEO_PUSH_SUBJECT` |
204
+
205
+ An environment variable, when set, wins over the saved value for that run.
206
+ `LITEPASEO_HOME` (default `~/.litepaseo`) chooses the data directory itself, so it
207
+ is only an environment variable.
208
+
209
+ **`push-subject`** is the contact address LitePaseo includes, signed, when it hands a
210
+ notification to Apple, Google or Mozilla. They use it only to reach whoever runs
211
+ the server if its notifications cause problems. It is never shown to anyone or
212
+ emailed, and it does not have to be personal: any `mailto:` address or `https://`
213
+ page you control works, such as your console's own address
214
+ (`https://agents.example.com`). Replace the placeholder default with a real one;
215
+ Apple is the strictest of the push services about this value.
216
+
183
217
  LitePaseo's data directory contains credentials and settings. Conversation
184
218
  history stays on your daemons, and drafts stay in browser storage.
185
219
 
@@ -23,7 +23,7 @@ import webpush from "web-push";
23
23
  import WebSocket, { WebSocketServer } from "ws";
24
24
  import { fileURLToPath } from "node:url";
25
25
  // src/server/version.ts
26
- const VERSION = "0.3.1";
26
+ const VERSION = "0.4.1";
27
27
  // src/server/rotating-log.ts
28
28
  /** One writer (the supervisor); bounded active file plus numbered archives. */
29
29
  var RotatingLog = class {
@@ -572,6 +572,19 @@ var Store = class {
572
572
  cards: JSON.parse(String(row.cards))
573
573
  };
574
574
  }
575
+ /**
576
+ * Read-modify-write of one card, at the current revision (synchronous, so nothing interleaves).
577
+ * `change` returns the new card, or null to leave the board untouched. False: no such card.
578
+ */
579
+ updateCard(id, change) {
580
+ const { revision, cards } = this.board();
581
+ const index = cards.findIndex((c) => c.id === id);
582
+ if (index < 0) return false;
583
+ const next = change(cards[index]);
584
+ if (!next) return true;
585
+ cards[index] = next;
586
+ return this.saveBoard(revision, cards);
587
+ }
575
588
  saveBoard(revision, cards) {
576
589
  return this.db.prepare("UPDATE board SET revision=revision+1,cards=? WHERE id=1 AND revision=?").run(JSON.stringify(cards), revision).changes === 1;
577
590
  }
@@ -984,9 +997,19 @@ function summarize(hostId, agent, project, activity = time(agent.updatedAt)) {
984
997
  thinking: agent.effectiveThinkingOptionId ?? agent.thinkingOptionId ?? agent.runtimeInfo?.thinkingOptionId ?? null,
985
998
  modeId: agent.currentModeId ?? null,
986
999
  contextUsed: agent.lastUsage?.contextWindowUsedTokens ?? null,
987
- contextMax: agent.lastUsage?.contextWindowMaxTokens ?? null
1000
+ contextMax: agent.lastUsage?.contextWindowMaxTokens ?? null,
1001
+ rewind: rewindModes(agent.capabilities)
988
1002
  };
989
1003
  }
1004
+ /** The rewind modes a provider supports, in Paseo's menu order. */
1005
+ function rewindModes(capabilities) {
1006
+ const c = capabilities ?? {};
1007
+ const modes = [];
1008
+ if (c.supportsRewindConversation === true) modes.push("conversation");
1009
+ if (c.supportsRewindFiles === true) modes.push("files");
1010
+ if (c.supportsRewindBoth === true) modes.push("both");
1011
+ return modes;
1012
+ }
990
1013
  const agentAdapter = {
991
1014
  updateType: "agent_update",
992
1015
  base: { scope: "active" },
@@ -3488,6 +3511,13 @@ function parseJson(text) {
3488
3511
  return null;
3489
3512
  }
3490
3513
  }
3514
+ const CARD_DESCRIPTION_MAX = 2e4;
3515
+ const CARD_COMMENT_MAX = 5e3;
3516
+ const cardComment = z.object({
3517
+ id: z.string().uuid(),
3518
+ text: z.string().trim().min(1).max(CARD_COMMENT_MAX),
3519
+ at: z.number().int().nonnegative()
3520
+ });
3491
3521
  const card = z.object({
3492
3522
  id: z.string().uuid(),
3493
3523
  title: z.string().min(1).max(300),
@@ -3497,8 +3527,26 @@ const card = z.object({
3497
3527
  "Done"
3498
3528
  ]),
3499
3529
  hostId: z.string().nullable(),
3500
- agentId: z.string().nullable()
3530
+ agentId: z.string().nullable(),
3531
+ description: z.string().max(CARD_DESCRIPTION_MAX).optional(),
3532
+ comments: z.array(cardComment).max(200).optional(),
3533
+ createdAt: z.number().int().nonnegative().optional(),
3534
+ updatedAt: z.number().int().nonnegative().optional()
3501
3535
  }).refine((c) => c.hostId === null === (c.agentId === null));
3536
+ /** One card's editable fields; omitted fields are left as they are. */
3537
+ const cardPatch = z.object({
3538
+ title: z.string().trim().min(1).max(300),
3539
+ column: z.enum([
3540
+ "Todo",
3541
+ "Doing",
3542
+ "Done"
3543
+ ]),
3544
+ description: z.string().max(CARD_DESCRIPTION_MAX),
3545
+ link: z.object({
3546
+ hostId: z.string(),
3547
+ agentId: z.string()
3548
+ }).nullable()
3549
+ }).partial();
3502
3550
  const SESSION_COOKIE = "lp_session";
3503
3551
  /** Cookie-authenticated writes must carry this header; a cross-site form or image cannot. */
3504
3552
  const CSRF_HEADER = "x-litepaseo";
@@ -3987,6 +4035,46 @@ function createApp(store, hosts, token, webRoot, options = {}) {
3987
4035
  }))
3988
4036
  });
3989
4037
  });
4038
+ /** The conversation's user prompts (seq + short preview), for the outline rail. */
4039
+ app.get("/api/hosts/:host/agents/:agent/timeline/prompts", async (c) => {
4040
+ const client = hosts.get(c.req.param("host"));
4041
+ try {
4042
+ const page = await client.driver.listAgentTimelinePrompts(c.req.param("agent"), { timeout: 15e3 });
4043
+ return c.json({
4044
+ epoch: page.epoch,
4045
+ prompts: page.prompts.map((p) => ({
4046
+ seq: p.seq,
4047
+ preview: p.preview.replace(/\s+/g, " ").trim().slice(0, 240)
4048
+ }))
4049
+ });
4050
+ } catch (error) {
4051
+ return c.json({ error: error.message || "Prompt index unavailable" }, 501);
4052
+ }
4053
+ });
4054
+ /**
4055
+ * Rewinds to just before a user message: the conversation, the tracked files, or both, as
4056
+ * the provider supports. Cannot be undone; the timeline is replaced (new epoch) on success.
4057
+ */
4058
+ app.post("/api/hosts/:host/agents/:agent/rewind", async (c) => {
4059
+ const { messageId, mode } = z.object({
4060
+ messageId: z.string().min(1).max(500),
4061
+ mode: z.enum([
4062
+ "conversation",
4063
+ "files",
4064
+ "both"
4065
+ ])
4066
+ }).parse(await c.req.json());
4067
+ const client = hosts.get(c.req.param("host"));
4068
+ const facts = client.directory.facts(c.req.param("agent"));
4069
+ if (!facts) return c.json({ error: "Unknown agent" }, 404);
4070
+ if (!rewindModes(facts.capabilities).includes(mode)) return c.json({ error: "This agent cannot rewind that way." }, 400);
4071
+ try {
4072
+ await client.driver.rewindAgent(c.req.param("agent"), messageId, mode);
4073
+ return c.json({ ok: true });
4074
+ } catch (error) {
4075
+ return c.json({ error: error.message || "Rewind failed" }, 502);
4076
+ }
4077
+ });
3990
4078
  /**
3991
4079
  * An image an agent referenced in a message (`![](file:///…)`, an absolute or workspace path).
3992
4080
  * Workspace files go through the daemon's file API; images the daemon materialized from
@@ -4296,6 +4384,49 @@ function createApp(store, hosts, token, webRoot, options = {}) {
4296
4384
  if (!store.saveBoard(b.revision, b.cards)) return c.json({ error: "Board changed. Reload before editing." }, 409);
4297
4385
  return c.json(store.board());
4298
4386
  });
4387
+ const cardEdit = (id, change) => store.updateCard(id, change) ? store.board() : null;
4388
+ app.patch("/api/board/cards/:id", async (c) => {
4389
+ const p = cardPatch.parse(await c.req.json());
4390
+ const board = cardEdit(c.req.param("id"), (card) => ({
4391
+ ...card,
4392
+ ...p.title !== void 0 ? { title: p.title } : {},
4393
+ ...p.column !== void 0 ? { column: p.column } : {},
4394
+ ...p.description !== void 0 ? { description: p.description } : {},
4395
+ ...p.link !== void 0 ? {
4396
+ hostId: p.link?.hostId ?? null,
4397
+ agentId: p.link?.agentId ?? null
4398
+ } : {},
4399
+ updatedAt: Date.now()
4400
+ }));
4401
+ return board ? c.json(board) : c.json({ error: "Task not found" }, 404);
4402
+ });
4403
+ app.post("/api/board/cards/:id/comments", async (c) => {
4404
+ const { text } = z.object({ text: z.string().trim().min(1).max(CARD_COMMENT_MAX) }).parse(await c.req.json());
4405
+ let full = false;
4406
+ const board = cardEdit(c.req.param("id"), (card) => {
4407
+ const comments = card.comments ?? [];
4408
+ if (comments.length >= 200) return full = true, null;
4409
+ return {
4410
+ ...card,
4411
+ comments: [...comments, {
4412
+ id: randomUUID(),
4413
+ text,
4414
+ at: Date.now()
4415
+ }],
4416
+ updatedAt: Date.now()
4417
+ };
4418
+ });
4419
+ if (full) return c.json({ error: `A task holds up to 200 comments.` }, 400);
4420
+ return board ? c.json(board, 201) : c.json({ error: "Task not found" }, 404);
4421
+ });
4422
+ app.delete("/api/board/cards/:id/comments/:comment", (c) => {
4423
+ const board = cardEdit(c.req.param("id"), (card) => ({
4424
+ ...card,
4425
+ comments: (card.comments ?? []).filter((m) => m.id !== c.req.param("comment")),
4426
+ updatedAt: Date.now()
4427
+ }));
4428
+ return board ? c.json(board) : c.json({ error: "Task not found" }, 404);
4429
+ });
4299
4430
  app.all("/api/*", (c) => c.json({ error: "Not found" }, 404));
4300
4431
  for (const [file, type] of [["sw.js", "text/javascript; charset=utf-8"], ["manifest.webmanifest", "application/manifest+json"]]) app.get("/" + file, (c) => {
4301
4432
  try {
@@ -4333,6 +4464,75 @@ function createApp(store, hosts, token, webRoot, options = {}) {
4333
4464
  }
4334
4465
  });
4335
4466
  }
4467
+ // src/server/config.ts
4468
+ /**
4469
+ * Settings that used to need an environment variable on every start. `litepaseo config set`
4470
+ * saves them with the rest of LitePaseo's data (so backups carry them); an environment
4471
+ * variable, when present, still wins for that run.
4472
+ */
4473
+ const CONFIG_KEYS = {
4474
+ port: {
4475
+ env: "LITEPASEO_PORT",
4476
+ fallback: "8787",
4477
+ summary: "Port the web console listens on",
4478
+ check: (value) => /^\d+$/.test(value) && Number(value) >= 1 && Number(value) <= 65535 ? null : "Use a port number from 1 to 65535."
4479
+ },
4480
+ bind: {
4481
+ env: "LITEPASEO_BIND",
4482
+ fallback: "127.0.0.1",
4483
+ summary: "Address to listen on (keep 127.0.0.1 behind a tunnel)",
4484
+ check: (value) => /^[^\s/]{1,255}$/.test(value) ? null : "Use an IP address or host name, such as 127.0.0.1."
4485
+ },
4486
+ "push-subject": {
4487
+ env: "LITEPASEO_PUSH_SUBJECT",
4488
+ fallback: "mailto:litepaseo@example.com",
4489
+ summary: "Contact sent to push services (mailto: or https: URL)",
4490
+ check: (value) => {
4491
+ if (/^mailto:[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) return null;
4492
+ try {
4493
+ if (new URL(value).protocol === "https:") return null;
4494
+ } catch {}
4495
+ return "Use mailto:you@example.com or an https:// address you control.";
4496
+ }
4497
+ }
4498
+ };
4499
+ const configKeys = Object.keys(CONFIG_KEYS);
4500
+ const isConfigKey = (key) => Object.hasOwn(CONFIG_KEYS, key);
4501
+ const settingName = (key) => `config.${key}`;
4502
+ function setConfig(store, key, value) {
4503
+ if (value !== null) {
4504
+ const problem = CONFIG_KEYS[key].check(value);
4505
+ if (problem) throw new Error(problem);
4506
+ }
4507
+ store.setSetting(settingName(key), value);
4508
+ }
4509
+ /** The value in effect for each key: environment, then saved configuration, then the default. */
4510
+ function effectiveConfig(store, env) {
4511
+ const entries = configKeys.map((key) => {
4512
+ const { env: name, fallback } = CONFIG_KEYS[key];
4513
+ const saved = store.setting(settingName(key));
4514
+ const fromEnv = env[name];
4515
+ if (fromEnv !== void 0 && fromEnv !== "") return {
4516
+ key,
4517
+ value: fromEnv,
4518
+ source: "environment",
4519
+ saved
4520
+ };
4521
+ if (saved !== null) return {
4522
+ key,
4523
+ value: saved,
4524
+ source: "saved",
4525
+ saved
4526
+ };
4527
+ return {
4528
+ key,
4529
+ value: fallback,
4530
+ source: "default",
4531
+ saved
4532
+ };
4533
+ });
4534
+ return Object.fromEntries(entries.map((entry) => [entry.key, entry]));
4535
+ }
4336
4536
  // src/server/worker.ts
4337
4537
  async function runWorker(directory, webRoot) {
4338
4538
  if (!process.send) throw new Error("worker is an internal supervised command");
@@ -4347,8 +4547,9 @@ async function runWorker(directory, webRoot) {
4347
4547
  } catch {
4348
4548
  console.error("Could not initialize host", host.id);
4349
4549
  }
4350
- const port = Number(process.env.LITEPASEO_PORT ?? 8787), hostname = process.env.LITEPASEO_BIND ?? "127.0.0.1";
4351
- const app = createApp(store, hosts, tokenFile(tokenPath), webRoot, { pushSubject: process.env.LITEPASEO_PUSH_SUBJECT });
4550
+ const config = effectiveConfig(store, process.env);
4551
+ const port = Number(config.port.value), hostname = config.bind.value;
4552
+ const app = createApp(store, hosts, tokenFile(tokenPath), webRoot, { pushSubject: config["push-subject"].value });
4352
4553
  const server = serve({
4353
4554
  fetch: app.fetch,
4354
4555
  port,
@@ -4371,7 +4572,7 @@ async function runWorker(directory, webRoot) {
4371
4572
  process.once("SIGTERM", () => void shutdown());
4372
4573
  process.once("disconnect", () => void shutdown());
4373
4574
  server.once("error", (error) => {
4374
- const message = error.code === "EADDRINUSE" ? `Port ${port} on ${hostname} is already in use (set LITEPASEO_PORT to use another)` : error.code === "EACCES" ? `Not permitted to listen on ${hostname}:${port}` : error.message;
4575
+ const message = error.code === "EADDRINUSE" ? `Port ${port} on ${hostname} is already in use (choose another with: litepaseo config set port <number>)` : error.code === "EACCES" ? `Not permitted to listen on ${hostname}:${port}` : error.message;
4375
4576
  console.error(message);
4376
4577
  process.send?.({
4377
4578
  type: "fatal",
@@ -4545,6 +4746,7 @@ const json = {
4545
4746
  summary: "Print machine-readable JSON"
4546
4747
  };
4547
4748
  const TOKEN_ACTIONS = ["set", "rotate"];
4749
+ const CONFIG_ACTIONS = ["set", "unset"];
4548
4750
  const SERVICE_ACTIONS = [
4549
4751
  "print",
4550
4752
  "install",
@@ -4625,6 +4827,29 @@ const COMMANDS = [
4625
4827
  "litepaseo token rotate"
4626
4828
  ]
4627
4829
  },
4830
+ {
4831
+ name: "config",
4832
+ group: "Configuration",
4833
+ args: "[set|unset] [key] [value]",
4834
+ summary: "Show or change saved settings",
4835
+ details: [
4836
+ "Saved settings apply on every start, so environment variables are no longer needed.",
4837
+ "An environment variable still overrides its setting for that run.",
4838
+ "",
4839
+ "Keys:",
4840
+ " port port the web console listens on (8787)",
4841
+ " bind address to listen on (127.0.0.1; keep it behind a tunnel)",
4842
+ " push-subject contact for push services: mailto:you@example.com or an https:// URL",
4843
+ "",
4844
+ "Changes apply after 'litepaseo restart' (or 'litepaseo service restart')."
4845
+ ],
4846
+ flags: [json],
4847
+ examples: [
4848
+ "litepaseo config",
4849
+ "litepaseo config set push-subject mailto:you@example.com",
4850
+ "litepaseo config unset port"
4851
+ ]
4852
+ },
4628
4853
  {
4629
4854
  name: "totp-reset",
4630
4855
  group: "Sign-in",
@@ -4769,11 +4994,13 @@ function mainHelp(version, directory, s) {
4769
4994
  `${s.bold("Usage:")} litepaseo <command> [options]`
4770
4995
  ];
4771
4996
  const groups = [...new Set(COMMANDS.map((c) => c.group))];
4997
+ const label = (c) => c.name + (c.args ? " " + c.args : "");
4998
+ const width = Math.max(22, ...COMMANDS.map((c) => label(c).length + 2));
4772
4999
  for (const group of groups) {
4773
5000
  lines.push("", s.bold(group));
4774
- for (const c of COMMANDS.filter((x) => x.group === group)) lines.push(` ${s.cyan((c.name + (c.args ? " " + c.args : "")).padEnd(22))}${c.summary}`);
5001
+ for (const c of COMMANDS.filter((x) => x.group === group)) lines.push(` ${s.cyan(label(c).padEnd(width))}${c.summary}`);
4775
5002
  }
4776
- lines.push("", s.bold("Options"), ` ${s.cyan("-h, --help".padEnd(22))}Show help (also after a command)`, ` ${s.cyan("-v, --version".padEnd(22))}Print the version`, "", s.bold("Environment"), ` ${s.cyan("LITEPASEO_HOME".padEnd(24))}Data directory ${s.dim(`(now ${directory})`)}`, ` ${s.cyan("LITEPASEO_PORT".padEnd(24))}Port ${s.dim("(8787)")}`, ` ${s.cyan("LITEPASEO_BIND".padEnd(24))}Listen address ${s.dim("(127.0.0.1)")}`, ` ${s.cyan("LITEPASEO_PUSH_SUBJECT".padEnd(24))}mailto: or https: contact for push services`, "", `Run ${s.bold("litepaseo help <command>")} for details on a command.`);
5003
+ lines.push("", s.bold("Options"), ` ${s.cyan("-h, --help".padEnd(22))}Show help (also after a command)`, ` ${s.cyan("-v, --version".padEnd(22))}Print the version`, "", `${s.bold("Environment")} ${s.dim("(overrides 'litepaseo config' for one run)")}`, ` ${s.cyan("LITEPASEO_HOME".padEnd(24))}Data directory ${s.dim(`(now ${directory})`)}`, ` ${s.cyan("LITEPASEO_PORT".padEnd(24))}Port ${s.dim("(8787)")}`, ` ${s.cyan("LITEPASEO_BIND".padEnd(24))}Listen address ${s.dim("(127.0.0.1)")}`, ` ${s.cyan("LITEPASEO_PUSH_SUBJECT".padEnd(24))}mailto: or https: contact for push services`, "", `Run ${s.bold("litepaseo help <command>")} for details on a command.`);
4777
5004
  return lines.join("\n");
4778
5005
  }
4779
5006
  function commandHelp(c, s) {
@@ -5037,6 +5264,41 @@ async function token(paths, action) {
5037
5264
  const note = running && versionNote(running, VERSION, err);
5038
5265
  if (note) console.error(note);
5039
5266
  }
5267
+ async function config(paths, args) {
5268
+ const [action, key, value] = args.positional;
5269
+ const store = new Store(paths.directory);
5270
+ try {
5271
+ if (action === void 0) {
5272
+ const entries = Object.values(effectiveConfig(store, process.env));
5273
+ if (args.flags.json) return console.log(JSON.stringify(Object.fromEntries(entries.map((e) => [e.key, {
5274
+ value: e.value,
5275
+ source: e.source
5276
+ }]))));
5277
+ for (const entry of entries) {
5278
+ const note = entry.source === "environment" ? `from ${CONFIG_KEYS[entry.key].env}${entry.saved !== null ? `, overriding saved ${entry.saved}` : ""}` : entry.source;
5279
+ console.log(`${out.cyan(entry.key.padEnd(14))}${entry.value} ${out.dim(`(${note})`)}`);
5280
+ }
5281
+ return;
5282
+ }
5283
+ if (!CONFIG_ACTIONS.includes(action)) {
5284
+ const guess = suggest(action, CONFIG_ACTIONS);
5285
+ throw new UsageError(`Unknown config action '${action}'.${guess ? ` Did you mean '${guess}'?` : ""} Actions: ${CONFIG_ACTIONS.join(", ")}.`);
5286
+ }
5287
+ if (!key || !isConfigKey(key)) {
5288
+ const guess = key ? suggest(key, configKeys) : void 0;
5289
+ throw new UsageError(`${key ? `Unknown key '${key}'.` : "Missing key."}${guess ? ` Did you mean '${guess}'?` : ""} Keys: ${configKeys.join(", ")}.`);
5290
+ }
5291
+ if (action === "set" && value === void 0) throw new UsageError(`Missing value for '${key}'.`);
5292
+ if (action === "unset" && value !== void 0) throw new UsageError(`'unset' takes no value.`);
5293
+ setConfig(store, key, action === "set" ? value : null);
5294
+ const entry = effectiveConfig(store, process.env)[key];
5295
+ console.log(action === "set" ? `${key} saved: ${value}` : `${key} reset to the default: ${CONFIG_KEYS[key].fallback}`);
5296
+ if (entry.source === "environment") console.log(out.yellow(`! ${CONFIG_KEYS[key].env} is set in this shell and overrides it.`));
5297
+ } finally {
5298
+ store.close();
5299
+ }
5300
+ if (await status(paths)) console.log(out.dim(" Restart to apply: litepaseo restart (or litepaseo service restart)"));
5301
+ }
5040
5302
  async function version(args) {
5041
5303
  const paths = await dataDirectory();
5042
5304
  const state = await status(paths);
@@ -5096,6 +5358,7 @@ async function run() {
5096
5358
  case "logs": return logs(paths, args);
5097
5359
  case "serve": return supervise(paths.directory, fileURLToPath(import.meta.url));
5098
5360
  case "token": return token(paths, args.positional[0]);
5361
+ case "config": return config(paths, args);
5099
5362
  case "totp-reset":
5100
5363
  case "signout-all": {
5101
5364
  const store = new Store(paths.directory);