log-llm-config 1.5.2 → 1.5.9
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/README.md +1 -1
- package/dist/bootstrap_constants.js +3 -3
- package/dist/dialog_prefs_cli.js +1 -1
- package/dist/log_config_files/auth/auth_flow.js +2 -2
- package/dist/log_config_files/auth/auth_key_store.js +2 -2
- package/dist/log_config_files/collection/claude_token_usage_collector.js +156 -0
- package/dist/log_config_files/collection/codex_token_usage_collector.js +245 -0
- package/dist/log_config_files/collection/config_collector.js +9 -0
- package/dist/log_config_files/collection/copilot_token_usage_collector.js +154 -0
- package/dist/log_config_files/collection/cowork_desktop_version_collector.js +60 -0
- package/dist/log_config_files/collection/cursor_token_usage_collector.js +188 -0
- package/dist/log_config_files/collection/hermes_token_usage_collector.js +219 -0
- package/dist/log_config_files/collection/openclaw_token_usage_collector.js +190 -0
- package/dist/log_config_files/collection/opencode_token_usage_collector.js +182 -0
- package/dist/log_config_files/collection/pi_token_usage_collector.js +203 -0
- package/dist/log_config_files/paths/path_constants_helpers.js +1 -1
- package/dist/log_config_files/runtime/client_event_reporter.js +4 -4
- package/dist/log_config_files/runtime/compliance_session_log.js +2 -2
- package/dist/log_config_files/runtime/hook_logger.js +3 -3
- package/dist/log_config_files/runtime/log_metadata.js +2 -2
- package/dist/log_config_files/runtime/main_runner.js +75 -3
- package/dist/log_config_files/runtime/management_storage.js +8 -8
- package/dist/log_config_files/runtime/remediation_sync.js +3 -3
- package/dist/log_config_files/sender/batch_sender.js +1 -1
- package/dist/log_sensitive_paths_audit.js +3 -3
- package/dist/log_uuid/auth_key_store.js +2 -2
- package/dist/log_uuid/startup_sender.js +1 -1
- package/dist/tofu.js +1 -1
- package/dist/tofu_environment.js +1 -1
- package/package.json +2 -2
|
@@ -541,7 +541,7 @@ function assertSafeSqliteIdentifiersForItemTable(table, keyColumn, valueColumn)
|
|
|
541
541
|
* Canonical Cursor restart_command strings — single source for buildDeferredCursorRestartCommand + allowlist.
|
|
542
542
|
*
|
|
543
543
|
* - **SQLite / state.vscdb (deferred):** autofix queued ItemTable writes; restart runs `apply_deferred_vscdb` then reopens Cursor.
|
|
544
|
-
* Routing matches shell hooks (`optimus-compliance-check.sh`): read
|
|
544
|
+
* Routing matches shell hooks (`optimus-compliance-check.sh`): read `~/.optimuslabs/management/optimus_dev.env`
|
|
545
545
|
* (then `OPTIMUS_ENVIRONMENT`), use `npx=` base for local `dist` when `environment=development`,
|
|
546
546
|
* `log-llm-config-staging@latest` when `environment=staging`, else production package.
|
|
547
547
|
* - **JSON settings files:** autofix wrote normal config JSON; restart is kill + reopen only (no deferred apply).
|
|
@@ -551,8 +551,8 @@ function assertSafeSqliteIdentifiersForItemTable(table, keyColumn, valueColumn)
|
|
|
551
551
|
*/
|
|
552
552
|
const TRUSTED_CURSOR_SQLITE_DEFERRED_RESTART_COMMAND = 'REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd) && export REPO_ROOT && ' +
|
|
553
553
|
'CURSOR_PROJECT="${CURSOR_PROJECT_DIR:-$REPO_ROOT}" && export CURSOR_PROJECT && ' +
|
|
554
|
-
'OPTIMUS_DEFERRED_LOG="${HOME}/
|
|
555
|
-
"nohup bash -c 'exec >>\"\$OPTIMUS_DEFERRED_LOG\" 2>&1; echo deferred_restart:begin ts=\$(date -u +%Y-%m-%dT%H:%M:%SZ) REPO_ROOT=\"\$REPO_ROOT\" CURSOR_PROJECT=\"\$CURSOR_PROJECT\"; sleep 2; STATIC_DEV_ENV=\"\$HOME/
|
|
554
|
+
'OPTIMUS_DEFERRED_LOG="${HOME}/.optimuslabs/management/vscdb/deferred_vscdb_restart.log" && mkdir -p "$(dirname "$OPTIMUS_DEFERRED_LOG")" && export OPTIMUS_DEFERRED_LOG && ' +
|
|
555
|
+
"nohup bash -c 'exec >>\"\$OPTIMUS_DEFERRED_LOG\" 2>&1; echo deferred_restart:begin ts=\$(date -u +%Y-%m-%dT%H:%M:%SZ) REPO_ROOT=\"\$REPO_ROOT\" CURSOR_PROJECT=\"\$CURSOR_PROJECT\"; sleep 2; STATIC_DEV_ENV=\"\$HOME/.optimuslabs/management/optimus_dev.env\"; ENV_LABEL=\"\"; if [ -f \"\$STATIC_DEV_ENV\" ]; then ENV_LABEL=\$(grep -E \"^(environment|ENVIRONMENT|OPTIMUS_ENVIRONMENT)=\" \"\$STATIC_DEV_ENV\" 2>/dev/null | head -1 | cut -d\"=\" -f2- | tr \"[:upper:]\" \"[:lower:]\" | xargs); fi; if [ -z \"\$ENV_LABEL\" ] && [ -n \"\${OPTIMUS_ENVIRONMENT:-}\" ]; then ENV_LABEL=\$(printf \"%s\" \"\$OPTIMUS_ENVIRONMENT\" | tr \"[:upper:]\" \"[:lower:]\" | xargs); fi; [ -z \"\$ENV_LABEL\" ] && ENV_LABEL=\"production\"; NPX_BASE=\"\"; if [ -f \"\$STATIC_DEV_ENV\" ]; then _nb=\$(grep -E \"^npx=\" \"\$STATIC_DEV_ENV\" 2>/dev/null | head -1 | cut -d\"=\" -f2- | xargs); [ -n \"\$_nb\" ] && [ -d \"\$_nb\" ] && NPX_BASE=\"\$_nb\"; fi; p=\"\${npm_config_prefix:-\${NPM_CONFIG_PREFIX:-}}\"; gp=\"\${npm_config_global_prefix:-}\"; gc=\"\${npm_config_globalconfig:-}\"; if [[ \"\$p\" == *\"/Applications/Cursor.app/\"* ]] || [[ \"\$gp\" == *\"/Applications/Cursor.app/\"* ]] || [[ \"\$gc\" == *\"/Applications/Cursor.app/\"* ]]; then unset npm_config_prefix NPM_CONFIG_PREFIX npm_config_global_prefix npm_config_globalconfig npm_node_execpath 2>/dev/null; fi; APPLY_EC=0; if [ -f \"\$REPO_ROOT/dev_npx_packages/log-llm-config/dist/apply_deferred_vscdb.js\" ]; then echo deferred_restart:apply_via_dev_npx_packages; node \"\$REPO_ROOT/dev_npx_packages/log-llm-config/dist/apply_deferred_vscdb.js\"; APPLY_EC=\$?; elif [ \"\$ENV_LABEL\" = \"development\" ] && [ -n \"\$NPX_BASE\" ] && [ -f \"\$NPX_BASE/log-llm-config/dist/apply_deferred_vscdb.js\" ]; then echo deferred_restart:apply_via_optimus_npx_base; node \"\$NPX_BASE/log-llm-config/dist/apply_deferred_vscdb.js\"; APPLY_EC=\$?; elif command -v npx >/dev/null 2>&1; then echo deferred_restart:apply_via_npx env=\"\$ENV_LABEL\"; cd \"\$REPO_ROOT\" || true; if [ \"\$ENV_LABEL\" = \"staging\" ]; then npx --yes --package=log-llm-config-staging@latest apply-deferred-vscdb-staging; APPLY_EC=\$?; else npx --yes --package=log-llm-config@latest apply-deferred-vscdb; APPLY_EC=\$?; fi; else echo deferred_restart:no_npx; APPLY_EC=127; fi; echo deferred_restart:apply_exit=\$APPLY_EC; if [ \$APPLY_EC -ne 0 ]; then echo deferred_restart:APPLY_FAILED_see_messages_above; fi; echo deferred_restart:open_cursor; env -u npm_config_package -u npm_lifecycle_event -u npm_lifecycle_script -u npm_config_local_prefix open -a Cursor \"\$CURSOR_PROJECT\"; echo deferred_restart:open_exit=\$?; echo deferred_restart:end ts=\$(date -u +%Y-%m-%dT%H:%M:%SZ)' >/dev/null 2>&1 & killall -9 Cursor";
|
|
556
556
|
/** Legacy manifests; hooks may run with cwd under `.cursor` where `pwd` is wrong. */
|
|
557
557
|
const TRUSTED_CURSOR_JSON_SETTINGS_RESTART_COMMAND_LEGACY = 'CURSOR_PROJECT=$(git rev-parse --show-toplevel 2>/dev/null || pwd) && export CURSOR_PROJECT && nohup bash -c \'sleep 2 && open -a Cursor "$CURSOR_PROJECT"\' >/dev/null 2>&1 & killall -9 Cursor';
|
|
558
558
|
const TRUSTED_CURSOR_JSON_SETTINGS_RESTART_COMMAND = 'REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd) && export REPO_ROOT && ' +
|
|
@@ -43,7 +43,7 @@ function readOrganizationUuid() {
|
|
|
43
43
|
if (envValue)
|
|
44
44
|
return envValue;
|
|
45
45
|
try {
|
|
46
|
-
return fs.readFileSync(path.join(os.homedir(), '
|
|
46
|
+
return fs.readFileSync(path.join(os.homedir(), '.optimuslabs', 'management', 'org', 'organization-uuid.txt'), 'utf8').trim();
|
|
47
47
|
}
|
|
48
48
|
catch {
|
|
49
49
|
return '';
|
|
@@ -10,7 +10,7 @@ import { existsSync, writeFileSync, mkdirSync, statSync } from 'node:fs';
|
|
|
10
10
|
import { join } from 'node:path';
|
|
11
11
|
import { homedir } from 'node:os';
|
|
12
12
|
import { getSensitivePathsAuditCandidates } from './endpoint_client/index.js';
|
|
13
|
-
import {
|
|
13
|
+
import { OPTIMUSLABS_LOGS_REL, LOG_GROUP_AUDIT } from './bootstrap_constants.js';
|
|
14
14
|
import { loadEndpointBase } from './log_config_files/sender/endpoint_config.js';
|
|
15
15
|
const AUDIT_FILENAME = 'sensitive_paths_audit.txt';
|
|
16
16
|
function expandPath(template, cwd) {
|
|
@@ -63,7 +63,7 @@ export function writeSensitivePathsAudit(outputDir, pathTemplates, cwd = process
|
|
|
63
63
|
* Run audit: fetch candidates from backend, check existence, write file. Returns paths for sending.
|
|
64
64
|
* Used by log_config_files to include the audit in the same batch (same auth).
|
|
65
65
|
*/
|
|
66
|
-
export async function runSensitivePathsAudit(endpointBase, outputDir = join(homedir(),
|
|
66
|
+
export async function runSensitivePathsAudit(endpointBase, outputDir = join(homedir(), OPTIMUSLABS_LOGS_REL, LOG_GROUP_AUDIT), cwd = process.cwd()) {
|
|
67
67
|
const response = await getSensitivePathsAuditCandidates(endpointBase);
|
|
68
68
|
const pathTemplates = response?.paths ?? [];
|
|
69
69
|
if (pathTemplates.length === 0 && !response) {
|
|
@@ -75,7 +75,7 @@ export async function runSensitivePathsAudit(endpointBase, outputDir = join(home
|
|
|
75
75
|
return { paths };
|
|
76
76
|
}
|
|
77
77
|
export async function main() {
|
|
78
|
-
const outputDir = join(homedir(),
|
|
78
|
+
const outputDir = join(homedir(), OPTIMUSLABS_LOGS_REL, LOG_GROUP_AUDIT);
|
|
79
79
|
const endpointBase = loadEndpointBase();
|
|
80
80
|
await runSensitivePathsAudit(endpointBase, outputDir, process.cwd());
|
|
81
81
|
process.exit(0);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import {
|
|
3
|
+
import { OPTIMUSLABS_MANAGEMENT_REL } from '../bootstrap_constants.js';
|
|
4
4
|
import { loadEndpointBase } from '../log_config_files/sender/endpoint_config.js';
|
|
5
5
|
import { buildStartupEndpointUrl, normalizeBaseUrl } from '../tofu.js';
|
|
6
|
-
const AUTH_KEY_RELATIVE_PATH = path.join(
|
|
6
|
+
const AUTH_KEY_RELATIVE_PATH = path.join(OPTIMUSLABS_MANAGEMENT_REL, 'auth', 'auth_key.txt');
|
|
7
7
|
const getAuthKeyPath = () => {
|
|
8
8
|
const homeDir = process.env.HOME || process.env.USERPROFILE;
|
|
9
9
|
if (!homeDir)
|
|
@@ -29,7 +29,7 @@ const readOrganizationUuid = () => {
|
|
|
29
29
|
if (envValue)
|
|
30
30
|
return envValue;
|
|
31
31
|
try {
|
|
32
|
-
return fs.readFileSync(path.join(os.homedir(), '
|
|
32
|
+
return fs.readFileSync(path.join(os.homedir(), '.optimuslabs', 'management', 'org', 'organization-uuid.txt'), 'utf8').trim();
|
|
33
33
|
}
|
|
34
34
|
catch {
|
|
35
35
|
return '';
|
package/dist/tofu.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Tofu shim — centralises all imports from optimus-tofu.
|
|
3
3
|
*
|
|
4
|
-
* Reads
|
|
4
|
+
* Reads ~/.optimuslabs/management/optimus_dev.env at startup:
|
|
5
5
|
* - No file / unreadable → staging (ignores OPTIMUS_ENVIRONMENT).
|
|
6
6
|
* - File present → environment= line in file, then OPTIMUS_ENVIRONMENT, then staging.
|
|
7
7
|
* - environment=development + local dist present → loads sibling optimus-tofu dist
|
package/dist/tofu_environment.js
CHANGED
|
@@ -5,7 +5,7 @@ export function managementEnvPath() {
|
|
|
5
5
|
const home = homedir();
|
|
6
6
|
if (!home)
|
|
7
7
|
return null;
|
|
8
|
-
return path.join(home, '
|
|
8
|
+
return path.join(home, '.optimuslabs', 'management', 'optimus_dev.env');
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* Resolve optimus environment label (matches shell hooks / optimus-tool-call):
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "log-llm-config",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.9",
|
|
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": "^0.1.
|
|
61
|
+
"optimus-tofu": "^0.1.18"
|
|
62
62
|
}
|
|
63
63
|
}
|