osdy-pi 0.1.0 → 0.1.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.
- package/extensions/osdy-pi.ts +35 -6
- package/package.json +1 -1
package/extensions/osdy-pi.ts
CHANGED
|
@@ -86,11 +86,19 @@ const HEADER_WIDTH = HEADER.reduce(
|
|
|
86
86
|
const HEADER_FALLBACK = ["OSDY - PI", "</> Compilador de ideas"];
|
|
87
87
|
|
|
88
88
|
class OsdyFooter implements Component {
|
|
89
|
+
private readonly ctx: ExtensionContext;
|
|
90
|
+
private readonly footerData: any;
|
|
91
|
+
private readonly theme: { fg(name: string, text: string): string };
|
|
92
|
+
|
|
89
93
|
constructor(
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
) {
|
|
94
|
+
ctx: ExtensionContext,
|
|
95
|
+
footerData: any,
|
|
96
|
+
theme: { fg(name: string, text: string): string },
|
|
97
|
+
) {
|
|
98
|
+
this.ctx = ctx;
|
|
99
|
+
this.footerData = footerData;
|
|
100
|
+
this.theme = theme;
|
|
101
|
+
}
|
|
94
102
|
|
|
95
103
|
render(width: number): string[] {
|
|
96
104
|
let location = formatPath(this.ctx.cwd);
|
|
@@ -500,12 +508,15 @@ function applyOsdyPi(
|
|
|
500
508
|
ctx.ui.setWorkingVisible(false);
|
|
501
509
|
|
|
502
510
|
class OsdyEditor extends CustomEditor {
|
|
511
|
+
private readonly tuiRef: TUI;
|
|
512
|
+
|
|
503
513
|
constructor(
|
|
504
|
-
|
|
514
|
+
tuiRef: TUI,
|
|
505
515
|
theme: EditorTheme,
|
|
506
516
|
keybindings: KeybindingsManager,
|
|
507
517
|
) {
|
|
508
518
|
super(tuiRef, theme, keybindings, { paddingX: 1 });
|
|
519
|
+
this.tuiRef = tuiRef;
|
|
509
520
|
}
|
|
510
521
|
render(width: number): string[] {
|
|
511
522
|
if (width < 4 || this.isShowingAutocomplete()) return super.render(width);
|
|
@@ -564,6 +575,24 @@ function disableOsdyPi(ctx: ExtensionContext, state: OsdyState): void {
|
|
|
564
575
|
ctx.ui.notify("osdy-pi disabled", "info");
|
|
565
576
|
}
|
|
566
577
|
|
|
578
|
+
function claimOsdyVisualLayer(
|
|
579
|
+
pi: ExtensionAPI,
|
|
580
|
+
ctx: ExtensionContext,
|
|
581
|
+
state: OsdyState,
|
|
582
|
+
): void {
|
|
583
|
+
if (!state.enabled) return;
|
|
584
|
+
applyOsdyPi(pi, ctx, state);
|
|
585
|
+
|
|
586
|
+
// Some packages install startup headers asynchronously. Re-apply Osdy-Pi
|
|
587
|
+
// after startup so it remains the visual owner without disabling those
|
|
588
|
+
// packages' prompts, agents, MCP tools, commands, or other behavior.
|
|
589
|
+
for (const delayMs of [300, 1000]) {
|
|
590
|
+
setTimeout(() => {
|
|
591
|
+
if (state.enabled) applyOsdyPi(pi, ctx, state);
|
|
592
|
+
}, delayMs);
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
|
|
567
596
|
export default function (pi: ExtensionAPI) {
|
|
568
597
|
const state: OsdyState = { enabled: true, gitLabel: "-", agentsLabel: "-" };
|
|
569
598
|
pi.on("session_start", (_event, ctx) => {
|
|
@@ -589,7 +618,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
589
618
|
.catch(() => {
|
|
590
619
|
state.agentsLabel = "0";
|
|
591
620
|
});
|
|
592
|
-
|
|
621
|
+
claimOsdyVisualLayer(pi, ctx, state);
|
|
593
622
|
});
|
|
594
623
|
pi.registerCommand("osdy-pi", {
|
|
595
624
|
description: "Manage the Osdy Pi experience: enable, disable, or status.",
|