@mrclrchtr/supi-debug 1.2.0 → 1.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.
@@ -12,7 +12,12 @@ pnpm add @mrclrchtr/supi-core
12
12
 
13
13
  ## Package role
14
14
 
15
- `@mrclrchtr/supi-core` is a library package. It does **not** register a pi extension and is not meant to be installed as a standalone pi package.
15
+ `@mrclrchtr/supi-core` now has two explicit surfaces:
16
+
17
+ - `@mrclrchtr/supi-core/api` — shared library helpers for other SuPi packages
18
+ - `@mrclrchtr/supi-core/extension` — a minimal pi extension that registers `/supi-settings`
19
+
20
+ `pi.extensions` still points at the real file path `./src/extension.ts` inside the package. The `/api` and `/extension` paths are consumer-facing package exports, not manifest aliases.
16
21
 
17
22
  ## What it provides
18
23
 
@@ -59,7 +64,7 @@ Main helpers:
59
64
  ## Example
60
65
 
61
66
  ```ts
62
- import { loadSupiConfig, registerConfigSettings, wrapExtensionContext } from "@mrclrchtr/supi-core";
67
+ import { loadSupiConfig, registerConfigSettings, wrapExtensionContext } from "@mrclrchtr/supi-core/api";
63
68
 
64
69
  const config = loadSupiConfig("my-extension", process.cwd(), {
65
70
  enabled: true,
@@ -87,4 +92,5 @@ const message = wrapExtensionContext("my-extension", "hello", {
87
92
 
88
93
  ## Source
89
94
 
90
- - Main exports: `src/index.ts`
95
+ - Library surface: `src/api.ts`
96
+ - Extension surface: `src/extension.ts`
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-core",
3
- "version": "1.2.0",
3
+ "version": "1.3.1",
4
4
  "description": "SuPi core — shared infrastructure for SuPi extensions (XML context tags, config system)",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -30,5 +30,15 @@
30
30
  "optional": true
31
31
  }
32
32
  },
33
- "main": "src/index.ts"
33
+ "main": "src/api.ts",
34
+ "exports": {
35
+ "./api": "./src/api.ts",
36
+ "./extension": "./src/extension.ts",
37
+ "./package.json": "./package.json"
38
+ },
39
+ "pi": {
40
+ "extensions": [
41
+ "./src/extension.ts"
42
+ ]
43
+ }
34
44
  }
@@ -0,0 +1,83 @@
1
+ // supi-core — shared infrastructure for SuPi extensions.
2
+ // Provides XML context tag wrapping, unified config system, context-message utilities,
3
+ // and settings registry for supi-wide TUI settings.
4
+
5
+ export type { SupiConfigLocation, SupiConfigOptions } from "./config.ts";
6
+ export {
7
+ loadSupiConfig,
8
+ loadSupiConfigForScope,
9
+ removeSupiConfigKey,
10
+ writeSupiConfig,
11
+ } from "./config.ts";
12
+ export type { ConfigSettingsHelpers, ConfigSettingsOptions } from "./config-settings.ts";
13
+ export { registerConfigSettings } from "./config-settings.ts";
14
+ export type { ContextMessageLike } from "./context-messages.ts";
15
+ export {
16
+ findLastUserMessageIndex,
17
+ getContextToken,
18
+ getPromptContent,
19
+ pruneAndReorderContextMessages,
20
+ restorePromptContent,
21
+ } from "./context-messages.ts";
22
+ export type { ContextProvider } from "./context-provider-registry.ts";
23
+ export {
24
+ clearRegisteredContextProviders,
25
+ getRegisteredContextProviders,
26
+ registerContextProvider,
27
+ } from "./context-provider-registry.ts";
28
+ export { wrapExtensionContext } from "./context-tag.ts";
29
+ export type {
30
+ DebugAgentAccess,
31
+ DebugEvent,
32
+ DebugEventInput,
33
+ DebugEventQuery,
34
+ DebugEventQueryResult,
35
+ DebugEventView,
36
+ DebugLevel,
37
+ DebugNotifyLevel,
38
+ DebugRegistryConfig,
39
+ DebugSummary,
40
+ } from "./debug-registry.ts";
41
+ export {
42
+ clearDebugEvents,
43
+ configureDebugRegistry,
44
+ DEBUG_REGISTRY_DEFAULTS,
45
+ getDebugEvents,
46
+ getDebugRegistryConfig,
47
+ getDebugSummary,
48
+ recordDebugEvent,
49
+ redactDebugData,
50
+ resetDebugRegistry,
51
+ } from "./debug-registry.ts";
52
+ export type { KnownRootEntry } from "./project-roots.ts";
53
+ export {
54
+ buildKnownRootsMap,
55
+ byPathDepth,
56
+ dedupeTopmostRoots,
57
+ findProjectRoot,
58
+ isWithin,
59
+ isWithinOrEqual,
60
+ mergeKnownRoots,
61
+ resolveKnownRoot,
62
+ segmentCount,
63
+ sortRootsBySpecificity,
64
+ walkProject,
65
+ } from "./project-roots.ts";
66
+ export { getActiveBranchEntries } from "./session-utils.ts";
67
+ export { registerSettingsCommand } from "./settings-command.ts";
68
+ export type { SettingsScope, SettingsSection } from "./settings-registry.ts";
69
+ export {
70
+ clearRegisteredSettings,
71
+ getRegisteredSettings,
72
+ registerSettings,
73
+ } from "./settings-registry.ts";
74
+ export { createInputSubmenu, openSettingsOverlay } from "./settings-ui.ts";
75
+ export type { TitleTarget } from "./terminal.ts";
76
+ export {
77
+ DONE_SYMBOL,
78
+ formatTitle,
79
+ signalBell,
80
+ signalDone,
81
+ signalWaiting,
82
+ WAITING_SYMBOL,
83
+ } from "./terminal.ts";
@@ -0,0 +1 @@
1
+ export { registerSettingsCommand as default } from "./settings-command.ts";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-debug",
3
- "version": "1.2.0",
3
+ "version": "1.3.1",
4
4
  "description": "SuPi Debug extension — shared debug event inspection for SuPi extensions",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -20,7 +20,7 @@
20
20
  "README.md"
21
21
  ],
22
22
  "dependencies": {
23
- "@mrclrchtr/supi-core": "1.2.0"
23
+ "@mrclrchtr/supi-core": "1.3.1"
24
24
  },
25
25
  "bundledDependencies": [
26
26
  "@mrclrchtr/supi-core"
@@ -43,8 +43,14 @@
43
43
  },
44
44
  "pi": {
45
45
  "extensions": [
46
- "./src/debug.ts"
46
+ "./src/extension.ts",
47
+ "node_modules/@mrclrchtr/supi-core/src/extension.ts"
47
48
  ]
48
49
  },
49
- "main": "src/index.ts"
50
+ "main": "src/api.ts",
51
+ "exports": {
52
+ "./api": "./src/api.ts",
53
+ "./extension": "./src/extension.ts",
54
+ "./package.json": "./package.json"
55
+ }
50
56
  }
package/src/api.ts ADDED
@@ -0,0 +1 @@
1
+ export { default } from "./debug.ts";
package/src/debug.ts CHANGED
@@ -13,11 +13,11 @@ import {
13
13
  loadSupiConfig,
14
14
  registerConfigSettings,
15
15
  registerContextProvider,
16
- } from "@mrclrchtr/supi-core";
16
+ } from "@mrclrchtr/supi-core/api";
17
17
  import { Type } from "typebox";
18
- import { maybeLogLoadStatus } from "../status-log.ts";
19
18
  import { formatDataLines } from "./format.ts";
20
19
  import { registerDebugMessageRenderer } from "./renderer.ts";
20
+ import { maybeLogLoadStatus } from "./status-log.ts";
21
21
 
22
22
  const DEBUG_SECTION = "debug";
23
23
  const DEBUG_REPORT_TYPE = "supi-debug-report";
@@ -0,0 +1 @@
1
+ export { default } from "./debug.ts";
package/src/renderer.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
2
  import { Text } from "@earendil-works/pi-tui";
3
- import type { DebugEventView } from "@mrclrchtr/supi-core";
3
+ import type { DebugEventView } from "@mrclrchtr/supi-core/api";
4
4
  import { formatDataLines } from "./format.ts";
5
5
 
6
6
  const DEBUG_REPORT_TYPE = "supi-debug-report";
@@ -0,0 +1,70 @@
1
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
+
3
+ const STATUS_LOG_PREFIX = "SUPI_STATUS ";
4
+ const STATUS_LOG_ENV = "SUPI_LOG_STATUS";
5
+ const EXPECTED_SUPI_TOOLS = ["ask_user", "lsp", "tree_sitter", "code_intel", "supi_debug"];
6
+ const EXPECTED_SUPI_COMMANDS = [
7
+ "supi-settings",
8
+ "supi-debug",
9
+ "supi-context",
10
+ "supi-cache",
11
+ "lsp-status",
12
+ "supi-review",
13
+ ];
14
+
15
+ function byName(a: string, b: string): number {
16
+ return a.localeCompare(b);
17
+ }
18
+
19
+ function statusLogEnabled(): boolean {
20
+ const value = process.env[STATUS_LOG_ENV];
21
+ if (!value) return false;
22
+ return ["1", "true", "yes", "on"].includes(value.trim().toLowerCase());
23
+ }
24
+
25
+ /**
26
+ * Emit a stderr-only SuPi load status marker for external log inspection.
27
+ *
28
+ * This deliberately does not call `pi.sendMessage()`: custom messages are part
29
+ * of pi's session history and are converted into LLM-visible user messages.
30
+ * `appendEntry()` is pi's native non-LLM context persistence surface, while
31
+ * stderr is captured by Harbor's `2>&1 | tee pi.txt` command for `--no-session`
32
+ * runs where session entries are not inspectable.
33
+ */
34
+ export function maybeLogLoadStatus(pi: ExtensionAPI, cwd: string): void {
35
+ if (!statusLogEnabled()) return;
36
+
37
+ const allTools = typeof pi.getAllTools === "function" ? pi.getAllTools() : [];
38
+ const activeTools = typeof pi.getActiveTools === "function" ? pi.getActiveTools() : [];
39
+ const commands = typeof pi.getCommands === "function" ? pi.getCommands() : [];
40
+ const registeredToolNames = allTools.map((tool) => tool.name).sort(byName);
41
+ const activeToolNames = [...activeTools].sort(byName);
42
+ const commandNames = commands.map((command) => command.name).sort(byName);
43
+
44
+ const status = {
45
+ type: "supi_status",
46
+ version: 1,
47
+ phase: "session_start",
48
+ cwd,
49
+ expectedTools: Object.fromEntries(
50
+ EXPECTED_SUPI_TOOLS.map((tool) => [
51
+ tool,
52
+ {
53
+ registered: registeredToolNames.includes(tool),
54
+ active: activeToolNames.includes(tool),
55
+ },
56
+ ]),
57
+ ),
58
+ expectedCommands: Object.fromEntries(
59
+ EXPECTED_SUPI_COMMANDS.map((command) => [command, commandNames.includes(command)]),
60
+ ),
61
+ tools: {
62
+ registered: registeredToolNames,
63
+ active: activeToolNames,
64
+ },
65
+ commands: commandNames,
66
+ };
67
+
68
+ pi.appendEntry("supi-status", status);
69
+ process.stderr.write(`${STATUS_LOG_PREFIX}${JSON.stringify(status)}\n`);
70
+ }