log-llm-config 1.3.42 → 1.3.46

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.
File without changes
package/dist/cli.js CHANGED
File without changes
File without changes
File without changes
File without changes
@@ -1,6 +1,6 @@
1
1
  import path from 'node:path';
2
2
  import { postStartupPayload } from '../../endpoint_client/index.js';
3
- import { ensureAuthentication as ensureTofuAuthentication } from 'optimus-tofu';
3
+ import { ensureAuthentication as ensureTofuAuthentication } from '../../tofu.js';
4
4
  import { loadEndpointBase } from '../sender/endpoint_config.js';
5
5
  import { OPT_AI_SEC_MANAGEMENT_REL } from '../../bootstrap_constants.js';
6
6
  import { hookRunLog } from '../runtime/hook_logger.js';
@@ -1,5 +1,5 @@
1
1
  import path from 'node:path';
2
- import { getAuthKeyPath as getSharedAuthKeyPath, readStoredAuthKey as readSharedStoredAuthKey, } from 'optimus-tofu';
2
+ import { getAuthKeyPath as getSharedAuthKeyPath, readStoredAuthKey as readSharedStoredAuthKey, } from '../../tofu.js';
3
3
  import { OPT_AI_SEC_MANAGEMENT_REL } from '../../bootstrap_constants.js';
4
4
  const AUTH_KEY_RELATIVE_PATH = path.join(OPT_AI_SEC_MANAGEMENT_REL, 'auth_key.txt');
5
5
  const AUTH_KEY_OPTIONS = { authRelativePath: AUTH_KEY_RELATIVE_PATH };
File without changes
@@ -1,4 +1,4 @@
1
- import { getEndpointSource as getSharedEndpointSource, loadEndpointBase as loadSharedEndpointBase, } from "optimus-tofu";
1
+ import { getEndpointSource as getSharedEndpointSource, loadEndpointBase as loadSharedEndpointBase, } from "../../tofu.js";
2
2
  /**
3
3
  * log-llm-config historically only honored OPTIMUS_ENDPOINT (plus file / default).
4
4
  * OPTIMUS_API_URL is reserved for optimus-tool-call; omit it here for backward compatibility.
@@ -1 +1 @@
1
- export { canonicalizePayload, createSignature } from 'optimus-tofu';
1
+ export { canonicalizePayload, createSignature } from '../../tofu.js';
@@ -16,7 +16,7 @@ function loadEndpointBase() {
16
16
  if (process.env.OPTIMUS_ENDPOINT) {
17
17
  return process.env.OPTIMUS_ENDPOINT.replace(/\/+$/, '') + '/';
18
18
  }
19
- const defaultEndpoint = 'https://demo.optimuslabs.io/';
19
+ const defaultEndpoint = 'https://app.optimuslabs.io/';
20
20
  const envPath = join(process.cwd(), 'optimus_dev.env');
21
21
  try {
22
22
  if (!existsSync(envPath))
@@ -35,7 +35,7 @@ const readStoredAuthKey = () => {
35
35
  return null;
36
36
  };
37
37
  const loadEndpointBase = () => {
38
- const DEFAULT_ENDPOINT = 'https://demo.optimuslabs.io/';
38
+ const DEFAULT_ENDPOINT = 'https://app.optimuslabs.io/';
39
39
  const fromEnv = process.env.OPTIMUS_ENDPOINT?.trim();
40
40
  if (fromEnv)
41
41
  return fromEnv;
File without changes
@@ -1,4 +1,4 @@
1
- import { createSignature as createSharedSignature } from 'optimus-tofu';
1
+ import { createSignature as createSharedSignature } from '../tofu.js';
2
2
  import { classifyEndpointResponse, postStartupPayload } from '../endpoint_client/index.js';
3
3
  import { resolveHardwareUuid } from './hardware_uuid.js';
4
4
  import { writeAuthKey, readStoredAuthKey, loadEndpointBase, buildStartupEndpointUrl } from './auth_key_store.js';
package/dist/tofu.js ADDED
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Tofu shim — centralises all imports from optimus-tofu.
3
+ *
4
+ * Reads ~/opt-ai-sec/management/optimus_dev.env at startup:
5
+ * - environment=development → loads local dist (file-relative path)
6
+ * - anything else → loads the published npm package
7
+ *
8
+ * All other source files import from this module, never directly from
9
+ * "optimus-tofu", so the conditional lives in exactly one place.
10
+ */
11
+ import { readFileSync } from "fs";
12
+ import { homedir } from "os";
13
+ import path from "path";
14
+ import { fileURLToPath } from "url";
15
+ function readEnvironment() {
16
+ const fromEnv = process.env.OPTIMUS_ENVIRONMENT?.trim().toLowerCase();
17
+ if (fromEnv)
18
+ return fromEnv;
19
+ try {
20
+ const content = readFileSync(path.join(homedir(), "opt-ai-sec", "management", "optimus_dev.env"), "utf8");
21
+ const match = content.match(/^(?:environment|ENVIRONMENT|OPTIMUS_ENVIRONMENT)\s*=\s*(.+)/m);
22
+ if (match)
23
+ return match[1].trim().toLowerCase();
24
+ }
25
+ catch {
26
+ // file missing or unreadable — default to production
27
+ }
28
+ return "production";
29
+ }
30
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
31
+ const isDevelopment = readEnvironment() === "development";
32
+ // In development: resolve local optimus-tofu dist relative to this file.
33
+ // dist/tofu.js → ../.. → npx_packages/staging/ → optimus-tofu/dist/index.js
34
+ const localTofuPath = path.join(__dirname, "../../optimus-tofu/dist/index.js");
35
+ const tofu = (isDevelopment
36
+ ? await import(localTofuPath)
37
+ : await import("optimus-tofu"));
38
+ export const { loadEndpointBase, buildStartupEndpointUrl, createSignature, persistAuthKey, readStoredAuthKey, ensureAuthentication, getEndpointSource, canonicalizePayload, getAuthKeyPath, } = tofu;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "log-llm-config",
3
- "version": "1.3.42",
3
+ "version": "1.3.46",
4
4
  "description": "CLI helpers for logging hardware UUIDs and posting startup payloads to Optimus Security.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -14,7 +14,7 @@
14
14
  "compliance_check_runner": "dist/compliance_check_runner.js"
15
15
  },
16
16
  "scripts": {
17
- "build": "tsc -p tsconfig.json",
17
+ "build": "tsc -p tsconfig.json && node ../../scripts/ensure-bin-executable.mjs",
18
18
  "dev": "ts-node src/cli.ts",
19
19
  "lint": "eslint \"src/**/*.ts\"",
20
20
  "prepare": "npm run build",
@@ -33,12 +33,12 @@
33
33
  "repository": {
34
34
  "type": "git",
35
35
  "url": "git+https://github.com/optimuslabs-io/optimus-secure-fdn.git",
36
- "directory": "dev_npx_packages/log-llm-config"
36
+ "directory": "npx_packages/production/log-llm-config"
37
37
  },
38
38
  "bugs": {
39
39
  "url": "https://github.com/optimuslabs-io/optimus-secure-fdn/issues"
40
40
  },
41
- "homepage": "https://github.com/optimuslabs-io/optimus-secure-fdn/tree/main/dev_npx_packages/log-llm-config#readme",
41
+ "homepage": "https://github.com/optimuslabs-io/optimus-secure-fdn/tree/main/npx_packages/production/log-llm-config#readme",
42
42
  "files": [
43
43
  "dist/**/*",
44
44
  "README.md"
@@ -57,6 +57,6 @@
57
57
  "dependencies": {
58
58
  "axios": "^1.15.0",
59
59
  "canonicalize": "^2.1.0",
60
- "optimus-tofu": "^0.1.0"
60
+ "optimus-tofu": "^0.1.9"
61
61
  }
62
62
  }