pi-goosedump 0.9.4 → 0.9.6

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 (2) hide show
  1. package/index.ts +54 -99
  2. package/package.json +11 -8
package/index.ts CHANGED
@@ -373,6 +373,43 @@ function resolveTarget(
373
373
  return null;
374
374
  }
375
375
 
376
+ const GOOSE_PROVIDERS = ['pi', 'claude', 'codex', 'crush', 'gemini', 'goose', 'opencode'] as const;
377
+
378
+ type HistoryOperation = 'search' | 'read' | 'grep';
379
+
380
+ const HISTORY_TARGET_GUIDELINE =
381
+ 'Use the current Pi session by default; non-Pi providers require an explicit session ID.';
382
+
383
+ function historyProviderParam(operation: HistoryOperation) {
384
+ return Type.Optional(
385
+ Type.Union(
386
+ GOOSE_PROVIDERS.map((provider) => Type.Literal(provider)),
387
+ {
388
+ default: 'pi',
389
+ description: `Source provider whose sessions to ${operation}. Defaults to pi. Non-pi providers have no current session, so they require an explicit session id.`,
390
+ },
391
+ ),
392
+ );
393
+ }
394
+
395
+ function historySessionParam() {
396
+ return Type.Optional(
397
+ Type.String({
398
+ description:
399
+ 'Context/session ID. Defaults to the current Pi session for pi; required when provider is not pi.',
400
+ }),
401
+ );
402
+ }
403
+
404
+ function historyScopeParam() {
405
+ return Type.Optional(
406
+ Type.Union([Type.Literal('lineage'), Type.Literal('all')], {
407
+ default: 'lineage',
408
+ description: 'Scope: lineage (current branch) or all entries in the session',
409
+ }),
410
+ );
411
+ }
412
+
376
413
  async function goosedumpCompact(
377
414
  target: string,
378
415
  options: { scope?: string; from?: string; until: string },
@@ -1129,46 +1166,18 @@ export function createGoosedumpIntegration(
1129
1166
  label: 'goose_search',
1130
1167
  description:
1131
1168
  'Search coding agent session history by ranked relevance. Returns compact entry overviews with entry IDs; use goose_get to expand specific IDs to full content. Defaults to the current Pi session.',
1132
- promptSnippet:
1133
- 'goose_search({ query, provider?, session?, scope?, page? }) - rank messages by query relevance; defaults to current Pi session',
1169
+ promptSnippet: 'Search session history by ranked relevance',
1134
1170
  promptGuidelines: [
1135
1171
  "Use goose_search to find relevant context in this or another coding agent's session history.",
1136
1172
  'Start with compact ranked results, then use goose_get to expand interesting entry IDs to full content.',
1137
1173
  'Default scope is "lineage" (current branch); use scope: "all" to include all entries in the session.',
1138
- 'Omit session to search the current Pi session; set provider (e.g. "claude", "gemini") with a session id to browse another tool\'s sessions.',
1174
+ HISTORY_TARGET_GUIDELINE,
1139
1175
  ],
1140
1176
  parameters: Type.Object({
1141
1177
  query: Type.String({ description: 'Search query to rank messages by relevance' }),
1142
- provider: Type.Optional(
1143
- Type.Union(
1144
- [
1145
- Type.Literal('pi'),
1146
- Type.Literal('claude'),
1147
- Type.Literal('codex'),
1148
- Type.Literal('crush'),
1149
- Type.Literal('gemini'),
1150
- Type.Literal('goose'),
1151
- Type.Literal('opencode'),
1152
- ],
1153
- {
1154
- default: 'pi',
1155
- description:
1156
- 'Source provider whose sessions to search. Defaults to pi. Non-pi providers have no current session, so they require an explicit session id.',
1157
- },
1158
- ),
1159
- ),
1160
- session: Type.Optional(
1161
- Type.String({
1162
- description:
1163
- 'Context/session ID. Defaults to the current Pi session for pi; required when provider is not pi.',
1164
- }),
1165
- ),
1166
- scope: Type.Optional(
1167
- Type.Union([Type.Literal('lineage'), Type.Literal('all')], {
1168
- default: 'lineage',
1169
- description: 'Scope: lineage (current branch) or all entries in the session',
1170
- }),
1171
- ),
1178
+ provider: historyProviderParam('search'),
1179
+ session: historySessionParam(),
1180
+ scope: historyScopeParam(),
1172
1181
  page: Type.Optional(
1173
1182
  Type.Integer({
1174
1183
  minimum: 1,
@@ -1212,47 +1221,21 @@ export function createGoosedumpIntegration(
1212
1221
  label: 'goose_get',
1213
1222
  description:
1214
1223
  'Expand specific entry IDs (from goose_search or goose_grep) to their full content. Defaults to the current Pi session.',
1215
- promptSnippet:
1216
- 'goose_get({ ids, provider?, session? }) - expand entry IDs to full content; defaults to current Pi session',
1224
+ promptSnippet: 'Expand session entries by ID to full content',
1217
1225
  promptGuidelines: [
1218
1226
  'Use goose_get to expand entry IDs returned by goose_search or goose_grep into their full content.',
1219
1227
  'Pass only the specific IDs you need; full transcripts are expensive.',
1228
+ 'Default scope is "lineage" (current branch); use scope: "all" to retrieve entries from all session branches.',
1229
+ HISTORY_TARGET_GUIDELINE,
1220
1230
  ],
1221
1231
  parameters: Type.Object({
1222
1232
  ids: Type.Array(Type.String(), {
1223
1233
  minItems: 1,
1224
1234
  description: 'Entry IDs to expand (show full content)',
1225
1235
  }),
1226
- provider: Type.Optional(
1227
- Type.Union(
1228
- [
1229
- Type.Literal('pi'),
1230
- Type.Literal('claude'),
1231
- Type.Literal('codex'),
1232
- Type.Literal('crush'),
1233
- Type.Literal('gemini'),
1234
- Type.Literal('goose'),
1235
- Type.Literal('opencode'),
1236
- ],
1237
- {
1238
- default: 'pi',
1239
- description:
1240
- 'Source provider whose sessions to read. Defaults to pi. Non-pi providers have no current session, so they require an explicit session id.',
1241
- },
1242
- ),
1243
- ),
1244
- session: Type.Optional(
1245
- Type.String({
1246
- description:
1247
- 'Context/session ID. Defaults to the current Pi session for pi; required when provider is not pi.',
1248
- }),
1249
- ),
1250
- scope: Type.Optional(
1251
- Type.Union([Type.Literal('lineage'), Type.Literal('all')], {
1252
- default: 'lineage',
1253
- description: 'Scope: lineage (current branch) or all entries in the session',
1254
- }),
1255
- ),
1236
+ provider: historyProviderParam('read'),
1237
+ session: historySessionParam(),
1238
+ scope: historyScopeParam(),
1256
1239
  }),
1257
1240
  async execute(_id, params, _signal, _onUpdate, ctx): Promise<AgentToolResult<void>> {
1258
1241
  if (!goosedumpAvailable) return goosedumpUnavailableResult();
@@ -1285,45 +1268,18 @@ export function createGoosedumpIntegration(
1285
1268
  label: 'goose_grep',
1286
1269
  description:
1287
1270
  'Filter session messages by glob pattern (e.g. *rand*). Returns compact entry overviews with entry IDs; use goose_get to expand. Defaults to the current Pi session.',
1288
- promptSnippet:
1289
- 'goose_grep({ pattern, provider?, session?, scope? }) - filter messages by glob; defaults to current Pi session',
1271
+ promptSnippet: 'Filter session history by glob pattern',
1290
1272
  promptGuidelines: [
1291
1273
  'Use goose_grep to filter session messages by glob pattern when you need exact substring/glob matching instead of ranked relevance.',
1292
1274
  'Expand interesting entry IDs with goose_get.',
1293
1275
  'Default scope is "lineage" (current branch); use scope: "all" to include all entries in the session.',
1276
+ HISTORY_TARGET_GUIDELINE,
1294
1277
  ],
1295
1278
  parameters: Type.Object({
1296
1279
  pattern: Type.String({ description: 'Glob pattern to filter messages (e.g. *rand*)' }),
1297
- provider: Type.Optional(
1298
- Type.Union(
1299
- [
1300
- Type.Literal('pi'),
1301
- Type.Literal('claude'),
1302
- Type.Literal('codex'),
1303
- Type.Literal('crush'),
1304
- Type.Literal('gemini'),
1305
- Type.Literal('goose'),
1306
- Type.Literal('opencode'),
1307
- ],
1308
- {
1309
- default: 'pi',
1310
- description:
1311
- 'Source provider whose sessions to grep. Defaults to pi. Non-pi providers have no current session, so they require an explicit session id.',
1312
- },
1313
- ),
1314
- ),
1315
- session: Type.Optional(
1316
- Type.String({
1317
- description:
1318
- 'Context/session ID. Defaults to the current Pi session for pi; required when provider is not pi.',
1319
- }),
1320
- ),
1321
- scope: Type.Optional(
1322
- Type.Union([Type.Literal('lineage'), Type.Literal('all')], {
1323
- default: 'lineage',
1324
- description: 'Scope: lineage (current branch) or all entries in the session',
1325
- }),
1326
- ),
1280
+ provider: historyProviderParam('grep'),
1281
+ session: historySessionParam(),
1282
+ scope: historyScopeParam(),
1327
1283
  }),
1328
1284
  async execute(_id, params, _signal, _onUpdate, ctx): Promise<AgentToolResult<void>> {
1329
1285
  if (!goosedumpAvailable) return goosedumpUnavailableResult();
@@ -1356,8 +1312,7 @@ export function createGoosedumpIntegration(
1356
1312
  label: 'goose_compact',
1357
1313
  description:
1358
1314
  "Trigger a goosedump compaction of the current session now, optionally keeping the last N user turns verbatim while summarizing everything before. Compaction runs asynchronously via Pi's compaction flow.",
1359
- promptSnippet:
1360
- "goose_compact({ keep? }) - compact now; keep last N user turns (turn-based), omit to compact up to Pi's cut",
1315
+ promptSnippet: 'Compact session history; optionally keep recent user turns',
1361
1316
  promptGuidelines: [
1362
1317
  'Use goose_compact to compact the session proactively with goosedump when context is large or nearing limits.',
1363
1318
  "Pass keep:N (N >= 1) to keep the last N user turns verbatim and summarize everything before them; omit to compact up to Pi's token-based cut.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-goosedump",
3
- "version": "0.9.4",
3
+ "version": "0.9.6",
4
4
  "description": "Pi extension for goosedump-backed session-history search, entry expansion, and compaction",
5
5
  "keywords": [
6
6
  "compaction",
@@ -21,17 +21,19 @@
21
21
  ],
22
22
  "type": "module",
23
23
  "scripts": {
24
- "fmt": "oxfmt index.ts package.json tsconfig.json .oxfmtrc.json README.md",
25
- "lint": "oxlint index.ts",
24
+ "fmt": "oxfmt index.ts tests package.json tsconfig.json .oxfmtrc.json README.md",
25
+ "lint": "oxlint index.ts tests",
26
26
  "check": "tsc --noEmit",
27
- "all": "npm run fmt && npm run lint && npm run check",
28
- "ci:fmt": "oxfmt --check index.ts package.json tsconfig.json .oxfmtrc.json README.md",
27
+ "test": "vitest run",
28
+ "all": "npm run fmt && npm run lint && npm run check && npm test",
29
+ "ci:fmt": "oxfmt --check index.ts tests package.json tsconfig.json .oxfmtrc.json README.md",
29
30
  "ci:lint": "npm run lint",
30
- "ci:check": "npm run check"
31
+ "ci:check": "npm run check",
32
+ "ci:test": "npm test"
31
33
  },
32
34
  "dependencies": {
33
35
  "@earendil-works/pi-tui": "^0.78.0",
34
- "@jarkkojs/goosedump": "^0.9.4",
36
+ "@jarkkojs/goosedump": "^0.9.6",
35
37
  "@sinclair/typebox": "^0.34.49"
36
38
  },
37
39
  "devDependencies": {
@@ -39,7 +41,8 @@
39
41
  "@types/node": "^24.0.0",
40
42
  "oxfmt": "^0.53.0",
41
43
  "oxlint": "^1.68.0",
42
- "typescript": "^5.0.0"
44
+ "typescript": "^5.0.0",
45
+ "vitest": "^4.1.10"
43
46
  },
44
47
  "peerDependencies": {
45
48
  "@earendil-works/pi-coding-agent": "^0.78.0"