skydive-cli 0.2.0-beta.708 → 0.2.0-beta.741
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 +147 -17
- package/dist/js/{boot-DVrdfWKC.mjs → boot-B971VDnw.mjs} +37 -10
- package/dist/js/{client-DqidlIb-.mjs → client-Dc7GZ3PG.mjs} +1 -1
- package/dist/js/client-DuwxEDG4.mjs +5 -0
- package/dist/js/{daemon-Dj1iBfMV.mjs → daemon-Ch_MSDmQ.mjs} +3 -3
- package/dist/js/{daemon-mXhmMGsS.mjs → daemon-Co4CtpXZ.mjs} +2 -2
- package/dist/js/{install-BOQuTR8i.mjs → install-CVVefO8_.mjs} +2 -2
- package/dist/js/{print-CXRJLvyp.mjs → print-CPCFci60.mjs} +2 -2
- package/dist/js/{print-CcvhSMi9.mjs → print-Cd-bVSEJ.mjs} +1 -1
- package/dist/js/{print-share-88a3VFKn.mjs → print-share-7qfpQtWK.mjs} +1 -1
- package/dist/js/{rest-B5v4v5ux.mjs → rest-BlN_uWmL.mjs} +11 -0
- package/dist/js/{rest-BFuvemde.mjs → rest-CDTXCmUb.mjs} +1 -1
- package/package.json +1 -1
- package/dist/js/client-Bi6tvlso.mjs +0 -5
package/dist/js/bin.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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 resolveAppUrl, C as getPromptHistoryPath, D as getStoredApiKeyId, E as getShareMachineDefault, F as saveConfig, I as saveSession, M as resolveManagementAuth, N as resolveSession, O as getStoredApiKeyWorkspaceName, R as setLastSeenVersion, S as getLastSeenVersion, _ as API_KEY_PREFIX, b as deleteConfig, g as API_KEY_FAMILY_PREFIX, h as API_KEYS_URL, i as resolveAgent, j as resolveConfig, k as getUpdateCheckDisabled, v as DEFAULT_API_URL, x as getConfigPath } from "./print-
|
|
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-CVVefO8_.mjs";
|
|
3
|
+
import { A as resolveAppUrl, C as getPromptHistoryPath, D as getStoredApiKeyId, E as getShareMachineDefault, F as saveConfig, I as saveSession, M as resolveManagementAuth, N as resolveSession, O as getStoredApiKeyWorkspaceName, R as setLastSeenVersion, S as getLastSeenVersion, _ as API_KEY_PREFIX, b as deleteConfig, g as API_KEY_FAMILY_PREFIX, h as API_KEYS_URL, i as resolveAgent, j as resolveConfig, k as getUpdateCheckDisabled, v as DEFAULT_API_URL, x as getConfigPath } from "./print-Cd-bVSEJ.mjs";
|
|
4
4
|
import { n as printError, r as printTable, t as output } from "./output-DYzzdXYV.mjs";
|
|
5
|
-
import { n as createRestClient } from "./rest-
|
|
6
|
-
import { a as registerPortalDevice, i as grantPortalAccess, n as fetchPortalDevices, o as revokePortalAccess, r as findThisDevice, s as machineIdentity } from "./client-
|
|
7
|
-
import { c as PORTAL_DAEMON_FLAG, i as queryDaemonStatus, l as daemonPaths, n as ensureDaemonRunning, o as stopDaemon } from "./daemon-
|
|
5
|
+
import { n as createRestClient, t as HttpError } from "./rest-BlN_uWmL.mjs";
|
|
6
|
+
import { a as registerPortalDevice, i as grantPortalAccess, n as fetchPortalDevices, o as revokePortalAccess, r as findThisDevice, s as machineIdentity } from "./client-Dc7GZ3PG.mjs";
|
|
7
|
+
import { c as PORTAL_DAEMON_FLAG, i as queryDaemonStatus, l as daemonPaths, n as ensureDaemonRunning, o as stopDaemon } from "./daemon-Co4CtpXZ.mjs";
|
|
8
8
|
import { t as SandboxStream } from "./client-DfcJFEbh.mjs";
|
|
9
9
|
import { hideBin } from "yargs/helpers";
|
|
10
10
|
import yargs from "yargs";
|
|
@@ -1500,7 +1500,7 @@ const importCommand = {
|
|
|
1500
1500
|
process.exit(1);
|
|
1501
1501
|
}
|
|
1502
1502
|
}
|
|
1503
|
-
const { runChat } = await import("./boot-
|
|
1503
|
+
const { runChat } = await import("./boot-B971VDnw.mjs");
|
|
1504
1504
|
await runChat({
|
|
1505
1505
|
appUrl,
|
|
1506
1506
|
sessionToken: session.value.sessionToken,
|
|
@@ -1527,7 +1527,7 @@ async function runImportPrintMode({ argv, appUrl }) {
|
|
|
1527
1527
|
printError(`${session.error.message} For non-interactive use, run \`skydive auth login --web\` first, or set SKYDIVE_SESSION_TOKEN.`);
|
|
1528
1528
|
process.exit(1);
|
|
1529
1529
|
}
|
|
1530
|
-
const { connectMachineShare } = await import("./print-share-
|
|
1530
|
+
const { connectMachineShare } = await import("./print-share-7qfpQtWK.mjs");
|
|
1531
1531
|
const machineShare = await connectMachineShare({
|
|
1532
1532
|
appUrl,
|
|
1533
1533
|
sessionToken: session.value.sessionToken,
|
|
@@ -1535,7 +1535,7 @@ async function runImportPrintMode({ argv, appUrl }) {
|
|
|
1535
1535
|
});
|
|
1536
1536
|
const extra = (argv.print ?? "").trim();
|
|
1537
1537
|
const prompt = buildImportSeedPrompt(process.cwd()) + (extra ? `\n\nAdditional instructions: ${extra}` : "");
|
|
1538
|
-
const { runPrint } = await import("./print-
|
|
1538
|
+
const { runPrint } = await import("./print-CPCFci60.mjs");
|
|
1539
1539
|
try {
|
|
1540
1540
|
const result = await runPrint({
|
|
1541
1541
|
appUrl,
|
|
@@ -1750,6 +1750,97 @@ const secretsCommand = {
|
|
|
1750
1750
|
handler: () => {}
|
|
1751
1751
|
};
|
|
1752
1752
|
|
|
1753
|
+
//#endregion
|
|
1754
|
+
//#region src/auth/agent-workspace.ts
|
|
1755
|
+
const uuidPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
1756
|
+
/**
|
|
1757
|
+
* Cap on concurrent per-workspace probes. An account can be in a lot of
|
|
1758
|
+
* workspaces; firing one request per workspace all at once is a burst the
|
|
1759
|
+
* API (and the user's uplink) doesn't need. Four keeps the common case
|
|
1760
|
+
* (a handful of workspaces) effectively parallel while bounding the worst.
|
|
1761
|
+
*/
|
|
1762
|
+
const PROBE_CONCURRENCY = 4;
|
|
1763
|
+
/**
|
|
1764
|
+
* `Promise.all` with at most `limit` tasks in flight — a dependency-free
|
|
1765
|
+
* stand-in for p-queue sized to this one call site. Results keep input
|
|
1766
|
+
* order.
|
|
1767
|
+
*/
|
|
1768
|
+
async function mapWithConcurrency(items, limit, fn) {
|
|
1769
|
+
const results = [];
|
|
1770
|
+
const queue = items.entries();
|
|
1771
|
+
const workers = Array.from({ length: Math.min(limit, items.length) }, async () => {
|
|
1772
|
+
for (const [index, item] of queue) results[index] = await fn(item);
|
|
1773
|
+
});
|
|
1774
|
+
await Promise.all(workers);
|
|
1775
|
+
return results;
|
|
1776
|
+
}
|
|
1777
|
+
/**
|
|
1778
|
+
* Whether the agent is visible in one workspace, via the typed rest client
|
|
1779
|
+
* scoped with `x-workspace-id` (a per-request override — the session's
|
|
1780
|
+
* persisted active workspace is untouched, so probing is side-effect free).
|
|
1781
|
+
* A miss (404 unknown/hidden, 403 other org) or a network failure is simply
|
|
1782
|
+
* "not here" — if the API is truly unreachable the main request path fails
|
|
1783
|
+
* right after with its own (better) error.
|
|
1784
|
+
*/
|
|
1785
|
+
async function probeAgent({ appUrl, sessionToken, agentId, workspaceId }) {
|
|
1786
|
+
const client = createRestClient({
|
|
1787
|
+
appUrl,
|
|
1788
|
+
sessionToken,
|
|
1789
|
+
...workspaceId ? { workspaceId } : {}
|
|
1790
|
+
});
|
|
1791
|
+
try {
|
|
1792
|
+
return { name: (await client.getAgent({ agentId })).name };
|
|
1793
|
+
} catch (error) {
|
|
1794
|
+
if (error instanceof HttpError) return null;
|
|
1795
|
+
return null;
|
|
1796
|
+
}
|
|
1797
|
+
}
|
|
1798
|
+
async function resolveAgentWorkspace({ appUrl, sessionToken, agentSelector }) {
|
|
1799
|
+
if (!agentSelector || !uuidPattern.test(agentSelector)) return { kind: "active" };
|
|
1800
|
+
if (await probeAgent({
|
|
1801
|
+
appUrl,
|
|
1802
|
+
sessionToken,
|
|
1803
|
+
agentId: agentSelector,
|
|
1804
|
+
workspaceId: null
|
|
1805
|
+
})) return { kind: "active" };
|
|
1806
|
+
const [workspaces, activeId] = await Promise.all([listWorkspaces({
|
|
1807
|
+
appUrl,
|
|
1808
|
+
sessionToken
|
|
1809
|
+
}), getActiveWorkspaceId({
|
|
1810
|
+
appUrl,
|
|
1811
|
+
sessionToken
|
|
1812
|
+
})]);
|
|
1813
|
+
if (workspaces.isErr()) return {
|
|
1814
|
+
kind: "list-failed",
|
|
1815
|
+
message: workspaces.error.message
|
|
1816
|
+
};
|
|
1817
|
+
const found = (await mapWithConcurrency(workspaces.value.filter((w) => activeId.isErr() || w.id !== activeId.value), PROBE_CONCURRENCY, async (workspace) => ({
|
|
1818
|
+
workspace,
|
|
1819
|
+
hit: await probeAgent({
|
|
1820
|
+
appUrl,
|
|
1821
|
+
sessionToken,
|
|
1822
|
+
agentId: agentSelector,
|
|
1823
|
+
workspaceId: workspace.id
|
|
1824
|
+
})
|
|
1825
|
+
}))).find((p) => p.hit !== null);
|
|
1826
|
+
if (!found?.hit) return { kind: "not-found" };
|
|
1827
|
+
const switched = await setActiveWorkspace({
|
|
1828
|
+
appUrl,
|
|
1829
|
+
sessionToken,
|
|
1830
|
+
organizationId: found.workspace.id
|
|
1831
|
+
});
|
|
1832
|
+
if (switched.isErr()) return {
|
|
1833
|
+
kind: "switch-failed",
|
|
1834
|
+
workspace: found.workspace,
|
|
1835
|
+
message: switched.error.message
|
|
1836
|
+
};
|
|
1837
|
+
return {
|
|
1838
|
+
kind: "switched",
|
|
1839
|
+
workspace: found.workspace,
|
|
1840
|
+
agentName: found.hit.name
|
|
1841
|
+
};
|
|
1842
|
+
}
|
|
1843
|
+
|
|
1753
1844
|
//#endregion
|
|
1754
1845
|
//#region src/commands/chat.ts
|
|
1755
1846
|
const chatCommand = {
|
|
@@ -1816,7 +1907,12 @@ const chatCommand = {
|
|
|
1816
1907
|
printError(`Unknown theme "${themeId}". Valid themes: ${themes.map((t) => t.id).join(", ")}`);
|
|
1817
1908
|
process.exit(1);
|
|
1818
1909
|
}
|
|
1819
|
-
|
|
1910
|
+
await ensureAgentWorkspace({
|
|
1911
|
+
appUrl,
|
|
1912
|
+
sessionToken: session.value.sessionToken,
|
|
1913
|
+
agentSelector: argv.agent ?? null
|
|
1914
|
+
});
|
|
1915
|
+
const { runChat } = await import("./boot-B971VDnw.mjs");
|
|
1820
1916
|
await runChat({
|
|
1821
1917
|
appUrl,
|
|
1822
1918
|
sessionToken: session.value.sessionToken,
|
|
@@ -1847,13 +1943,47 @@ function resolveShareMachine(argv) {
|
|
|
1847
1943
|
function resolveNewConversation(argv) {
|
|
1848
1944
|
return argv.new === true && !argv.conversation;
|
|
1849
1945
|
}
|
|
1946
|
+
/**
|
|
1947
|
+
* Cross-workspace `--agent <uuid>` handling shared by the TUI and -p paths:
|
|
1948
|
+
* on a hit in another workspace, switch to it and say so on stderr (stdout
|
|
1949
|
+
* may carry the -p reply/JSON envelope); when the id matches no workspace on
|
|
1950
|
+
* the account, fail with the two realistic fixes instead of the misleading
|
|
1951
|
+
* "no agent matches" roster error.
|
|
1952
|
+
*/
|
|
1953
|
+
async function ensureAgentWorkspace({ appUrl, sessionToken, agentSelector }) {
|
|
1954
|
+
const resolution = await resolveAgentWorkspace({
|
|
1955
|
+
appUrl,
|
|
1956
|
+
sessionToken,
|
|
1957
|
+
agentSelector
|
|
1958
|
+
});
|
|
1959
|
+
if (resolution.kind === "active") return;
|
|
1960
|
+
if (resolution.kind === "switched") {
|
|
1961
|
+
console.error(`Switched workspace to ${resolution.workspace.name} (${resolution.workspace.slug}) — ${resolution.agentName} lives there.`);
|
|
1962
|
+
return;
|
|
1963
|
+
}
|
|
1964
|
+
if (resolution.kind === "list-failed") {
|
|
1965
|
+
printError(`No agent with id ${agentSelector} in the current workspace, and listing your other workspaces failed (${resolution.message}), so it couldn't be searched for elsewhere. Retry, or run \`skydive workspace switch <slug>\` if you know where it lives.`);
|
|
1966
|
+
process.exit(1);
|
|
1967
|
+
}
|
|
1968
|
+
if (resolution.kind === "switch-failed") {
|
|
1969
|
+
printError(`Agent found in workspace ${resolution.workspace.name}, but switching to it failed: ${resolution.message}. Run \`skydive workspace switch ${resolution.workspace.slug}\` and retry.`);
|
|
1970
|
+
process.exit(1);
|
|
1971
|
+
}
|
|
1972
|
+
printError(`No agent with id ${agentSelector} in any workspace on this account. It may belong to a different account — run \`skydive auth login\` with the right one — or the agent may have been archived.`);
|
|
1973
|
+
process.exit(1);
|
|
1974
|
+
}
|
|
1850
1975
|
async function runPrintMode({ argv, appUrl }) {
|
|
1851
1976
|
const session = resolveSession({ appUrl });
|
|
1852
1977
|
if (session.isErr()) {
|
|
1853
1978
|
printError(`${session.error.message} For non-interactive use, run \`skydive auth login\` first, or set SKYDIVE_SESSION_TOKEN.`);
|
|
1854
1979
|
process.exit(1);
|
|
1855
1980
|
}
|
|
1856
|
-
const { runPrint, readStdin } = await import("./print-
|
|
1981
|
+
const { runPrint, readStdin } = await import("./print-CPCFci60.mjs");
|
|
1982
|
+
await ensureAgentWorkspace({
|
|
1983
|
+
appUrl,
|
|
1984
|
+
sessionToken: session.value.sessionToken,
|
|
1985
|
+
agentSelector: argv.agent ?? null
|
|
1986
|
+
});
|
|
1857
1987
|
let prompt = (argv.print ?? "").trim();
|
|
1858
1988
|
if (!prompt) {
|
|
1859
1989
|
if (process.stdin.isTTY) {
|
|
@@ -1868,7 +1998,7 @@ async function runPrintMode({ argv, appUrl }) {
|
|
|
1868
1998
|
}
|
|
1869
1999
|
let machineShare = null;
|
|
1870
2000
|
if (resolveShareMachine(argv)) {
|
|
1871
|
-
const { connectMachineShare } = await import("./print-share-
|
|
2001
|
+
const { connectMachineShare } = await import("./print-share-7qfpQtWK.mjs");
|
|
1872
2002
|
machineShare = await connectMachineShare({
|
|
1873
2003
|
appUrl,
|
|
1874
2004
|
sessionToken: session.value.sessionToken,
|
|
@@ -1927,7 +2057,7 @@ const getCommand = {
|
|
|
1927
2057
|
printError(`${session.error.message} Run \`skydive auth login\` first, or set SKYDIVE_SESSION_TOKEN.`);
|
|
1928
2058
|
process.exit(1);
|
|
1929
2059
|
}
|
|
1930
|
-
const { messageGet } = await import("./print-
|
|
2060
|
+
const { messageGet } = await import("./print-CPCFci60.mjs");
|
|
1931
2061
|
try {
|
|
1932
2062
|
const result = await messageGet({
|
|
1933
2063
|
appUrl,
|
|
@@ -2124,7 +2254,7 @@ const switchCommand = {
|
|
|
2124
2254
|
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.");
|
|
2125
2255
|
process.exit(1);
|
|
2126
2256
|
}
|
|
2127
|
-
const { runWorkspacePicker } = await import("./boot-
|
|
2257
|
+
const { runWorkspacePicker } = await import("./boot-B971VDnw.mjs");
|
|
2128
2258
|
await runWorkspacePicker(session);
|
|
2129
2259
|
return;
|
|
2130
2260
|
}
|
|
@@ -2202,7 +2332,7 @@ const openCommand = {
|
|
|
2202
2332
|
const agent = argv.agent ? resolveAgent((await fetchPortalDevices(session)).agents, argv.agent) : null;
|
|
2203
2333
|
const cwd = argv.cwd ? path.resolve(argv.cwd) : process.cwd();
|
|
2204
2334
|
const { machineName } = machineIdentity();
|
|
2205
|
-
const { PortalClient } = await import("./client-
|
|
2335
|
+
const { PortalClient } = await import("./client-DuwxEDG4.mjs");
|
|
2206
2336
|
let lastLine = "";
|
|
2207
2337
|
let signalConnected;
|
|
2208
2338
|
const connected = new Promise((resolve) => {
|
|
@@ -2475,8 +2605,8 @@ const sandboxCommand = {
|
|
|
2475
2605
|
}).example("skydive sandbox --agent grace", "Live terminal (Ctrl-] detaches)").example("skydive sandbox --agent grace -- tail -n 50 /tmp/harness.log", "One-shot command (use `--` so its flags reach the sandbox)").example("skydive sandbox --agent grace -- sh -c 'ls /tmp | wc -l'", "Shell features go through an explicit `sh -c`"),
|
|
2476
2606
|
handler: async (argv) => {
|
|
2477
2607
|
const session = requireSession(argv);
|
|
2478
|
-
const { createRestClient } = await import("./rest-
|
|
2479
|
-
const { resolveAgent } = await import("./print-
|
|
2608
|
+
const { createRestClient } = await import("./rest-CDTXCmUb.mjs");
|
|
2609
|
+
const { resolveAgent } = await import("./print-CPCFci60.mjs");
|
|
2480
2610
|
const client = createRestClient({
|
|
2481
2611
|
appUrl: session.appUrl,
|
|
2482
2612
|
sessionToken: session.sessionToken
|
|
@@ -3553,7 +3683,7 @@ if (process.argv.includes(UPDATE_WORKER_FLAG)) {
|
|
|
3553
3683
|
process.exit(0);
|
|
3554
3684
|
}
|
|
3555
3685
|
if (process.argv.includes(PORTAL_DAEMON_FLAG)) {
|
|
3556
|
-
const { runPortalDaemon } = await import("./daemon-
|
|
3686
|
+
const { runPortalDaemon } = await import("./daemon-Ch_MSDmQ.mjs");
|
|
3557
3687
|
runPortalDaemon(process.argv);
|
|
3558
3688
|
} else runCli();
|
|
3559
3689
|
function runCli() {
|
|
@@ -1,9 +1,9 @@
|
|
|
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 { L as saveTheme, P as resolveWebUrl, T as getSavedTheme, 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, w as getReviewStateDir, x as getConfigPath, y as DEFAULT_APP_URL } from "./print-
|
|
4
|
-
import { a as errorMessage, i as sendErrorMessage, n as createRestClient, o as isRecord, r as errorDetail, t as HttpError } from "./rest-
|
|
5
|
-
import { t as PortalClient } from "./client-
|
|
6
|
-
import { d as makeLineParser, f as parseDaemonMessage, l as daemonPaths, n as ensureDaemonRunning, s as LOCAL_PROTOCOL_VERSION, u as encodeLine } from "./daemon-
|
|
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-CVVefO8_.mjs";
|
|
3
|
+
import { L as saveTheme, P as resolveWebUrl, T as getSavedTheme, 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, w as getReviewStateDir, x as getConfigPath, y as DEFAULT_APP_URL } from "./print-Cd-bVSEJ.mjs";
|
|
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
|
+
import { t as PortalClient } from "./client-Dc7GZ3PG.mjs";
|
|
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";
|
|
7
7
|
import { t as SandboxStream } from "./client-DfcJFEbh.mjs";
|
|
8
8
|
import { t as runRawPtyPassthrough } from "./raw-pty-BcjbTjHJ.mjs";
|
|
9
9
|
import * as os$1 from "node:os";
|
|
@@ -6038,6 +6038,13 @@ const slashCommands = [
|
|
|
6038
6038
|
description: "start a new conversation with this agent",
|
|
6039
6039
|
action: { kind: "new-conversation" }
|
|
6040
6040
|
},
|
|
6041
|
+
{
|
|
6042
|
+
name: "fork",
|
|
6043
|
+
aliases: [],
|
|
6044
|
+
argsHint: null,
|
|
6045
|
+
description: "fork this conversation into a new one (full copy)",
|
|
6046
|
+
action: { kind: "fork" }
|
|
6047
|
+
},
|
|
6041
6048
|
{
|
|
6042
6049
|
name: "archive",
|
|
6043
6050
|
aliases: [],
|
|
@@ -9186,6 +9193,7 @@ function routeInput(raw) {
|
|
|
9186
9193
|
};
|
|
9187
9194
|
}
|
|
9188
9195
|
case "new-conversation":
|
|
9196
|
+
case "fork":
|
|
9189
9197
|
case "archive-conversation":
|
|
9190
9198
|
case "model-picker":
|
|
9191
9199
|
case "theme-picker":
|
|
@@ -10300,10 +10308,9 @@ function ChatScreen({ agent, conversation }) {
|
|
|
10300
10308
|
if (!rest || !conversationId || forkingRef.current) return;
|
|
10301
10309
|
forkingRef.current = true;
|
|
10302
10310
|
setForking(true);
|
|
10303
|
-
|
|
10304
|
-
|
|
10305
|
-
|
|
10306
|
-
};
|
|
10311
|
+
useStore.getState().showToast({ message: "forking into a new chat…" });
|
|
10312
|
+
const screenAtFork = useStore.getState().screen;
|
|
10313
|
+
const stillHere = () => useStore.getState().screen === screenAtFork;
|
|
10307
10314
|
rest.forkConversation({ conversationId }).then((forked) => {
|
|
10308
10315
|
if (!stillHere()) return;
|
|
10309
10316
|
goTo({
|
|
@@ -10314,6 +10321,10 @@ function ChatScreen({ agent, conversation }) {
|
|
|
10314
10321
|
forked
|
|
10315
10322
|
})
|
|
10316
10323
|
});
|
|
10324
|
+
useStore.getState().showToast({
|
|
10325
|
+
variant: "success",
|
|
10326
|
+
message: "Forked conversation"
|
|
10327
|
+
});
|
|
10317
10328
|
}).catch((err) => {
|
|
10318
10329
|
forkingRef.current = false;
|
|
10319
10330
|
setForking(false);
|
|
@@ -10506,6 +10517,10 @@ function ChatScreen({ agent, conversation }) {
|
|
|
10506
10517
|
]);
|
|
10507
10518
|
const executeLine = useCallback((content, staged) => {
|
|
10508
10519
|
if (!content && staged.length === 0) return;
|
|
10520
|
+
if (forkingRef.current) {
|
|
10521
|
+
useStore.getState().showToast({ message: "forking… hang on" });
|
|
10522
|
+
return;
|
|
10523
|
+
}
|
|
10509
10524
|
const routed = routeInput(content);
|
|
10510
10525
|
if (routed.kind !== "message") {
|
|
10511
10526
|
history.append(content);
|
|
@@ -10540,6 +10555,17 @@ function ChatScreen({ agent, conversation }) {
|
|
|
10540
10555
|
}
|
|
10541
10556
|
});
|
|
10542
10557
|
break;
|
|
10558
|
+
case "fork":
|
|
10559
|
+
if (runRef.current.kind !== "idle") {
|
|
10560
|
+
useStore.getState().showToast({ message: "finish or cancel the run first (ctrl+c)" });
|
|
10561
|
+
break;
|
|
10562
|
+
}
|
|
10563
|
+
if (!conversationId) {
|
|
10564
|
+
useStore.getState().showToast({ message: "nothing to fork yet — send a message first" });
|
|
10565
|
+
break;
|
|
10566
|
+
}
|
|
10567
|
+
forkAndContinue();
|
|
10568
|
+
break;
|
|
10543
10569
|
case "conversation-picker":
|
|
10544
10570
|
leaveForScreen({
|
|
10545
10571
|
kind: "conversation-picker",
|
|
@@ -10627,6 +10653,7 @@ function ChatScreen({ agent, conversation }) {
|
|
|
10627
10653
|
runSandboxExec,
|
|
10628
10654
|
runSandboxPty,
|
|
10629
10655
|
archiveConversation,
|
|
10656
|
+
forkAndContinue,
|
|
10630
10657
|
leaveForScreen,
|
|
10631
10658
|
openConversationRef,
|
|
10632
10659
|
toggleShare,
|
|
@@ -11208,7 +11235,7 @@ function ChatScreen({ agent, conversation }) {
|
|
|
11208
11235
|
},
|
|
11209
11236
|
children: /* @__PURE__ */ jsx("textarea", {
|
|
11210
11237
|
ref: composerRef,
|
|
11211
|
-
placeholder: `message ${agent.name}…`,
|
|
11238
|
+
placeholder: forking ? "forking into a new chat…" : `message ${agent.name}…`,
|
|
11212
11239
|
keyBindings: composerKeyBindings,
|
|
11213
11240
|
onContentChange: handleComposerChange,
|
|
11214
11241
|
onSubmit: submit,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as errorMessage, t as HttpError } from "./rest-
|
|
2
|
+
import { a as errorMessage, t as HttpError } from "./rest-BlN_uWmL.mjs";
|
|
3
3
|
import os from "node:os";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { spawn } from "node:child_process";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import "./rest-
|
|
3
|
-
import "./client-
|
|
4
|
-
import { a as runPortalDaemon, i as queryDaemonStatus, n as ensureDaemonRunning, o as stopDaemon, r as isDaemonListening, t as PortalDaemon } from "./daemon-
|
|
2
|
+
import "./rest-BlN_uWmL.mjs";
|
|
3
|
+
import "./client-Dc7GZ3PG.mjs";
|
|
4
|
+
import { a as runPortalDaemon, i as queryDaemonStatus, n as ensureDaemonRunning, o as stopDaemon, r as isDaemonListening, t as PortalDaemon } from "./daemon-Co4CtpXZ.mjs";
|
|
5
5
|
|
|
6
6
|
export { runPortalDaemon };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { o as isRecord } from "./rest-
|
|
3
|
-
import { t as PortalClient } from "./client-
|
|
2
|
+
import { o as isRecord } from "./rest-BlN_uWmL.mjs";
|
|
3
|
+
import { t as PortalClient } from "./client-Dc7GZ3PG.mjs";
|
|
4
4
|
import os from "node:os";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { z } from "zod";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { x as getConfigPath } from "./print-
|
|
2
|
+
import { x as getConfigPath } from "./print-Cd-bVSEJ.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.2.0-beta.
|
|
11
|
+
var version$1 = "0.2.0-beta.741";
|
|
12
12
|
|
|
13
13
|
//#endregion
|
|
14
14
|
//#region src/auth/organization.ts
|
|
@@ -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-
|
|
3
|
-
import "./rest-
|
|
2
|
+
import { a as runPrint, i as resolveAgent, n as messageGet, o as toPrintError, r as readStdin, t as collectRunText } from "./print-Cd-bVSEJ.mjs";
|
|
3
|
+
import "./rest-BlN_uWmL.mjs";
|
|
4
4
|
|
|
5
5
|
export { messageGet, readStdin, resolveAgent, runPrint };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as errorMessage, i as sendErrorMessage, n as createRestClient, o as isRecord, t as HttpError } from "./rest-
|
|
2
|
+
import { a as errorMessage, i as sendErrorMessage, n as createRestClient, o as isRecord, t as HttpError } from "./rest-BlN_uWmL.mjs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import Conf from "conf";
|
|
5
5
|
import { err, ok } from "neverthrow";
|
|
@@ -14,7 +14,7 @@ import { n as printError } from "./output-DYzzdXYV.mjs";
|
|
|
14
14
|
* the reply (and to --json).
|
|
15
15
|
*/
|
|
16
16
|
async function connectMachineShare({ appUrl, sessionToken, timeoutHint }) {
|
|
17
|
-
const { PortalClient } = await import("./client-
|
|
17
|
+
const { PortalClient } = await import("./client-DuwxEDG4.mjs");
|
|
18
18
|
let signalConnected;
|
|
19
19
|
const connected = new Promise((resolve) => {
|
|
20
20
|
signalConnected = resolve;
|
|
@@ -216,6 +216,13 @@ function createRestClient({ appUrl, sessionToken, workspaceId }) {
|
|
|
216
216
|
const { agent } = await post("/api/v1/agents", { name }, createAgentResponseSchema);
|
|
217
217
|
return agent;
|
|
218
218
|
},
|
|
219
|
+
getAgent: async ({ agentId }) => {
|
|
220
|
+
const { agent } = await get(`/api/v1/agents/${encodeURIComponent(agentId)}`, getAgentResponseSchema);
|
|
221
|
+
return {
|
|
222
|
+
id: agent.id,
|
|
223
|
+
name: agent.name
|
|
224
|
+
};
|
|
225
|
+
},
|
|
219
226
|
suggestAgentIdentity: async () => {
|
|
220
227
|
const { suggestion } = await get("/api/v1/agents/suggest", suggestAgentResponseSchema);
|
|
221
228
|
return suggestion;
|
|
@@ -439,6 +446,10 @@ const listAgentsResponseSchema = z.object({
|
|
|
439
446
|
totalCount: z.number().nullable().optional()
|
|
440
447
|
});
|
|
441
448
|
const createAgentResponseSchema = z.object({ agent: agentSummarySchema });
|
|
449
|
+
const getAgentResponseSchema = z.object({ agent: z.object({
|
|
450
|
+
id: z.string(),
|
|
451
|
+
name: z.string()
|
|
452
|
+
}).passthrough() });
|
|
442
453
|
const agentSuggestionSchema = z.object({ name: z.string() });
|
|
443
454
|
const suggestAgentResponseSchema = z.object({ suggestion: agentSuggestionSchema.nullable() });
|
|
444
455
|
const conversationAgentSchema = z.object({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { i as sendErrorMessage, n as createRestClient, r as errorDetail, t as HttpError } from "./rest-
|
|
2
|
+
import { i as sendErrorMessage, n as createRestClient, r as errorDetail, t as HttpError } from "./rest-BlN_uWmL.mjs";
|
|
3
3
|
|
|
4
4
|
export { createRestClient };
|
package/package.json
CHANGED