@fyeeme/pi-session-name 1.0.2 → 1.0.3

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/CHANGELOG.md +10 -1
  2. package/index.ts +8 -6
  3. package/package.json +6 -6
package/CHANGELOG.md CHANGED
@@ -7,12 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
- ## [1.0.1] - 2025-07-25
10
+ ## [1.0.3] - 2026-09-09
11
+
12
+ ### Changed
13
+
14
+ - Project config path uses `CONFIG_DIR_NAME` instead of a hardcoded `.pi`.
15
+ - Title generation forwards `ctx.signal` so aborts cancel the nested model call.
16
+
17
+ ## [1.0.2] - 2025-07-25
11
18
 
12
19
  ### Fixed
13
20
 
14
21
  - Race condition where auto-generated title could overwrite manual rename when `generateTitle` async call completes after user renamed the session
15
22
 
23
+ ## [1.0.1] - 2025-07-25
24
+
16
25
  ### Added
17
26
 
18
27
  - `/rename [name]` command: manually rename the current session on demand. With a name argument it sets that name; with no argument it auto-generates one from the conversation. Invoking it locks out background auto-naming (manual control), consistent with `/name`.
package/index.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { readFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
- import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
3
+ import { CONFIG_DIR_NAME, type ExtensionAPI, type ExtensionContext } from "@earendil-works/pi-coding-agent";
4
4
  import type { Model } from "@earendil-works/pi-ai";
5
5
  import { complete } from "@earendil-works/pi-ai/compat";
6
6
 
@@ -122,7 +122,7 @@ const DEFAULT_CONFIG: SessionNameConfig = { mode: "first", enabled: true, maxLen
122
122
 
123
123
  export function loadConfig(cwd: string, env: Record<string, string | undefined> = process.env): SessionNameConfig {
124
124
  let fileCfg: Partial<SessionNameConfig> = {};
125
- const file = join(cwd, ".pi", "session-name.json");
125
+ const file = join(cwd, CONFIG_DIR_NAME, "session-name.json");
126
126
  try {
127
127
  fileCfg = JSON.parse(readFileSync(file, "utf8")) as Partial<SessionNameConfig>;
128
128
  } catch {
@@ -168,6 +168,7 @@ export async function generateTitle(
168
168
  prompt: string,
169
169
  auth: ModelAuth,
170
170
  completeFn: typeof complete = complete,
171
+ signal?: AbortSignal,
171
172
  ): Promise<string> {
172
173
  const response = await completeFn(
173
174
  auth.model,
@@ -176,7 +177,8 @@ export async function generateTitle(
176
177
  { role: "user", content: [{ type: "text", text: prompt }], timestamp: Date.now() },
177
178
  ],
178
179
  },
179
- { apiKey: auth.apiKey, headers: auth.headers },
180
+ // ctx.signal (undefined while idle) lets Esc/abort cancel the nested call.
181
+ { apiKey: auth.apiKey, headers: auth.headers, signal },
180
182
  );
181
183
  return response.content
182
184
  .filter((c): c is { type: "text"; text: string } => c.type === "text")
@@ -224,9 +226,9 @@ export default function (pi: ExtensionAPI): void {
224
226
 
225
227
  let title: string | null;
226
228
  if (cfg.mode === "first" || !currentName) {
227
- title = cleanTitle(await generateTitle(buildFirstPrompt(text, cfg), auth), cfg.maxLength);
229
+ title = cleanTitle(await generateTitle(buildFirstPrompt(text, cfg), auth, complete, ctx.signal), cfg.maxLength);
228
230
  } else {
229
- const verdict = await generateTitle(buildAutoPrompt(currentName, text, cfg), auth);
231
+ const verdict = await generateTitle(buildAutoPrompt(currentName, text, cfg), auth, complete, ctx.signal);
230
232
  title = /^keep$/i.test(verdict.trim()) ? null : cleanTitle(verdict, cfg.maxLength);
231
233
  }
232
234
  if (!title) return;
@@ -276,7 +278,7 @@ export default function (pi: ExtensionAPI): void {
276
278
  return;
277
279
  }
278
280
  try {
279
- const title = cleanTitle(await generateTitle(buildFirstPrompt(text, cfg), auth), cfg.maxLength);
281
+ const title = cleanTitle(await generateTitle(buildFirstPrompt(text, cfg), auth, complete, ctx.signal), cfg.maxLength);
280
282
  if (!title) {
281
283
  ctx.ui.notify("Could not generate a name from the model response", "warning");
282
284
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fyeeme/pi-session-name",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Auto-name pi sessions with a short LLM-generated title so --resume lists are easy to scan. Supports first (once) and auto (content-aware rename) modes; never overwrites manual names.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "repository": {
12
12
  "type": "git",
13
- "url": "https://github.com/fyeeme/pi-packages"
13
+ "url": "git+https://github.com/fyeeme/pi-packages.git"
14
14
  },
15
15
  "bugs": {
16
16
  "url": "https://github.com/fyeeme/pi-packages/issues"
@@ -43,12 +43,12 @@
43
43
  "typecheck": "tsc"
44
44
  },
45
45
  "peerDependencies": {
46
- "@earendil-works/pi-coding-agent": ">=0.80.0",
47
- "@earendil-works/pi-ai": ">=0.80.0"
46
+ "@earendil-works/pi-coding-agent": ">=0.84.1",
47
+ "@earendil-works/pi-ai": ">=0.84.1"
48
48
  },
49
49
  "devDependencies": {
50
- "@earendil-works/pi-coding-agent": "0.80.10",
51
- "@earendil-works/pi-ai": "0.80.10",
50
+ "@earendil-works/pi-coding-agent": "0.84.1",
51
+ "@earendil-works/pi-ai": "0.84.1",
52
52
  "@types/node": "22.19.19",
53
53
  "typescript": "5.9.3",
54
54
  "vitest": "3.2.7"