@ramarivera/coding-agent-langfuse 0.1.33 → 0.1.34

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 CHANGED
@@ -77,6 +77,11 @@ The Windows path intentionally uses a per-user Scheduled Task for the default
77
77
  `npx` workflow. A true Windows SCM service needs an installed wrapper or native
78
78
  service binary; raw `sc.exe` is not a good fit for a transient npm command.
79
79
 
80
+ The generated services are package-manager agnostic. By default the installer
81
+ uses the `npx` executable found on the current host and captures the current
82
+ `PATH`; use `--npx-path` and `--path` when installing from a shell manager such
83
+ as Homebrew, nvm, fnm, Volta, asdf, mise, or a system Node.js install.
84
+
80
85
  ## Backfill windows
81
86
 
82
87
  Backfill only a timeframe when repairing a host or replaying a recent window:
package/dist/service.d.ts CHANGED
@@ -13,6 +13,7 @@ type ServiceOptions = {
13
13
  batchSize: number;
14
14
  pollIntervalMs: number;
15
15
  postDelayMs: number;
16
+ npxPath: string;
16
17
  since?: string;
17
18
  dryRun: boolean;
18
19
  start: boolean;
package/dist/service.js CHANGED
@@ -20,6 +20,7 @@ Service options:
20
20
  --state PATH Dedupe state file
21
21
  --home PATH Home directory to scan (default: current user home)
22
22
  --package-spec SPEC npx package spec (default: ${defaultPackageSpec})
23
+ --npx-path PATH npx executable path for host services (default: auto-detected)
23
24
  --batch-size N OTLP spans per POST (default: 10)
24
25
  --poll-interval-ms N Delay between --follow scans (default: 5000)
25
26
  --post-delay-ms N Delay after each successful OTLP POST (default: 0)
@@ -44,6 +45,7 @@ function parseServiceArgs(argv) {
44
45
  let statePath = "";
45
46
  let name = "";
46
47
  let packageSpec = defaultPackageSpec;
48
+ let npxPath = process.env.CODING_AGENT_LANGFUSE_NPX_PATH ?? "";
47
49
  let batchSize = 10;
48
50
  let pollIntervalMs = 5_000;
49
51
  let postDelayMs = 0;
@@ -81,6 +83,9 @@ function parseServiceArgs(argv) {
81
83
  else if (arg === "--package-spec") {
82
84
  packageSpec = next();
83
85
  }
86
+ else if (arg === "--npx-path") {
87
+ npxPath = next();
88
+ }
84
89
  else if (arg === "--batch-size") {
85
90
  batchSize = parsePositiveInt(arg, next());
86
91
  }
@@ -114,6 +119,7 @@ function parseServiceArgs(argv) {
114
119
  name ||= defaultServiceName(agents, platform);
115
120
  workingDirectory ||= homeDir;
116
121
  pathEnv ||= defaultPathEnv(homeDir, platform);
122
+ npxPath ||= defaultNpxPath(platform);
117
123
  statePath ||= join(homeDir, ".local/state/coding-agent-langfuse", `${name}.json`);
118
124
  return {
119
125
  action,
@@ -124,6 +130,7 @@ function parseServiceArgs(argv) {
124
130
  homeDir,
125
131
  name,
126
132
  packageSpec,
133
+ npxPath,
127
134
  batchSize,
128
135
  pollIntervalMs,
129
136
  postDelayMs,
@@ -254,7 +261,7 @@ async function serviceMain(argv = process.argv.slice(2)) {
254
261
  }
255
262
  function buildFollowCommand(options) {
256
263
  const command = [
257
- options.platform === "win32" ? "npx.cmd" : "npx",
264
+ options.npxPath,
258
265
  "--yes",
259
266
  options.packageSpec,
260
267
  "--agents",
@@ -376,6 +383,8 @@ function defaultServiceName(agents, platform) {
376
383
  : `coding-agent-langfuse-${suffix}`;
377
384
  }
378
385
  function defaultPathEnv(homeDir, platform) {
386
+ if (process.env.PATH)
387
+ return process.env.PATH;
379
388
  if (platform === "win32") {
380
389
  return [
381
390
  "%APPDATA%\\npm",
@@ -385,7 +394,6 @@ function defaultPathEnv(homeDir, platform) {
385
394
  ].join(";");
386
395
  }
387
396
  return [
388
- join(homeDir, ".local/share/mise/shims"),
389
397
  join(homeDir, ".local/bin"),
390
398
  "/opt/homebrew/bin",
391
399
  "/usr/local/bin",
@@ -395,6 +403,24 @@ function defaultPathEnv(homeDir, platform) {
395
403
  "/sbin",
396
404
  ].join(":");
397
405
  }
406
+ function defaultNpxPath(platform) {
407
+ if (platform === "win32") {
408
+ return findExecutable("npx.cmd", "where") ?? "npx.cmd";
409
+ }
410
+ return findExecutable("npx", "which") ?? "npx";
411
+ }
412
+ function findExecutable(name, finder) {
413
+ try {
414
+ const output = execFileSync(finder, [name], {
415
+ encoding: "utf8",
416
+ stdio: ["ignore", "pipe", "ignore"],
417
+ });
418
+ return output.split(/\r?\n/).find((line) => line.trim().length > 0)?.trim();
419
+ }
420
+ catch {
421
+ return undefined;
422
+ }
423
+ }
398
424
  function parsePositiveInt(flag, value) {
399
425
  const parsed = Number.parseInt(value, 10);
400
426
  if (!Number.isFinite(parsed) || parsed < 1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ramarivera/coding-agent-langfuse",
3
- "version": "0.1.33",
3
+ "version": "0.1.34",
4
4
  "description": "Universal coding-agent Langfuse backfiller and live OTLP helpers",
5
5
  "type": "module",
6
6
  "license": "MIT",