ework-daemon 0.4.62 → 0.4.63

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/opencode.ts +18 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ework-daemon",
3
- "version": "0.4.62",
3
+ "version": "0.4.63",
4
4
  "description": "Issue-driven AI development daemon. Spawns opencode subprocesses to resolve Gitea issues.",
5
5
  "module": "src/index.ts",
6
6
  "type": "module",
package/src/opencode.ts CHANGED
@@ -330,6 +330,23 @@ export function wakePolicySkips(
330
330
  return null;
331
331
  }
332
332
 
333
+ // Per-issue npm prefix: `npm install -g <pkg>` inside a session lands in the issue's
334
+ // workdir instead of the system global, so concurrent agents debugging different
335
+ // issues cannot clobber each other's global installs (nor poison the shared daemon env).
336
+ export function spawnEnvFor(
337
+ base: Record<string, string | undefined>,
338
+ hooks: Record<string, string | undefined>,
339
+ workdir: string,
340
+ ): Record<string, string> {
341
+ const npmHome = `${workdir}/.npm-global`;
342
+ return {
343
+ ...base,
344
+ ...hooks,
345
+ NPM_CONFIG_PREFIX: npmHome,
346
+ PATH: `${npmHome}/bin:${base.PATH ?? ""}`,
347
+ };
348
+ }
349
+
333
350
  export class Engine {
334
351
  private cfg: Config;
335
352
  private store: Store;
@@ -1259,7 +1276,7 @@ export class Engine {
1259
1276
  try { await tracker.setReaction(ref, msg.sourceCommentId, "eyes"); } catch { /* non-critical */ }
1260
1277
  }
1261
1278
 
1262
- const childEnv = { ...process.env, ...this.hookEnvFor(issue, session, workdir) };
1279
+ const childEnv = spawnEnvFor(process.env, this.hookEnvFor(issue, session, workdir), workdir);
1263
1280
 
1264
1281
  let exitCode: number | null = null;
1265
1282