pi-goosedump 0.11.3 → 0.12.0
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 +6 -11
- package/dist/index.ts +24 -16
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -23,14 +23,10 @@ report that they are unavailable.
|
|
|
23
23
|
- **`goose_grep`** filters session messages with a glob pattern.
|
|
24
24
|
- **`goose_recall`** searches memory harvested by earlier compactions. It
|
|
25
25
|
searches the current working directory by default, can filter decisions,
|
|
26
|
-
facts, preferences, procedures, or episodes, and returns
|
|
27
|
-
|
|
28
|
-
4,096-byte/token-safe output budget. Quarantined, expired, superseded, and
|
|
29
|
-
contradicted entries are excluded.
|
|
26
|
+
facts, preferences, procedures, or episodes, and returns typed excerpts with
|
|
27
|
+
provenance within a 4,096-byte/token-safe output budget.
|
|
30
28
|
- **`goose_compact`** starts asynchronous compaction of the current Pi session.
|
|
31
29
|
Set `keep` to preserve the last N user turns verbatim.
|
|
32
|
-
Trained memory is indexed through goosedump's durable, bounded-retry ingestion
|
|
33
|
-
ledger; inspect terminal failures with `goosedump ingest review --status failed`.
|
|
34
30
|
|
|
35
31
|
The session-history tools accept an optional `provider` (`pi` by default),
|
|
36
32
|
`session`, and `scope` (`lineage` by default or `all`). The current Pi session
|
|
@@ -81,11 +77,10 @@ global setting.
|
|
|
81
77
|
## Compaction behavior
|
|
82
78
|
|
|
83
79
|
The extension replaces Pi's normal summary during manual, scheduled, and
|
|
84
|
-
automatic compaction. It
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
history is available to summarize.
|
|
80
|
+
automatic compaction. It invokes `goosedump session compact --remember`,
|
|
81
|
+
preserves the previous compaction summary, and summarizes only the newly
|
|
82
|
+
compacted range. A `keep:N` request keeps the last N active user turns;
|
|
83
|
+
it is cancelled when no earlier history is available to summarize.
|
|
89
84
|
|
|
90
85
|
Compactions with custom instructions continue to use Pi's normal compactor. If
|
|
91
86
|
goosedump fails, the extension reports the error and falls back to Pi. Successful
|
package/dist/index.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright (C) Jarkko Sakkinen 2026
|
|
3
|
+
|
|
1
4
|
// index.ts
|
|
2
5
|
import {
|
|
3
6
|
DEFAULT_COMPACTION_SETTINGS,
|
|
@@ -289,7 +292,7 @@ function parsePiMessages(output) {
|
|
|
289
292
|
function parseMemoryHits(output) {
|
|
290
293
|
const value = JSON.parse(output);
|
|
291
294
|
if (!Array.isArray(value))
|
|
292
|
-
throw new Error("goosedump
|
|
295
|
+
throw new Error("goosedump memory search returned invalid JSON");
|
|
293
296
|
return value.filter((item) => isRecord(item) && typeof item.hash === "string" && typeof item.kind === "string" && typeof item.text === "string" && typeof item.score === "number" && typeof item.provider === "string" && typeof item.context_id === "string" && typeof item.entry_id === "string" && typeof item.path === "string" && typeof item.source_path === "string" && ["decision", "fact", "preference", "procedure", "episode"].includes(item.memory_type) && typeof item.trust === "number" && typeof item.confidence === "number" && (item.valid_from === null || typeof item.valid_from === "number") && (item.valid_until === null || typeof item.valid_until === "number") && ["context", "project"].includes(item.scope) && ["observed", "mutation"].includes(item.derivation));
|
|
294
297
|
}
|
|
295
298
|
function formatMemoryHit(hit, maxBytes) {
|
|
@@ -412,26 +415,31 @@ function readFirstLine(path) {
|
|
|
412
415
|
function formatTarget(provider, id) {
|
|
413
416
|
return `${provider}:${id}`;
|
|
414
417
|
}
|
|
418
|
+
function appendScope(args, scope) {
|
|
419
|
+
if (scope === "all")
|
|
420
|
+
args.push("--all");
|
|
421
|
+
}
|
|
415
422
|
function goosedumpSearch(target, query, options = {}) {
|
|
416
|
-
const
|
|
417
|
-
|
|
423
|
+
const args = ["session", "search", target, query, "--as", "pi"];
|
|
424
|
+
appendScope(args, options.scope);
|
|
418
425
|
if (options.page)
|
|
419
|
-
args.push("
|
|
426
|
+
args.push("--page", String(options.page));
|
|
420
427
|
return parsePiMessages(runGoosedump(args));
|
|
421
428
|
}
|
|
422
429
|
function goosedumpGrep(target, pattern, options = {}) {
|
|
423
|
-
const
|
|
424
|
-
|
|
430
|
+
const args = ["session", "find", target, pattern, "--as", "pi"];
|
|
431
|
+
appendScope(args, options.scope);
|
|
432
|
+
return parsePiMessages(runGoosedump(args));
|
|
425
433
|
}
|
|
426
434
|
function goosedumpShow(target, options = {}) {
|
|
427
|
-
const
|
|
428
|
-
|
|
435
|
+
const args = ["session", "show", target, "--as", "pi"];
|
|
436
|
+
appendScope(args, options.scope);
|
|
429
437
|
for (const id of options.ids ?? [])
|
|
430
|
-
args.push("
|
|
438
|
+
args.push("--entry", id);
|
|
431
439
|
return parsePiMessages(runGoosedump(args));
|
|
432
440
|
}
|
|
433
441
|
async function goosedumpRecall(query, options = {}, signal, executablePath) {
|
|
434
|
-
const args = ["
|
|
442
|
+
const args = ["memory", "search", query, "--limit", String(options.limit ?? 5)];
|
|
435
443
|
if (options.provider)
|
|
436
444
|
args.push("--provider", options.provider);
|
|
437
445
|
if (options.path)
|
|
@@ -468,13 +476,13 @@ function historyScopeParam() {
|
|
|
468
476
|
}));
|
|
469
477
|
}
|
|
470
478
|
async function goosedumpCompact(target, options, signal, executablePath) {
|
|
471
|
-
const
|
|
472
|
-
|
|
479
|
+
const args = ["session", "compact", target, "--remember"];
|
|
480
|
+
appendScope(args, options.scope);
|
|
473
481
|
if (options.from)
|
|
474
482
|
args.push("--from", options.from);
|
|
475
483
|
if (options.previousSummary)
|
|
476
484
|
args.push("--previous-summary", options.previousSummary);
|
|
477
|
-
args.push("--
|
|
485
|
+
args.push("--before", options.until);
|
|
478
486
|
const output = await runGoosedumpAsync(args, signal, executablePath);
|
|
479
487
|
for (const line of output.stdout.split(`
|
|
480
488
|
`)) {
|
|
@@ -1123,7 +1131,7 @@ function createGoosedumpIntegration(options = {}) {
|
|
|
1123
1131
|
pendingKeep = null;
|
|
1124
1132
|
const message = error instanceof Error ? error.message : String(error);
|
|
1125
1133
|
if (ctx.hasUI)
|
|
1126
|
-
ctx.ui.notify(`goosedump
|
|
1134
|
+
ctx.ui.notify(`goosedump compaction failed: ${message}`, "error");
|
|
1127
1135
|
}
|
|
1128
1136
|
});
|
|
1129
1137
|
return "started";
|
|
@@ -1370,7 +1378,7 @@ function createGoosedumpIntegration(options = {}) {
|
|
|
1370
1378
|
updateStatus(ctx);
|
|
1371
1379
|
const message = error instanceof Error ? error.message : String(error);
|
|
1372
1380
|
if (ctx.hasUI)
|
|
1373
|
-
ctx.ui.notify(`goosedump
|
|
1381
|
+
ctx.ui.notify(`goosedump compaction failed: ${message}`, "error");
|
|
1374
1382
|
}
|
|
1375
1383
|
});
|
|
1376
1384
|
}
|
|
@@ -1424,7 +1432,7 @@ function createGoosedumpIntegration(options = {}) {
|
|
|
1424
1432
|
return { cancel: true };
|
|
1425
1433
|
if (ctx.hasUI) {
|
|
1426
1434
|
const message = err instanceof Error ? err.message : String(err);
|
|
1427
|
-
ctx.ui.notify(`goosedump
|
|
1435
|
+
ctx.ui.notify(`goosedump compaction failed; falling back to Pi compaction: ${message}`, "error");
|
|
1428
1436
|
}
|
|
1429
1437
|
return;
|
|
1430
1438
|
} finally {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-goosedump",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Pi extension for goosedump-backed session-history search, entry expansion, and compaction",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"compaction",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
".": "./dist/index.ts"
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
27
|
-
"build": "bun build index.ts --outfile dist/index.ts --target=node --packages=external",
|
|
27
|
+
"build": "bun build index.ts --outfile dist/index.ts --target=node --packages=external --banner='// SPDX-License-Identifier: Apache-2.0\n// Copyright (C) Jarkko Sakkinen 2026\n'",
|
|
28
28
|
"prepack": "npm run build",
|
|
29
29
|
"fmt": "oxfmt index.ts tests package.json tsconfig.json .oxfmtrc.json README.md",
|
|
30
30
|
"lint": "oxlint index.ts tests",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@earendil-works/pi-tui": "^0.78.0",
|
|
41
|
-
"@jarkkojs/goosedump": "^0.
|
|
41
|
+
"@jarkkojs/goosedump": "^0.12.0",
|
|
42
42
|
"@sinclair/typebox": "^0.34.49"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|