pi-goosedump 0.9.11 → 0.9.13
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 +2 -1
- package/index.ts +19 -8
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -12,7 +12,8 @@ pi install npm:pi-goosedump
|
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
This installs `pi-goosedump` and its main dependency `@jarkkojs/goosedump`,
|
|
15
|
-
which includes platform-specific native binaries for Linux, macOS,
|
|
15
|
+
which includes platform-specific native binaries for Linux x64, macOS arm64,
|
|
16
|
+
and Windows x64.
|
|
16
17
|
If the goosedump binary cannot be resolved, the extension disables itself.
|
|
17
18
|
|
|
18
19
|
## Tools
|
package/index.ts
CHANGED
|
@@ -276,7 +276,7 @@ function compactStartedMessage(keep: number | null): string {
|
|
|
276
276
|
|
|
277
277
|
function runGoosedump(args: string[]): string {
|
|
278
278
|
try {
|
|
279
|
-
return execFileSync(
|
|
279
|
+
return execFileSync(process.execPath, [resolveGoosedumpBinary(), ...args], {
|
|
280
280
|
encoding: 'utf-8',
|
|
281
281
|
maxBuffer: 16 * 1024 * 1024,
|
|
282
282
|
});
|
|
@@ -291,14 +291,15 @@ function runGoosedump(args: string[]): string {
|
|
|
291
291
|
// Non-blocking variant for the compact path: goosedump compact runs an ML
|
|
292
292
|
// model and can take many seconds, so execFileSync would freeze Pi's event
|
|
293
293
|
// loop (and its compaction spinner). execFile keeps the loop free to render.
|
|
294
|
-
function runGoosedumpAsync(args: string[]): Promise<string> {
|
|
294
|
+
function runGoosedumpAsync(args: string[], signal?: AbortSignal): Promise<string> {
|
|
295
295
|
return new Promise((resolve, reject) => {
|
|
296
296
|
execFile(
|
|
297
|
-
|
|
297
|
+
process.execPath,
|
|
298
298
|
[resolveGoosedumpBinary(), ...args],
|
|
299
299
|
{
|
|
300
300
|
encoding: 'utf-8',
|
|
301
301
|
maxBuffer: 16 * 1024 * 1024,
|
|
302
|
+
signal,
|
|
302
303
|
},
|
|
303
304
|
(err, stdout, stderr) => {
|
|
304
305
|
if (err) {
|
|
@@ -419,13 +420,14 @@ function historyScopeParam() {
|
|
|
419
420
|
async function goosedumpCompact(
|
|
420
421
|
target: string,
|
|
421
422
|
options: { scope?: string; from?: string; until: string },
|
|
423
|
+
signal?: AbortSignal,
|
|
422
424
|
): Promise<string> {
|
|
423
425
|
const scope = options.scope ?? 'lineage';
|
|
424
426
|
const args = ['compact', target, '--scope', scope];
|
|
425
427
|
if (options.from) args.push('--from', options.from);
|
|
426
428
|
args.push('--until', options.until);
|
|
427
429
|
|
|
428
|
-
const output = await runGoosedumpAsync(args);
|
|
430
|
+
const output = await runGoosedumpAsync(args, signal);
|
|
429
431
|
for (const line of output.split('\n')) {
|
|
430
432
|
if (!line) continue;
|
|
431
433
|
try {
|
|
@@ -622,6 +624,7 @@ async function buildGoosedumpCompaction(
|
|
|
622
624
|
},
|
|
623
625
|
branchEntries: SessionEntry[],
|
|
624
626
|
keep?: number,
|
|
627
|
+
signal?: AbortSignal,
|
|
625
628
|
): Promise<
|
|
626
629
|
CompactionResult<GoosedumpCompactionDetails> | { cancel: true; reason: string } | undefined
|
|
627
630
|
> {
|
|
@@ -639,7 +642,7 @@ async function buildGoosedumpCompaction(
|
|
|
639
642
|
const range = buildCompactRange(branchEntries, firstKeptEntryId);
|
|
640
643
|
if (!range) return undefined;
|
|
641
644
|
|
|
642
|
-
const summary = await goosedumpCompact(target, range);
|
|
645
|
+
const summary = await goosedumpCompact(target, range, signal);
|
|
643
646
|
if (!summary) return undefined;
|
|
644
647
|
|
|
645
648
|
return {
|
|
@@ -1123,7 +1126,7 @@ export function createGoosedumpIntegration(
|
|
|
1123
1126
|
|
|
1124
1127
|
function checkGoosedump(ctx?: ExtensionContext): boolean {
|
|
1125
1128
|
try {
|
|
1126
|
-
resolveGoosedumpBinary();
|
|
1129
|
+
execFileSync(process.execPath, [resolveGoosedumpBinary(), '--version'], { stdio: 'ignore' });
|
|
1127
1130
|
return true;
|
|
1128
1131
|
} catch {
|
|
1129
1132
|
if (ctx) {
|
|
@@ -1145,7 +1148,7 @@ export function createGoosedumpIntegration(
|
|
|
1145
1148
|
keep: number | null,
|
|
1146
1149
|
): 'started' | 'busy' | 'nothing-to-compact' {
|
|
1147
1150
|
if (compactionQueued) return 'busy';
|
|
1148
|
-
if (!hasCompactableHistory(ctx)) return 'nothing-to-compact';
|
|
1151
|
+
if (keep === null && !hasCompactableHistory(ctx)) return 'nothing-to-compact';
|
|
1149
1152
|
|
|
1150
1153
|
compactionQueued = true;
|
|
1151
1154
|
pendingKeep = keep;
|
|
@@ -1412,7 +1415,13 @@ export function createGoosedumpIntegration(
|
|
|
1412
1415
|
if (event.signal.aborted) return;
|
|
1413
1416
|
|
|
1414
1417
|
const { messagesToSummarize, turnPrefixMessages } = event.preparation;
|
|
1415
|
-
if (
|
|
1418
|
+
if (
|
|
1419
|
+
pendingKeep === null &&
|
|
1420
|
+
messagesToSummarize.length === 0 &&
|
|
1421
|
+
turnPrefixMessages.length === 0
|
|
1422
|
+
) {
|
|
1423
|
+
return;
|
|
1424
|
+
}
|
|
1416
1425
|
|
|
1417
1426
|
const target = currentSessionTarget(ctx);
|
|
1418
1427
|
if (!target) return;
|
|
@@ -1424,6 +1433,7 @@ export function createGoosedumpIntegration(
|
|
|
1424
1433
|
event.preparation,
|
|
1425
1434
|
event.branchEntries,
|
|
1426
1435
|
keep,
|
|
1436
|
+
event.signal,
|
|
1427
1437
|
);
|
|
1428
1438
|
if (compaction && 'cancel' in compaction) {
|
|
1429
1439
|
if (ctx.hasUI) ctx.ui.notify(compaction.reason, 'info');
|
|
@@ -1431,6 +1441,7 @@ export function createGoosedumpIntegration(
|
|
|
1431
1441
|
}
|
|
1432
1442
|
return compaction ? { compaction } : undefined;
|
|
1433
1443
|
} catch (err) {
|
|
1444
|
+
if (event.signal.aborted) return { cancel: true };
|
|
1434
1445
|
if (ctx.hasUI) {
|
|
1435
1446
|
const message = err instanceof Error ? err.message : String(err);
|
|
1436
1447
|
ctx.ui.notify(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-goosedump",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.13",
|
|
4
4
|
"description": "Pi extension for goosedump-backed session-history search, entry expansion, and compaction",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"compaction",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@earendil-works/pi-tui": "^0.78.0",
|
|
36
|
-
"@jarkkojs/goosedump": "^0.9.
|
|
36
|
+
"@jarkkojs/goosedump": "^0.9.8",
|
|
37
37
|
"@sinclair/typebox": "^0.34.49"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|