@commonlyai/cli 0.1.315 → 0.1.316
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/package.json +1 -1
- package/src/commands/daemon.js +14 -6
- package/src/lib/machine-host.js +29 -0
package/package.json
CHANGED
package/src/commands/daemon.js
CHANGED
|
@@ -50,6 +50,7 @@ import {
|
|
|
50
50
|
createReachCache, loadPodReach, readSessionLastTurn,
|
|
51
51
|
} from '../lib/daemon-agent-states.js';
|
|
52
52
|
import { installedCliVersion, startUpdateNotice, UPDATE_CHECK_OPT_OUT_ENV } from '../lib/update-check.js';
|
|
53
|
+
import { machineHostReport } from '../lib/machine-host.js';
|
|
53
54
|
|
|
54
55
|
// One supervised seat, as `commonly daemon status --verbose` names it. Two of these
|
|
55
56
|
// fields are worth reading closely: the seat's `instanceId` (the identity the
|
|
@@ -182,9 +183,12 @@ export const registerDaemonMachine = async ({
|
|
|
182
183
|
instanceUrl,
|
|
183
184
|
name,
|
|
184
185
|
persist = saveDaemonRecord,
|
|
186
|
+
host = machineHostReport(),
|
|
185
187
|
}) => {
|
|
188
|
+
// TASK-784: the host report is metadata only (platform, OS release major,
|
|
189
|
+
// arch, CLI version). An older server ignores it.
|
|
186
190
|
const { machine, daemonToken } = requireRegistrationResponse(
|
|
187
|
-
await client.post('/api/machines', { name }),
|
|
191
|
+
await client.post('/api/machines', { name, host }),
|
|
188
192
|
);
|
|
189
193
|
const record = {
|
|
190
194
|
machineDbId: machine.id,
|
|
@@ -213,6 +217,14 @@ export const registerDaemonMachine = async ({
|
|
|
213
217
|
return { machine, record };
|
|
214
218
|
};
|
|
215
219
|
|
|
220
|
+
// What each supervisor check-in tells the server about this computer.
|
|
221
|
+
// Native Windows has no OS sandbox for any adapter, so it never reports
|
|
222
|
+
// 'default': Codex there runs on its own profiles only, and a removed marker
|
|
223
|
+
// must not read as "confined" while seats may still run. An older daemon sends
|
|
224
|
+
// neither field, which leaves the server's record. TASK-784: the host report
|
|
225
|
+
// rides along, so a machine an older CLI registered fills in on upgrade.
|
|
226
|
+
export const daemonMachineReport = () => ({ sandbox: hostSandboxReport(), host: machineHostReport() });
|
|
227
|
+
|
|
216
228
|
export const heartbeatDaemonMachine = async ({ client, record }) => (
|
|
217
229
|
client.post(`/api/machines/${record.machineDbId}/heartbeat`)
|
|
218
230
|
);
|
|
@@ -656,11 +668,7 @@ Examples:
|
|
|
656
668
|
},
|
|
657
669
|
loadToken: loadAgentToken,
|
|
658
670
|
saveToken: saveAgentToken,
|
|
659
|
-
|
|
660
|
-
// reports 'default': Codex there runs on its own profiles only, and a
|
|
661
|
-
// removed marker must not read as "confined" while seats may still run.
|
|
662
|
-
// An older daemon sends nothing, which leaves the server's record.
|
|
663
|
-
machineReport: () => ({ sandbox: hostSandboxReport() }),
|
|
671
|
+
machineReport: daemonMachineReport,
|
|
664
672
|
runtimeInventory: async () => {
|
|
665
673
|
if (!cachedInventory || Date.now() - inventoryCheckedAt > 300_000) {
|
|
666
674
|
cachedInventory = await collectRuntimeInventory(getAdapter);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TASK-784 (D164): what the daemon's computer runs, as the server stores it.
|
|
3
|
+
* Metadata only: Node's platform and arch names, the OS release's leading
|
|
4
|
+
* number, and this CLI's version. Nothing here may name the machine or the
|
|
5
|
+
* person (no hostname, path or user name); the server drops anything else.
|
|
6
|
+
*/
|
|
7
|
+
import { release as osRelease } from 'os';
|
|
8
|
+
import { installedCliVersion } from './update-check.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The leading number of an OS release string: Windows "10.0.22631" is 10,
|
|
12
|
+
* a Darwin kernel "25.4.0" is 25, Linux "6.5.0-1025-azure" is 6.
|
|
13
|
+
*/
|
|
14
|
+
export const osReleaseMajor = (release) => {
|
|
15
|
+
const match = /^(\d{1,4})(?:\D|$)/.exec(String(release ?? ''));
|
|
16
|
+
return match ? Number(match[1]) : null;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const machineHostReport = ({
|
|
20
|
+
platform = process.platform,
|
|
21
|
+
release = osRelease(),
|
|
22
|
+
arch = process.arch,
|
|
23
|
+
cliVersion = installedCliVersion(),
|
|
24
|
+
} = {}) => ({
|
|
25
|
+
platform,
|
|
26
|
+
osMajor: osReleaseMajor(release),
|
|
27
|
+
arch,
|
|
28
|
+
cliVersion: cliVersion || null,
|
|
29
|
+
});
|