pi-goosedump 0.10.10 → 0.10.11

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 (3) hide show
  1. package/README.md +5 -2
  2. package/index.ts +36 -3
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -22,8 +22,10 @@ report that they are unavailable.
22
22
  - **`goose_get`** expands entry IDs returned by `goose_search` or `goose_grep`.
23
23
  - **`goose_grep`** filters session messages with a glob pattern.
24
24
  - **`goose_recall`** searches memory harvested by earlier compactions. It
25
- searches the current working directory by default and returns remembered
26
- excerpts with provenance within a 4,096-byte/token-safe output budget.
25
+ searches the current working directory by default, can filter decisions,
26
+ facts, preferences, procedures, or episodes, and returns typed excerpts with
27
+ trust, confidence, scope, derivation, and provenance within a 4,096-byte/token-safe
28
+ output budget.
27
29
  - **`goose_compact`** starts asynchronous compaction of the current Pi session.
28
30
  Set `keep` to preserve the last N user turns verbatim.
29
31
 
@@ -40,6 +42,7 @@ goose_search({ query: "auth", scope: "all", page: 2 })
40
42
  goose_get({ ids: ["entry-a", "entry-b"] })
41
43
  goose_grep({ pattern: "*timeout*" })
42
44
  goose_recall({ query: "prior architecture decision" })
45
+ goose_recall({ query: "database", type: "decision" })
43
46
  goose_compact({ keep: 2 })
44
47
  ```
45
48
 
package/index.ts CHANGED
@@ -76,6 +76,13 @@ interface GoosedumpMemoryHit {
76
76
  entry_id: string;
77
77
  path: string;
78
78
  source_path: string;
79
+ memory_type: 'decision' | 'fact' | 'preference' | 'procedure' | 'episode';
80
+ trust: number;
81
+ confidence: number;
82
+ valid_from: number | null;
83
+ valid_until: number | null;
84
+ scope: 'context' | 'project';
85
+ derivation: 'observed' | 'mutation';
79
86
  }
80
87
 
81
88
  const RECALL_TOKEN_BUDGET = 4096;
@@ -398,13 +405,24 @@ function parseMemoryHits(output: string): GoosedumpMemoryHit[] {
398
405
  typeof item.context_id === 'string' &&
399
406
  typeof item.entry_id === 'string' &&
400
407
  typeof item.path === 'string' &&
401
- typeof item.source_path === 'string',
408
+ typeof item.source_path === 'string' &&
409
+ ['decision', 'fact', 'preference', 'procedure', 'episode'].includes(
410
+ item.memory_type as string,
411
+ ) &&
412
+ typeof item.trust === 'number' &&
413
+ typeof item.confidence === 'number' &&
414
+ (item.valid_from === null || typeof item.valid_from === 'number') &&
415
+ (item.valid_until === null || typeof item.valid_until === 'number') &&
416
+ ['context', 'project'].includes(item.scope as string) &&
417
+ ['observed', 'mutation'].includes(item.derivation as string),
402
418
  );
403
419
  }
404
420
 
405
421
  function formatMemoryHit(hit: GoosedumpMemoryHit, maxBytes: number): string {
406
422
  const provenance =
407
- `[${hit.hash}] ${hit.kind} (${hit.provider}:${hit.context_id}/${hit.entry_id})\n` +
423
+ `[${hit.hash}] ${hit.memory_type} (${hit.kind}; ${hit.scope}/${hit.derivation}; ` +
424
+ `trust ${hit.trust.toFixed(2)}, confidence ${hit.confidence.toFixed(2)}; ` +
425
+ `${hit.provider}:${hit.context_id}/${hit.entry_id})\n` +
408
426
  `Working directory: ${hit.path}\nSource: ${hit.source_path}\n`;
409
427
  const full = `${provenance}${hit.text}`;
410
428
  if (Buffer.byteLength(full) <= maxBytes) return full;
@@ -582,13 +600,19 @@ function goosedumpShow(
582
600
 
583
601
  async function goosedumpRecall(
584
602
  query: string,
585
- options: { provider?: string; path?: string; limit?: number } = {},
603
+ options: {
604
+ provider?: string;
605
+ path?: string;
606
+ type?: GoosedumpMemoryHit['memory_type'];
607
+ limit?: number;
608
+ } = {},
586
609
  signal?: AbortSignal,
587
610
  executablePath?: string,
588
611
  ): Promise<{ hits: GoosedumpMemoryHit[]; warning: string }> {
589
612
  const args = ['recall', query, '--limit', String(options.limit ?? 5)];
590
613
  if (options.provider) args.push('--provider', options.provider);
591
614
  if (options.path) args.push('--path', options.path);
615
+ if (options.type) args.push('--type', options.type);
592
616
  const output = await runGoosedumpAsync(args, signal, executablePath);
593
617
  return { hits: parseMemoryHits(output.stdout), warning: output.stderr.trim() };
594
618
  }
@@ -1574,6 +1598,14 @@ export function createGoosedumpIntegration(
1574
1598
  },
1575
1599
  ),
1576
1600
  ),
1601
+ type: Type.Optional(
1602
+ Type.Union(
1603
+ ['decision', 'fact', 'preference', 'procedure', 'episode'].map((type) =>
1604
+ Type.Literal(type),
1605
+ ),
1606
+ { description: 'Optional memory-type filter' },
1607
+ ),
1608
+ ),
1577
1609
  allProjects: Type.Optional(
1578
1610
  Type.Boolean({
1579
1611
  default: false,
@@ -1597,6 +1629,7 @@ export function createGoosedumpIntegration(
1597
1629
  {
1598
1630
  provider: params.provider,
1599
1631
  path: params.allProjects ? undefined : ctx.cwd,
1632
+ type: params.type,
1600
1633
  limit: params.limit,
1601
1634
  },
1602
1635
  signal,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-goosedump",
3
- "version": "0.10.10",
3
+ "version": "0.10.11",
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.10",
36
+ "@jarkkojs/goosedump": "^0.10.11",
37
37
  "@sinclair/typebox": "^0.34.49"
38
38
  },
39
39
  "devDependencies": {