gsd-pi 2.38.0-dev.4d4d14a → 2.38.0-dev.5492881

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 (37) hide show
  1. package/dist/resource-loader.js +34 -1
  2. package/dist/resources/extensions/gsd/auto-dispatch.js +1 -1
  3. package/dist/resources/extensions/gsd/auto-loop.js +538 -469
  4. package/dist/resources/extensions/gsd/auto-post-unit.js +9 -3
  5. package/dist/resources/extensions/gsd/auto-prompts.js +18 -14
  6. package/dist/resources/extensions/gsd/auto-worktree.js +3 -3
  7. package/dist/resources/extensions/gsd/commands.js +2 -1
  8. package/dist/resources/extensions/gsd/doctor.js +20 -1
  9. package/dist/resources/extensions/gsd/exit-command.js +2 -1
  10. package/dist/resources/extensions/gsd/files.js +4 -0
  11. package/dist/resources/extensions/gsd/git-service.js +22 -11
  12. package/dist/resources/extensions/gsd/guided-flow.js +82 -32
  13. package/dist/resources/extensions/gsd/native-git-bridge.js +37 -0
  14. package/dist/resources/extensions/gsd/prompts/run-uat.md +2 -0
  15. package/dist/resources/extensions/gsd/roadmap-mutations.js +24 -0
  16. package/dist/resources/extensions/mcp-client/index.js +14 -1
  17. package/package.json +1 -1
  18. package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts.map +1 -1
  19. package/packages/pi-coding-agent/dist/core/extensions/loader.js +205 -7
  20. package/packages/pi-coding-agent/dist/core/extensions/loader.js.map +1 -1
  21. package/packages/pi-coding-agent/src/core/extensions/loader.ts +223 -7
  22. package/src/resources/extensions/gsd/auto-dispatch.ts +1 -1
  23. package/src/resources/extensions/gsd/auto-loop.ts +342 -304
  24. package/src/resources/extensions/gsd/auto-post-unit.ts +10 -3
  25. package/src/resources/extensions/gsd/auto-prompts.ts +20 -14
  26. package/src/resources/extensions/gsd/auto-worktree.ts +3 -3
  27. package/src/resources/extensions/gsd/commands.ts +2 -2
  28. package/src/resources/extensions/gsd/doctor.ts +22 -1
  29. package/src/resources/extensions/gsd/exit-command.ts +2 -2
  30. package/src/resources/extensions/gsd/files.ts +3 -1
  31. package/src/resources/extensions/gsd/git-service.ts +31 -9
  32. package/src/resources/extensions/gsd/guided-flow.ts +110 -38
  33. package/src/resources/extensions/gsd/native-git-bridge.ts +37 -0
  34. package/src/resources/extensions/gsd/prompts/run-uat.md +2 -0
  35. package/src/resources/extensions/gsd/roadmap-mutations.ts +29 -0
  36. package/src/resources/extensions/gsd/tests/auto-loop.test.ts +106 -31
  37. package/src/resources/extensions/mcp-client/index.ts +17 -1
@@ -1,7 +1,7 @@
1
1
  import { DefaultResourceLoader } from '@gsd/pi-coding-agent';
2
2
  import { createHash } from 'node:crypto';
3
3
  import { homedir } from 'node:os';
4
- import { chmodSync, copyFileSync, cpSync, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from 'node:fs';
4
+ import { chmodSync, copyFileSync, cpSync, existsSync, lstatSync, mkdirSync, readFileSync, readlinkSync, readdirSync, rmSync, statSync, symlinkSync, unlinkSync, writeFileSync } from 'node:fs';
5
5
  import { dirname, join, relative, resolve } from 'node:path';
6
6
  import { fileURLToPath } from 'node:url';
7
7
  import { compareSemver } from './update-check.js';
@@ -217,6 +217,35 @@ function copyDirRecursive(src, dest) {
217
217
  }
218
218
  }
219
219
  }
220
+ /**
221
+ * Creates (or updates) a symlink at agentDir/node_modules pointing to GSD's
222
+ * own node_modules directory.
223
+ *
224
+ * Native ESM `import()` ignores NODE_PATH — it resolves packages by walking
225
+ * up the directory tree from the importing file. Extension files synced to
226
+ * ~/.gsd/agent/extensions/ have no ancestor node_modules, so imports of
227
+ * @gsd/* packages fail. The symlink makes Node's standard resolution find
228
+ * them without requiring every call site to use jiti.
229
+ */
230
+ function ensureNodeModulesSymlink(agentDir) {
231
+ const agentNodeModules = join(agentDir, 'node_modules');
232
+ const gsdNodeModules = join(packageRoot, 'node_modules');
233
+ try {
234
+ const existing = readlinkSync(agentNodeModules);
235
+ if (existing === gsdNodeModules)
236
+ return; // already correct
237
+ unlinkSync(agentNodeModules);
238
+ }
239
+ catch {
240
+ // readlinkSync throws if path doesn't exist or isn't a symlink — both are fine
241
+ }
242
+ try {
243
+ symlinkSync(gsdNodeModules, agentNodeModules, 'junction');
244
+ }
245
+ catch {
246
+ // Non-fatal — worst case, extensions fall back to NODE_PATH via jiti
247
+ }
248
+ }
220
249
  /**
221
250
  * Syncs all bundled resources to agentDir (~/.gsd/agent/) on every launch.
222
251
  *
@@ -262,6 +291,10 @@ export function initResources(agentDir) {
262
291
  // Ensure all newly copied files are owner-writable so the next run can
263
292
  // overwrite them (covers extensions, agents, and skills in one walk).
264
293
  makeTreeWritable(agentDir);
294
+ // Ensure ~/.gsd/agent/node_modules symlinks to GSD's node_modules so that
295
+ // native ESM import() calls from synced extension files can resolve @gsd/*
296
+ // packages via ancestor directory lookup. NODE_PATH only applies to CJS/jiti.
297
+ ensureNodeModulesSymlink(agentDir);
265
298
  writeManagedResourceManifest(agentDir);
266
299
  ensureRegistryEntries(join(agentDir, 'extensions'));
267
300
  }
@@ -80,7 +80,7 @@ const DISPATCH_RULES = [
80
80
  unitType: "run-uat",
81
81
  unitId: `${mid}/${sliceId}`,
82
82
  prompt: await buildRunUatPrompt(mid, sliceId, relSliceFile(basePath, mid, sliceId, "UAT"), uatContent ?? "", basePath),
83
- pauseAfterDispatch: uatType !== "artifact-driven",
83
+ pauseAfterDispatch: uatType !== "artifact-driven" && uatType !== "browser-executable" && uatType !== "runtime-executable",
84
84
  };
85
85
  },
86
86
  },