@camstack/server 1.2.679 → 1.2.680

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/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.2.680] - 2026-10-28
11
+
12
+ ### Fixed
13
+
14
+ - A desktop or container agent renamed from its own page now shows the new name on the hub right away, even when the rename was made while it was pairing
15
+
10
16
  ## [1.2.679] - 2026-10-28
11
17
 
12
18
  ### Changed
@@ -55,7 +55,7 @@ function describe(s) {
55
55
  return [
56
56
  `Pairing request from hub "${s.hub.nodeId}" (${s.hub.url}), CA ${fp}`,
57
57
  ` PIN: ${s.pin} (type it on this agent's page with the code the HUB shows)`,
58
- ` this agent's code: ${s.code ?? '(not known yet - the hub has not revealed its nonce)'} (type it on the hub)`,
58
+ ` this agent's code: ${s.code ?? "(shown here once you confirmed on this agent's page)"} (type this on the hub)`,
59
59
  ` expires: ${new Date(s.expiresAt).toISOString()}`,
60
60
  ].join('\n');
61
61
  }
@@ -211,6 +211,26 @@ function isHubConnected(broker) {
211
211
  return false;
212
212
  }
213
213
  }
214
+ /**
215
+ * The agent's name as persisted in `agent.json` — the single source of truth the agent UI
216
+ * writes (`POST /api/agent/config`). The in-memory `deps.agentName` is only a fallback: the
217
+ * UI's follow-up `$agent.rename` call is best-effort and can be lost (broker mid-reconnect
218
+ * while pairing), which left the hub on the old name until a restart.
219
+ */
220
+ function persistedAgentName(configPath, fallback) {
221
+ try {
222
+ const raw = JSON.parse(fs.readFileSync(path.resolve(configPath), 'utf-8'));
223
+ if (typeof raw === 'object' && raw !== null && 'name' in raw) {
224
+ const name = raw.name;
225
+ if (typeof name === 'string' && name.trim().length > 0)
226
+ return name.trim();
227
+ }
228
+ }
229
+ catch {
230
+ /* no file yet, or unreadable: the in-memory name stands */
231
+ }
232
+ return fallback;
233
+ }
214
234
  function createAgentService(deps) {
215
235
  return {
216
236
  name: '$agent',
@@ -235,7 +255,7 @@ function createAgentService(deps) {
235
255
  const decodeDetection = buildDecodeDetectionSlice();
236
256
  return {
237
257
  nodeId: broker.nodeID,
238
- name: deps.agentName,
258
+ name: persistedAgentName(deps.configPath, deps.agentName),
239
259
  platform: os.platform(),
240
260
  arch: os.arch(),
241
261
  hostname: os.hostname(),
@@ -307,7 +327,7 @@ function createAgentService(deps) {
307
327
  return {
308
328
  ok: errored === 0,
309
329
  nodeId: broker.nodeID,
310
- name: deps.agentName,
330
+ name: persistedAgentName(deps.configPath, deps.agentName),
311
331
  version: deps.agentVersion ?? 'unknown',
312
332
  uptimeSeconds: Math.round(process.uptime()),
313
333
  pid: process.pid,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/server",
3
- "version": "1.2.679",
3
+ "version": "1.2.680",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -49,8 +49,8 @@
49
49
  ]
50
50
  },
51
51
  "dependencies": {
52
- "@camstack/addon-admin-ui": "1.2.508",
53
- "@camstack/addon-agent-ui": "1.2.287",
52
+ "@camstack/addon-admin-ui": "1.2.509",
53
+ "@camstack/addon-agent-ui": "1.2.288",
54
54
  "@camstack/addon-auth": "1.2.170",
55
55
  "@camstack/addon-benchmark": "1.2.288",
56
56
  "@camstack/addon-decoder-nodeav": "1.2.144",
@@ -60,7 +60,7 @@
60
60
  "@camstack/addon-post-analysis": "1.2.650",
61
61
  "@camstack/develop": "0.1.38",
62
62
  "@camstack/sdk": "1.2.154",
63
- "@camstack/system": "1.2.510",
63
+ "@camstack/system": "1.2.511",
64
64
  "@camstack/types": "1.2.438",
65
65
  "@camstack/ui-library": "1.2.346",
66
66
  "@fastify/compress": "^9.0.0",