log-llm-config 1.3.76 → 1.3.78

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.
@@ -16,8 +16,17 @@ import { collectWorkspaceVscdbs } from '../collection/mcp_tool_collector.js';
16
16
  import { normalizePathSkipPrefixes } from '../paths/pattern_resolver.js';
17
17
  import { sendConfigFile, sendConfigFilesBatch, sendHookRequestCreate, sendHookRequestUpdateManifest, sendIngestSessionStart, sendIngestSessionFinish, BATCH_CHUNK_SIZE } from '../sender/batch_sender.js';
18
18
  import { canonicalCursorUserStateVscdbPath } from './remediation_config_path.js';
19
+ import { execFileSync } from 'node:child_process';
19
20
  import { createSignature, canonicalizePayload } from '../sender/signing.js';
20
- const PROJECT_ROOT = process.cwd();
21
+ function resolveProjectRoot() {
22
+ try {
23
+ return execFileSync('git', ['rev-parse', '--show-toplevel'], { encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'] }).trim();
24
+ }
25
+ catch {
26
+ return process.cwd();
27
+ }
28
+ }
29
+ const PROJECT_ROOT = resolveProjectRoot();
21
30
  async function collectAllConfigFiles(endpointBase) {
22
31
  const patternsUrl = `${endpointBase.replace(/\/+$/, '')}${FILE_PATH_REGISTRY_FILE_PATTERNS_PATH}`;
23
32
  hookRunLog(`fetching patterns from ${patternsUrl}`);
@@ -76,15 +76,25 @@ function buildRequestBody(hardwareUuid, timestamp) {
76
76
  }
77
77
  return requestBody;
78
78
  }
79
- const maybeSendToEndpoint = async (hardwareUuid, timestamp) => {
79
+ const maybeSendToEndpoint = async (hardwareUuid, timestamp, options = {}) => {
80
80
  const startupEndpointUrl = buildStartupEndpointUrl(loadEndpointBase());
81
81
  const requestBody = buildRequestBody(hardwareUuid, timestamp);
82
82
  try {
83
83
  const response = await postStartupPayload(startupEndpointUrl, requestBody);
84
84
  const result = classifyEndpointResponse(response);
85
85
  console.log(result.message);
86
- if (result.branch === 'key_issued' && result.key)
86
+ if (result.branch === 'key_issued' && result.key) {
87
87
  writeAuthKey(result.key, result.keyId, hardwareUuid);
88
+ // First startup on a machine is unsigned; hook_manifest is only persisted for valid signatures.
89
+ // Re-post immediately so unthrottled init records all hook hashes without a tool call.
90
+ const manifest = parseHookManifest();
91
+ if (options.allowKeyIssuedRetry !== false &&
92
+ Object.keys(manifest).length > 0) {
93
+ await maybeSendToEndpoint(hardwareUuid, new Date().toISOString(), {
94
+ allowKeyIssuedRetry: false,
95
+ });
96
+ }
97
+ }
88
98
  }
89
99
  catch (error) {
90
100
  console.error(`Failed to contact endpoint: ${error.message}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "log-llm-config",
3
- "version": "1.3.76",
3
+ "version": "1.3.78",
4
4
  "description": "CLI helpers for logging hardware UUIDs and posting startup payloads to Optimus Security.",
5
5
  "type": "module",
6
6
  "bin": {