@pi-ohm/handoff 0.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.
- package/README.md +7 -0
- package/package.json +27 -0
- package/src/extension.ts +66 -0
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pi-ohm/handoff",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "src/extension.ts",
|
|
6
|
+
"types": "src/extension.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"src/",
|
|
9
|
+
"README.md"
|
|
10
|
+
],
|
|
11
|
+
"pi": {
|
|
12
|
+
"extensions": [
|
|
13
|
+
"./src/extension.ts"
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@mariozechner/pi-coding-agent": "^0.52.0",
|
|
18
|
+
"@pi-ohm/config": "^0.3.0"
|
|
19
|
+
},
|
|
20
|
+
"peerDependencies": {
|
|
21
|
+
"@mariozechner/pi-coding-agent": "*"
|
|
22
|
+
},
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public",
|
|
25
|
+
"provenance": true
|
|
26
|
+
}
|
|
27
|
+
}
|
package/src/extension.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { ExtensionAPI, ExtensionContext } from "@mariozechner/pi-coding-agent";
|
|
2
|
+
import { loadOhmRuntimeConfig, registerOhmSettings } from "@pi-ohm/config";
|
|
3
|
+
|
|
4
|
+
function renderHandoffMapWidget(ctx: ExtensionContext, visible: boolean): void {
|
|
5
|
+
if (!ctx.hasUI) return;
|
|
6
|
+
|
|
7
|
+
if (!visible) {
|
|
8
|
+
ctx.ui.setWidget("ohm-handoff-map", undefined, { placement: "belowEditor" });
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const lines = [
|
|
13
|
+
"ohm handoff visualizer (scaffold)",
|
|
14
|
+
`session: ${ctx.sessionManager.getSessionFile() ?? "ephemeral"}`,
|
|
15
|
+
"next: wire this into /resume tree + handoff links",
|
|
16
|
+
];
|
|
17
|
+
ctx.ui.setWidget("ohm-handoff-map", lines, { placement: "belowEditor" });
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async function refreshStatus(ctx: ExtensionContext): Promise<void> {
|
|
21
|
+
const { config } = await loadOhmRuntimeConfig(ctx.cwd);
|
|
22
|
+
const enabled = config.features.handoff ? "on" : "off";
|
|
23
|
+
const viz = config.features.handoffVisualizer ? "on" : "off";
|
|
24
|
+
|
|
25
|
+
if (ctx.hasUI) {
|
|
26
|
+
ctx.ui.setStatus("ohm-handoff", `handoff:${enabled} · visualizer:${viz}`);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
renderHandoffMapWidget(ctx, config.features.handoff && config.features.handoffVisualizer);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default function registerHandoffExtension(pi: ExtensionAPI): void {
|
|
33
|
+
registerOhmSettings(pi);
|
|
34
|
+
|
|
35
|
+
pi.on("session_start", async (_event, ctx) => {
|
|
36
|
+
await refreshStatus(ctx);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
pi.on("session_switch", async (_event, ctx) => {
|
|
40
|
+
await refreshStatus(ctx);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
pi.registerCommand("ohm-handoff", {
|
|
44
|
+
description: "Show handoff + visualizer config and status",
|
|
45
|
+
handler: async (_args, ctx) => {
|
|
46
|
+
const loaded = await loadOhmRuntimeConfig(ctx.cwd);
|
|
47
|
+
const text = [
|
|
48
|
+
"Pi OHM: handoff",
|
|
49
|
+
"",
|
|
50
|
+
`enabled: ${loaded.config.features.handoff ? "yes" : "no"}`,
|
|
51
|
+
`visualizer: ${loaded.config.features.handoffVisualizer ? "yes" : "no"}`,
|
|
52
|
+
`subagent backend: ${loaded.config.subagentBackend}`,
|
|
53
|
+
"",
|
|
54
|
+
`configDir: ${loaded.paths.configDir}`,
|
|
55
|
+
`loadedFrom: ${loaded.loadedFrom.length > 0 ? loaded.loadedFrom.join(", ") : "defaults + extension settings"}`,
|
|
56
|
+
].join("\n");
|
|
57
|
+
|
|
58
|
+
if (!ctx.hasUI) {
|
|
59
|
+
console.log(text);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
await ctx.ui.editor("pi-ohm handoff", text);
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
}
|