@pi-ohm/handoff 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,23 @@
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 HandoffConfig {
6
+ enabled: boolean;
7
+ visualizer: boolean;
8
+ }
9
+ declare const DEFAULT_HANDOFF_CONFIG: HandoffConfig;
10
+ declare const HandoffConfigSchema: Type.TObject<{
11
+ enabled: Type.TOptional<Type.TBoolean>;
12
+ visualizer: Type.TOptional<Type.TBoolean>;
13
+ }>;
14
+ declare const handoffConfigModule: _$_pi_ohm_core_config0.ExtensionConfigModule<{
15
+ enabled: boolean;
16
+ visualizer: boolean;
17
+ }, Type.TObject<{
18
+ enabled: Type.TOptional<Type.TBoolean>;
19
+ visualizer: Type.TOptional<Type.TBoolean>;
20
+ }>>;
21
+ declare function isHandoffConfig(value: unknown): value is HandoffConfig;
22
+ //#endregion
23
+ export { DEFAULT_HANDOFF_CONFIG, HandoffConfig, HandoffConfigSchema, handoffConfigModule, isHandoffConfig };
package/dist/config.js ADDED
@@ -0,0 +1,31 @@
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_HANDOFF_CONFIG = {
7
+ enabled: true,
8
+ visualizer: true
9
+ };
10
+ const HandoffConfigSchema = Type.Object({
11
+ enabled: Type.Optional(Type.Boolean()),
12
+ visualizer: Type.Optional(Type.Boolean())
13
+ }, { additionalProperties: false });
14
+ const handoffConfigModule = registerConfig({
15
+ namespace: "handoff",
16
+ schema: HandoffConfigSchema,
17
+ defaults: DEFAULT_HANDOFF_CONFIG,
18
+ merge(base, patch) {
19
+ return Result.ok({
20
+ enabled: patch.enabled ?? base.enabled,
21
+ visualizer: patch.visualizer ?? base.visualizer
22
+ });
23
+ }
24
+ });
25
+ function isHandoffConfig(value) {
26
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
27
+ return typeof Reflect.get(value, "enabled") === "boolean" && typeof Reflect.get(value, "visualizer") === "boolean";
28
+ }
29
+
30
+ //#endregion
31
+ export { DEFAULT_HANDOFF_CONFIG, HandoffConfigSchema, handoffConfigModule, isHandoffConfig };
@@ -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 registerHandoffExtension(pi: ExtensionAPI): void;
package/dist/extension.js CHANGED
@@ -1,6 +1,25 @@
1
- import { loadOhmRuntimeConfig, registerOhmSettings } from "@pi-ohm/config";
1
+ import { handoffConfigModule, isHandoffConfig } 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 loadHandoffConfig(cwd) {
7
+ const loaded = await loadConfig({
8
+ cwd,
9
+ modules: [handoffConfigModule]
10
+ });
11
+ if (Result.isError(loaded)) return Result.err(loaded.error);
12
+ const config = pickConfig({
13
+ loaded: loaded.value,
14
+ module: handoffConfigModule,
15
+ is: isHandoffConfig
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 renderHandoffMapWidget(ctx, visible) {
5
24
  if (!ctx.hasUI) return;
6
25
  if (!visible) {
@@ -15,32 +34,35 @@ function renderHandoffMapWidget(ctx, visible) {
15
34
  ctx.ui.setWidget("ohm-handoff-map", lines, { placement: "belowEditor" });
16
35
  }
17
36
  async function refreshStatus(ctx) {
18
- const { config } = await loadOhmRuntimeConfig(ctx.cwd);
19
- const enabled = config.features.handoff ? "on" : "off";
20
- const viz = config.features.handoffVisualizer ? "on" : "off";
37
+ const config = await loadHandoffConfig(ctx.cwd);
38
+ if (Result.isError(config)) return;
39
+ const enabled = config.value.config.enabled ? "on" : "off";
40
+ const viz = config.value.config.visualizer ? "on" : "off";
21
41
  if (ctx.hasUI) {
22
42
  ctx.ui.setStatus("ohm-handoff", `handoff:${enabled} · visualizer:${viz}`);
23
43
  }
24
- renderHandoffMapWidget(ctx, config.features.handoff && config.features.handoffVisualizer);
44
+ renderHandoffMapWidget(ctx, config.value.config.enabled && config.value.config.visualizer);
25
45
  }
26
46
  function registerHandoffExtension(pi) {
27
- registerOhmSettings(pi);
28
47
  pi.on("session_start", async (_event, ctx) => {
29
48
  await refreshStatus(ctx);
30
49
  });
31
50
  pi.registerCommand("ohm-handoff", {
32
51
  description: "Show handoff + visualizer config and status",
33
52
  handler: async (_args, ctx) => {
34
- const loaded = await loadOhmRuntimeConfig(ctx.cwd);
53
+ const config = await loadHandoffConfig(ctx.cwd);
54
+ if (Result.isError(config)) {
55
+ console.log(config.error.message);
56
+ return;
57
+ }
35
58
  const text = [
36
59
  "Pi OHM: handoff",
37
60
  "",
38
- `enabled: ${loaded.config.features.handoff ? "yes" : "no"}`,
39
- `visualizer: ${loaded.config.features.handoffVisualizer ? "yes" : "no"}`,
40
- `subagent backend: ${loaded.config.subagentBackend}`,
61
+ `enabled: ${config.value.config.enabled ? "yes" : "no"}`,
62
+ `visualizer: ${config.value.config.visualizer ? "yes" : "no"}`,
41
63
  "",
42
- `configDir: ${loaded.paths.configDir}`,
43
- `loadedFrom: ${loaded.loadedFrom.length > 0 ? loaded.loadedFrom.join(", ") : "defaults + extension settings"}`
64
+ `configDir: ${config.value.loaded.paths.configDir}`,
65
+ `loadedFrom: ${config.value.loaded.loadedFrom.length > 0 ? config.value.loaded.loadedFrom.join(", ") : "defaults"}`
44
66
  ].join("\n");
45
67
  if (!ctx.hasUI) {
46
68
  console.log(text);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-ohm/handoff",
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/handoff#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": [