@cortexkit/aft-opencode 0.45.1 → 0.47.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/dist/bash-wait-detach.d.ts +5 -0
- package/dist/bash-wait-detach.d.ts.map +1 -0
- package/dist/config.d.ts +3 -11
- package/dist/config.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2304 -1133
- package/dist/logger.d.ts.map +1 -1
- package/dist/lsp-auto-install.d.ts +8 -3
- package/dist/lsp-auto-install.d.ts.map +1 -1
- package/dist/lsp-github-install.d.ts +2 -0
- package/dist/lsp-github-install.d.ts.map +1 -1
- package/dist/shared/ignored-message.d.ts +9 -7
- package/dist/shared/ignored-message.d.ts.map +1 -1
- package/dist/shared/rpc-client.d.ts +23 -1
- package/dist/shared/rpc-client.d.ts.map +1 -1
- package/dist/subc-tool-schemas.d.ts.map +1 -1
- package/dist/tools/_shared.d.ts.map +1 -1
- package/dist/tools/hoisted.d.ts.map +1 -1
- package/dist/tools/permissions.d.ts +8 -0
- package/dist/tools/permissions.d.ts.map +1 -1
- package/dist/tools/semantic.d.ts.map +1 -1
- package/dist/tui/notification-socket.d.ts.map +1 -1
- package/package.json +17 -14
- package/src/logger.ts +5 -6
- package/src/shared/ignored-message.ts +38 -19
- package/src/shared/rpc-client.ts +116 -4
- package/src/tui/entry.mjs +16 -0
- package/src/tui/notification-socket.ts +28 -1
- package/src/tui-compiled/badge-contrast.ts +43 -0
- package/src/tui-compiled/index.tsx +992 -0
- package/src/tui-compiled/notification-socket.ts +448 -0
- package/src/tui-compiled/preferences.ts +243 -0
- package/src/tui-compiled/sidebar.tsx +936 -0
- package/src/tui-compiled/types/opencode-plugin-tui.d.ts +239 -0
- package/dist/tui.js +0 -13462
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AftRpcClient, type AftRpcEndpoint } from "../shared/rpc-client";
|
|
1
|
+
import { AftRpcClient, type AftRpcEndpoint, subscribeRpcRedirects } from "../shared/rpc-client";
|
|
2
2
|
import { resolveCortexKitStorageRoot } from "../shared/storage-paths";
|
|
3
3
|
|
|
4
4
|
export interface SocketNotification {
|
|
@@ -86,14 +86,41 @@ export function startAftTuiSocket(options: TuiSocketOptions): void {
|
|
|
86
86
|
opts = options;
|
|
87
87
|
closed = false;
|
|
88
88
|
generation += 1;
|
|
89
|
+
ensureRedirectSubscription();
|
|
89
90
|
void reconcileSocketScope();
|
|
90
91
|
}
|
|
91
92
|
|
|
93
|
+
/**
|
|
94
|
+
* Re-home the socket when a status call learns a verified-directory redirect
|
|
95
|
+
* (see rpc-client). The socket may already be connected to this directory's
|
|
96
|
+
* bridgeless instance — which authenticates and accepts hello but will never
|
|
97
|
+
* push a status-changed frame, because the session's bridge lives in another
|
|
98
|
+
* process. Drop it and reconnect; resolveEndpoint now follows the redirect.
|
|
99
|
+
*/
|
|
100
|
+
let redirectUnsubscribe: (() => void) | null = null;
|
|
101
|
+
function ensureRedirectSubscription(): void {
|
|
102
|
+
if (redirectUnsubscribe) return;
|
|
103
|
+
redirectUnsubscribe = subscribeRpcRedirects((from) => {
|
|
104
|
+
if (closed) return;
|
|
105
|
+
const scope = currentScope();
|
|
106
|
+
if (!scope || scope.directory !== from) return;
|
|
107
|
+
generation += 1;
|
|
108
|
+
connectingGeneration = null;
|
|
109
|
+
connectingScope = null;
|
|
110
|
+
closeCurrentSocket(false);
|
|
111
|
+
void connect(scope, generation);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
|
|
92
115
|
export function stopAftTuiSocket(): void {
|
|
93
116
|
closed = true;
|
|
94
117
|
generation += 1;
|
|
95
118
|
connectingGeneration = null;
|
|
96
119
|
connectingScope = null;
|
|
120
|
+
if (redirectUnsubscribe) {
|
|
121
|
+
redirectUnsubscribe();
|
|
122
|
+
redirectUnsubscribe = null;
|
|
123
|
+
}
|
|
97
124
|
if (reconnectTimer) {
|
|
98
125
|
deps.clearTimeout(reconnectTimer);
|
|
99
126
|
reconnectTimer = undefined;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pick the text color for a sidebar badge label drawn on a theme accent.
|
|
3
|
+
* Keep this logic in sync with Magic Context so both sidebars make the same
|
|
4
|
+
* contrast decision for shared themes.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
type Color = { r: number; g: number; b: number; a?: number };
|
|
8
|
+
|
|
9
|
+
const MIN_OPAQUE_ALPHA = 0.5;
|
|
10
|
+
const MIN_CHANNEL_DISTANCE = 0.06;
|
|
11
|
+
const LIGHT_ACCENT_LUMINANCE = 0.5;
|
|
12
|
+
|
|
13
|
+
function srgbChannelToLinear(c: number): number {
|
|
14
|
+
return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function relativeLuminance(bg: Color): number {
|
|
18
|
+
return (
|
|
19
|
+
0.2126 * srgbChannelToLinear(bg.r) +
|
|
20
|
+
0.7152 * srgbChannelToLinear(bg.g) +
|
|
21
|
+
0.0722 * srgbChannelToLinear(bg.b)
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function nearlyEqual(a: Color, b: Color): boolean {
|
|
26
|
+
return (
|
|
27
|
+
Math.abs(a.r - b.r) < MIN_CHANNEL_DISTANCE &&
|
|
28
|
+
Math.abs(a.g - b.g) < MIN_CHANNEL_DISTANCE &&
|
|
29
|
+
Math.abs(a.b - b.b) < MIN_CHANNEL_DISTANCE
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function readableTextColorOn(bg: Color): string {
|
|
34
|
+
return relativeLuminance(bg) < LIGHT_ACCENT_LUMINANCE ? "#ffffff" : "#000000";
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function badgeTextColor<T extends Color>(accent: T, background: T): T | string {
|
|
38
|
+
const alpha = background.a ?? 1;
|
|
39
|
+
if (alpha >= MIN_OPAQUE_ALPHA && !nearlyEqual(accent, background)) {
|
|
40
|
+
return background;
|
|
41
|
+
}
|
|
42
|
+
return readableTextColorOn(accent);
|
|
43
|
+
}
|