@commonlyai/cli 0.1.314 → 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
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);
|
|
@@ -1104,7 +1104,9 @@ export default {
|
|
|
1104
1104
|
// repository set up to run programs is refused before anything starts
|
|
1105
1105
|
// (sandbox/workspace-git-config.js).
|
|
1106
1106
|
if (workspacePath) {
|
|
1107
|
-
(ctx._refuseCodeRunningGitSetup || refuseCodeRunningGitSetup)(workspacePath, {
|
|
1107
|
+
(ctx._refuseCodeRunningGitSetup || refuseCodeRunningGitSetup)(workspacePath, {
|
|
1108
|
+
seat: 'This public Codex agent', env: ctx.env || process.env,
|
|
1109
|
+
});
|
|
1108
1110
|
}
|
|
1109
1111
|
|
|
1110
1112
|
// Per-spawn temp dir for --output-last-message. Cleaned up in `finally`
|
|
@@ -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
|
+
});
|
|
@@ -82,9 +82,15 @@ export const codeRunningKey = (key, value = '') => {
|
|
|
82
82
|
return false;
|
|
83
83
|
};
|
|
84
84
|
|
|
85
|
-
// What git reads from the environment to pick a repository
|
|
86
|
-
// the check opens the repository Codex's git would.
|
|
87
|
-
const DISCOVERY_ENV = [
|
|
85
|
+
// What git reads from the environment to pick a repository and its index.
|
|
86
|
+
// Passed through, so the check opens the repository Codex's git would.
|
|
87
|
+
const DISCOVERY_ENV = [
|
|
88
|
+
'GIT_DIR', 'GIT_WORK_TREE', 'GIT_COMMON_DIR', 'GIT_INDEX_FILE', 'GIT_CEILING_DIRECTORIES', 'GIT_DISCOVERY_ACROSS_FILESYSTEM',
|
|
89
|
+
];
|
|
90
|
+
// The ones git clears before it runs inside a submodule (its local_repo_env):
|
|
91
|
+
// they name the top repository, so a submodule is opened from its own folder.
|
|
92
|
+
const TOP_REPOSITORY_ENV = ['GIT_DIR', 'GIT_WORK_TREE', 'GIT_COMMON_DIR', 'GIT_INDEX_FILE'];
|
|
93
|
+
const submoduleEnv = (env) => Object.fromEntries(Object.entries(env).filter(([name]) => !TOP_REPOSITORY_ENV.includes(name)));
|
|
88
94
|
// On the command line, ahead of anything the repository says: nothing these
|
|
89
95
|
// commands do may start fsmonitor or a hook.
|
|
90
96
|
const SAFE_FLAGS = ['-c', 'core.fsmonitor=false', '-c', 'core.hooksPath=/dev/null', '-c', 'core.untrackedCache=false'];
|
|
@@ -202,7 +208,8 @@ const inspect = (dir, context, findings, seen, depth) => {
|
|
|
202
208
|
findings.push({ file: top, key: 'unreadable index' });
|
|
203
209
|
return;
|
|
204
210
|
}
|
|
205
|
-
|
|
211
|
+
const subContext = { ...context, env: submoduleEnv(context.env) };
|
|
212
|
+
for (const sub of submodules) inspect(sub, subContext, findings, seen, depth + 1);
|
|
206
213
|
};
|
|
207
214
|
|
|
208
215
|
/**
|