@vendian/cli 0.0.20 → 0.0.22
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/cli-wrapper.mjs +142 -12
- package/package.json +1 -1
package/cli-wrapper.mjs
CHANGED
|
@@ -35807,11 +35807,12 @@ function runCapture(command, args, options = {}) {
|
|
|
35807
35807
|
shell: false,
|
|
35808
35808
|
...options
|
|
35809
35809
|
});
|
|
35810
|
+
const errorMessage3 = result.error && typeof result.error.message === "string" ? result.error.message : "";
|
|
35810
35811
|
return {
|
|
35811
|
-
ok: result.status === 0,
|
|
35812
|
+
ok: !result.error && result.status === 0,
|
|
35812
35813
|
status: result.status ?? 1,
|
|
35813
35814
|
stdout: result.stdout || "",
|
|
35814
|
-
stderr: result.stderr ||
|
|
35815
|
+
stderr: result.stderr || errorMessage3
|
|
35815
35816
|
};
|
|
35816
35817
|
}
|
|
35817
35818
|
function runInherit(command, args, options = {}) {
|
|
@@ -35916,10 +35917,12 @@ function verifyVendianImports(pythonPath) {
|
|
|
35916
35917
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
35917
35918
|
var SERVICE = "Vendian CLI";
|
|
35918
35919
|
var PACKAGE_TOKEN_ACCOUNT = "gitlab-package-token";
|
|
35920
|
+
var SECRET_STORE_TIMEOUT_MS = 5e3;
|
|
35919
35921
|
function run(command, args, options = {}) {
|
|
35920
35922
|
return spawnSync2(command, args, {
|
|
35921
35923
|
encoding: "utf8",
|
|
35922
35924
|
shell: false,
|
|
35925
|
+
timeout: SECRET_STORE_TIMEOUT_MS,
|
|
35923
35926
|
...options
|
|
35924
35927
|
});
|
|
35925
35928
|
}
|
|
@@ -36675,7 +36678,12 @@ async function forwardToPythonVendian(args, { env: env3 = process.env, platform:
|
|
|
36675
36678
|
recordForwardedDocsCommand(args, code, { env: env3, platform: platform2 });
|
|
36676
36679
|
process.exitCode = code;
|
|
36677
36680
|
}
|
|
36678
|
-
async function preparePythonVendianInvocation(args, {
|
|
36681
|
+
async function preparePythonVendianInvocation(args, {
|
|
36682
|
+
env: env3 = process.env,
|
|
36683
|
+
platform: platform2 = process.platform,
|
|
36684
|
+
onProgress = null,
|
|
36685
|
+
skipAutoUpdate = false
|
|
36686
|
+
} = {}) {
|
|
36679
36687
|
const venvPath = managedVenvPath(env3, platform2);
|
|
36680
36688
|
const vendianPath = venvVendian(venvPath, platform2);
|
|
36681
36689
|
reportProgress(onProgress, "Checking managed Python runtime");
|
|
@@ -36688,7 +36696,9 @@ async function preparePythonVendianInvocation(args, { env: env3 = process.env, p
|
|
|
36688
36696
|
reportProgress(onProgress, "Refreshing package access");
|
|
36689
36697
|
}
|
|
36690
36698
|
const refreshed = requiresPackageAccess ? await refreshPackageAccessFromCloudAuth({ config: loadedConfig, env: env3, platform: platform2 }) : { config: loadedConfig };
|
|
36691
|
-
|
|
36699
|
+
if (!skipAutoUpdate) {
|
|
36700
|
+
maybeAutoUpdateManagedEnv({ env: env3, platform: platform2, venvPath, onProgress });
|
|
36701
|
+
}
|
|
36692
36702
|
const config = refreshed.config;
|
|
36693
36703
|
reportProgress(onProgress, "Preparing package indexes");
|
|
36694
36704
|
const registry = registryConfig(config, env3, platform2);
|
|
@@ -36794,7 +36804,7 @@ import fs12 from "node:fs";
|
|
|
36794
36804
|
import readlinePromises from "node:readline/promises";
|
|
36795
36805
|
|
|
36796
36806
|
// src/version.js
|
|
36797
|
-
var CLI_VERSION = true ? "0.0.
|
|
36807
|
+
var CLI_VERSION = true ? "0.0.22" : process.env.npm_package_version || "0.0.0-dev";
|
|
36798
36808
|
|
|
36799
36809
|
// src/npm-update.js
|
|
36800
36810
|
var NPM_CHECK_INTERVAL_MS = 30 * 60 * 1e3;
|
|
@@ -37002,6 +37012,34 @@ function findAgentDirectoryCandidates({
|
|
|
37002
37012
|
function defaultAgentsDir(candidates = []) {
|
|
37003
37013
|
return candidates[0]?.path || "./agents";
|
|
37004
37014
|
}
|
|
37015
|
+
function findAgentFolders(root, {
|
|
37016
|
+
cwd: cwd2 = process.cwd(),
|
|
37017
|
+
maxDepth = 6,
|
|
37018
|
+
maxDirs = 1e3,
|
|
37019
|
+
limit = 100
|
|
37020
|
+
} = {}) {
|
|
37021
|
+
const start = path6.resolve(cwd2);
|
|
37022
|
+
const resolvedRoot = safeResolve(root || ".");
|
|
37023
|
+
if (!resolvedRoot) {
|
|
37024
|
+
return [];
|
|
37025
|
+
}
|
|
37026
|
+
const seen = /* @__PURE__ */ new Set();
|
|
37027
|
+
const folders = [];
|
|
37028
|
+
for (const manifest of findManifestFiles(resolvedRoot, { maxDepth, maxDirs, limit })) {
|
|
37029
|
+
const folder = path6.dirname(manifest);
|
|
37030
|
+
const resolved = safeResolve(folder);
|
|
37031
|
+
if (!resolved || seen.has(resolved)) {
|
|
37032
|
+
continue;
|
|
37033
|
+
}
|
|
37034
|
+
seen.add(resolved);
|
|
37035
|
+
folders.push({
|
|
37036
|
+
path: displayPath(resolved, start),
|
|
37037
|
+
absolutePath: resolved,
|
|
37038
|
+
name: path6.basename(resolved) || displayPath(resolved, start)
|
|
37039
|
+
});
|
|
37040
|
+
}
|
|
37041
|
+
return folders.sort((a, b) => a.path.localeCompare(b.path)).slice(0, limit);
|
|
37042
|
+
}
|
|
37005
37043
|
function countAgentManifests(root, { maxDepth = 6, maxDirs = 1e3, limit = 100 } = {}) {
|
|
37006
37044
|
let count = 0;
|
|
37007
37045
|
for (const _manifest of findManifestFiles(root, { maxDepth, maxDirs, limit })) {
|
|
@@ -37959,10 +37997,21 @@ async function listCloudWorkspaces({
|
|
|
37959
37997
|
env: env3 = process.env,
|
|
37960
37998
|
platform: platform2 = process.platform,
|
|
37961
37999
|
prepareInvocation = preparePythonVendianInvocation,
|
|
37962
|
-
run: run2 = runCapture
|
|
38000
|
+
run: run2 = runCapture,
|
|
38001
|
+
onProgress = null,
|
|
38002
|
+
timeoutMs = 2e4
|
|
37963
38003
|
} = {}) {
|
|
37964
|
-
const
|
|
37965
|
-
|
|
38004
|
+
const progress = typeof onProgress === "function" ? onProgress : () => {
|
|
38005
|
+
};
|
|
38006
|
+
progress("Checking managed Python runtime");
|
|
38007
|
+
const invocation = await prepareInvocation(["cloud", "collections", "list", "--json"], {
|
|
38008
|
+
env: env3,
|
|
38009
|
+
platform: platform2,
|
|
38010
|
+
onProgress: progress,
|
|
38011
|
+
skipAutoUpdate: true
|
|
38012
|
+
});
|
|
38013
|
+
progress("Loading workspaces from Vendian");
|
|
38014
|
+
const result = run2(invocation.command, invocation.args, { env: invocation.env, timeout: timeoutMs });
|
|
37966
38015
|
if (!result.ok) {
|
|
37967
38016
|
return {
|
|
37968
38017
|
ok: false,
|
|
@@ -38567,6 +38616,7 @@ function ServeScreen({ env: env3, platform: platform2, input, onBack, onState, o
|
|
|
38567
38616
|
const [selectingDir, setSelectingDir] = useState5(() => agentDirCandidates.length > 0);
|
|
38568
38617
|
const [workspaceChoices, setWorkspaceChoices] = useState5([]);
|
|
38569
38618
|
const [pendingAgentsDir, setPendingAgentsDir] = useState5("");
|
|
38619
|
+
const [serveScopeChoice, setServeScopeChoice] = useState5(null);
|
|
38570
38620
|
const [loadingWorkspaces, setLoadingWorkspaces] = useState5(false);
|
|
38571
38621
|
const [started, setStarted] = useState5(false);
|
|
38572
38622
|
const [state, setState] = useState5(initialServeState());
|
|
@@ -38704,10 +38754,17 @@ function ServeScreen({ env: env3, platform: platform2, input, onBack, onState, o
|
|
|
38704
38754
|
const serveRoot = selectedAgentsDir || "./agents";
|
|
38705
38755
|
setAgentsDir(serveRoot);
|
|
38706
38756
|
setPendingAgentsDir(serveRoot);
|
|
38757
|
+
setServeScopeChoice(null);
|
|
38707
38758
|
setStartupError("");
|
|
38708
38759
|
setLoadingWorkspaces(true);
|
|
38709
38760
|
try {
|
|
38710
|
-
const result = await listCloudWorkspaces({
|
|
38761
|
+
const result = await listCloudWorkspaces({
|
|
38762
|
+
env: env3,
|
|
38763
|
+
platform: platform2,
|
|
38764
|
+
onProgress: (message) => {
|
|
38765
|
+
setState((current) => ({ ...current, activity: message || "Loading workspaces" }));
|
|
38766
|
+
}
|
|
38767
|
+
});
|
|
38711
38768
|
if (!result.ok) {
|
|
38712
38769
|
setStartupError(result.error || "Could not list workspaces.");
|
|
38713
38770
|
return;
|
|
@@ -38723,7 +38780,77 @@ function ServeScreen({ env: env3, platform: platform2, input, onBack, onState, o
|
|
|
38723
38780
|
setLoadingWorkspaces(false);
|
|
38724
38781
|
}
|
|
38725
38782
|
}
|
|
38783
|
+
function chooseServeScope(candidate) {
|
|
38784
|
+
if (!candidate || candidate.value === "__custom__" || candidate.value === "__back__") {
|
|
38785
|
+
return candidate?.value;
|
|
38786
|
+
}
|
|
38787
|
+
return chooseServePath(candidate.path, {
|
|
38788
|
+
absolutePath: candidate.absolutePath,
|
|
38789
|
+
agentCount: candidate.agentCount
|
|
38790
|
+
});
|
|
38791
|
+
}
|
|
38792
|
+
function chooseServePath(selectedPath, { absolutePath = selectedPath, agentCount = null } = {}) {
|
|
38793
|
+
const normalizedPath = selectedPath || "./agents";
|
|
38794
|
+
if (agentCount !== null && Number(agentCount || 0) <= 1) {
|
|
38795
|
+
chooseWorkspaceThenStart(normalizedPath);
|
|
38796
|
+
return "started";
|
|
38797
|
+
}
|
|
38798
|
+
const folders = findAgentFolders(absolutePath || normalizedPath);
|
|
38799
|
+
if (folders.length <= 1) {
|
|
38800
|
+
chooseWorkspaceThenStart(normalizedPath);
|
|
38801
|
+
return "started";
|
|
38802
|
+
}
|
|
38803
|
+
setServeScopeChoice({
|
|
38804
|
+
rootPath: normalizedPath,
|
|
38805
|
+
agentCount: agentCount ?? folders.length,
|
|
38806
|
+
folders
|
|
38807
|
+
});
|
|
38808
|
+
return "scope";
|
|
38809
|
+
}
|
|
38726
38810
|
if (!started) {
|
|
38811
|
+
if (serveScopeChoice) {
|
|
38812
|
+
const scopeItems = [
|
|
38813
|
+
{
|
|
38814
|
+
label: `All agents in ${serveScopeChoice.rootPath} (${serveScopeChoice.agentCount} agents)`,
|
|
38815
|
+
value: serveScopeChoice.rootPath
|
|
38816
|
+
},
|
|
38817
|
+
...serveScopeChoice.folders.map((folder) => ({
|
|
38818
|
+
label: `One: ${folder.path}`,
|
|
38819
|
+
value: folder.path
|
|
38820
|
+
})),
|
|
38821
|
+
{ label: "Back", value: "__back__" }
|
|
38822
|
+
];
|
|
38823
|
+
return h(
|
|
38824
|
+
Box2,
|
|
38825
|
+
{ flexDirection: "column" },
|
|
38826
|
+
h(Text2, { bold: true }, "Serve one or many agents:"),
|
|
38827
|
+
h(SelectInput2, {
|
|
38828
|
+
items: scopeItems,
|
|
38829
|
+
onSelect: (item) => {
|
|
38830
|
+
if (item.value === "__back__") {
|
|
38831
|
+
setServeScopeChoice(null);
|
|
38832
|
+
return;
|
|
38833
|
+
}
|
|
38834
|
+
setServeScopeChoice(null);
|
|
38835
|
+
chooseWorkspaceThenStart(item.value);
|
|
38836
|
+
}
|
|
38837
|
+
}),
|
|
38838
|
+
loadingWorkspaces && h(
|
|
38839
|
+
Box2,
|
|
38840
|
+
null,
|
|
38841
|
+
h(Text2, { color: colors.brand }, " "),
|
|
38842
|
+
h(Spinner2, { type: "dots" }),
|
|
38843
|
+
h(Text2, { color: colors.brand }, " Loading workspaces")
|
|
38844
|
+
),
|
|
38845
|
+
startupError && h(Text2, { color: colors.error }, ` ${fig.cross} ${startupError}`),
|
|
38846
|
+
h(Text2, null, ""),
|
|
38847
|
+
h(FooterBar, { items: [
|
|
38848
|
+
{ key: "\u2191\u2193", label: "Navigate" },
|
|
38849
|
+
{ key: "\u23CE", label: "Select" },
|
|
38850
|
+
{ key: "esc", label: "Back" }
|
|
38851
|
+
] })
|
|
38852
|
+
);
|
|
38853
|
+
}
|
|
38727
38854
|
if (workspaceChoices.length > 1) {
|
|
38728
38855
|
return h(
|
|
38729
38856
|
Box2,
|
|
@@ -38756,7 +38883,10 @@ function ServeScreen({ env: env3, platform: platform2, input, onBack, onState, o
|
|
|
38756
38883
|
const items = [
|
|
38757
38884
|
...agentDirCandidates.map((candidate) => ({
|
|
38758
38885
|
label: `${candidate.path} (${candidate.agentCount} ${candidate.agentCount === 1 ? "agent" : "agents"})`,
|
|
38759
|
-
value: candidate.path
|
|
38886
|
+
value: candidate.path,
|
|
38887
|
+
path: candidate.path,
|
|
38888
|
+
absolutePath: candidate.absolutePath,
|
|
38889
|
+
agentCount: candidate.agentCount
|
|
38760
38890
|
})),
|
|
38761
38891
|
{ label: "Custom path", value: "__custom__" },
|
|
38762
38892
|
{ label: "Back", value: "__back__" }
|
|
@@ -38778,14 +38908,14 @@ function ServeScreen({ env: env3, platform: platform2, input, onBack, onState, o
|
|
|
38778
38908
|
return;
|
|
38779
38909
|
}
|
|
38780
38910
|
setAgentsDir(item.value);
|
|
38781
|
-
|
|
38911
|
+
chooseServeScope(item);
|
|
38782
38912
|
}
|
|
38783
38913
|
}),
|
|
38784
38914
|
!selectingDir && h(TextInput2, {
|
|
38785
38915
|
value: agentsDir,
|
|
38786
38916
|
placeholder: "./agents",
|
|
38787
38917
|
onChange: setAgentsDir,
|
|
38788
|
-
onSubmit: (value) =>
|
|
38918
|
+
onSubmit: (value) => chooseServePath(value)
|
|
38789
38919
|
}),
|
|
38790
38920
|
loadingWorkspaces && h(
|
|
38791
38921
|
Box2,
|