@myvillage/cli 1.82.0 → 1.83.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/agent-runtime/loop.js +13 -5
- package/src/commands/agent.js +9 -4
package/package.json
CHANGED
|
@@ -112,6 +112,14 @@ export async function agentLoop(agentName, { signal }) {
|
|
|
112
112
|
model = anthropic(modelId);
|
|
113
113
|
}
|
|
114
114
|
const maxTokens = config.brain?.max_tokens_per_loop || 8000;
|
|
115
|
+
// Max agentic steps (one model turn + its tool executions) per loop
|
|
116
|
+
// iteration. A task like "enumerate N villagers' knowledge, then Slack each
|
|
117
|
+
// lead" needs a step per discovery wave plus the action steps; 10 was too low
|
|
118
|
+
// — the model would exhaust the budget mid-task (e.g. right after listing
|
|
119
|
+
// Slack channels but before sending). Configurable per agent via
|
|
120
|
+
// brain.max_steps_per_loop; default 25. Cost stays bounded by
|
|
121
|
+
// max_tokens_per_loop and the rate limiter regardless of this ceiling.
|
|
122
|
+
const maxSteps = config.brain?.max_steps_per_loop || 25;
|
|
115
123
|
|
|
116
124
|
// Initialize MCP tools
|
|
117
125
|
let tools;
|
|
@@ -293,10 +301,10 @@ Guidelines:
|
|
|
293
301
|
// AI SDK v6 removed `maxSteps` — the loop now uses `stopWhen` with
|
|
294
302
|
// a StopCondition predicate. The default is `stepCountIs(1)`, so
|
|
295
303
|
// without this the model gets exactly ONE round of tool calls and
|
|
296
|
-
// returns immediately. We give it up to
|
|
297
|
-
//
|
|
298
|
-
//
|
|
299
|
-
//
|
|
304
|
+
// returns immediately. We give it up to `maxSteps` steps (default 25,
|
|
305
|
+
// see above) so a multi-step task like "find the low-activity villagers,
|
|
306
|
+
// then message each lead" can do discover → reason → act across enough
|
|
307
|
+
// turns to actually finish, instead of stopping mid-task.
|
|
300
308
|
//
|
|
301
309
|
// Anthropic prompt caching: we mark the system block as ephemeral so
|
|
302
310
|
// everything before it (tool schemas + system prompt) is cached.
|
|
@@ -319,7 +327,7 @@ Guidelines:
|
|
|
319
327
|
{ role: 'user', content: context },
|
|
320
328
|
],
|
|
321
329
|
tools,
|
|
322
|
-
stopWhen: stepCountIs(
|
|
330
|
+
stopWhen: stepCountIs(maxSteps),
|
|
323
331
|
maxOutputTokens: maxTokens,
|
|
324
332
|
});
|
|
325
333
|
|
package/src/commands/agent.js
CHANGED
|
@@ -92,10 +92,14 @@ export async function agentCreateCommand() {
|
|
|
92
92
|
// org-chart hierarchy. Failure here is non-fatal — just skip the picker.
|
|
93
93
|
let parentChoices = [];
|
|
94
94
|
try {
|
|
95
|
-
|
|
95
|
+
// excludeSystem: don't offer system personas (Griot et al.) as parents —
|
|
96
|
+
// admins technically own them, but they aren't part of a villager's org chart.
|
|
97
|
+
const existing = await listMyAgents({ excludeSystem: true });
|
|
96
98
|
const mine = existing.data || existing;
|
|
97
99
|
if (Array.isArray(mine)) {
|
|
98
|
-
parentChoices = mine
|
|
100
|
+
parentChoices = mine
|
|
101
|
+
.filter(a => !a.isSystemAgent)
|
|
102
|
+
.map(a => ({ name: `@${a.handle} — ${a.displayName}`, value: a.id }));
|
|
99
103
|
}
|
|
100
104
|
} catch {
|
|
101
105
|
parentChoices = [];
|
|
@@ -311,11 +315,12 @@ export async function agentEditCommand(handle) {
|
|
|
311
315
|
// avoid the trivial cycle; deeper cycles are rejected by the backend).
|
|
312
316
|
let parentChoices = [];
|
|
313
317
|
try {
|
|
314
|
-
|
|
318
|
+
// excludeSystem: system personas (Griot et al.) aren't valid parents.
|
|
319
|
+
const existing = await listMyAgents({ excludeSystem: true });
|
|
315
320
|
const mine = existing.data || existing;
|
|
316
321
|
if (Array.isArray(mine)) {
|
|
317
322
|
parentChoices = mine
|
|
318
|
-
.filter(a => a.id !== agent.id)
|
|
323
|
+
.filter(a => a.id !== agent.id && !a.isSystemAgent)
|
|
319
324
|
.map(a => ({ name: `@${a.handle} — ${a.displayName}`, value: a.id }));
|
|
320
325
|
}
|
|
321
326
|
} catch {
|