@mrclrchtr/supi-lsp 2.2.1 → 2.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-core",
3
- "version": "2.2.1",
3
+ "version": "2.3.0",
4
4
  "description": "SuPi core — shared infrastructure for SuPi extensions (XML context tags, config system)",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -2,6 +2,48 @@
2
2
 
3
3
  import type { FileEntry, SessionEntry } from "@earendil-works/pi-coding-agent";
4
4
 
5
+ /**
6
+ * Minimal pi API surface needed to track the current session display name reactively.
7
+ * Accept `ExtensionAPI` or any object satisfying this shape.
8
+ */
9
+ export interface SessionNameTrackerHost {
10
+ on(event: string, handler: (...args: unknown[]) => unknown): void;
11
+ getSessionName(): string | undefined;
12
+ }
13
+
14
+ /**
15
+ * Create a reactive session-name tracker that stays consistent across
16
+ * session starts, renames, and shutdowns without polling.
17
+ *
18
+ * Subscribes to `session_start` (initial name), `session_info_changed`
19
+ * (renames via `/name`, `pi.setSessionName()`, or RPC), and
20
+ * `session_shutdown` (reset to `undefined`).
21
+ *
22
+ * @returns a zero-arg getter that always returns the current session name
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * const getSessionName = createSessionNameTracker(pi);
27
+ * // …later, during tool execute or spinner rendering:
28
+ * const name = getSessionName();
29
+ * ```
30
+ */
31
+ export function createSessionNameTracker(pi: SessionNameTrackerHost): () => string | undefined {
32
+ let name: string | undefined;
33
+
34
+ pi.on("session_start", () => {
35
+ name = pi.getSessionName();
36
+ });
37
+ pi.on("session_info_changed", (event) => {
38
+ name = (event as { name?: string }).name;
39
+ });
40
+ pi.on("session_shutdown", () => {
41
+ name = undefined;
42
+ });
43
+
44
+ return () => name;
45
+ }
46
+
5
47
  /**
6
48
  * Resolve the active branch path using PI's append-only tree semantics.
7
49
  *
@@ -1,4 +1,8 @@
1
1
  // supi-core session domain — session utilities and registries.
2
2
 
3
3
  export { createRegistry, createSessionStateRegistry } from "./registry-utils.ts";
4
- export { getActiveBranchEntries } from "./session-utils.ts";
4
+ export type { SessionNameTrackerHost } from "./session-utils.ts";
5
+ export {
6
+ createSessionNameTracker,
7
+ getActiveBranchEntries,
8
+ } from "./session-utils.ts";
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-code-runtime",
3
- "version": "2.2.1",
3
+ "version": "2.3.0",
4
4
  "description": "SuPi code-runtime — shared workspace context, capability contracts, and canonical types for the code-understanding stack",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -29,7 +29,7 @@
29
29
  "!__tests__"
30
30
  ],
31
31
  "dependencies": {
32
- "@mrclrchtr/supi-core": "2.2.1"
32
+ "@mrclrchtr/supi-core": "2.3.0"
33
33
  },
34
34
  "bundledDependencies": [
35
35
  "@mrclrchtr/supi-core"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-core",
3
- "version": "2.2.1",
3
+ "version": "2.3.0",
4
4
  "description": "SuPi core — shared infrastructure for SuPi extensions (XML context tags, config system)",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -2,6 +2,48 @@
2
2
 
3
3
  import type { FileEntry, SessionEntry } from "@earendil-works/pi-coding-agent";
4
4
 
5
+ /**
6
+ * Minimal pi API surface needed to track the current session display name reactively.
7
+ * Accept `ExtensionAPI` or any object satisfying this shape.
8
+ */
9
+ export interface SessionNameTrackerHost {
10
+ on(event: string, handler: (...args: unknown[]) => unknown): void;
11
+ getSessionName(): string | undefined;
12
+ }
13
+
14
+ /**
15
+ * Create a reactive session-name tracker that stays consistent across
16
+ * session starts, renames, and shutdowns without polling.
17
+ *
18
+ * Subscribes to `session_start` (initial name), `session_info_changed`
19
+ * (renames via `/name`, `pi.setSessionName()`, or RPC), and
20
+ * `session_shutdown` (reset to `undefined`).
21
+ *
22
+ * @returns a zero-arg getter that always returns the current session name
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * const getSessionName = createSessionNameTracker(pi);
27
+ * // …later, during tool execute or spinner rendering:
28
+ * const name = getSessionName();
29
+ * ```
30
+ */
31
+ export function createSessionNameTracker(pi: SessionNameTrackerHost): () => string | undefined {
32
+ let name: string | undefined;
33
+
34
+ pi.on("session_start", () => {
35
+ name = pi.getSessionName();
36
+ });
37
+ pi.on("session_info_changed", (event) => {
38
+ name = (event as { name?: string }).name;
39
+ });
40
+ pi.on("session_shutdown", () => {
41
+ name = undefined;
42
+ });
43
+
44
+ return () => name;
45
+ }
46
+
5
47
  /**
6
48
  * Resolve the active branch path using PI's append-only tree semantics.
7
49
  *
@@ -1,4 +1,8 @@
1
1
  // supi-core session domain — session utilities and registries.
2
2
 
3
3
  export { createRegistry, createSessionStateRegistry } from "./registry-utils.ts";
4
- export { getActiveBranchEntries } from "./session-utils.ts";
4
+ export type { SessionNameTrackerHost } from "./session-utils.ts";
5
+ export {
6
+ createSessionNameTracker,
7
+ getActiveBranchEntries,
8
+ } from "./session-utils.ts";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-lsp",
3
- "version": "2.2.1",
3
+ "version": "2.3.0",
4
4
  "description": "SuPi LSP extension — Language Server Protocol integration for pi",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -38,8 +38,8 @@
38
38
  "vscode-jsonrpc": "^9.0.0",
39
39
  "vscode-languageserver-protocol": "^3.17.5",
40
40
  "vscode-languageserver-types": "^3.17.5",
41
- "@mrclrchtr/supi-code-runtime": "2.2.1",
42
- "@mrclrchtr/supi-core": "2.2.1"
41
+ "@mrclrchtr/supi-code-runtime": "2.3.0",
42
+ "@mrclrchtr/supi-core": "2.3.0"
43
43
  },
44
44
  "bundledDependencies": [
45
45
  "@mrclrchtr/supi-code-runtime",