@myvillage/cli 1.85.2 → 1.86.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 +1 -1
- package/src/commands/agent-local.js +10 -3
- package/src/commands/agent.js +3 -2
- package/src/index.js +2 -0
- package/src/utils/api.js +8 -2
- package/src/utils/formatters.js +2 -0
package/package.json
CHANGED
|
@@ -333,12 +333,19 @@ export async function agentRecipesListCommand() {
|
|
|
333
333
|
|
|
334
334
|
// ── Start Agent ─────────────────────────────────────────
|
|
335
335
|
|
|
336
|
-
export async function agentStartCommand(name) {
|
|
336
|
+
export async function agentStartCommand(name, options = {}) {
|
|
337
337
|
if (!isAuthenticated()) {
|
|
338
338
|
console.log(chalk.red(' \u2717 Authentication required. Run \'myvillage login\' first.'));
|
|
339
339
|
return;
|
|
340
340
|
}
|
|
341
341
|
|
|
342
|
+
// Organizational village tags for this agent (grouping/filtering only \u2014 no
|
|
343
|
+
// access effect). Accept either a pre-parsed array (if a caller passes one)
|
|
344
|
+
// or a comma-separated string from the --village flag.
|
|
345
|
+
const associatedVillages = Array.isArray(options.village)
|
|
346
|
+
? options.village.map(v => String(v).trim()).filter(Boolean)
|
|
347
|
+
: (options.village || '').split(',').map(v => v.trim()).filter(Boolean);
|
|
348
|
+
|
|
342
349
|
if (!agentExists(name)) {
|
|
343
350
|
// Check whether the agent exists server-side under this handle. If so,
|
|
344
351
|
// this is a "different machine" situation \u2014 point them at `agent pull`
|
|
@@ -453,7 +460,7 @@ export async function agentStartCommand(name) {
|
|
|
453
460
|
archetypes: [],
|
|
454
461
|
greeting: '',
|
|
455
462
|
starterPrompts: [],
|
|
456
|
-
associatedVillages
|
|
463
|
+
associatedVillages,
|
|
457
464
|
specialInstructions: null,
|
|
458
465
|
agentProfileId: agent.id,
|
|
459
466
|
});
|
|
@@ -512,7 +519,7 @@ export async function agentStartCommand(name) {
|
|
|
512
519
|
archetypes: [],
|
|
513
520
|
greeting: '',
|
|
514
521
|
starterPrompts: [],
|
|
515
|
-
associatedVillages
|
|
522
|
+
associatedVillages,
|
|
516
523
|
specialInstructions: null,
|
|
517
524
|
agentProfileId: agentConfig.man.agent_id,
|
|
518
525
|
});
|
package/src/commands/agent.js
CHANGED
|
@@ -27,7 +27,7 @@ async function resolveAgentHandle(handle) {
|
|
|
27
27
|
|
|
28
28
|
// ── Commands ─────────────────────────────────────────
|
|
29
29
|
|
|
30
|
-
export async function agentCommand(handle) {
|
|
30
|
+
export async function agentCommand(handle, options = {}) {
|
|
31
31
|
if (!isAuthenticated()) {
|
|
32
32
|
console.log(chalk.red(' \u2717 Authentication required. Run \'myvillage login\' first.'));
|
|
33
33
|
return;
|
|
@@ -46,7 +46,8 @@ export async function agentCommand(handle) {
|
|
|
46
46
|
const spinner = villageSpinner('Loading remote agents...').start();
|
|
47
47
|
|
|
48
48
|
try {
|
|
49
|
-
|
|
49
|
+
// --village filters remote agents by an associated village id (organizational).
|
|
50
|
+
const result = await listMyAgents(options.village ? { village: options.village } : {});
|
|
50
51
|
spinner.stop();
|
|
51
52
|
|
|
52
53
|
const agents = result.data || result;
|
package/src/index.js
CHANGED
|
@@ -440,6 +440,7 @@ export function run() {
|
|
|
440
440
|
const agentCmd = program
|
|
441
441
|
.command('agent [handle]')
|
|
442
442
|
.description('List your agents, or view an agent by handle')
|
|
443
|
+
.option('--village <id>', 'Filter agents by associated village ID')
|
|
443
444
|
.action(agentCommand);
|
|
444
445
|
|
|
445
446
|
agentCmd
|
|
@@ -510,6 +511,7 @@ export function run() {
|
|
|
510
511
|
agentCmd
|
|
511
512
|
.command('start <name>')
|
|
512
513
|
.description('Start a local agent daemon')
|
|
514
|
+
.option('--village <ids>', 'Comma-separated village IDs to tag this agent with (organizational only; does not change access)')
|
|
513
515
|
.action(agentStartCommand);
|
|
514
516
|
|
|
515
517
|
agentCmd
|
package/src/utils/api.js
CHANGED
|
@@ -290,8 +290,14 @@ export async function createAgent(data) {
|
|
|
290
290
|
return response.data;
|
|
291
291
|
}
|
|
292
292
|
|
|
293
|
-
export async function listMyAgents(
|
|
294
|
-
const client = getNetworkClient();
|
|
293
|
+
export async function listMyAgents(options = {}) {
|
|
294
|
+
const client = getNetworkClient();
|
|
295
|
+
// Pass through recognized query params. `village` filters by an associated
|
|
296
|
+
// village id (organizational grouping only); existing callers may also pass
|
|
297
|
+
// excludeSystem / unlinked etc., so spread the rest through unchanged.
|
|
298
|
+
const { village, ...rest } = options;
|
|
299
|
+
const params = { ...rest };
|
|
300
|
+
if (village) params.village = village;
|
|
295
301
|
const response = await client.get('/agents/my', { params });
|
|
296
302
|
return response.data;
|
|
297
303
|
}
|
package/src/utils/formatters.js
CHANGED
|
@@ -398,6 +398,8 @@ export function formatAgentList(agents) {
|
|
|
398
398
|
if (agent.agentCategory && agent.agentCategory !== 'NETWORK' && agent.schedule) {
|
|
399
399
|
console.log(` ${chalk.dim(' ')}${chalk.dim(`Schedule: ${agent.schedule}`)}`);
|
|
400
400
|
}
|
|
401
|
+
const villages = Array.isArray(agent.associatedVillages) ? agent.associatedVillages.filter(Boolean) : [];
|
|
402
|
+
console.log(` ${chalk.dim(' ')}${chalk.dim(`Villages: ${villages.length ? villages.join(', ') : '—'}`)}`);
|
|
401
403
|
console.log('');
|
|
402
404
|
}
|
|
403
405
|
}
|