nolo-cli 0.100.0 → 0.101.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.
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-K6U4NKFJ.js";
5
5
  import {
6
6
  runAgentCreateCommand
7
- } from "./chunk-F3NUFVSP.js";
7
+ } from "./chunk-NRUSXKH7.js";
8
8
  import {
9
9
  positionalArgs,
10
10
  readFlagValue
@@ -2,7 +2,9 @@ import {
2
2
  toErrorMessage
3
3
  } from "./chunk-HNMXYYJR.js";
4
4
  import {
5
- readOption
5
+ readOption,
6
+ resolveAuthToken,
7
+ resolveServerUrl
6
8
  } from "./chunk-A7GB5UGH.js";
7
9
  import "./chunk-OLZBQWZU.js";
8
10
  import "./chunk-LCBAMY2M.js";
@@ -24,10 +26,102 @@ function resolveProviderKey(args, env) {
24
26
  function joinBase(baseUrl, path) {
25
27
  return `${baseUrl.replace(/\/+$/, "")}${path}`;
26
28
  }
29
+ var AGENT_MODELS_USAGE = "Usage: nolo agent models --preset <presetId> [--api-key <key>] [--filter <str>] [--json]\n nolo agent models --url <base> --api-key <key> [--filter <str>] [--json]\n --preset discover models via the server (POST /api/agents/providers/discover-models);\n exit 0 = live, 1 = static fallback / error. OAuth presets (devin-oauth) take no --api-key.\n --url list models straight from an OpenAI-compatible provider's /models\n";
30
+ async function runPresetModelsCommand(presetId, args, deps) {
31
+ const env = asEnvVars(deps.env ?? process.env);
32
+ const output = deps.output ?? process.stdout;
33
+ const fetchImpl = deps.fetchImpl ?? fetch;
34
+ const filter = (readOption(args, "--filter") ?? "").trim().toLowerCase();
35
+ const wantJson = args.includes("--json");
36
+ if (!presetId || presetId.startsWith("--")) {
37
+ output.write(`[nolo] agent models --preset requires a preset id.
38
+ ${AGENT_MODELS_USAGE}`);
39
+ return 1;
40
+ }
41
+ const authToken = resolveAuthToken(args, env);
42
+ if (!authToken) {
43
+ output.write(
44
+ "[nolo] agent models --preset requires login. Run `nolo login` or set AUTH_TOKEN.\n"
45
+ );
46
+ return 1;
47
+ }
48
+ const explicitKey = readOption(args, "--api-key") ?? readOption(args, "--provider-api-key");
49
+ const apiKey = explicitKey?.trim() ? explicitKey.trim() : void 0;
50
+ try {
51
+ const url = joinBase(
52
+ resolveServerUrl(args, env),
53
+ "/api/agents/providers/discover-models"
54
+ );
55
+ const res = await fetchImpl(url, {
56
+ method: "POST",
57
+ headers: {
58
+ "Content-Type": "application/json",
59
+ Authorization: `Bearer ${authToken}`
60
+ },
61
+ body: JSON.stringify(apiKey ? { presetId, apiKey } : { presetId })
62
+ });
63
+ const body = await res.json().catch(() => null);
64
+ if (!res.ok || !body || body.ok === false) {
65
+ if (wantJson) {
66
+ output.write(
67
+ JSON.stringify(body ?? { ok: false, status: res.status }, null, 2) + "\n"
68
+ );
69
+ } else {
70
+ const code = body?.code ? ` ${body.code}` : "";
71
+ const detail = body?.error ? `: ${body.error}` : "";
72
+ output.write(
73
+ `[nolo] agent models --preset ${presetId} failed (HTTP ${res.status}${code})${detail}
74
+ `
75
+ );
76
+ }
77
+ return 1;
78
+ }
79
+ const isLive = body.source === "live";
80
+ if (wantJson) {
81
+ output.write(JSON.stringify(body, null, 2) + "\n");
82
+ return isLive ? 0 : 1;
83
+ }
84
+ const models = Array.isArray(body.models) ? body.models : [];
85
+ const shown = filter ? models.filter(
86
+ (m) => (m.id ?? "").toLowerCase().includes(filter) || (m.label ?? "").toLowerCase().includes(filter)
87
+ ) : models;
88
+ output.write(
89
+ isLive ? `source: live${typeof body.observedAt === "number" ? ` (observedAt ${body.observedAt})` : ""}
90
+ ` : `source: ${body.source ?? "unknown"}
91
+ `
92
+ );
93
+ if (!isLive) {
94
+ output.write(`static fallback: ${body.fallbackReason ?? "unknown"}
95
+ `);
96
+ }
97
+ if (body.truncated) output.write("(list truncated by server)\n");
98
+ if (!shown.length) {
99
+ output.write(
100
+ `[nolo] agent models: no models found${filter ? ` matching "${filter}"` : ""} for preset ${presetId}
101
+ `
102
+ );
103
+ return 1;
104
+ }
105
+ for (const m of shown) {
106
+ const label = m.label && m.label !== m.id ? ` ${m.label}` : "";
107
+ const tags = [m.recommended ? "recommended" : "", m.hasVision ? "vision" : ""].filter(Boolean).join(",");
108
+ output.write(`${m.id ?? ""}${label}${tags ? ` [${tags}]` : ""}
109
+ `);
110
+ }
111
+ return isLive ? 0 : 1;
112
+ } catch (error) {
113
+ output.write(`[nolo] agent models failed: ${toErrorMessage(error)}
114
+ `);
115
+ return 1;
116
+ }
117
+ }
27
118
  async function runAgentModelsCommand(args, deps = {}) {
28
119
  const env = asEnvVars(deps.env ?? process.env);
29
120
  const output = deps.output ?? process.stdout;
30
121
  const fetchImpl = deps.fetchImpl ?? fetch;
122
+ if (args.includes("--preset")) {
123
+ return runPresetModelsCommand(readOption(args, "--preset") ?? "", args, deps);
124
+ }
31
125
  const base = resolveProviderUrl(args, env);
32
126
  const key = resolveProviderKey(args, env);
33
127
  const filter = (readOption(args, "--filter") ?? "").trim().toLowerCase();
@@ -203,6 +297,7 @@ async function runAgentProvidersCommand(args, deps = {}) {
203
297
  }
204
298
  }
205
299
  export {
300
+ AGENT_MODELS_USAGE,
206
301
  runAgentModelsCommand,
207
302
  runAgentProvidersCommand,
208
303
  verifyCustomProvider
@@ -2,7 +2,7 @@ import {
2
2
  runAgentCreateCommand,
3
3
  runAgentReadCommand,
4
4
  runAgentUpdateCommand
5
- } from "./chunk-F3NUFVSP.js";
5
+ } from "./chunk-NRUSXKH7.js";
6
6
  import "./chunk-PH275YDS.js";
7
7
  import "./chunk-2WJ57RJA.js";
8
8
  import "./chunk-YUNJN43V.js";
@@ -212,7 +212,7 @@ async function runAgentCreateCommand(args, deps = {}) {
212
212
  clearCliLocalRuntimePreparedAgentCache();
213
213
  let verifyResult;
214
214
  if (parsed.verify) {
215
- const { verifyCustomProvider } = await import("./agentProviderCommands-IRNZXVGE.js");
215
+ const { verifyCustomProvider } = await import("./agentProviderCommands-XPJYZSCE.js");
216
216
  const rec = built.nextRecord;
217
217
  verifyResult = await verifyCustomProvider({
218
218
  providerUrl: rec.customProviderUrl,
@@ -119,15 +119,15 @@ function getAgentInternalCommandEntries() {
119
119
  return runAgentListCommand(args, deps);
120
120
  }),
121
121
  createEnvCommand(["agent", "create"], "Create a new agent", async (args, deps) => {
122
- const { runAgentCreateCommand } = await import("./agentRecordCommands-BIV7NMQZ.js");
122
+ const { runAgentCreateCommand } = await import("./agentRecordCommands-MLDVCTFN.js");
123
123
  return runAgentCreateCommand(args, deps);
124
124
  }),
125
- createEnvCommand(["agent", "models"], "List models available on an OpenAI-compatible provider", async (args, deps) => {
126
- const { runAgentModelsCommand } = await import("./agentProviderCommands-IRNZXVGE.js");
125
+ createEnvCommand(["agent", "models"], "List models: --preset <id> (server discovery, exit 1 on static fallback) or --url <base> --api-key <key> (OpenAI-compatible /models)", async (args, deps) => {
126
+ const { runAgentModelsCommand } = await import("./agentProviderCommands-XPJYZSCE.js");
127
127
  return runAgentModelsCommand(args, deps);
128
128
  }),
129
129
  createEnvCommand(["agent", "providers"], "List agent-creation provider presets (subscription / metered / oauth)", async (args, deps) => {
130
- const { runAgentProvidersCommand } = await import("./agentProviderCommands-IRNZXVGE.js");
130
+ const { runAgentProvidersCommand } = await import("./agentProviderCommands-XPJYZSCE.js");
131
131
  return runAgentProvidersCommand(args, deps);
132
132
  }),
133
133
  createEnvCommand(["agent", "pull"], "Cache an agent for local runs", async (args, deps) => {
@@ -135,7 +135,7 @@ function getAgentInternalCommandEntries() {
135
135
  return runAgentPullCommand(args, deps);
136
136
  }),
137
137
  createEnvCommand(["agent", "read"], "Read a single agent", async (args, deps) => {
138
- const { runAgentReadCommand } = await import("./agentRecordCommands-BIV7NMQZ.js");
138
+ const { runAgentReadCommand } = await import("./agentRecordCommands-MLDVCTFN.js");
139
139
  return runAgentReadCommand(args, deps);
140
140
  }),
141
141
  createAgentRunCommand(["agent", "run"], "Run an agent"),
@@ -164,26 +164,26 @@ function getAgentInternalCommandEntries() {
164
164
  return runSetupOfflineMarxistsAgentCommand(args, deps);
165
165
  }),
166
166
  createEnvCommand(["agent", "update"], "Update agent fields", async (args, deps) => {
167
- const { runAgentUpdateCommand } = await import("./agentRecordCommands-BIV7NMQZ.js");
167
+ const { runAgentUpdateCommand } = await import("./agentRecordCommands-MLDVCTFN.js");
168
168
  return runAgentUpdateCommand(args, deps);
169
169
  }),
170
170
  createEnvCommand(["agent", "email", "provision"], "Provision a controlled inbox for an agent", async (args, deps) => {
171
- const { runAgentEmailProvisionCommand } = await import("./agentEmailCommands-XQMUAB4R.js");
171
+ const { runAgentEmailProvisionCommand } = await import("./agentEmailCommands-FJ2DAY5M.js");
172
172
  return runAgentEmailProvisionCommand(args, deps);
173
173
  }),
174
174
  createEnvCommand(["agent", "email", "bind"], "Bind an existing email address to an agent", async (args, deps) => {
175
- const { runAgentEmailBindCommand } = await import("./agentEmailCommands-XQMUAB4R.js");
175
+ const { runAgentEmailBindCommand } = await import("./agentEmailCommands-FJ2DAY5M.js");
176
176
  return runAgentEmailBindCommand(args, deps);
177
177
  }),
178
178
  createEnvCommand(["agent", "email", "transfer"], "Transfer an email identity from one agent to another (cross-account)", async (args, deps) => {
179
- const { runAgentEmailTransferCommand } = await import("./agentEmailCommands-XQMUAB4R.js");
179
+ const { runAgentEmailTransferCommand } = await import("./agentEmailCommands-FJ2DAY5M.js");
180
180
  return runAgentEmailTransferCommand(args, deps);
181
181
  }),
182
182
  createEnvCommand(
183
183
  ["agent", "email", "create-and-provision"],
184
184
  "Create an agent and provision its controlled inbox",
185
185
  async (args, deps) => {
186
- const { runAgentEmailCreateAndProvisionCommand } = await import("./agentEmailCommands-XQMUAB4R.js");
186
+ const { runAgentEmailCreateAndProvisionCommand } = await import("./agentEmailCommands-FJ2DAY5M.js");
187
187
  return runAgentEmailCreateAndProvisionCommand(args, deps);
188
188
  }
189
189
  ),
package/index.js CHANGED
@@ -81,7 +81,7 @@ async function launchTuiWorkspace(args2) {
81
81
  });
82
82
  }
83
83
  async function main() {
84
- const { createCliRuntimeContext, looksLikeDaemonShortcut, renderHelpText, resolveCommand, runResolvedCommand } = await import("./commandRegistry-NKJIYWXB.js");
84
+ const { createCliRuntimeContext, looksLikeDaemonShortcut, renderHelpText, resolveCommand, runResolvedCommand } = await import("./commandRegistry-2HPRUR3I.js");
85
85
  const { buildCliRuntimeEnv, loadProfileConfig } = await import("./profileConfig-ZGOFORWV.js");
86
86
  const { resolveTuiLaunchMode } = await import("./runtimeModeArgs-2Y7BALTO.js");
87
87
  const runtimeEnv = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nolo-cli",
3
- "version": "0.100.0",
3
+ "version": "0.101.0",
4
4
  "type": "module",
5
5
  "description": "Agent-first terminal workspace for Nolo",
6
6
  "bin": {