@ramarivera/coding-agent-langfuse 0.1.36 → 0.1.38

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/dist/service.d.ts CHANGED
@@ -34,4 +34,6 @@ type ServicePlan = {
34
34
  declare function parseServiceArgs(argv: string[]): ServiceOptions;
35
35
  declare function buildServicePlan(options: ServiceOptions): ServicePlan;
36
36
  declare function serviceMain(argv?: string[]): Promise<ServicePlan>;
37
- export { type ServiceOptions, type ServicePlan, buildServicePlan, parseServiceArgs, serviceMain, };
37
+ declare function redactStatusOutput(output: string): string;
38
+ declare function lifecycleEnv(): NodeJS.ProcessEnv;
39
+ export { type ServiceOptions, type ServicePlan, buildServicePlan, redactStatusOutput, parseServiceArgs, serviceMain, lifecycleEnv, };
package/dist/service.js CHANGED
@@ -249,7 +249,7 @@ async function serviceMain(argv = process.argv.slice(2)) {
249
249
  return plan;
250
250
  }
251
251
  if (options.action === "status") {
252
- runCommands(plan.statusCommands);
252
+ runStatusCommands(plan.statusCommands);
253
253
  console.log(JSON.stringify(plan, null, 2));
254
254
  return plan;
255
255
  }
@@ -441,9 +441,10 @@ function parseNonNegativeInt(flag, value) {
441
441
  return parsed;
442
442
  }
443
443
  function runCommands(commands, options = {}) {
444
+ const env = lifecycleEnv();
444
445
  for (const command of commands) {
445
446
  try {
446
- execFileSync(command[0], command.slice(1), { stdio: "inherit" });
447
+ execFileSync(command[0], command.slice(1), { stdio: "inherit", env });
447
448
  }
448
449
  catch (error) {
449
450
  if (!options.ignoreFailure)
@@ -451,6 +452,59 @@ function runCommands(commands, options = {}) {
451
452
  }
452
453
  }
453
454
  }
455
+ function runStatusCommands(commands) {
456
+ const env = lifecycleEnv();
457
+ for (const command of commands) {
458
+ const output = execFileSync(command[0], command.slice(1), {
459
+ encoding: "utf8",
460
+ env,
461
+ stdio: ["ignore", "pipe", "pipe"],
462
+ });
463
+ process.stdout.write(redactStatusOutput(output));
464
+ }
465
+ }
466
+ function redactStatusOutput(output) {
467
+ return output
468
+ .split(/\r?\n/)
469
+ .map((line) => {
470
+ if (/^\s*[A-Za-z_][A-Za-z0-9_()]*\s*=>\s*/.test(line)) {
471
+ return line.replace(/=>\s*.*/, "=> [redacted]");
472
+ }
473
+ if (/^\s*(Path|PATH|.*(?:TOKEN|KEY|SECRET|PASSWORD|AUTH|CREDENTIAL).*)\s*:/i.test(line)) {
474
+ return line.replace(/:\s*.*/, ": [redacted]");
475
+ }
476
+ return line;
477
+ })
478
+ .join("\n");
479
+ }
480
+ function lifecycleEnv() {
481
+ const keys = [
482
+ "PATH",
483
+ "Path",
484
+ "HOME",
485
+ "USER",
486
+ "LOGNAME",
487
+ "TMPDIR",
488
+ "TMP",
489
+ "TEMP",
490
+ "SystemRoot",
491
+ "WINDIR",
492
+ "APPDATA",
493
+ "LOCALAPPDATA",
494
+ "ProgramFiles",
495
+ "ProgramFiles(x86)",
496
+ "ProgramData",
497
+ ];
498
+ const env = {};
499
+ for (const key of keys) {
500
+ const value = process.env[key];
501
+ if (value)
502
+ env[key] = value;
503
+ }
504
+ if (!env.PATH && !env.Path)
505
+ env.PATH = defaultPathEnv(process.env.HOME ?? homedir(), currentServicePlatform());
506
+ return env;
507
+ }
454
508
  function systemdCommand(command) {
455
509
  return ["/usr/bin/env", ...command].map(systemdQuote).join(" ");
456
510
  }
@@ -470,4 +524,4 @@ function escapeXml(value) {
470
524
  .replaceAll('"', "&quot;")
471
525
  .replaceAll("'", "&apos;");
472
526
  }
473
- export { buildServicePlan, parseServiceArgs, serviceMain, };
527
+ export { buildServicePlan, redactStatusOutput, parseServiceArgs, serviceMain, lifecycleEnv, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ramarivera/coding-agent-langfuse",
3
- "version": "0.1.36",
3
+ "version": "0.1.38",
4
4
  "description": "Universal coding-agent Langfuse backfiller and live OTLP helpers",
5
5
  "type": "module",
6
6
  "license": "MIT",