@oh-my-pi/pi-coding-agent 14.8.0 → 14.9.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 (60) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/package.json +16 -7
  3. package/src/config/model-resolver.ts +92 -35
  4. package/src/config/prompt-templates.ts +1 -1
  5. package/src/debug/index.ts +21 -0
  6. package/src/debug/raw-sse-buffer.ts +229 -0
  7. package/src/debug/raw-sse.ts +213 -0
  8. package/src/edit/index.ts +9 -10
  9. package/src/edit/streaming.ts +6 -5
  10. package/src/eval/js/context-manager.ts +91 -47
  11. package/src/extensibility/extensions/loader.ts +9 -3
  12. package/src/extensibility/extensions/types.ts +10 -3
  13. package/src/extensibility/plugins/legacy-pi-compat.ts +99 -20
  14. package/src/hashline/anchors.ts +113 -0
  15. package/src/hashline/apply.ts +732 -0
  16. package/src/hashline/bigrams.json +649 -0
  17. package/src/hashline/constants.ts +8 -0
  18. package/src/hashline/diff-preview.ts +43 -0
  19. package/src/hashline/diff.ts +56 -0
  20. package/src/hashline/execute.ts +268 -0
  21. package/src/{edit/modes/hashline.lark → hashline/grammar.lark} +1 -1
  22. package/src/{edit/line-hash.ts → hashline/hash.ts} +5 -651
  23. package/src/hashline/index.ts +14 -0
  24. package/src/hashline/input.ts +110 -0
  25. package/src/hashline/parser.ts +220 -0
  26. package/src/hashline/prefixes.ts +101 -0
  27. package/src/hashline/recovery.ts +72 -0
  28. package/src/hashline/stream.ts +123 -0
  29. package/src/hashline/types.ts +69 -0
  30. package/src/hashline/utils.ts +3 -0
  31. package/src/index.ts +1 -1
  32. package/src/lsp/index.ts +1 -1
  33. package/src/lsp/render.ts +4 -0
  34. package/src/memories/index.ts +13 -4
  35. package/src/modes/components/assistant-message.ts +55 -9
  36. package/src/modes/components/welcome.ts +114 -38
  37. package/src/modes/controllers/event-controller.ts +3 -1
  38. package/src/modes/controllers/extension-ui-controller.ts +1 -1
  39. package/src/modes/controllers/input-controller.ts +8 -1
  40. package/src/modes/interactive-mode.ts +50 -11
  41. package/src/modes/prompt-action-autocomplete.ts +3 -0
  42. package/src/modes/rpc/rpc-client.ts +53 -2
  43. package/src/modes/rpc/rpc-mode.ts +67 -1
  44. package/src/modes/rpc/rpc-types.ts +17 -2
  45. package/src/modes/types.ts +4 -1
  46. package/src/modes/utils/ui-helpers.ts +3 -1
  47. package/src/prompts/agents/reviewer.md +14 -0
  48. package/src/prompts/tools/hashline.md +57 -10
  49. package/src/sdk.ts +4 -3
  50. package/src/session/agent-session.ts +195 -30
  51. package/src/session/compaction/branch-summarization.ts +4 -2
  52. package/src/session/compaction/compaction.ts +22 -3
  53. package/src/task/executor.ts +21 -2
  54. package/src/task/index.ts +4 -1
  55. package/src/tools/ast-edit.ts +1 -1
  56. package/src/tools/match-line-format.ts +1 -1
  57. package/src/tools/read.ts +1 -1
  58. package/src/utils/file-mentions.ts +1 -1
  59. package/src/utils/title-generator.ts +11 -0
  60. package/src/edit/modes/hashline.ts +0 -2039
@@ -36,6 +36,11 @@ function getTitleModel(registry: ModelRegistry, settings: Settings, currentModel
36
36
  * @param registry Model registry
37
37
  * @param settings Settings used to resolve the smol role
38
38
  * @param sessionId Optional session id for sticky API key selection
39
+ * @param currentModel Current model (used to derive title model)
40
+ * @param metadataResolver Optional resolver evaluated after credential selection
41
+ * to produce request metadata (e.g. user_id for session attribution). Using a
42
+ * resolver instead of a pre-evaluated value ensures the metadata's account_uuid
43
+ * reflects the credential actually selected for this request.
39
44
  */
40
45
  export async function generateSessionTitle(
41
46
  firstMessage: string,
@@ -43,6 +48,7 @@ export async function generateSessionTitle(
43
48
  settings: Settings,
44
49
  sessionId?: string,
45
50
  currentModel?: Model<Api>,
51
+ metadataResolver?: (provider: string) => Record<string, unknown> | undefined,
46
52
  ): Promise<string | null> {
47
53
  const model = getTitleModel(registry, settings, currentModel);
48
54
  if (!model) {
@@ -65,6 +71,10 @@ ${truncatedMessage}
65
71
  });
66
72
  return null;
67
73
  }
74
+ // Resolve metadata after getApiKey so the session-sticky credential for this
75
+ // request is already recorded; metadataResolver can then return the correct
76
+ // account_uuid rather than the snapshot-at-call-site value.
77
+ const metadata = metadataResolver?.(model.provider);
68
78
 
69
79
  // Title generation is a 3-6 word task; force reasoning off so reasoning models
70
80
  // don't burn the entire output budget on internal thinking and return an empty
@@ -88,6 +98,7 @@ ${truncatedMessage}
88
98
  apiKey,
89
99
  maxTokens: 30,
90
100
  disableReasoning: true,
101
+ metadata,
91
102
  },
92
103
  );
93
104