pi-goosedump 0.10.7 → 0.10.8
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/index.ts +16 -5
- package/package.json +2 -2
package/index.ts
CHANGED
|
@@ -461,10 +461,14 @@ function runGoosedump(args: string[]): string {
|
|
|
461
461
|
// Non-blocking variant for the compact path: goosedump compact runs an ML
|
|
462
462
|
// model and can take many seconds, so execFileSync would freeze Pi's event
|
|
463
463
|
// loop (and its compaction spinner). execFile keeps the loop free to render.
|
|
464
|
-
function runGoosedumpAsync(
|
|
464
|
+
function runGoosedumpAsync(
|
|
465
|
+
args: string[],
|
|
466
|
+
signal?: AbortSignal,
|
|
467
|
+
executablePath = resolveNativeGoosedumpBinary(),
|
|
468
|
+
): Promise<GoosedumpCommandOutput> {
|
|
465
469
|
return new Promise((resolve, reject) => {
|
|
466
470
|
execFile(
|
|
467
|
-
|
|
471
|
+
executablePath,
|
|
468
472
|
args,
|
|
469
473
|
{
|
|
470
474
|
encoding: 'utf-8',
|
|
@@ -542,11 +546,12 @@ async function goosedumpRecall(
|
|
|
542
546
|
query: string,
|
|
543
547
|
options: { provider?: string; path?: string; limit?: number } = {},
|
|
544
548
|
signal?: AbortSignal,
|
|
549
|
+
executablePath?: string,
|
|
545
550
|
): Promise<{ hits: GoosedumpMemoryHit[]; warning: string }> {
|
|
546
551
|
const args = ['recall', query, '--limit', String(options.limit ?? 5)];
|
|
547
552
|
if (options.provider) args.push('--provider', options.provider);
|
|
548
553
|
if (options.path) args.push('--path', options.path);
|
|
549
|
-
const output = await runGoosedumpAsync(args, signal);
|
|
554
|
+
const output = await runGoosedumpAsync(args, signal, executablePath);
|
|
550
555
|
return { hits: parseMemoryHits(output.stdout), warning: output.stderr.trim() };
|
|
551
556
|
}
|
|
552
557
|
|
|
@@ -604,13 +609,14 @@ async function goosedumpCompact(
|
|
|
604
609
|
target: string,
|
|
605
610
|
options: { scope?: string; from?: string; until: string },
|
|
606
611
|
signal?: AbortSignal,
|
|
612
|
+
executablePath?: string,
|
|
607
613
|
): Promise<{ summary: string; warning: string }> {
|
|
608
614
|
const scope = options.scope ?? 'lineage';
|
|
609
615
|
const args = ['compact', target, '--scope', scope];
|
|
610
616
|
if (options.from) args.push('--from', options.from);
|
|
611
617
|
args.push('--until', options.until);
|
|
612
618
|
|
|
613
|
-
const output = await runGoosedumpAsync(args, signal);
|
|
619
|
+
const output = await runGoosedumpAsync(args, signal, executablePath);
|
|
614
620
|
for (const line of output.stdout.split('\n')) {
|
|
615
621
|
if (!line) continue;
|
|
616
622
|
try {
|
|
@@ -628,6 +634,7 @@ async function goosedumpCompact(
|
|
|
628
634
|
export interface GoosedumpIntegrationOptions {
|
|
629
635
|
registerTool?: boolean;
|
|
630
636
|
overrideDefaultCompaction?: boolean;
|
|
637
|
+
nativeExecutablePath?: string;
|
|
631
638
|
}
|
|
632
639
|
|
|
633
640
|
interface GoosedumpCompactRange {
|
|
@@ -930,6 +937,7 @@ async function buildGoosedumpCompaction(
|
|
|
930
937
|
reserveTokens: number,
|
|
931
938
|
keep?: number,
|
|
932
939
|
signal?: AbortSignal,
|
|
940
|
+
executablePath?: string,
|
|
933
941
|
): Promise<
|
|
934
942
|
CompactionResult<GoosedumpCompactionDetails> | { cancel: true; reason: string } | undefined
|
|
935
943
|
> {
|
|
@@ -947,7 +955,7 @@ async function buildGoosedumpCompaction(
|
|
|
947
955
|
const range = buildCompactRange(branchEntries, firstKeptEntryId);
|
|
948
956
|
if (!range) return undefined;
|
|
949
957
|
|
|
950
|
-
const generated = await goosedumpCompact(target, range, signal);
|
|
958
|
+
const generated = await goosedumpCompact(target, range, signal, executablePath);
|
|
951
959
|
if (!generated.summary) return undefined;
|
|
952
960
|
const summary = mergeCompactionSummary(
|
|
953
961
|
preparation.previousSummary,
|
|
@@ -1426,6 +1434,7 @@ export function createGoosedumpIntegration(
|
|
|
1426
1434
|
): GoosedumpIntegration {
|
|
1427
1435
|
const shouldRegisterTool = options.registerTool ?? true;
|
|
1428
1436
|
const shouldOverrideDefaultCompaction = options.overrideDefaultCompaction ?? true;
|
|
1437
|
+
const nativeExecutablePath = options.nativeExecutablePath;
|
|
1429
1438
|
|
|
1430
1439
|
let goosedumpAvailable = false;
|
|
1431
1440
|
let compactSettings = DEFAULT_GOOSEDUMP_SETTINGS;
|
|
@@ -1553,6 +1562,7 @@ export function createGoosedumpIntegration(
|
|
|
1553
1562
|
limit: params.limit,
|
|
1554
1563
|
},
|
|
1555
1564
|
signal,
|
|
1565
|
+
nativeExecutablePath,
|
|
1556
1566
|
);
|
|
1557
1567
|
if (warning && ctx.hasUI) ctx.ui.notify(warning, 'warning');
|
|
1558
1568
|
if (hits.length === 0) return textResult(`No durable memory for "${params.query}"`);
|
|
@@ -1842,6 +1852,7 @@ export function createGoosedumpIntegration(
|
|
|
1842
1852
|
piReserveTokens(ctx.cwd),
|
|
1843
1853
|
keep,
|
|
1844
1854
|
event.signal,
|
|
1855
|
+
nativeExecutablePath,
|
|
1845
1856
|
);
|
|
1846
1857
|
if (compaction && 'cancel' in compaction) {
|
|
1847
1858
|
if (ctx.hasUI) ctx.ui.notify(compaction.reason, 'info');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-goosedump",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.8",
|
|
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.10.
|
|
36
|
+
"@jarkkojs/goosedump": "^0.10.8",
|
|
37
37
|
"@sinclair/typebox": "^0.34.49"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|