pi-sessions 0.3.0 → 0.3.1

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.
package/README.md CHANGED
@@ -20,6 +20,8 @@
20
20
 
21
21
  ## Install
22
22
 
23
+ Requires Pi `0.78.1` or newer.
24
+
23
25
  **From npm** (recommended):
24
26
 
25
27
  ```bash
@@ -1,5 +1,6 @@
1
1
  import type { ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
2
2
  import type { AutocompleteItem } from "@earendil-works/pi-tui";
3
+ import { isTuiMode } from "../shared/pi-mode.js";
3
4
 
4
5
  export const TITLE_USAGE = "Usage: /title [this|folder|pi] [-f]";
5
6
 
@@ -51,7 +52,7 @@ export function createSessionAutoTitleCommandHandler(
51
52
  ) => Promise<RetitleCommandOutcome>,
52
53
  ): (args: string, ctx: ExtensionCommandContext) => Promise<void> {
53
54
  return async (args: string, ctx: ExtensionCommandContext): Promise<void> => {
54
- const parsed = parseRetitleCommand(args, ctx.hasUI);
55
+ const parsed = parseRetitleCommand(args, isTuiMode(ctx));
55
56
  if (parsed.kind === "error") {
56
57
  ctx.ui.notify(parsed.message, "error");
57
58
  return;
@@ -76,10 +77,10 @@ export function getRetitleArgumentCompletions(argumentPrefix: string): Autocompl
76
77
  return filtered.length > 0 ? filtered : null;
77
78
  }
78
79
 
79
- export function parseRetitleCommand(args: string, hasUI: boolean): RetitleCommandParseResult {
80
+ export function parseRetitleCommand(args: string, hasTui: boolean): RetitleCommandParseResult {
80
81
  const trimmedArgs = args.trim();
81
82
  if (!trimmedArgs) {
82
- return hasUI ? { kind: "open-pane" } : { kind: "run", scope: "this" };
83
+ return hasTui ? { kind: "open-pane" } : { kind: "run", scope: "this" };
83
84
  }
84
85
 
85
86
  const tokens = trimmedArgs.split(/\s+/);
@@ -25,6 +25,7 @@ import {
25
25
  runRetitlePlan,
26
26
  } from "./session-auto-title/retitle.js";
27
27
  import { showRetitleWizard } from "./session-auto-title/wizard.js";
28
+ import { isTuiMode } from "./shared/pi-mode.js";
28
29
  import { loadSettings } from "./shared/settings.js";
29
30
 
30
31
  export {
@@ -160,7 +161,7 @@ async function handleTitleInvocation(
160
161
  };
161
162
 
162
163
  if (invocation.kind === "open-pane") {
163
- if (!ctx.hasUI) {
164
+ if (!isTuiMode(ctx)) {
164
165
  return retitleCurrentSession();
165
166
  }
166
167
 
@@ -171,7 +172,7 @@ async function handleTitleInvocation(
171
172
  return runWithInFlightTracking(state, retitleCurrentSession);
172
173
  }
173
174
 
174
- if (ctx.hasUI && !invocation.force) {
175
+ if (isTuiMode(ctx) && !invocation.force) {
175
176
  return showRetitleWizard(
176
177
  pi,
177
178
  state.controller,
@@ -23,6 +23,7 @@ import {
23
23
  launchSplitHandoffSession,
24
24
  validateSplitHandoffPrerequisites,
25
25
  } from "./session-handoff/spawn.js";
26
+ import { isTuiMode } from "./shared/pi-mode.js";
26
27
  import { loadSettings } from "./shared/settings.js";
27
28
 
28
29
  const HANDOFF_USAGE = "Usage: /handoff [--left|--right|--up|--down] <goal for new thread>";
@@ -38,7 +39,7 @@ export default function sessionHandoffExtension(pi: ExtensionAPI): void {
38
39
  pi.registerCommand("handoff", {
39
40
  description: "Transfer context to a new focused session",
40
41
  handler: async (args: string, ctx: ExtensionCommandContext): Promise<void> => {
41
- if (!ctx.hasUI) {
42
+ if (!isTuiMode(ctx)) {
42
43
  ctx.ui.notify("handoff requires interactive mode", "error");
43
44
  return;
44
45
  }
@@ -157,7 +158,7 @@ export default function sessionHandoffExtension(pi: ExtensionAPI): void {
157
158
  pi.registerShortcut(settings.handoff.pickerShortcut, {
158
159
  description: "Open the session reference picker",
159
160
  handler: async (ctx) => {
160
- if (!ctx.hasUI) {
161
+ if (!isTuiMode(ctx)) {
161
162
  return;
162
163
  }
163
164
 
@@ -6,6 +6,7 @@ import {
6
6
  } from "@earendil-works/pi-coding-agent";
7
7
  import { type Focusable, matchesKey, visibleWidth } from "@earendil-works/pi-tui";
8
8
  import { type ReindexResult, rebuildSessionIndex } from "./session-search/reindex.js";
9
+ import { isTuiMode } from "./shared/pi-mode.js";
9
10
  import { getIndexStatus, type SessionIndexStatus } from "./shared/session-index/index.js";
10
11
  import { loadSettings } from "./shared/settings.js";
11
12
 
@@ -17,7 +18,7 @@ export default function sessionIndexExtension(pi: ExtensionAPI): void {
17
18
  pi.registerCommand("session-index", {
18
19
  description: "Open the session index control panel",
19
20
  handler: async (_args, ctx) => {
20
- if (!ctx.hasUI) {
21
+ if (!isTuiMode(ctx)) {
21
22
  ctx.ui.notify("/session-index requires interactive mode.", "warning");
22
23
  return;
23
24
  }
@@ -0,0 +1,5 @@
1
+ import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
2
+
3
+ export function isTuiMode(ctx: Pick<ExtensionContext, "mode">): boolean {
4
+ return ctx.mode === "tui";
5
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-sessions",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "type": "module",
5
5
  "description": "Pi session search, ask, handoff, auto-titling, and indexing tools",
6
6
  "license": "MIT",
@@ -42,10 +42,10 @@
42
42
  },
43
43
  "devDependencies": {
44
44
  "@biomejs/biome": "^2.4.14",
45
- "@earendil-works/pi-agent-core": "^0.78.0",
46
- "@earendil-works/pi-ai": "^0.78.0",
47
- "@earendil-works/pi-coding-agent": "^0.78.0",
48
- "@earendil-works/pi-tui": "^0.78.0",
45
+ "@earendil-works/pi-agent-core": "^0.78.1",
46
+ "@earendil-works/pi-ai": "^0.78.1",
47
+ "@earendil-works/pi-coding-agent": "^0.78.1",
48
+ "@earendil-works/pi-tui": "^0.78.1",
49
49
  "@types/better-sqlite3": "^7.6.13",
50
50
  "@types/node": "^25.6.2",
51
51
  "husky": "^9.1.7",
@@ -55,10 +55,10 @@
55
55
  "vitest": "^4.1.5"
56
56
  },
57
57
  "peerDependencies": {
58
- "@earendil-works/pi-agent-core": ">=0.78.0",
59
- "@earendil-works/pi-ai": ">=0.78.0",
60
- "@earendil-works/pi-coding-agent": ">=0.78.0",
61
- "@earendil-works/pi-tui": ">=0.78.0",
58
+ "@earendil-works/pi-agent-core": ">=0.78.1",
59
+ "@earendil-works/pi-ai": ">=0.78.1",
60
+ "@earendil-works/pi-coding-agent": ">=0.78.1",
61
+ "@earendil-works/pi-tui": ">=0.78.1",
62
62
  "typebox": ">=1.1.24"
63
63
  },
64
64
  "lint-staged": {