@myvillage/cli 1.78.0 → 1.79.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myvillage/cli",
3
- "version": "1.78.0",
3
+ "version": "1.79.0",
4
4
  "description": "MyVillageOS CLI for community developers",
5
5
  "type": "module",
6
6
  "bin": {
@@ -15,6 +15,7 @@ import { isWithinActiveHours, getNextCheckInMs } from './scheduler.js';
15
15
  import { parse as parseYaml } from 'yaml';
16
16
  import { postAgentHeartbeat, listAgentTasks, claimAgentTask, completeAgentTask, refreshAccessToken } from '../utils/api.js';
17
17
  import { getAccessToken, isTokenExpired } from '../utils/auth.js';
18
+ import { getConfig } from '../utils/config.js';
18
19
  import { readAgentWisdom } from '../utils/wisdom.js';
19
20
 
20
21
  export async function agentLoop(agentName, { signal }) {
@@ -39,6 +40,7 @@ export async function agentLoop(agentName, { signal }) {
39
40
  anthropic: 'claude-sonnet-4-5-20250929',
40
41
  openai: 'gpt-4o',
41
42
  'self-hosted': '',
43
+ myvillage: 'vee-1.3',
42
44
  };
43
45
  const modelId =
44
46
  config.brain?.model || defaultModel.model || DEFAULT_MODEL_ID[provider] || DEFAULT_MODEL_ID.anthropic;
@@ -63,6 +65,17 @@ export async function agentLoop(agentName, { signal }) {
63
65
  const apiKey = process.env.SELF_HOSTED_API_KEY || globalConfig.selfHostedApiKey || 'not-needed';
64
66
  const openai = createOpenAI({ apiKey, baseURL });
65
67
  model = openai(modelId);
68
+ } else if (provider === 'myvillage') {
69
+ // MyVillage-hosted models via the AI Gateway. OpenAI-compatible; the villager's
70
+ // OAuth token is the credential, and MVTs are deducted server-side by usage.
71
+ const token = getAccessToken();
72
+ if (!token) {
73
+ logActivity(agentDir, { type: 'error', error: 'Not logged in for MyVillage-hosted model' });
74
+ throw new Error('Not logged in. Run `myvillage login` to use MyVillage-hosted models.');
75
+ }
76
+ const { apiBaseUrl } = getConfig();
77
+ const openai = createOpenAI({ apiKey: token, baseURL: `${apiBaseUrl}/ai` });
78
+ model = openai(modelId);
66
79
  } else {
67
80
  const apiKey = process.env.ANTHROPIC_API_KEY || globalConfig.anthropicApiKey;
68
81
  if (!apiKey) {
@@ -129,6 +129,7 @@ export async function agentCreateLocalCommand() {
129
129
  name: 'provider',
130
130
  message: 'AI provider:',
131
131
  choices: [
132
+ { name: 'MyVillage (hosted — billed in MVTs)', value: 'myvillage' },
132
133
  { name: 'Anthropic (Claude)', value: 'anthropic' },
133
134
  { name: 'OpenAI (GPT)', value: 'openai' },
134
135
  ],
@@ -139,6 +140,11 @@ export async function agentCreateLocalCommand() {
139
140
  name: 'model',
140
141
  message: 'Model:',
141
142
  choices: (prev) => {
143
+ if (prev.provider === 'myvillage') {
144
+ return [
145
+ { name: 'Vee 1.3 (recommended)', value: 'vee-1.3' },
146
+ ];
147
+ }
142
148
  if (prev.provider === 'openai') {
143
149
  return [
144
150
  { name: 'gpt-4o (recommended)', value: 'gpt-4o' },
@@ -271,7 +277,13 @@ export async function agentStartCommand(name) {
271
277
  let providerLabel;
272
278
  let consoleUrl;
273
279
 
274
- if (provider === 'openai') {
280
+ if (provider === 'myvillage') {
281
+ // MyVillage-hosted models authenticate with the OAuth login, not an API key.
282
+ if (!getAccessToken()) {
283
+ console.log(chalk.yellow('\n Log in to use MyVillage-hosted models: run `myvillage login`.\n'));
284
+ return;
285
+ }
286
+ } else if (provider === 'openai') {
275
287
  apiKey = cliConfig.openaiApiKey || process.env.OPENAI_API_KEY;
276
288
  configKeyName = 'openaiApiKey';
277
289
  providerLabel = 'OpenAI';
@@ -283,7 +295,7 @@ export async function agentStartCommand(name) {
283
295
  consoleUrl = 'https://console.anthropic.com';
284
296
  }
285
297
 
286
- if (!apiKey) {
298
+ if (provider !== 'myvillage' && !apiKey) {
287
299
  console.log(chalk.yellow(`\n ${providerLabel} API key required for this agent.`));
288
300
  console.log(brand.teal(` Get yours at: ${consoleUrl}\n`));
289
301