pi-sessions 0.2.1 → 0.3.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.
Files changed (30) hide show
  1. package/README.md +2 -1
  2. package/extensions/session-ask.ts +4 -4
  3. package/extensions/session-auto-title/command.ts +2 -2
  4. package/extensions/session-auto-title/context.ts +1 -1
  5. package/extensions/session-auto-title/controller.ts +3 -16
  6. package/extensions/session-auto-title/generate.ts +256 -0
  7. package/extensions/session-auto-title/model.ts +2 -2
  8. package/extensions/session-auto-title/retitle.ts +41 -377
  9. package/extensions/session-auto-title/state.ts +2 -2
  10. package/extensions/session-auto-title/wizard.ts +12 -16
  11. package/extensions/session-auto-title.ts +22 -10
  12. package/extensions/session-handoff/extract.ts +33 -16
  13. package/extensions/session-handoff/metadata.ts +7 -2
  14. package/extensions/session-handoff/picker.ts +2 -2
  15. package/extensions/session-handoff/review.ts +3 -3
  16. package/extensions/session-handoff/spawn.ts +27 -6
  17. package/extensions/session-handoff.ts +54 -17
  18. package/extensions/session-hooks.ts +1 -1
  19. package/extensions/session-index.ts +2 -2
  20. package/extensions/session-search/extract.ts +4 -4
  21. package/extensions/session-search/hooks.ts +2 -2
  22. package/extensions/session-search/reindex.ts +1 -1
  23. package/extensions/session-search.ts +3 -3
  24. package/extensions/shared/session-index/common.ts +1 -1
  25. package/extensions/shared/session-index/lineage.ts +1 -1
  26. package/extensions/shared/session-index/search.ts +1 -1
  27. package/extensions/shared/settings.ts +12 -3
  28. package/extensions/shared/typebox.ts +4 -4
  29. package/package.json +18 -13
  30. package/extensions/session-auto-title/prompt.ts +0 -54
@@ -1,54 +0,0 @@
1
- import type { AutoTitleContext } from "./context.js";
2
- import type { AutoTitleTrigger } from "./state.js";
3
-
4
- const AUTO_TITLE_CHAR_MAX = 120;
5
-
6
- export const AUTO_TITLE_SYSTEM_PROMPT = `You generate concrete coding session titles from the conversation provided.
7
-
8
- Return title text only.
9
-
10
- Rules:
11
- - Prefer 3-15 words.
12
- - Maximum 120 characters.
13
- - Use the full conversation, while letting the most recent work refine the title when needed.
14
- - Describe the current task, bug, feature, or investigation on the active branch.
15
- - Mention specific subsystem or file only when it improves clarity.
16
- - No quotes, markdown, emojis, prefixes, or explanations.
17
- - No trailing punctuation.
18
- - Avoid generic titles like Coding help or Working on project.`;
19
-
20
- export function buildAutoTitlePrompt(context: AutoTitleContext, trigger: AutoTitleTrigger): string {
21
- const sections = [
22
- ["## Trigger", trigger],
23
- ["## Current Title", context.currentTitle ?? "(none)"],
24
- ["## Counts", formatCounts(context)],
25
- ["## Conversation", context.conversationText || "(none)"],
26
- ];
27
-
28
- if (context.cwd) {
29
- sections.unshift(["## Cwd", context.cwd]);
30
- }
31
-
32
- return sections.map(([heading, body]) => `${heading}\n${body}`).join("\n\n");
33
- }
34
-
35
- export function normalizeGeneratedAutoTitle(value: string): string | undefined {
36
- const withoutQuotes = value.trim().replace(/^["'`]+|["'`]+$/g, "");
37
- const collapsed = withoutQuotes
38
- .replace(/\s+/g, " ")
39
- .replace(/[.!?]+$/g, "")
40
- .trim();
41
- if (!collapsed) {
42
- return undefined;
43
- }
44
-
45
- const truncated = collapsed.slice(0, AUTO_TITLE_CHAR_MAX).trim();
46
- return truncated || undefined;
47
- }
48
-
49
- function formatCounts(context: AutoTitleContext): string {
50
- return [
51
- `user_turns: ${context.userTurnCount}`,
52
- `assistant_turns: ${context.assistantTurnCount}`,
53
- ].join("\n");
54
- }