@pi-ohm/session-search 0.6.4-dev.25351601005.1.815a0e8 → 0.6.4-dev.25620170147.1.0b6891f

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.
@@ -0,0 +1,19 @@
1
+ import * as _$_pi_ohm_core_config0 from "@pi-ohm/core/config";
2
+ import { Type } from "typebox";
3
+
4
+ //#region src/config.d.ts
5
+ interface SessionSearchConfig {
6
+ enabled: boolean;
7
+ }
8
+ declare const DEFAULT_SESSION_SEARCH_CONFIG: SessionSearchConfig;
9
+ declare const SessionSearchConfigSchema: Type.TObject<{
10
+ enabled: Type.TOptional<Type.TBoolean>;
11
+ }>;
12
+ declare const sessionSearchConfigModule: _$_pi_ohm_core_config0.ExtensionConfigModule<{
13
+ enabled: boolean;
14
+ }, Type.TObject<{
15
+ enabled: Type.TOptional<Type.TBoolean>;
16
+ }>>;
17
+ declare function isSessionSearchConfig(value: unknown): value is SessionSearchConfig;
18
+ //#endregion
19
+ export { DEFAULT_SESSION_SEARCH_CONFIG, SessionSearchConfig, SessionSearchConfigSchema, isSessionSearchConfig, sessionSearchConfigModule };
package/dist/config.js ADDED
@@ -0,0 +1,22 @@
1
+ import { Result } from "better-result";
2
+ import { registerConfig } from "@pi-ohm/core/config";
3
+ import { Type } from "typebox";
4
+
5
+ //#region src/config.ts
6
+ const DEFAULT_SESSION_SEARCH_CONFIG = { enabled: true };
7
+ const SessionSearchConfigSchema = Type.Object({ enabled: Type.Optional(Type.Boolean()) }, { additionalProperties: false });
8
+ const sessionSearchConfigModule = registerConfig({
9
+ namespace: "session-search",
10
+ schema: SessionSearchConfigSchema,
11
+ defaults: DEFAULT_SESSION_SEARCH_CONFIG,
12
+ merge(base, patch) {
13
+ return Result.ok({ enabled: patch.enabled ?? base.enabled });
14
+ }
15
+ });
16
+ function isSessionSearchConfig(value) {
17
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
18
+ return typeof Reflect.get(value, "enabled") === "boolean";
19
+ }
20
+
21
+ //#endregion
22
+ export { DEFAULT_SESSION_SEARCH_CONFIG, SessionSearchConfigSchema, isSessionSearchConfig, sessionSearchConfigModule };
@@ -1,4 +1,4 @@
1
- import { ExtensionAPI } from "@mariozechner/pi-coding-agent";
1
+ import { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
2
 
3
3
  //#region src/extension.d.ts
4
4
  declare function registerSessionSearchExtension(pi: ExtensionAPI): void;
package/dist/extension.js CHANGED
@@ -1,22 +1,45 @@
1
- import { loadOhmRuntimeConfig, registerOhmSettings } from "@pi-ohm/config";
1
+ import { isSessionSearchConfig, sessionSearchConfigModule } from "./config.js";
2
+ import { Result } from "better-result";
3
+ import { loadConfig, pickConfig } from "@pi-ohm/core/config";
2
4
 
3
5
  //#region src/extension.ts
6
+ async function loadSessionSearchConfig(cwd) {
7
+ const loaded = await loadConfig({
8
+ cwd,
9
+ modules: [sessionSearchConfigModule]
10
+ });
11
+ if (Result.isError(loaded)) return Result.err(loaded.error);
12
+ const config = pickConfig({
13
+ loaded: loaded.value,
14
+ module: sessionSearchConfigModule,
15
+ is: isSessionSearchConfig
16
+ });
17
+ if (Result.isError(config)) return Result.err(config.error);
18
+ return Result.ok({
19
+ loaded: loaded.value,
20
+ config: config.value
21
+ });
22
+ }
4
23
  function registerSessionSearchExtension(pi) {
5
- registerOhmSettings(pi);
6
24
  pi.on("session_start", async (_event, ctx) => {
7
- const { config } = await loadOhmRuntimeConfig(ctx.cwd);
25
+ const config = await loadSessionSearchConfig(ctx.cwd);
26
+ if (Result.isError(config)) return;
8
27
  if (!ctx.hasUI) return;
9
- const enabled = config.features.sessionThreadSearch ? "on" : "off";
28
+ const enabled = config.value.config.enabled ? "on" : "off";
10
29
  ctx.ui.setStatus("ohm-session-search", `session-search:${enabled}`);
11
30
  });
12
31
  pi.registerCommand("ohm-session-search", {
13
32
  description: "Show session/thread search feature state",
14
33
  handler: async (_args, ctx) => {
15
- const { config } = await loadOhmRuntimeConfig(ctx.cwd);
34
+ const config = await loadSessionSearchConfig(ctx.cwd);
35
+ if (Result.isError(config)) {
36
+ console.log(config.error.message);
37
+ return;
38
+ }
16
39
  const text = [
17
40
  "Pi OHM: session/thread search",
18
41
  "",
19
- `enabled: ${config.features.sessionThreadSearch ? "yes" : "no"}`,
42
+ `enabled: ${config.value.config.enabled ? "yes" : "no"}`,
20
43
  "",
21
44
  "Scaffold note: connect this package to session_query + thread index tools."
22
45
  ].join("\n");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-ohm/session-search",
3
- "version": "0.6.4-dev.25351601005.1.815a0e8",
3
+ "version": "0.6.4-dev.25620170147.1.0b6891f",
4
4
  "homepage": "https://github.com/pi-ohm/pi-ohm/tree/dev/packages/session-search#readme",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,6 +18,10 @@
18
18
  ".": {
19
19
  "types": "./dist/extension.d.ts",
20
20
  "default": "./dist/extension.js"
21
+ },
22
+ "./config": {
23
+ "types": "./dist/config.d.ts",
24
+ "default": "./dist/config.js"
21
25
  }
22
26
  },
23
27
  "publishConfig": {
@@ -25,14 +29,16 @@
25
29
  "provenance": true
26
30
  },
27
31
  "scripts": {
28
- "build": "vp pack src/extension.ts"
32
+ "build": "vp pack src/extension.ts src/config.ts"
29
33
  },
30
34
  "dependencies": {
31
- "@mariozechner/pi-coding-agent": "^0.72.1",
32
- "@pi-ohm/config": "0.6.4-dev.25351601005.1.815a0e8"
35
+ "@earendil-works/pi-coding-agent": "0.74.0",
36
+ "@pi-ohm/core": "0.6.4-dev.25620170147.1.0b6891f",
37
+ "better-result": "2.9.2",
38
+ "typebox": "^1.0.68"
33
39
  },
34
40
  "peerDependencies": {
35
- "@mariozechner/pi-coding-agent": "*"
41
+ "@earendil-works/pi-coding-agent": "0.74.0"
36
42
  },
37
43
  "pi": {
38
44
  "extensions": [