@ouro.bot/cli 0.1.0-alpha.72 → 0.1.0-alpha.73

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/changelog.json CHANGED
@@ -1,6 +1,14 @@
1
1
  {
2
2
  "_note": "This changelog is maintained as part of the PR/version-bump workflow. Agent-curated, not auto-generated. Agents read this file directly via read_file to understand what changed between versions.",
3
3
  "versions": [
4
+ {
5
+ "version": "0.1.0-alpha.73",
6
+ "changes": [
7
+ "New `ouro config models --agent <name>` command: list available models for the current provider. For github-copilot, queries the models API; other providers show a static message.",
8
+ "Fix: `ouro config model` now validates model availability for github-copilot before writing, showing available models if the requested one isn't found.",
9
+ "Fix: system prompt now tells the agent that model/provider changes take effect on the next turn automatically (no restart needed)."
10
+ ]
11
+ },
4
12
  {
5
13
  "version": "0.1.0-alpha.72",
6
14
  "changes": [
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.ensureDaemonRunning = ensureDaemonRunning;
37
+ exports.listGithubCopilotModels = listGithubCopilotModels;
37
38
  exports.parseOuroCommand = parseOuroCommand;
38
39
  exports.discoverExistingCredentials = discoverExistingCredentials;
39
40
  exports.createDefaultOuroCliDeps = createDefaultOuroCliDeps;
@@ -270,6 +271,7 @@ function usage() {
270
271
  " ouro stop|down|status|logs|hatch",
271
272
  " ouro -v|--version",
272
273
  " ouro config model --agent <name> <model-name>",
274
+ " ouro config models --agent <name>",
273
275
  " ouro auth --agent <name> [--provider <provider>]",
274
276
  " ouro auth verify --agent <name> [--provider <provider>]",
275
277
  " ouro auth switch --agent <name> --provider <provider>",
@@ -488,7 +490,30 @@ async function verifyProviderCredentials(provider, providers, fetchImpl = fetch)
488
490
  return "failed (no api key)";
489
491
  return "ok";
490
492
  }
491
- /* v8 ignore stop */
493
+ async function listGithubCopilotModels(baseUrl, token, fetchImpl = fetch) {
494
+ const url = `${baseUrl.replace(/\/+$/, "")}/models`;
495
+ const response = await fetchImpl(url, {
496
+ headers: { Authorization: `Bearer ${token}` },
497
+ });
498
+ if (!response.ok) {
499
+ throw new Error(`model listing failed (HTTP ${response.status})`);
500
+ }
501
+ const body = await response.json();
502
+ /* v8 ignore start -- response shape handling: tested via config-models.test.ts @preserve */
503
+ const items = Array.isArray(body) ? body : (body?.data ?? []);
504
+ return items.map((item) => {
505
+ const rec = item;
506
+ const capabilities = Array.isArray(rec.capabilities)
507
+ ? rec.capabilities.filter((c) => typeof c === "string")
508
+ : undefined;
509
+ return {
510
+ id: String(rec.id ?? rec.name ?? ""),
511
+ name: String(rec.name ?? rec.id ?? ""),
512
+ ...(capabilities ? { capabilities } : {}),
513
+ };
514
+ });
515
+ /* v8 ignore stop */
516
+ }
492
517
  function parseHatchCommand(args) {
493
518
  let agentName;
494
519
  let humanName;
@@ -805,6 +830,11 @@ function parseConfigCommand(args) {
805
830
  throw new Error(`Usage: ouro config model --agent <name> <model-name>`);
806
831
  return { kind: "config.model", agent, modelName };
807
832
  }
833
+ if (sub === "models") {
834
+ if (!agent)
835
+ throw new Error("--agent is required for config models");
836
+ return { kind: "config.models", agent };
837
+ }
808
838
  throw new Error(`Usage\n${usage()}`);
809
839
  }
810
840
  function parseMcpCommand(args) {
@@ -1796,9 +1826,62 @@ async function runOuroCli(args, deps = createDefaultOuroCliDeps()) {
1796
1826
  return message;
1797
1827
  }
1798
1828
  /* v8 ignore stop */
1829
+ // ── config models (local, no daemon socket needed) ──
1830
+ /* v8 ignore start -- config models: tested via daemon-cli.test.ts @preserve */
1831
+ if (command.kind === "config.models") {
1832
+ const { config } = (0, auth_flow_1.readAgentConfigForAgent)(command.agent);
1833
+ const provider = config.provider;
1834
+ if (provider !== "github-copilot") {
1835
+ const message = `model listing not available for ${provider} — check provider documentation.`;
1836
+ deps.writeStdout(message);
1837
+ return message;
1838
+ }
1839
+ const { secrets } = (0, auth_flow_1.loadAgentSecrets)(command.agent);
1840
+ const ghConfig = secrets.providers["github-copilot"];
1841
+ if (!ghConfig.githubToken || !ghConfig.baseUrl) {
1842
+ throw new Error(`github-copilot credentials not configured. Run \`ouro auth --agent ${command.agent} --provider github-copilot\` first.`);
1843
+ }
1844
+ const fetchFn = deps.fetchImpl ?? fetch;
1845
+ const models = await listGithubCopilotModels(ghConfig.baseUrl, ghConfig.githubToken, fetchFn);
1846
+ if (models.length === 0) {
1847
+ const message = "no models found";
1848
+ deps.writeStdout(message);
1849
+ return message;
1850
+ }
1851
+ const lines = ["available models:"];
1852
+ for (const m of models) {
1853
+ const caps = m.capabilities?.length ? ` (${m.capabilities.join(", ")})` : "";
1854
+ lines.push(` ${m.id}${caps}`);
1855
+ }
1856
+ const message = lines.join("\n");
1857
+ deps.writeStdout(message);
1858
+ return message;
1859
+ }
1860
+ /* v8 ignore stop */
1799
1861
  // ── config model (local, no daemon socket needed) ──
1800
1862
  /* v8 ignore start -- config model: tested via daemon-cli.test.ts @preserve */
1801
1863
  if (command.kind === "config.model") {
1864
+ // Validate model availability for github-copilot before writing
1865
+ const { config } = (0, auth_flow_1.readAgentConfigForAgent)(command.agent);
1866
+ if (config.provider === "github-copilot") {
1867
+ const { secrets } = (0, auth_flow_1.loadAgentSecrets)(command.agent);
1868
+ const ghConfig = secrets.providers["github-copilot"];
1869
+ if (ghConfig.githubToken && ghConfig.baseUrl) {
1870
+ const fetchFn = deps.fetchImpl ?? fetch;
1871
+ try {
1872
+ const models = await listGithubCopilotModels(ghConfig.baseUrl, ghConfig.githubToken, fetchFn);
1873
+ const available = models.map((m) => m.id);
1874
+ if (available.length > 0 && !available.includes(command.modelName)) {
1875
+ const message = `model '${command.modelName}' not found. available models:\n${available.map((id) => ` ${id}`).join("\n")}`;
1876
+ deps.writeStdout(message);
1877
+ return message;
1878
+ }
1879
+ }
1880
+ catch {
1881
+ // Validation failed — fall through and write anyway
1882
+ }
1883
+ }
1884
+ }
1802
1885
  const { provider, previousModel } = (0, auth_flow_1.writeAgentModel)(command.agent, command.modelName);
1803
1886
  const message = previousModel
1804
1887
  ? `updated ${command.agent} model on ${provider}: ${previousModel} → ${command.modelName}`
@@ -182,12 +182,15 @@ my bones give me the \`ouro\` cli. always pass \`--agent ${agentName}\`:
182
182
  ouro session list --agent ${agentName}
183
183
  ouro reminder create --agent ${agentName} <title> --body <body>
184
184
  ouro config model --agent ${agentName} <model-name>
185
+ ouro config models --agent ${agentName}
185
186
  ouro auth --agent ${agentName} --provider <provider>
186
187
  ouro auth verify --agent ${agentName} [--provider <provider>]
187
188
  ouro auth switch --agent ${agentName} --provider <provider>
188
189
  ouro mcp list --agent ${agentName}
189
190
  ouro mcp call --agent ${agentName} <server> <tool> --args '{...}'
190
- ouro --help`;
191
+ ouro --help
192
+
193
+ provider/model changes via \`ouro config model\` or \`ouro auth switch\` take effect on the next turn automatically — no restart needed.`;
191
194
  }
192
195
  function mcpToolsSection(mcpManager) {
193
196
  if (!mcpManager)
@@ -168,6 +168,7 @@ exports.OURO_CLI_TRUST_MANIFEST = {
168
168
  "friend update": "family",
169
169
  "reminder create": "friend",
170
170
  "config model": "friend",
171
+ "config models": "friend",
171
172
  "mcp list": "acquaintance",
172
173
  "mcp call": "friend",
173
174
  auth: "family",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.72",
3
+ "version": "0.1.0-alpha.73",
4
4
  "main": "dist/heart/daemon/ouro-entry.js",
5
5
  "bin": {
6
6
  "cli": "dist/heart/daemon/ouro-bot-entry.js",