shapewall 0.2.3 → 0.2.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 (39) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/agent/package-lock.json +2 -2
  3. package/dist/client/assets/BoardChat-C0a3DDjv.js +28 -0
  4. package/dist/client/assets/ChecksPanel-BHWgwJWO.js +1 -0
  5. package/dist/client/assets/{History-CVVuuxUK.js → History-C01qLFpP.js} +1 -1
  6. package/dist/client/assets/{LocalSettings-CvlVtNY_.js → LocalSettings-B5gtfKEl.js} +1 -1
  7. package/dist/client/assets/{Management-DOJkFY_o.js → Management-BxEUZAmI.js} +1 -1
  8. package/dist/client/assets/QuickConnect-BzTM3UNO.js +1 -0
  9. package/dist/client/assets/{app-update-dialog-Dox9-LWv.js → app-update-dialog-BONq9YFp.js} +1 -1
  10. package/dist/client/assets/index-C1IsGdGs.js +29 -0
  11. package/dist/client/assets/index-DnsWelgZ.css +2 -0
  12. package/dist/client/build-info.json +1 -1
  13. package/dist/client/index.html +2 -2
  14. package/dist/client/sw.js +2 -2
  15. package/dist/console/assets/LocalAccountsApp-DtfTDbQg.js +1 -0
  16. package/dist/console/assets/LocalConsole-BPpsxDq_.js +1 -0
  17. package/dist/console/assets/app-update-dialog-o4QY_jL9.js +1 -0
  18. package/dist/console/assets/console-DeOji9Zv.css +2 -0
  19. package/dist/console/assets/console-MvFrlUCC.js +51 -0
  20. package/dist/console/build-info.json +1 -1
  21. package/dist/console/console.html +2 -2
  22. package/docs/design-system.md +13 -5
  23. package/docs/journeys.md +13 -1
  24. package/package.json +1 -1
  25. package/src/agent/backends/acp.js +12 -0
  26. package/src/agent/manage.js +1 -1
  27. package/src/agent/routes.js +52 -2
  28. package/src/agent/settings-events.js +103 -0
  29. package/src/agent/settings-routes.js +23 -1
  30. package/dist/client/assets/BoardChat-C88k4s-W.js +0 -28
  31. package/dist/client/assets/ChecksPanel-B54chcLA.js +0 -1
  32. package/dist/client/assets/QuickConnect-D40mj4Ry.js +0 -1
  33. package/dist/client/assets/index-CwvFfwU0.js +0 -29
  34. package/dist/client/assets/index-UIYSPHoh.css +0 -2
  35. package/dist/console/assets/LocalAccountsApp-4MtW1QlZ.js +0 -1
  36. package/dist/console/assets/LocalConsole-CgKqYa8i.js +0 -1
  37. package/dist/console/assets/app-update-dialog-S2Yyc7Pw.js +0 -1
  38. package/dist/console/assets/console-BPmBRIoz.js +0 -51
  39. package/dist/console/assets/console-DgVrGRMD.css +0 -2
@@ -1 +1 @@
1
- {"version":"0.2.3","revision":"d75d0acee17ca5e2b921a6d1309140b69c891e5c"}
1
+ {"version":"0.2.4","revision":"ba73528d10c3efa024fe504c3620ceb48e06012f"}
@@ -12,8 +12,8 @@
12
12
  <title>Shapewall</title>
13
13
  <!-- Saved light/dark mode and theme, before the first paint (see src/lib/theme.js). -->
14
14
  <script src="/_console/theme-boot.js"></script>
15
- <script type="module" crossorigin src="/_console/assets/console-BPmBRIoz.js"></script>
16
- <link rel="stylesheet" crossorigin href="/_console/assets/console-DgVrGRMD.css">
15
+ <script type="module" crossorigin src="/_console/assets/console-MvFrlUCC.js"></script>
16
+ <link rel="stylesheet" crossorigin href="/_console/assets/console-DeOji9Zv.css">
17
17
  </head>
18
18
  <body>
19
19
  <div id="root"></div>
@@ -113,13 +113,16 @@ not create hosted accounts, workspaces or memberships. Inside Console, Projects,
113
113
  contains identity and appearance rather than duplicate workspace navigation. The earlier `?settings=general` board link remains supported.
114
114
 
115
115
  The app sidebar (`AppRail`, `components/app-rail.jsx`) is a labelled menu when expanded and a rail of icons when collapsed. Collapsed,
116
- an icon with more behind it (the board's pages tree, the sections of the workspace or account you are in) opens a flyout beside the
116
+ an icon with more behind it (the board's Pages and Journeys, the sections of the workspace or account you are in) opens a flyout beside the
117
117
  rail instead of expanding the sidebar: on hover after 150 ms, closing 250 ms after the pointer leaves both the icon and the panel, so
118
118
  you can move into it; a click, tap, Enter, Space or ArrowRight opens it pinned and moves focus in. A choice in it, Escape (focus back on
119
119
  the icon), a click outside or Tab past its end closes it. It is a non-modal `role="dialog"` named after its icon, the expanded
120
120
  sidebar's width, on the Chrome layer (above the canvas and the comment thread, below dialogs and menus). Icons with nothing behind them
121
121
  keep their tooltip. Only the panel button and Ctrl/Cmd+B expand the sidebar. The hover timing and height rules are in
122
- `components/rail-flyout.js`.
122
+ `components/rail-flyout.js`. A rail icon can carry a dot (`dot`): the Journeys icon has one while a journey is open. On the board the
123
+ expanded sidebar puts a segmented `Tabs` switch, "Pages 26 | Journeys 6" with the counts as quiet text, where a single heading would
124
+ be, and shows the page tree (filter "Filter pages") or the journeys list (filter "Filter journeys", only past eight); the tab is
125
+ kept per browser (`board/SidebarNav.jsx`).
123
126
 
124
127
  App-level pieces outside the kit, in `client/src/components/`: `ProfileMenu` (the avatar menu: account items, the console's workspace
125
128
  switcher, View as in the demo, Appearance, and About Shapewall and updates) and `DemoBanner` (the demo's "viewing as" strip with Reset; in the console header a chip whose Reset is desktop only, on phones Reset the demo is in the profile menu).
@@ -130,14 +133,19 @@ scrolling keeps momentum and `scrollIntoView` on phones).
130
133
  ## The board toolbar
131
134
 
132
135
  On desktop the toolbar has three zones, the way canvas tools lay it out. Left, where you are and how you look at it: the board
133
- switcher, the screen-size toggle, View options and, on a local board, Capture with its status (otherwise the status dot sits by the
136
+ switcher, the screen-size toggle, Views (the journeys and what the canvas shows; an open journey's name and a clear button take
137
+ its place on the button) and, on a local board, Capture with its status (otherwise the status dot sits by the
134
138
  name). Centre, find: the "Go to page or journey" box, centred on the toolbar itself, 240 to 320 px wide. Right, act and open panels:
135
139
  the viewer note, Comment (the primary action: `soft` while comment mode is off, filled `default` with `aria-pressed="true"`
136
140
  while it is on, agreeing with the comment-mode banner), the Comments, Agent and Checks toggles as one tight group (`Toggle variant="flat"`:
137
141
  the open panel's toggle takes the selected chip look, none while the panel is closed), then Agent settings. Zones
138
142
  are 20 px apart, controls inside a zone 6 px, with no dividers. When it gets narrow, `client/src/board/toolbarFit.js` drops words in a
139
- fixed order (search to an icon, the panel toggles, View, then the screen-size toggle to icons with tooltips) and the board name
140
- truncates a little at each step, never below about 8 characters. Accessible names, shortcuts and tooltips never change.
143
+ fixed order (search to an icon, the panel toggles, Views (an open journey's name shortens first), then the screen-size toggle to icons with tooltips) and the board name
144
+ truncates a little at each step, never below about 8 characters. With a journey open its name matters more than the search: the
145
+ search is an icon from the start and the name takes the left zone's room, in full up to about 280 px; the icon leaves the centre line
146
+ before the name truncates, and only when the zones no longer fit side by side do the steps go on (the name keeps at least 128 px, then
147
+ 96, then Views becomes an icon). Its full name is the button's accessible name and is in its tooltip. Accessible names, shortcuts and
148
+ tooltips never change.
141
149
  `test/toolbar-fit.test.js` checks the order and that nothing overlaps from a 1024 px window with the widest sidebar up. The phone
142
150
  toolbar is a separate compact bar. `ToggleGroup` options take a `tooltip` for icon-only labels.
143
151
 
package/docs/journeys.md CHANGED
@@ -91,7 +91,7 @@ page id, any step after a page can be a fork:
91
91
 
92
92
  ## Journeys made on the board
93
93
 
94
- Pick **New journey** in the journey picker (on a phone: the **...** menu), then click pages in the order people visit them. Name the
94
+ Pick **New journey** in the toolbar's **Views** menu or the command palette (on a phone: the **...** menu), then click pages in the order people visit them. Name the
95
95
  journey and save. Journeys made this way are stored in `.shapewall/<board>/journeys.json`, with the same atomic writes and file lock as
96
96
  comments, and can be edited or deleted from the journey bar. If a page leaves the config, its steps drop out of the journey (a fork left
97
97
  with one branch becomes that branch's steps).
@@ -117,6 +117,18 @@ The same structure is in `shapewall journeys --json`, the MCP tool `list_journey
117
117
 
118
118
  ## Stepping through
119
119
 
120
+ Open a journey from any of these; they all show the same one:
121
+
122
+ - **Views** in the toolbar: its **Journeys** group lists every journey with its steps (or paths), and **None** shows all pages again.
123
+ With more than eight, the list scrolls and has a filter. While a journey is open the button shows its name, and its **x** leaves it.
124
+ - The sidebar: expanded, its **Pages | Journeys** switch; the **Journeys** tab lists **None** (show all pages) and every journey with
125
+ its steps, the open one highlighted, a filter past eight and **New journey** where you can make one. The tab you chose is kept in this
126
+ browser; opening a journey elsewhere does not switch it, but the **Journeys** tab shows a dot while one is open. Collapsed, the
127
+ **Journeys** icon (with the same dot) opens that list beside the rail.
128
+ - The command palette (Ctrl/Cmd+K): type the journey's name.
129
+ - **J** opens the next journey, **Shift+J** the previous one; past the last one the board shows all pages again.
130
+ - On a phone: the **...** menu's **Journeys** group.
131
+
120
132
  Selecting a journey highlights its pages with numbered badges, draws arrows between consecutive steps and fades everything else. The
121
133
  journey bar steps through it:
122
134
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shapewall",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Every page of your site on one zoomable wall: desktop and phone captures, sandboxed live HTML, and element-anchored comments your coding agent can read.",
5
5
  "license": "Apache-2.0 AND FSL-1.1-ALv2",
6
6
  "author": "Dan Baruch",
@@ -309,6 +309,13 @@ async function reserveProcessSlot(processPool, agent, signal, { evict = true } =
309
309
  if (signal?.aborted) throw new AgentError('agent_stopped', 'The agent start was cancelled.', 409)
310
310
  if (processPool.epoch !== epoch) throw new AgentError('agent_start', 'The server is stopping.')
311
311
  processPool.agents.add(agent)
312
+ processPool.changed?.()
313
+ }
314
+
315
+ // The pool's agents changed (one started, became ready or went away): the
316
+ // open views refetch the agents' states (routes.js processPool.changed).
317
+ function poolChanged(processPool) {
318
+ processPool?.changed?.()
312
319
  }
313
320
 
314
321
  // A queue a turn's events go into and the backend's stream reads from.
@@ -1300,6 +1307,7 @@ export function createAcpBackend(
1300
1307
  onGone: (item) => {
1301
1308
  if (item.stopped || !item.pid) processPool?.agents.delete(item)
1302
1309
  if (processes.get(item.thread) === item) processes.delete(item.thread)
1310
+ poolChanged(processPool)
1303
1311
  },
1304
1312
  })
1305
1313
  if (closed) throw new AgentError('agent_start', 'The server is stopping.')
@@ -1320,6 +1328,8 @@ export function createAcpBackend(
1320
1328
  } finally {
1321
1329
  starting.delete(agent)
1322
1330
  if (agent.stopped || !agent.pid) processPool?.agents.delete(agent)
1331
+ // Ready now, or gone.
1332
+ poolChanged(processPool)
1323
1333
  }
1324
1334
  if (closed) {
1325
1335
  agent.kill('shutdown')
@@ -1455,6 +1465,7 @@ export async function acpHandshake(settings, { env = process.env, root, timeoutM
1455
1465
  thread: 'doctor',
1456
1466
  onGone: (item) => {
1457
1467
  if (item.stopped || !item.pid) processPool?.agents.delete(item)
1468
+ poolChanged(processPool)
1458
1469
  },
1459
1470
  })
1460
1471
  try {
@@ -1469,5 +1480,6 @@ export async function acpHandshake(settings, { env = process.env, root, timeoutM
1469
1480
  // spawn can fail without an exit event; a dead child with no pid has
1470
1481
  // no process left to release its reservation through onGone.
1471
1482
  if (agent.stopped || !agent.pid) processPool?.agents.delete(agent)
1483
+ poolChanged(processPool)
1472
1484
  }
1473
1485
  }
@@ -38,7 +38,7 @@ export function createAgentManagement({ config, env = process.env, token = newSe
38
38
  if (!expires || expires < Date.now()) return fail(res, 404)
39
39
  res.redirect(303, `/#settings-token=${token}`)
40
40
  })
41
- app.use('/api', (req, res, next) => (/^\/agent\/settings(?:\/|$)/.test(req.path) ? next() : fail(res, 404)))
41
+ app.use('/api', (req, res, next) => (/^\/agent\/(?:settings(?:\/|$)|events$)/.test(req.path) ? next() : fail(res, 404)))
42
42
  app.use('/api/agent', agents)
43
43
  app.use('/api', (req, res) => fail(res, 404))
44
44
  app.use('/assets', express.static(path.join(clientDir, 'assets'), { index: false, dotfiles: 'deny' }))
@@ -1,6 +1,7 @@
1
1
  // /api/agent/*: the chat panel's API. JSON in, server-sent events out.
2
2
  //
3
3
  // GET /api/agent/status what chat is connected to (no secrets)
4
+ // GET /api/agent/events SSE: "agents" when the agent settings change (settings-events.js)
4
5
  // GET /api/agent/boards/:id/threads the viewer's chat history (?q= searches it)
5
6
  // GET /api/agent/boards/:id/threads/:thread one thread
6
7
  // POST /api/agent/boards/:id/threads/:thread/messages send a message (editOf: rerun from an edit; regenerate: a new answer); SSE back
@@ -37,6 +38,7 @@ import { createHash, randomBytes } from 'node:crypto'
37
38
  import express from 'express'
38
39
  import { addReply, getComment, listComments, setAgentStatus } from '../store.js'
39
40
  import { createBackend } from './backends/index.js'
41
+ import { AGENTS_EVENT, createSettingsEvents } from './settings-events.js'
40
42
  import { cleanChoices } from './backends/acp.js'
41
43
  import { createOptionsCache, withChoices } from './options-cache.js'
42
44
  import { authFiles } from '../config.js'
@@ -45,7 +47,7 @@ import { AgentError } from './errors.js'
45
47
  import { createAgentHealth } from './agent-health.js'
46
48
  import { beginAgentOperation } from './control.js'
47
49
  import { validateFiles, validateMentions } from './composer.js'
48
- import { profileForDefault, userAgentEntry } from './user-settings.js'
50
+ import { profileForDefault, userAgentEntry, userSettingsFile } from './user-settings.js'
49
51
  import { finishFix, projectChanged, projectSnapshot } from './feedback-loop.js'
50
52
  import { ownerMcpServers } from './owner-mcp.js'
51
53
  import { RUN_MS_MAX, commentIdOf, runTurn } from './run.js'
@@ -178,6 +180,13 @@ export function agentRouter({
178
180
  }) {
179
181
  const limit = { ...DEFAULT_LIMITS, ...limits }
180
182
  const router = express.Router()
183
+ // "Agents changed" for every open view: this server's settings routes and
184
+ // edits of the agents file from outside (settings-events.js).
185
+ const settingsEvents = createSettingsEvents({ file: userSettingsFile(env), watch: limit.watchSettings !== false })
186
+ router.settingsEvents = settingsEvents
187
+ // The open GET /events responses, ended on close.
188
+ const eventStreams = new Set()
189
+ let eventsClosed = false
181
190
  const settings = (profileId = null) => {
182
191
  const current = agentSettings(config, env, { acp, profileId })
183
192
  if (shared && !allowRemoteAgent && current.backend === 'acp' && current.configured) {
@@ -195,7 +204,14 @@ export function agentRouter({
195
204
  // processes) while the settings stay the same.
196
205
  let cached = null
197
206
  const backends = new Map()
198
- const processPool = { epoch: 0, agents: new Set(), max: Math.min(limit.runsMax, limit.acp?.processesMax ?? limit.runsMax) }
207
+ // `changed`: an agent process started, became ready or went away, which
208
+ // moves an agent's state ("Starting", "Ready"): the open views hear it.
209
+ const processPool = {
210
+ epoch: 0,
211
+ agents: new Set(),
212
+ max: Math.min(limit.runsMax, limit.acp?.processesMax ?? limit.runsMax),
213
+ changed: () => settingsEvents.changed('state'),
214
+ }
199
215
  // How each agent is doing (agent-health.js): from the last turn or test.
200
216
  const health = createAgentHealth()
201
217
  const agentStatus = (current) => health.status(current, processPool)
@@ -280,6 +296,11 @@ export function agentRouter({
280
296
  // Server shutdown: stop agent processes (src/server/app.js stopChildren).
281
297
  router.close = () => {
282
298
  processPool.epoch += 1
299
+ settingsEvents.close()
300
+ // An open events stream would hold the server open: end every one.
301
+ eventsClosed = true
302
+ for (const res of eventStreams) res.end()
303
+ eventStreams.clear()
283
304
  const settingsStopped = settingsApi.close()
284
305
  const owned = [...processPool.agents]
285
306
  for (const agent of owned) agent.kill('shutdown')
@@ -715,6 +736,34 @@ export function agentRouter({
715
736
 
716
737
  router.use(express.json({ limit: SMALL_BODY_LIMIT }))
717
738
 
739
+ // The agent settings changed (here, in another tab, or in the file): a
740
+ // nudge only, no settings in it; each view refetches what it shows.
741
+ router.get('/events', (req, res) => {
742
+ if (eventsClosed) return res.status(503).json({ error: { code: 'stopping', message: 'The server is stopping.' } })
743
+ res.writeHead(200, {
744
+ 'Content-Type': 'text/event-stream; charset=utf-8',
745
+ 'Cache-Control': 'no-store',
746
+ 'X-Accel-Buffering': 'no',
747
+ Connection: 'keep-alive',
748
+ })
749
+ res.flushHeaders?.()
750
+ res.write(': connected\n\n')
751
+ const stop = settingsEvents.subscribe((event) => {
752
+ if (!res.writableEnded) res.write(`event: ${AGENTS_EVENT}\ndata: ${JSON.stringify({ at: event.at })}\n\n`)
753
+ })
754
+ const keepalive = setInterval(() => {
755
+ if (!res.writableEnded) res.write(': ping\n\n')
756
+ }, limit.keepaliveMs)
757
+ keepalive.unref?.()
758
+ eventStreams.add(res)
759
+ const done = () => {
760
+ clearInterval(keepalive)
761
+ stop()
762
+ eventStreams.delete(res)
763
+ }
764
+ req.on('close', done)
765
+ res.on('finish', done)
766
+ })
718
767
  router.get('/status', (req, res) =>
719
768
  res.json({
720
769
  ...publicAgentInfo(settings()),
@@ -727,6 +776,7 @@ export function agentRouter({
727
776
  }),
728
777
  )
729
778
  const settingsApi = settingsRoutes({
779
+ events: settingsEvents,
730
780
  config,
731
781
  env,
732
782
  fetchImpl,
@@ -0,0 +1,103 @@
1
+ // "Agents changed": one event for every open view when the agent settings
2
+ // change, whoever changed them. Two sources:
3
+ // - this server's own settings routes (connect, remove, default, save):
4
+ // changed('settings') after each one;
5
+ // - the saved agents file itself (src/agent/user-settings.js), watched with
6
+ // fs.watch on its folder, for edits made outside this process
7
+ // (`shapewall settings`, another `shapewall serve`, a person or an agent
8
+ // editing the file).
9
+ // Changes inside `debounceMs` of each other become one event, so a route's
10
+ // own write and the watcher noticing it say "changed" once.
11
+ //
12
+ // Browsers hear it on GET /api/agent/events (server-sent events, routes.js),
13
+ // which carries no settings, only that they changed: each view refetches
14
+ // what it shows through its usual, authorized routes.
15
+
16
+ import fs from 'node:fs'
17
+ import path from 'node:path'
18
+
19
+ export const AGENTS_EVENT = 'agents'
20
+
21
+ export function createSettingsEvents({ file = null, debounceMs = 150, watch = true, now = () => Date.now() } = {}) {
22
+ const listeners = new Set()
23
+ let timer = null
24
+ let reasons = new Set()
25
+ let watcher = null
26
+ let closed = false
27
+
28
+ const flush = () => {
29
+ timer = null
30
+ const event = { at: new Date(now()).toISOString(), reasons: [...reasons] }
31
+ reasons = new Set()
32
+ for (const listener of [...listeners]) {
33
+ try {
34
+ listener(event)
35
+ } catch {
36
+ // One listener failing never stops the others.
37
+ }
38
+ }
39
+ }
40
+ const changed = (reason = 'settings') => {
41
+ if (closed) return
42
+ reasons.add(reason)
43
+ if (!timer) {
44
+ timer = setTimeout(flush, debounceMs)
45
+ timer.unref?.()
46
+ }
47
+ }
48
+
49
+ // The folder, not the file: saves replace the file (write, then rename),
50
+ // which a watch on the file itself would lose. A folder that does not
51
+ // exist yet (no settings saved) is watched once it appears, via its parent.
52
+ const start = () => {
53
+ if (!watch || !file || closed || watcher) return
54
+ const dir = path.dirname(file)
55
+ const name = path.basename(file)
56
+ try {
57
+ watcher = fs.watch(dir, (event, changedName) => {
58
+ if (!changedName || changedName === name || String(changedName).startsWith(`${name}.`)) changed('file')
59
+ })
60
+ watcher.on('error', () => {
61
+ watcher?.close()
62
+ watcher = null
63
+ })
64
+ watcher.unref?.()
65
+ } catch {
66
+ watcher = null
67
+ // The folder is not there yet: wait for it in the parent.
68
+ try {
69
+ const parent = fs.watch(path.dirname(dir), (event, changedName) => {
70
+ if (changedName !== path.basename(dir) || !fs.existsSync(dir)) return
71
+ parent.close()
72
+ watcher = null
73
+ start()
74
+ changed('file')
75
+ })
76
+ parent.on('error', () => parent.close())
77
+ parent.unref?.()
78
+ // Replaced by the real watcher once the folder appears.
79
+ watcher = { close: () => parent.close() }
80
+ } catch {
81
+ // No parent either: only this server's own changes are announced.
82
+ }
83
+ }
84
+ }
85
+ start()
86
+
87
+ return {
88
+ changed,
89
+ subscribe(listener) {
90
+ listeners.add(listener)
91
+ return () => listeners.delete(listener)
92
+ },
93
+ listenerCount: () => listeners.size,
94
+ close() {
95
+ closed = true
96
+ if (timer) clearTimeout(timer)
97
+ timer = null
98
+ watcher?.close()
99
+ watcher = null
100
+ listeners.clear()
101
+ },
102
+ }
103
+ }
@@ -328,8 +328,30 @@ export async function testConnection(settings, { env = process.env, fetchImpl =
328
328
  // `repo` is the config's `agent`. `busy()` is true while an answer is being
329
329
  // written, `reload()` switches the chat over to new settings.
330
330
  // `token` is the per-process settings token (null: the routes are off).
331
- export function settingsRoutes({ config, env, fetchImpl, settings, shared, token, busy, reload, processPool, health = null }) {
331
+ export function settingsRoutes({
332
+ config,
333
+ env,
334
+ fetchImpl,
335
+ settings,
336
+ shared,
337
+ token,
338
+ busy,
339
+ reload,
340
+ processPool,
341
+ health = null,
342
+ events = null,
343
+ }) {
332
344
  const router = express.Router()
345
+ // Every change that went through (and a test, which updates an agent's
346
+ // state) tells the open views (settings-events.js).
347
+ router.use((req, res, next) => {
348
+ if (events && !['GET', 'HEAD', 'OPTIONS'].includes(req.method)) {
349
+ res.on('finish', () => {
350
+ if (res.statusCode < 400) events.changed('settings')
351
+ })
352
+ }
353
+ next()
354
+ })
333
355
  const repo = () => config.agent || {}
334
356
  let testing = false
335
357
  let closing = false