log-llm-config 1.3.90 → 1.3.92
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.
|
@@ -39,6 +39,8 @@ export function normalizeAgentToken(raw) {
|
|
|
39
39
|
return 'claude';
|
|
40
40
|
if (s === 'cursor')
|
|
41
41
|
return 'cursor';
|
|
42
|
+
if (s === 'copilot')
|
|
43
|
+
return 'copilot';
|
|
42
44
|
return '';
|
|
43
45
|
}
|
|
44
46
|
function currentAgentFromEnv() {
|
|
@@ -46,9 +48,13 @@ function currentAgentFromEnv() {
|
|
|
46
48
|
const override = normalizeAgentToken(process.env.OPTIMUS_AGENT);
|
|
47
49
|
if (override)
|
|
48
50
|
return override;
|
|
49
|
-
// Backwards-compatible: hook wrappers set OPTIMUS_HOOK_TYPE to cursor|claude.
|
|
51
|
+
// Backwards-compatible: hook wrappers set OPTIMUS_HOOK_TYPE to cursor|claude|copilot.
|
|
50
52
|
const hookType = normalizeAgentToken(process.env.OPTIMUS_HOOK_TYPE);
|
|
51
|
-
|
|
53
|
+
if (hookType === 'cursor')
|
|
54
|
+
return 'cursor';
|
|
55
|
+
if (hookType === 'copilot')
|
|
56
|
+
return 'copilot';
|
|
57
|
+
return 'claude';
|
|
52
58
|
}
|
|
53
59
|
function targetsCurrentAgent(entry, agent) {
|
|
54
60
|
// Prefer top-level manifest field; fall back to embedded fix payload for older local files.
|
|
@@ -91,7 +91,7 @@ async function addSensitivePathsAudit(endpointBase, configFiles) {
|
|
|
91
91
|
}
|
|
92
92
|
async function sendAllConfigFiles(configFiles, worktreeReport, hardwareUuid, authKey) {
|
|
93
93
|
const hookTypeRaw = (process.env.OPTIMUS_HOOK_TYPE || 'claude').toLowerCase();
|
|
94
|
-
const hookType = hookTypeRaw === 'cursor' ? 'cursor' : 'claude';
|
|
94
|
+
const hookType = hookTypeRaw === 'cursor' ? 'cursor' : hookTypeRaw === 'copilot' ? 'copilot' : 'claude';
|
|
95
95
|
const manifest = configFiles.map((c) => canonicalCursorUserStateVscdbPath(c.file_path));
|
|
96
96
|
const workspaceRepo = ensureWorkspaceRepoEnv(manifest);
|
|
97
97
|
const hookRequestId = await sendHookRequestCreate(hardwareUuid, authKey, hookType, workspaceRepo);
|
|
@@ -132,7 +132,8 @@ async function main() {
|
|
|
132
132
|
const endpointBase = loadEndpointBase();
|
|
133
133
|
hookRunLog(`start endpoint=${endpointBase} hardware_uuid=${hardwareUuid}`);
|
|
134
134
|
hookRunLog(`endpoint_source=${getEndpointSource()} cwd=${process.cwd()}`);
|
|
135
|
-
|
|
135
|
+
const envForLog = (v) => (v && v.trim() ? v.trim() : 'unset');
|
|
136
|
+
hookRunLog(`env: OPTIMUS_HOOK_TYPE=${envForLog(process.env.OPTIMUS_HOOK_TYPE)} OPTIMUS_PROJECT_DIR=${envForLog(process.env.OPTIMUS_PROJECT_DIR)} OPTIMUS_WORKSPACE_REPO=${envForLog(process.env.OPTIMUS_WORKSPACE_REPO)} OPTIMUS_ENDPOINT=${envForLog(process.env.OPTIMUS_ENDPOINT)}`);
|
|
136
137
|
let authKey;
|
|
137
138
|
try {
|
|
138
139
|
authKey = await ensureAuthentication(hardwareUuid);
|
|
@@ -32,10 +32,16 @@ function currentAgentFromEnv() {
|
|
|
32
32
|
const override = normalizeAgentToken(process.env.OPTIMUS_AGENT);
|
|
33
33
|
if (override === 'cursor')
|
|
34
34
|
return 'cursor';
|
|
35
|
+
if (override === 'copilot')
|
|
36
|
+
return 'copilot';
|
|
35
37
|
if (override === 'claude' || override === 'claude_desktop')
|
|
36
38
|
return 'claude';
|
|
37
39
|
const hookType = normalizeAgentToken(process.env.OPTIMUS_HOOK_TYPE);
|
|
38
|
-
|
|
40
|
+
if (hookType === 'cursor')
|
|
41
|
+
return 'cursor';
|
|
42
|
+
if (hookType === 'copilot')
|
|
43
|
+
return 'copilot';
|
|
44
|
+
return 'claude';
|
|
39
45
|
}
|
|
40
46
|
/** Spawn each trusted command detached (same pattern as former compliance_prompt_gate fireRestartCommands). */
|
|
41
47
|
export function executeTrustedRestartCommands(commands) {
|
package/dist/tofu.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Tofu shim — centralises all imports from optimus-tofu.
|
|
3
3
|
*
|
|
4
|
-
* Reads ~/opt-ai-sec/management/optimus_dev.env at startup:
|
|
5
|
-
* - No file / unreadable →
|
|
6
|
-
* - File present → environment= line in file, then OPTIMUS_ENVIRONMENT, then
|
|
4
|
+
* Reads ~/opt-ai-sec/management/optimus_dev.env at startup (see tofu_environment.ts):
|
|
5
|
+
* - No file / unreadable → production (ignores OPTIMUS_ENVIRONMENT).
|
|
6
|
+
* - File present → environment= line in file, then OPTIMUS_ENVIRONMENT, then production.
|
|
7
7
|
* - environment=development + local dist present → loads sibling optimus-tofu dist
|
|
8
8
|
* - staging / production / npx installs → published optimus-tofu npm package
|
|
9
9
|
*
|
package/dist/tofu_environment.js
CHANGED
|
@@ -7,25 +7,30 @@ export function managementEnvPath() {
|
|
|
7
7
|
return null;
|
|
8
8
|
return path.join(home, 'opt-ai-sec', 'management', 'optimus_dev.env');
|
|
9
9
|
}
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Resolve optimus environment label (production package; matches shell hooks):
|
|
12
|
+
* - No management file / unreadable → production (ignores OPTIMUS_ENVIRONMENT).
|
|
13
|
+
* - File present → environment= line in file, then OPTIMUS_ENVIRONMENT, then production.
|
|
14
|
+
*/
|
|
11
15
|
export function readEnvironment() {
|
|
12
16
|
const envPath = managementEnvPath();
|
|
13
17
|
if (!envPath) {
|
|
14
|
-
return '
|
|
18
|
+
return 'production';
|
|
15
19
|
}
|
|
20
|
+
let content;
|
|
16
21
|
try {
|
|
17
|
-
|
|
18
|
-
const match = content.match(/^(?:environment|ENVIRONMENT|OPTIMUS_ENVIRONMENT)\s*=\s*(.+)/m);
|
|
19
|
-
if (match)
|
|
20
|
-
return match[1].trim().toLowerCase();
|
|
22
|
+
content = readFileSync(envPath, 'utf8');
|
|
21
23
|
}
|
|
22
24
|
catch {
|
|
23
|
-
return '
|
|
25
|
+
return 'production';
|
|
24
26
|
}
|
|
27
|
+
const match = content?.match(/^(?:environment|ENVIRONMENT|OPTIMUS_ENVIRONMENT)\s*=\s*(.+)/m);
|
|
28
|
+
if (match)
|
|
29
|
+
return match[1].trim().toLowerCase();
|
|
25
30
|
const fromEnv = process.env.OPTIMUS_ENVIRONMENT?.trim().toLowerCase();
|
|
26
31
|
if (fromEnv)
|
|
27
32
|
return fromEnv;
|
|
28
|
-
return '
|
|
33
|
+
return 'production';
|
|
29
34
|
}
|
|
30
35
|
export function shouldUseLocalTofuDist(localTofuPath) {
|
|
31
36
|
return readEnvironment() === 'development' && existsSync(localTofuPath);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "log-llm-config",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.92",
|
|
4
4
|
"description": "CLI helpers for logging hardware UUIDs and posting startup payloads to Optimus Security.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -58,6 +58,6 @@
|
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"axios": "^1.15.2",
|
|
60
60
|
"canonicalize": "^2.1.0",
|
|
61
|
-
"optimus-tofu": "
|
|
61
|
+
"optimus-tofu": "^0.1.17"
|
|
62
62
|
}
|
|
63
63
|
}
|