gsd-pi 2.39.0 → 2.40.0-dev.4a93031
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/resource-loader.js +66 -2
- package/dist/resources/extensions/async-jobs/index.js +10 -0
- package/dist/resources/extensions/get-secrets-from-user.js +1 -1
- package/dist/resources/extensions/gsd/auto-dashboard.js +7 -0
- package/dist/resources/extensions/gsd/auto-loop.js +761 -673
- package/dist/resources/extensions/gsd/auto-post-unit.js +10 -2
- package/dist/resources/extensions/gsd/auto-prompts.js +3 -3
- package/dist/resources/extensions/gsd/auto-start.js +6 -1
- package/dist/resources/extensions/gsd/auto.js +6 -4
- package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +126 -0
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +233 -0
- package/dist/resources/extensions/gsd/bootstrap/dynamic-tools.js +59 -0
- package/dist/resources/extensions/gsd/bootstrap/register-extension.js +38 -0
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +156 -0
- package/dist/resources/extensions/gsd/bootstrap/register-shortcuts.js +46 -0
- package/dist/resources/extensions/gsd/bootstrap/system-context.js +300 -0
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +38 -0
- package/dist/resources/extensions/gsd/commands/catalog.js +278 -0
- package/dist/resources/extensions/gsd/commands/context.js +84 -0
- package/dist/resources/extensions/gsd/commands/dispatcher.js +21 -0
- package/dist/resources/extensions/gsd/commands/handlers/auto.js +72 -0
- package/dist/resources/extensions/gsd/commands/handlers/core.js +246 -0
- package/dist/resources/extensions/gsd/commands/handlers/ops.js +166 -0
- package/dist/resources/extensions/gsd/commands/handlers/parallel.js +94 -0
- package/dist/resources/extensions/gsd/commands/handlers/workflow.js +102 -0
- package/dist/resources/extensions/gsd/commands/index.js +11 -0
- package/dist/resources/extensions/gsd/commands-handlers.js +1 -1
- package/dist/resources/extensions/gsd/commands.js +8 -1190
- package/dist/resources/extensions/gsd/dashboard-overlay.js +9 -0
- package/dist/resources/extensions/gsd/doctor-proactive.js +80 -10
- package/dist/resources/extensions/gsd/doctor.js +32 -2
- package/dist/resources/extensions/gsd/export-html.js +46 -0
- package/dist/resources/extensions/gsd/files.js +1 -1
- package/dist/resources/extensions/gsd/health-widget.js +1 -1
- package/dist/resources/extensions/gsd/index.js +4 -1115
- package/dist/resources/extensions/gsd/progress-score.js +20 -1
- package/dist/resources/extensions/gsd/prompts/forensics.md +121 -46
- package/dist/resources/extensions/gsd/visualizer-data.js +26 -1
- package/dist/resources/extensions/gsd/visualizer-views.js +52 -0
- package/dist/welcome-screen.d.ts +3 -2
- package/dist/welcome-screen.js +66 -22
- package/package.json +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts +12 -0
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.js +107 -24
- package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/skill-tool.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/skill-tool.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/skill-tool.test.js +70 -0
- package/packages/pi-coding-agent/dist/core/skill-tool.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/skills.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/skills.js +2 -1
- package/packages/pi-coding-agent/dist/core/skills.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts +17 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js +244 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/extension-ui-controller.d.ts +3 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/extension-ui-controller.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/extension-ui-controller.js +58 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/extension-ui-controller.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.d.ts +12 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.js +54 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/model-controller.d.ts +6 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/model-controller.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/model-controller.js +63 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/model-controller.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-state.d.ts +38 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-state.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-state.js +2 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-state.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +15 -457
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/pi-coding-agent/package.json +1 -1
- package/packages/pi-coding-agent/src/core/agent-session.ts +122 -23
- package/packages/pi-coding-agent/src/core/skill-tool.test.ts +89 -0
- package/packages/pi-coding-agent/src/core/skills.ts +2 -1
- package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +302 -0
- package/packages/pi-coding-agent/src/modes/interactive/controllers/extension-ui-controller.ts +59 -0
- package/packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.ts +68 -0
- package/packages/pi-coding-agent/src/modes/interactive/controllers/model-controller.ts +71 -0
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode-state.ts +37 -0
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +18 -510
- package/pkg/package.json +1 -1
- package/src/resources/extensions/async-jobs/index.ts +11 -0
- package/src/resources/extensions/get-secrets-from-user.ts +1 -1
- package/src/resources/extensions/gsd/auto-dashboard.ts +10 -0
- package/src/resources/extensions/gsd/auto-loop.ts +1075 -921
- package/src/resources/extensions/gsd/auto-post-unit.ts +10 -2
- package/src/resources/extensions/gsd/auto-prompts.ts +3 -3
- package/src/resources/extensions/gsd/auto-start.ts +6 -1
- package/src/resources/extensions/gsd/auto.ts +13 -10
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +142 -0
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +238 -0
- package/src/resources/extensions/gsd/bootstrap/dynamic-tools.ts +90 -0
- package/src/resources/extensions/gsd/bootstrap/register-extension.ts +46 -0
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +167 -0
- package/src/resources/extensions/gsd/bootstrap/register-shortcuts.ts +55 -0
- package/src/resources/extensions/gsd/bootstrap/system-context.ts +340 -0
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +51 -0
- package/src/resources/extensions/gsd/commands/catalog.ts +301 -0
- package/src/resources/extensions/gsd/commands/context.ts +101 -0
- package/src/resources/extensions/gsd/commands/dispatcher.ts +32 -0
- package/src/resources/extensions/gsd/commands/handlers/auto.ts +74 -0
- package/src/resources/extensions/gsd/commands/handlers/core.ts +274 -0
- package/src/resources/extensions/gsd/commands/handlers/ops.ts +169 -0
- package/src/resources/extensions/gsd/commands/handlers/parallel.ts +118 -0
- package/src/resources/extensions/gsd/commands/handlers/workflow.ts +109 -0
- package/src/resources/extensions/gsd/commands/index.ts +14 -0
- package/src/resources/extensions/gsd/commands-handlers.ts +1 -1
- package/src/resources/extensions/gsd/commands.ts +10 -1329
- package/src/resources/extensions/gsd/dashboard-overlay.ts +10 -0
- package/src/resources/extensions/gsd/doctor-proactive.ts +106 -10
- package/src/resources/extensions/gsd/doctor.ts +47 -3
- package/src/resources/extensions/gsd/export-html.ts +51 -0
- package/src/resources/extensions/gsd/files.ts +1 -1
- package/src/resources/extensions/gsd/health-widget.ts +2 -1
- package/src/resources/extensions/gsd/index.ts +12 -1314
- package/src/resources/extensions/gsd/progress-score.ts +23 -0
- package/src/resources/extensions/gsd/prompts/forensics.md +121 -46
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +13 -9
- package/src/resources/extensions/gsd/tests/doctor-proactive.test.ts +3 -3
- package/src/resources/extensions/gsd/tests/provider-errors.test.ts +16 -16
- package/src/resources/extensions/gsd/tests/skill-activation.test.ts +4 -4
- package/src/resources/extensions/gsd/tests/visualizer-data.test.ts +10 -10
- package/src/resources/extensions/gsd/visualizer-data.ts +51 -1
- package/src/resources/extensions/gsd/visualizer-views.ts +58 -0
- /package/dist/resources/extensions/{env-utils.js → gsd/env-utils.js} +0 -0
- /package/src/resources/extensions/{env-utils.ts → gsd/env-utils.ts} +0 -0
package/dist/resource-loader.js
CHANGED
|
@@ -48,10 +48,22 @@ function getBundledGsdVersion() {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
function writeManagedResourceManifest(agentDir) {
|
|
51
|
+
// Record root-level files currently in the bundled extensions source so that
|
|
52
|
+
// future upgrades can detect and prune any that get removed or moved.
|
|
53
|
+
let installedExtensionRootFiles = [];
|
|
54
|
+
try {
|
|
55
|
+
if (existsSync(bundledExtensionsDir)) {
|
|
56
|
+
installedExtensionRootFiles = readdirSync(bundledExtensionsDir, { withFileTypes: true })
|
|
57
|
+
.filter(e => e.isFile())
|
|
58
|
+
.map(e => e.name);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch { /* non-fatal */ }
|
|
51
62
|
const manifest = {
|
|
52
63
|
gsdVersion: getBundledGsdVersion(),
|
|
53
64
|
syncedAt: Date.now(),
|
|
54
65
|
contentHash: computeResourceFingerprint(),
|
|
66
|
+
installedExtensionRootFiles,
|
|
55
67
|
};
|
|
56
68
|
writeFileSync(getManagedResourceManifestPath(agentDir), JSON.stringify(manifest));
|
|
57
69
|
}
|
|
@@ -246,6 +258,53 @@ function ensureNodeModulesSymlink(agentDir) {
|
|
|
246
258
|
// Non-fatal — worst case, extensions fall back to NODE_PATH via jiti
|
|
247
259
|
}
|
|
248
260
|
}
|
|
261
|
+
/**
|
|
262
|
+
* Prune root-level extension files that were installed by a previous GSD version
|
|
263
|
+
* but have since been removed or relocated to a subdirectory.
|
|
264
|
+
*
|
|
265
|
+
* Two strategies:
|
|
266
|
+
* 1. Manifest-based (preferred): the manifest records which root files were installed
|
|
267
|
+
* last time; any that are no longer in the current bundle are deleted.
|
|
268
|
+
* 2. Known-stale fallback: for upgrades from versions before manifest tracking,
|
|
269
|
+
* explicitly delete files known to have been moved (e.g. env-utils.js → gsd/).
|
|
270
|
+
*/
|
|
271
|
+
function pruneRemovedBundledExtensions(manifest, agentDir) {
|
|
272
|
+
const extensionsDir = join(agentDir, 'extensions');
|
|
273
|
+
if (!existsSync(extensionsDir))
|
|
274
|
+
return;
|
|
275
|
+
// Current bundled root-level files (what the new version provides)
|
|
276
|
+
const currentSourceFiles = new Set();
|
|
277
|
+
try {
|
|
278
|
+
if (existsSync(bundledExtensionsDir)) {
|
|
279
|
+
for (const e of readdirSync(bundledExtensionsDir, { withFileTypes: true })) {
|
|
280
|
+
if (e.isFile())
|
|
281
|
+
currentSourceFiles.add(e.name);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
catch { /* non-fatal */ }
|
|
286
|
+
const removeIfStale = (fileName) => {
|
|
287
|
+
if (currentSourceFiles.has(fileName))
|
|
288
|
+
return; // still in bundle, not stale
|
|
289
|
+
const stale = join(extensionsDir, fileName);
|
|
290
|
+
try {
|
|
291
|
+
if (existsSync(stale))
|
|
292
|
+
rmSync(stale, { force: true });
|
|
293
|
+
}
|
|
294
|
+
catch { /* non-fatal */ }
|
|
295
|
+
};
|
|
296
|
+
if (manifest?.installedExtensionRootFiles) {
|
|
297
|
+
// Manifest-based: remove previously-installed root files that are no longer bundled
|
|
298
|
+
for (const prevFile of manifest.installedExtensionRootFiles) {
|
|
299
|
+
removeIfStale(prevFile);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
else {
|
|
303
|
+
// Fallback: explicitly remove known stale files from pre-manifest-tracking versions
|
|
304
|
+
// env-utils.js was moved from extensions/ root → gsd/ in v2.39.x (#1634)
|
|
305
|
+
removeIfStale('env-utils.js');
|
|
306
|
+
}
|
|
307
|
+
}
|
|
249
308
|
/**
|
|
250
309
|
* Syncs all bundled resources to agentDir (~/.gsd/agent/) on every launch.
|
|
251
310
|
*
|
|
@@ -263,11 +322,16 @@ function ensureNodeModulesSymlink(agentDir) {
|
|
|
263
322
|
*/
|
|
264
323
|
export function initResources(agentDir) {
|
|
265
324
|
mkdirSync(agentDir, { recursive: true });
|
|
325
|
+
const currentVersion = getBundledGsdVersion();
|
|
326
|
+
const manifest = readManagedResourceManifest(agentDir);
|
|
327
|
+
// Always prune root-level extension files that were removed from the bundle.
|
|
328
|
+
// This is cheap (a few existence checks + at most one rmSync) and must run
|
|
329
|
+
// unconditionally so that stale files left by a previous version are cleaned
|
|
330
|
+
// up even when the version/hash match causes the full sync to be skipped.
|
|
331
|
+
pruneRemovedBundledExtensions(manifest, agentDir);
|
|
266
332
|
// Skip the full copy when both version AND content fingerprint match.
|
|
267
333
|
// Version-only checks miss same-version content changes (npm link dev workflow,
|
|
268
334
|
// hotfixes within a release). The content hash catches those at ~1ms cost.
|
|
269
|
-
const currentVersion = getBundledGsdVersion();
|
|
270
|
-
const manifest = readManagedResourceManifest(agentDir);
|
|
271
335
|
if (manifest && manifest.gsdVersion === currentVersion) {
|
|
272
336
|
// Version matches — check content fingerprint for same-version staleness.
|
|
273
337
|
const currentHash = computeResourceFingerprint();
|
|
@@ -64,6 +64,16 @@ export default function AsyncJobs(pi) {
|
|
|
64
64
|
},
|
|
65
65
|
});
|
|
66
66
|
});
|
|
67
|
+
pi.on("session_before_switch", async () => {
|
|
68
|
+
if (manager) {
|
|
69
|
+
// Cancel all running background jobs — their results are no longer
|
|
70
|
+
// relevant to the new session and would produce wasteful follow-up
|
|
71
|
+
// notifications that trigger empty LLM turns (#1642).
|
|
72
|
+
for (const job of manager.getRunningJobs()) {
|
|
73
|
+
manager.cancel(job.id);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
});
|
|
67
77
|
pi.on("session_shutdown", async () => {
|
|
68
78
|
if (manager) {
|
|
69
79
|
manager.shutdown();
|
|
@@ -49,7 +49,7 @@ async function writeEnvKey(filePath, key, value) {
|
|
|
49
49
|
// Re-export from env-utils.ts so existing consumers still work.
|
|
50
50
|
// The implementation lives in env-utils.ts to avoid pulling @gsd/pi-tui
|
|
51
51
|
// into modules that only need env-checking (e.g. files.ts during reports).
|
|
52
|
-
import { checkExistingEnvKeys } from "./env-utils.js";
|
|
52
|
+
import { checkExistingEnvKeys } from "./gsd/env-utils.js";
|
|
53
53
|
export { checkExistingEnvKeys };
|
|
54
54
|
/**
|
|
55
55
|
* Detect the write destination based on project files in basePath.
|
|
@@ -371,6 +371,13 @@ export function updateProgressWidget(ctx, unitType, unitId, state, accessors, ti
|
|
|
371
371
|
render(width) {
|
|
372
372
|
if (cachedLines && cachedWidth === width)
|
|
373
373
|
return cachedLines;
|
|
374
|
+
// While newSession() is in-flight, session state is mid-mutation.
|
|
375
|
+
// Accessing cmdCtx.sessionManager or cmdCtx.getContextUsage() can
|
|
376
|
+
// block the render loop and freeze the TUI. Return the last cached
|
|
377
|
+
// frame (or an empty frame on first render) until the switch settles.
|
|
378
|
+
if (accessors.isSessionSwitching()) {
|
|
379
|
+
return cachedLines ?? [];
|
|
380
|
+
}
|
|
374
381
|
const ui = makeUI(theme, width);
|
|
375
382
|
const lines = [];
|
|
376
383
|
const pad = INDENT.base;
|