@cortexkit/opencode-openai-auth 0.3.3 → 0.3.4
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/cli.js +1 -1
- package/dist/core/oauth.d.ts +1 -1
- package/dist/{index-phrx93zy.js → index-y8d01tgn.js} +8 -8
- package/dist/index.js +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +6 -4
- package/src/tui/entry.mjs +37 -0
- package/src/tui-compiled/logger.ts +161 -0
- package/src/tui-compiled/rpc/port-file.ts +70 -0
- package/src/tui-compiled/rpc/protocol.ts +31 -0
- package/src/tui-compiled/rpc/rpc-client.ts +78 -0
- package/src/tui-compiled/rpc/rpc-dir.ts +22 -0
- package/src/tui-compiled/sidebar-state.ts +316 -0
- package/src/tui-compiled/tui/command-dialogs.tsx +640 -0
- package/src/tui-compiled/tui-preferences.ts +328 -0
- package/src/tui-compiled/tui.tsx +1041 -0
- package/src/tui-compiled/util/open-url.ts +30 -0
- package/src/tui.tsx +16 -13
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { execFileSync as defaultExecFileSync } from 'node:child_process'
|
|
2
|
+
|
|
3
|
+
type BrowserExec = (
|
|
4
|
+
file: string,
|
|
5
|
+
args: string[],
|
|
6
|
+
options: { stdio: 'ignore'; timeout: number },
|
|
7
|
+
) => unknown
|
|
8
|
+
|
|
9
|
+
export function openUrl(
|
|
10
|
+
url: string,
|
|
11
|
+
platform: NodeJS.Platform = process.platform,
|
|
12
|
+
execFileSync: BrowserExec = defaultExecFileSync,
|
|
13
|
+
) {
|
|
14
|
+
try {
|
|
15
|
+
if (platform === 'win32') {
|
|
16
|
+
execFileSync('cmd', ['/c', 'start', '', url], {
|
|
17
|
+
stdio: 'ignore',
|
|
18
|
+
timeout: 3000,
|
|
19
|
+
})
|
|
20
|
+
return
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
execFileSync(platform === 'darwin' ? 'open' : 'xdg-open', [url], {
|
|
24
|
+
stdio: 'ignore',
|
|
25
|
+
timeout: 3000,
|
|
26
|
+
})
|
|
27
|
+
} catch {
|
|
28
|
+
// Browser launch is best effort; the printed URL remains the fallback.
|
|
29
|
+
}
|
|
30
|
+
}
|
package/src/tui.tsx
CHANGED
|
@@ -50,21 +50,24 @@ const log = createLogger('rpc-tui')
|
|
|
50
50
|
|
|
51
51
|
const ID = 'cortexkit.openai-auth'
|
|
52
52
|
|
|
53
|
-
//
|
|
54
|
-
//
|
|
55
|
-
//
|
|
56
|
-
// rootDir). tui.tsx ships as source (package.json exports["./tui"] →
|
|
57
|
-
// "./src/tui.tsx") and is never compiled into a deeper dist tree, so `..` from
|
|
58
|
-
// src/ is always the package root. Empty string on any failure → header shows
|
|
59
|
-
// the badge with no version.
|
|
53
|
+
// Read package metadata from either the raw src/ entry or its generated
|
|
54
|
+
// src/tui-compiled/ counterpart. Avoid a JSON import because package.json sits
|
|
55
|
+
// outside the declaration build's rootDir.
|
|
60
56
|
const PLUGIN_VERSION: string = (() => {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
57
|
+
const here = dirname(fileURLToPath(import.meta.url))
|
|
58
|
+
for (const packageFile of [
|
|
59
|
+
join(here, '..', 'package.json'),
|
|
60
|
+
join(here, '..', '..', 'package.json'),
|
|
61
|
+
]) {
|
|
62
|
+
try {
|
|
63
|
+
const raw = readFileSync(packageFile, 'utf8')
|
|
64
|
+
const version = (JSON.parse(raw) as { version?: string }).version
|
|
65
|
+
if (version) return version
|
|
66
|
+
} catch {
|
|
67
|
+
// Try the path for the other TUI entry layout.
|
|
68
|
+
}
|
|
67
69
|
}
|
|
70
|
+
return ''
|
|
68
71
|
})()
|
|
69
72
|
|
|
70
73
|
// biome-ignore lint/suspicious/noExplicitAny: opentui border prop not typed in plugin tui surface
|