skydive-cli 0.3.0-beta.794 → 0.3.0-beta.823
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/js/bin.mjs +44 -35
- package/dist/js/{boot-C-PAidLX.mjs → boot-BypwzKHP.mjs} +26 -10
- package/dist/js/{install-DqLgkAHr.mjs → install-DrX2_gs-.mjs} +2 -2
- package/dist/js/{print-Bmgp3ZT9.mjs → print-Bs_6CrTC.mjs} +16 -1
- package/dist/js/{print-CB9kyvkV.mjs → print-bhjVgVMK.mjs} +1 -1
- package/package.json +1 -1
package/dist/js/bin.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { C as setActiveWorkspace, S as listWorkspaces, T as version, _ as themes, b as getActiveWorkspaceId, o as brandHelpArt, t as installCrashHandler, w as name, x as getSessionIdentity, y as ensureActiveOrganization } from "./install-
|
|
3
|
-
import { A as getStoredApiKeyWorkspaceName,
|
|
2
|
+
import { C as setActiveWorkspace, S as listWorkspaces, T as version, _ as themes, b as getActiveWorkspaceId, o as brandHelpArt, t as installCrashHandler, w as name, x as getSessionIdentity, y as ensureActiveOrganization } from "./install-DrX2_gs-.mjs";
|
|
3
|
+
import { A as getStoredApiKeyWorkspaceName, C as getLastSeenVersion, F as resolveManagementAuth, I as resolveSession, M as resolveAppUrl, N as resolveChatAuth, O as getShareMachineDefault, P as resolveConfig, R as saveConfig, S as getConfigPath, T as getPromptHistoryPath, V as setLastSeenVersion, _ as API_KEY_PREFIX, b as PREFERENCES, g as API_KEY_FAMILY_PREFIX, h as API_KEYS_URL, i as resolveAgent, j as getUpdateCheckDisabled, k as getStoredApiKeyId, v as DEFAULT_API_URL, w as getPreference, x as deleteConfig, z as saveSession } from "./print-Bs_6CrTC.mjs";
|
|
4
4
|
import { n as printError, r as printTable, t as output } from "./output-DYzzdXYV.mjs";
|
|
5
5
|
import { n as createRestClient, t as HttpError } from "./rest-BlN_uWmL.mjs";
|
|
6
6
|
import { a as registerPortalDevice, i as grantPortalAccess, n as fetchPortalDevices, o as revokePortalAccess, r as findThisDevice, s as machineIdentity } from "./client-Dc7GZ3PG.mjs";
|
|
@@ -1047,10 +1047,14 @@ function requireManagementClient(argv) {
|
|
|
1047
1047
|
}
|
|
1048
1048
|
/** Resolve the session (see {@link requireSession}) and build a REST client. */
|
|
1049
1049
|
function requireRestClient(argv) {
|
|
1050
|
-
const
|
|
1050
|
+
const auth = resolveChatAuth({ appUrl: resolveAppUrl({ appUrl: argv["api-url"] }) });
|
|
1051
|
+
if (auth.isErr()) {
|
|
1052
|
+
printError(`${auth.error.message} Run \`skydive auth login\` first, or set SKYDIVE_API_KEY / SKYDIVE_SESSION_TOKEN.`);
|
|
1053
|
+
process.exit(1);
|
|
1054
|
+
}
|
|
1051
1055
|
return createRestClient({
|
|
1052
|
-
appUrl:
|
|
1053
|
-
sessionToken:
|
|
1056
|
+
appUrl: auth.value.appUrl,
|
|
1057
|
+
sessionToken: auth.value.token
|
|
1054
1058
|
});
|
|
1055
1059
|
}
|
|
1056
1060
|
|
|
@@ -1500,7 +1504,7 @@ const importCommand = {
|
|
|
1500
1504
|
process.exit(1);
|
|
1501
1505
|
}
|
|
1502
1506
|
}
|
|
1503
|
-
const { runChat } = await import("./boot-
|
|
1507
|
+
const { runChat } = await import("./boot-BypwzKHP.mjs");
|
|
1504
1508
|
await runChat({
|
|
1505
1509
|
appUrl,
|
|
1506
1510
|
sessionToken: session.value.sessionToken,
|
|
@@ -1535,7 +1539,7 @@ async function runImportPrintMode({ argv, appUrl }) {
|
|
|
1535
1539
|
});
|
|
1536
1540
|
const extra = (argv.print ?? "").trim();
|
|
1537
1541
|
const prompt = buildImportSeedPrompt(process.cwd()) + (extra ? `\n\nAdditional instructions: ${extra}` : "");
|
|
1538
|
-
const { runPrint } = await import("./print-
|
|
1542
|
+
const { runPrint } = await import("./print-bhjVgVMK.mjs");
|
|
1539
1543
|
try {
|
|
1540
1544
|
const result = await runPrint({
|
|
1541
1545
|
appUrl,
|
|
@@ -1885,10 +1889,10 @@ const chatCommand = {
|
|
|
1885
1889
|
printError(`chat needs the Bun runtime and it couldn't be set up automatically (no network, an unsupported platform, or a failed download). Install Bun (https://bun.sh) and run chat under it, e.g. \`bun ${process.argv[1] ?? "skydive"} chat\`, or point SKYDIVE_BUN_PATH at an existing bun binary. For a non-interactive one-shot that runs under Node, use \`chat -p "<prompt>"\`.`);
|
|
1886
1890
|
process.exit(1);
|
|
1887
1891
|
}
|
|
1888
|
-
let
|
|
1889
|
-
if (
|
|
1892
|
+
let auth = resolveChatAuth({ appUrl });
|
|
1893
|
+
if (auth.isErr()) {
|
|
1890
1894
|
if (isNonInteractive()) {
|
|
1891
|
-
printError("Not signed in
|
|
1895
|
+
printError("Not signed in and no interactive terminal. Run `skydive auth login`, or set SKYDIVE_API_KEY / SKYDIVE_SESSION_TOKEN.");
|
|
1892
1896
|
process.exit(1);
|
|
1893
1897
|
}
|
|
1894
1898
|
const login = await loginWithDevice({ appUrl });
|
|
@@ -1896,8 +1900,8 @@ const chatCommand = {
|
|
|
1896
1900
|
printError(login.error.message);
|
|
1897
1901
|
process.exit(1);
|
|
1898
1902
|
}
|
|
1899
|
-
|
|
1900
|
-
if (
|
|
1903
|
+
auth = resolveChatAuth({ appUrl });
|
|
1904
|
+
if (auth.isErr()) {
|
|
1901
1905
|
printError("Signed in, but no session was stored.");
|
|
1902
1906
|
process.exit(1);
|
|
1903
1907
|
}
|
|
@@ -1909,13 +1913,14 @@ const chatCommand = {
|
|
|
1909
1913
|
}
|
|
1910
1914
|
await ensureAgentWorkspace({
|
|
1911
1915
|
appUrl,
|
|
1912
|
-
sessionToken:
|
|
1916
|
+
sessionToken: auth.value.token,
|
|
1913
1917
|
agentSelector: argv.agent ?? null
|
|
1914
1918
|
});
|
|
1915
|
-
const { runChat } = await import("./boot-
|
|
1919
|
+
const { runChat } = await import("./boot-BypwzKHP.mjs");
|
|
1916
1920
|
await runChat({
|
|
1917
|
-
appUrl,
|
|
1918
|
-
sessionToken:
|
|
1921
|
+
appUrl: auth.value.appUrl,
|
|
1922
|
+
sessionToken: auth.value.token,
|
|
1923
|
+
authKind: auth.value.kind,
|
|
1919
1924
|
shareMachine: resolveShareMachine(argv),
|
|
1920
1925
|
promptHistoryPath: getPromptHistoryPath(),
|
|
1921
1926
|
theme: themeId,
|
|
@@ -1973,15 +1978,15 @@ async function ensureAgentWorkspace({ appUrl, sessionToken, agentSelector }) {
|
|
|
1973
1978
|
process.exit(1);
|
|
1974
1979
|
}
|
|
1975
1980
|
async function runPrintMode({ argv, appUrl }) {
|
|
1976
|
-
const
|
|
1977
|
-
if (
|
|
1978
|
-
printError(`${
|
|
1981
|
+
const auth = resolveChatAuth({ appUrl });
|
|
1982
|
+
if (auth.isErr()) {
|
|
1983
|
+
printError(`${auth.error.message} For non-interactive use, run \`skydive auth login\` first, or set SKYDIVE_API_KEY / SKYDIVE_SESSION_TOKEN.`);
|
|
1979
1984
|
process.exit(1);
|
|
1980
1985
|
}
|
|
1981
|
-
const { runPrint, readStdin } = await import("./print-
|
|
1986
|
+
const { runPrint, readStdin } = await import("./print-bhjVgVMK.mjs");
|
|
1982
1987
|
await ensureAgentWorkspace({
|
|
1983
1988
|
appUrl,
|
|
1984
|
-
sessionToken:
|
|
1989
|
+
sessionToken: auth.value.token,
|
|
1985
1990
|
agentSelector: argv.agent ?? null
|
|
1986
1991
|
});
|
|
1987
1992
|
let prompt = (argv.print ?? "").trim();
|
|
@@ -1997,18 +2002,23 @@ async function runPrintMode({ argv, appUrl }) {
|
|
|
1997
2002
|
}
|
|
1998
2003
|
}
|
|
1999
2004
|
let machineShare = null;
|
|
2000
|
-
if (resolveShareMachine(argv)) {
|
|
2005
|
+
if (resolveShareMachine(argv)) if (auth.value.kind === "api-key") {
|
|
2006
|
+
if (argv["share-machine"] === true) {
|
|
2007
|
+
printError("Machine sharing needs a browser session (API keys cannot grant local access). Run `skydive auth login --web` first, or re-run with --no-share-machine.");
|
|
2008
|
+
process.exit(1);
|
|
2009
|
+
}
|
|
2010
|
+
} else {
|
|
2001
2011
|
const { connectMachineShare } = await import("./print-share-7qfpQtWK.mjs");
|
|
2002
2012
|
machineShare = await connectMachineShare({
|
|
2003
|
-
appUrl,
|
|
2004
|
-
sessionToken:
|
|
2013
|
+
appUrl: auth.value.appUrl,
|
|
2014
|
+
sessionToken: auth.value.token,
|
|
2005
2015
|
timeoutHint: "Re-run with --no-share-machine (or unset `shareMachineDefault` in the CLI config), or check `skydive portal status`."
|
|
2006
2016
|
});
|
|
2007
2017
|
}
|
|
2008
2018
|
try {
|
|
2009
2019
|
const result = await runPrint({
|
|
2010
|
-
appUrl,
|
|
2011
|
-
sessionToken:
|
|
2020
|
+
appUrl: auth.value.appUrl,
|
|
2021
|
+
sessionToken: auth.value.token,
|
|
2012
2022
|
prompt,
|
|
2013
2023
|
agentSelector: argv.agent ?? null,
|
|
2014
2024
|
conversationId: argv.conversation ?? null,
|
|
@@ -2051,17 +2061,16 @@ const getCommand$1 = {
|
|
|
2051
2061
|
describe: "Message id (the `messageId` from a prior `chat -p --json`)"
|
|
2052
2062
|
}),
|
|
2053
2063
|
handler: async (argv) => {
|
|
2054
|
-
const
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
printError(`${session.error.message} Run \`skydive auth login\` first, or set SKYDIVE_SESSION_TOKEN.`);
|
|
2064
|
+
const auth = resolveChatAuth({ appUrl: resolveAppUrl({ appUrl: argv["api-url"] }) });
|
|
2065
|
+
if (auth.isErr()) {
|
|
2066
|
+
printError(`${auth.error.message} Run \`skydive auth login\` first, or set SKYDIVE_API_KEY / SKYDIVE_SESSION_TOKEN.`);
|
|
2058
2067
|
process.exit(1);
|
|
2059
2068
|
}
|
|
2060
|
-
const { messageGet } = await import("./print-
|
|
2069
|
+
const { messageGet } = await import("./print-bhjVgVMK.mjs");
|
|
2061
2070
|
try {
|
|
2062
2071
|
const result = await messageGet({
|
|
2063
|
-
appUrl,
|
|
2064
|
-
sessionToken:
|
|
2072
|
+
appUrl: auth.value.appUrl,
|
|
2073
|
+
sessionToken: auth.value.token,
|
|
2065
2074
|
messageId: argv["message-id"],
|
|
2066
2075
|
json: argv.json
|
|
2067
2076
|
});
|
|
@@ -2254,7 +2263,7 @@ const switchCommand = {
|
|
|
2254
2263
|
printError("The workspace picker needs the Bun runtime and it could not be set up automatically. Pass a workspace slug instead, or install Bun and retry.");
|
|
2255
2264
|
process.exit(1);
|
|
2256
2265
|
}
|
|
2257
|
-
const { runWorkspacePicker } = await import("./boot-
|
|
2266
|
+
const { runWorkspacePicker } = await import("./boot-BypwzKHP.mjs");
|
|
2258
2267
|
await runWorkspacePicker(session);
|
|
2259
2268
|
return;
|
|
2260
2269
|
}
|
|
@@ -2606,7 +2615,7 @@ const sandboxCommand = {
|
|
|
2606
2615
|
handler: async (argv) => {
|
|
2607
2616
|
const session = requireSession(argv);
|
|
2608
2617
|
const { createRestClient } = await import("./rest-CDTXCmUb.mjs");
|
|
2609
|
-
const { resolveAgent } = await import("./print-
|
|
2618
|
+
const { resolveAgent } = await import("./print-bhjVgVMK.mjs");
|
|
2610
2619
|
const client = createRestClient({
|
|
2611
2620
|
appUrl: session.appUrl,
|
|
2612
2621
|
sessionToken: session.sessionToken
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { C as setActiveWorkspace, S as listWorkspaces, a as WORDMARK, b as getActiveWorkspaceId, c as applyTheme, d as noColorRequested, f as theme, g as themeVersion, h as themeModeFromColorFgBg, i as MARK_CELLS, l as findTheme, m as themeMode, n as buildCrashReport, p as themeForMode, r as writeCrashReport, s as DEFAULT_THEME_ID, t as installCrashHandler, u as monoTheme, v as themesForMode } from "./install-
|
|
3
|
-
import { D as getSavedTheme, E as getReviewStateDir,
|
|
2
|
+
import { C as setActiveWorkspace, S as listWorkspaces, a as WORDMARK, b as getActiveWorkspaceId, c as applyTheme, d as noColorRequested, f as theme, g as themeVersion, h as themeModeFromColorFgBg, i as MARK_CELLS, l as findTheme, m as themeMode, n as buildCrashReport, p as themeForMode, r as writeCrashReport, s as DEFAULT_THEME_ID, t as installCrashHandler, u as monoTheme, v as themesForMode } from "./install-DrX2_gs-.mjs";
|
|
3
|
+
import { B as saveTheme, D as getSavedTheme, E as getReviewStateDir, L as resolveWebUrl, S as getConfigPath, c as cardActionErrorMessage, d as reconcileMaskedInput, f as resolveConnectUrl, i as resolveAgent, l as parseExternalOauthConnectParams, m as specKeyFor, p as parseConnectCard, s as MASK_CHAR, u as parseOauthConnectParams, v as DEFAULT_API_URL, y as DEFAULT_APP_URL } from "./print-Bs_6CrTC.mjs";
|
|
4
4
|
import { a as errorMessage, i as sendErrorMessage, n as createRestClient, o as isRecord, r as errorDetail, t as HttpError } from "./rest-BlN_uWmL.mjs";
|
|
5
5
|
import { t as PortalClient } from "./client-Dc7GZ3PG.mjs";
|
|
6
6
|
import { d as makeLineParser, f as parseDaemonMessage, l as daemonPaths, n as ensureDaemonRunning, s as LOCAL_PROTOCOL_VERSION, u as encodeLine } from "./daemon-Co4CtpXZ.mjs";
|
|
@@ -69,6 +69,7 @@ const useStore = create((set, get) => ({
|
|
|
69
69
|
themeLocked: false,
|
|
70
70
|
appUrl: null,
|
|
71
71
|
sessionToken: null,
|
|
72
|
+
authKind: "session",
|
|
72
73
|
workspaceName: null,
|
|
73
74
|
rest: null,
|
|
74
75
|
promptHistoryPath: null,
|
|
@@ -437,10 +438,11 @@ function createPortalClient(opts) {
|
|
|
437
438
|
* user turns sharing on from the chat screen. Detaching on unmount leaves the
|
|
438
439
|
* daemon running for any other attached CLIs.
|
|
439
440
|
*/
|
|
440
|
-
function usePortal({ appUrl, sessionToken, shareMachine }) {
|
|
441
|
+
function usePortal({ appUrl, sessionToken, shareMachine, enabled = true }) {
|
|
441
442
|
const syncPortal = useStore((s) => s.syncPortal);
|
|
442
443
|
const setPortalClient = useStore((s) => s.setPortalClient);
|
|
443
444
|
useEffect(() => {
|
|
445
|
+
if (!enabled) return;
|
|
444
446
|
const client = createPortalClient({
|
|
445
447
|
appUrl,
|
|
446
448
|
sessionToken,
|
|
@@ -463,6 +465,7 @@ function usePortal({ appUrl, sessionToken, shareMachine }) {
|
|
|
463
465
|
appUrl,
|
|
464
466
|
sessionToken,
|
|
465
467
|
shareMachine,
|
|
468
|
+
enabled,
|
|
466
469
|
syncPortal,
|
|
467
470
|
setPortalClient
|
|
468
471
|
]);
|
|
@@ -1687,8 +1690,13 @@ function AgentPickerScreen() {
|
|
|
1687
1690
|
const [cache, setCache] = useState({});
|
|
1688
1691
|
const [state, setState] = useState({ kind: "loading" });
|
|
1689
1692
|
useKeyboard((key) => {
|
|
1690
|
-
if (key.name === "w" && key.ctrl)
|
|
1691
|
-
|
|
1693
|
+
if (key.name === "w" && key.ctrl) {
|
|
1694
|
+
if (useStore.getState().authKind === "api-key") {
|
|
1695
|
+
useStore.getState().showToast({ message: "API keys are pinned to one workspace. Run `skydive auth login --web` to switch workspaces." });
|
|
1696
|
+
return;
|
|
1697
|
+
}
|
|
1698
|
+
goTo({ kind: "workspace-picker" });
|
|
1699
|
+
} else if (key.name === "n" && key.ctrl) goTo({ kind: "agent-create" });
|
|
1692
1700
|
else if (key.name === "tab") setScope((s) => s === "mine" ? "org" : "mine");
|
|
1693
1701
|
});
|
|
1694
1702
|
useEffect(() => {
|
|
@@ -10476,7 +10484,10 @@ function ChatScreen({ agent, conversation }) {
|
|
|
10476
10484
|
leaveForScreen
|
|
10477
10485
|
]);
|
|
10478
10486
|
const toggleShare = useCallback(() => {
|
|
10479
|
-
if (!portalClient)
|
|
10487
|
+
if (!portalClient) {
|
|
10488
|
+
useStore.getState().showToast({ message: useStore.getState().authKind === "api-key" ? "local access needs a browser session — run `skydive auth login --web`" : "local access is unavailable in this session" });
|
|
10489
|
+
return;
|
|
10490
|
+
}
|
|
10480
10491
|
if (portal.status === "off") {
|
|
10481
10492
|
declinedRef.current.delete(agent.id);
|
|
10482
10493
|
portalClient.enable();
|
|
@@ -10517,7 +10528,7 @@ function ChatScreen({ agent, conversation }) {
|
|
|
10517
10528
|
}, [agent.id, setPortalPrompt]);
|
|
10518
10529
|
const openPortalAccess = useCallback(() => {
|
|
10519
10530
|
if (!portalClient) {
|
|
10520
|
-
useStore.getState().showToast({ message: "local access is unavailable in this session" });
|
|
10531
|
+
useStore.getState().showToast({ message: useStore.getState().authKind === "api-key" ? "local access needs a browser session — run `skydive auth login --web`" : "local access is unavailable in this session" });
|
|
10521
10532
|
return;
|
|
10522
10533
|
}
|
|
10523
10534
|
switch (portal.status) {
|
|
@@ -11541,7 +11552,7 @@ function ToastView() {
|
|
|
11541
11552
|
|
|
11542
11553
|
//#endregion
|
|
11543
11554
|
//#region src/chat/tui/app.tsx
|
|
11544
|
-
function App({ appUrl, sessionToken, shareMachine, promptHistoryPath, notifications, agentSelector, conversationId, newConversation }) {
|
|
11555
|
+
function App({ appUrl, sessionToken, authKind, shareMachine, promptHistoryPath, notifications, agentSelector, conversationId, newConversation }) {
|
|
11545
11556
|
const renderer = useRenderer();
|
|
11546
11557
|
const screen = useStore((s) => s.screen);
|
|
11547
11558
|
const chatTitle = useStore((s) => s.chatTitle);
|
|
@@ -11557,7 +11568,8 @@ function App({ appUrl, sessionToken, shareMachine, promptHistoryPath, notificati
|
|
|
11557
11568
|
usePortal({
|
|
11558
11569
|
appUrl,
|
|
11559
11570
|
sessionToken,
|
|
11560
|
-
shareMachine
|
|
11571
|
+
shareMachine,
|
|
11572
|
+
enabled: authKind === "session"
|
|
11561
11573
|
});
|
|
11562
11574
|
useEffect(() => {
|
|
11563
11575
|
agentHost.transition({ state: "idle" });
|
|
@@ -11585,6 +11597,7 @@ function App({ appUrl, sessionToken, shareMachine, promptHistoryPath, notificati
|
|
|
11585
11597
|
const fail = useStore((s) => s.fail);
|
|
11586
11598
|
const setWorkspaceName = useStore((s) => s.setWorkspaceName);
|
|
11587
11599
|
useEffect(() => {
|
|
11600
|
+
if (authKind !== "session") return;
|
|
11588
11601
|
let cancelled = false;
|
|
11589
11602
|
(async () => {
|
|
11590
11603
|
const [activeId, workspaces] = await Promise.all([getActiveWorkspaceId({
|
|
@@ -11603,6 +11616,7 @@ function App({ appUrl, sessionToken, shareMachine, promptHistoryPath, notificati
|
|
|
11603
11616
|
}, [
|
|
11604
11617
|
appUrl,
|
|
11605
11618
|
sessionToken,
|
|
11619
|
+
authKind,
|
|
11606
11620
|
setWorkspaceName
|
|
11607
11621
|
]);
|
|
11608
11622
|
useEffect(() => {
|
|
@@ -12126,13 +12140,14 @@ async function settleBootThemeMode({ source, applyThemeMode, graceMs = THEME_QUE
|
|
|
12126
12140
|
* module — and the heavy OpenTUI dependency graph it pulls in — is
|
|
12127
12141
|
* dynamically imported and never loaded on the Node management path.
|
|
12128
12142
|
*/
|
|
12129
|
-
async function runChat({ appUrl, sessionToken, shareMachine, promptHistoryPath, theme: themeOverride, notifications, agentSelector, conversationId, newConversation, seedPrompt }) {
|
|
12143
|
+
async function runChat({ appUrl, sessionToken, authKind = "session", shareMachine, promptHistoryPath, theme: themeOverride, notifications, agentSelector, conversationId, newConversation, seedPrompt }) {
|
|
12130
12144
|
await registerGrammars();
|
|
12131
12145
|
const watchdog = startMemoryWatchdog();
|
|
12132
12146
|
installCrashHandler({ memoryProvider: () => watchdog.snapshot() });
|
|
12133
12147
|
const renderer = await createCliRenderer({ exitOnCtrlC: false });
|
|
12134
12148
|
extend({ markdown: LinkifiedMarkdownRenderable });
|
|
12135
12149
|
useStore.setState({
|
|
12150
|
+
authKind,
|
|
12136
12151
|
seedPrompt: seedPrompt ?? null,
|
|
12137
12152
|
autoGrantMachine: Boolean(seedPrompt && shareMachine),
|
|
12138
12153
|
newConversationIntent: newConversation
|
|
@@ -12152,6 +12167,7 @@ async function runChat({ appUrl, sessionToken, shareMachine, promptHistoryPath,
|
|
|
12152
12167
|
createRoot(renderer).render(/* @__PURE__ */ jsx(App, {
|
|
12153
12168
|
appUrl,
|
|
12154
12169
|
sessionToken,
|
|
12170
|
+
authKind,
|
|
12155
12171
|
shareMachine,
|
|
12156
12172
|
promptHistoryPath,
|
|
12157
12173
|
notifications,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { S as getConfigPath } from "./print-
|
|
2
|
+
import { S as getConfigPath } from "./print-Bs_6CrTC.mjs";
|
|
3
3
|
import os from "node:os";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { err, ok } from "neverthrow";
|
|
@@ -8,7 +8,7 @@ import fs from "node:fs";
|
|
|
8
8
|
|
|
9
9
|
//#region package.json
|
|
10
10
|
var name = "skydive-cli";
|
|
11
|
-
var version$1 = "0.3.0-beta.
|
|
11
|
+
var version$1 = "0.3.0-beta.823";
|
|
12
12
|
|
|
13
13
|
//#endregion
|
|
14
14
|
//#region src/auth/organization.ts
|
|
@@ -153,6 +153,21 @@ function resolveSession(opts) {
|
|
|
153
153
|
appUrl
|
|
154
154
|
});
|
|
155
155
|
}
|
|
156
|
+
function resolveChatAuth(opts) {
|
|
157
|
+
const session = resolveSession({ appUrl: opts.appUrl });
|
|
158
|
+
if (session.isOk()) return ok({
|
|
159
|
+
token: session.value.sessionToken,
|
|
160
|
+
appUrl: session.value.appUrl,
|
|
161
|
+
kind: "session"
|
|
162
|
+
});
|
|
163
|
+
const apiKey = process.env["SKYDIVE_API_KEY"] ?? store.get("apiKey");
|
|
164
|
+
if (apiKey) return ok({
|
|
165
|
+
token: apiKey,
|
|
166
|
+
appUrl: process.env["SKYDIVE_APP_URL"] ?? opts.appUrl ?? store.get("apiUrl") ?? process.env["SKYDIVE_API_URL"] ?? DEFAULT_APP_URL,
|
|
167
|
+
kind: "api-key"
|
|
168
|
+
});
|
|
169
|
+
return err({ message: "Not signed in. Run `skydive auth login` first." });
|
|
170
|
+
}
|
|
156
171
|
function saveSession(session) {
|
|
157
172
|
store.set("sessionToken", session.sessionToken);
|
|
158
173
|
store.set("sessionObtainedAt", (/* @__PURE__ */ new Date()).toISOString());
|
|
@@ -727,4 +742,4 @@ async function readStdin() {
|
|
|
727
742
|
}
|
|
728
743
|
|
|
729
744
|
//#endregion
|
|
730
|
-
export { getStoredApiKeyWorkspaceName as A,
|
|
745
|
+
export { getStoredApiKeyWorkspaceName as A, saveTheme as B, getLastSeenVersion as C, getSavedTheme as D, getReviewStateDir as E, resolveManagementAuth as F, resolveSession as I, resolveWebUrl as L, resolveAppUrl as M, resolveChatAuth as N, getShareMachineDefault as O, resolveConfig as P, saveConfig as R, getConfigPath as S, getPromptHistoryPath as T, setLastSeenVersion as V, API_KEY_PREFIX as _, runPrint as a, PREFERENCES as b, cardActionErrorMessage as c, reconcileMaskedInput as d, resolveConnectUrl as f, API_KEY_FAMILY_PREFIX as g, API_KEYS_URL as h, resolveAgent as i, getUpdateCheckDisabled as j, getStoredApiKeyId as k, parseExternalOauthConnectParams as l, specKeyFor as m, messageGet as n, toPrintError as o, parseConnectCard as p, readStdin as r, MASK_CHAR as s, collectRunText as t, parseOauthConnectParams as u, DEFAULT_API_URL as v, getPreference as w, deleteConfig as x, DEFAULT_APP_URL as y, saveSession as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as runPrint, i as resolveAgent, n as messageGet, o as toPrintError, r as readStdin, t as collectRunText } from "./print-
|
|
2
|
+
import { a as runPrint, i as resolveAgent, n as messageGet, o as toPrintError, r as readStdin, t as collectRunText } from "./print-Bs_6CrTC.mjs";
|
|
3
3
|
import "./rest-BlN_uWmL.mjs";
|
|
4
4
|
|
|
5
5
|
export { messageGet, readStdin, resolveAgent, runPrint };
|