@ai-setting/roy-agent-core 1.5.42 → 1.5.43
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/dist/env/agent/index.js +2 -2
- package/dist/env/index.js +4 -4
- package/dist/env/task/delegate/index.js +3 -2
- package/dist/env/task/index.js +3 -3
- package/dist/index.js +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-9q6sa7m3.js → roy-agent-core-1zq3p19q.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-xz22rmak.js → roy-agent-core-9p43ap7h.js} +21 -7
- package/dist/shared/@ai-setting/{roy-agent-core-7t05apnp.js → roy-agent-core-fg3j215p.js} +26 -0
- package/dist/shared/@ai-setting/{roy-agent-core-ek6gk3wk.js → roy-agent-core-r6rwsr54.js} +42 -3
- package/package.json +1 -1
package/dist/env/agent/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AgentComponent,
|
|
3
3
|
AgentComponentConfigSchema
|
|
4
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
4
|
+
} from "../../shared/@ai-setting/roy-agent-core-r6rwsr54.js";
|
|
5
5
|
import"../../shared/@ai-setting/roy-agent-core-e25xkv53.js";
|
|
6
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
6
|
+
import"../../shared/@ai-setting/roy-agent-core-fg3j215p.js";
|
|
7
7
|
import"../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
|
|
8
8
|
import"../../shared/@ai-setting/roy-agent-core-ctdhjv68.js";
|
|
9
9
|
import {
|
package/dist/env/index.js
CHANGED
|
@@ -34,14 +34,14 @@ import"../shared/@ai-setting/roy-agent-core-1ce3fqrk.js";
|
|
|
34
34
|
import {
|
|
35
35
|
AgentComponent,
|
|
36
36
|
AgentComponentConfigSchema
|
|
37
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
37
|
+
} from "../shared/@ai-setting/roy-agent-core-r6rwsr54.js";
|
|
38
38
|
import"../shared/@ai-setting/roy-agent-core-e25xkv53.js";
|
|
39
39
|
import {
|
|
40
40
|
TaskComponent
|
|
41
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
42
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
41
|
+
} from "../shared/@ai-setting/roy-agent-core-1zq3p19q.js";
|
|
42
|
+
import"../shared/@ai-setting/roy-agent-core-9p43ap7h.js";
|
|
43
43
|
import"../shared/@ai-setting/roy-agent-core-hsxn8m1j.js";
|
|
44
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
44
|
+
import"../shared/@ai-setting/roy-agent-core-fg3j215p.js";
|
|
45
45
|
import {
|
|
46
46
|
XDG_PATHS,
|
|
47
47
|
getXDGPath,
|
|
@@ -3,10 +3,11 @@ import {
|
|
|
3
3
|
BackgroundTaskManager,
|
|
4
4
|
createDelegateTool,
|
|
5
5
|
createStopTool
|
|
6
|
-
} from "../../../shared/@ai-setting/roy-agent-core-
|
|
7
|
-
import"../../../shared/@ai-setting/roy-agent-core-
|
|
6
|
+
} from "../../../shared/@ai-setting/roy-agent-core-9p43ap7h.js";
|
|
7
|
+
import"../../../shared/@ai-setting/roy-agent-core-fg3j215p.js";
|
|
8
8
|
import"../../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
|
|
9
9
|
import"../../../shared/@ai-setting/roy-agent-core-92z6t4he.js";
|
|
10
|
+
import"../../../shared/@ai-setting/roy-agent-core-q5qj0fes.js";
|
|
10
11
|
import"../../../shared/@ai-setting/roy-agent-core-jqy2mdyq.js";
|
|
11
12
|
import"../../../shared/@ai-setting/roy-agent-core-z33en0cz.js";
|
|
12
13
|
import"../../../shared/@ai-setting/roy-agent-core-10n2jh7p.js";
|
package/dist/env/task/index.js
CHANGED
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
TaskConfigSchema,
|
|
5
5
|
TaskPriorityEnum,
|
|
6
6
|
TaskStatusEnum
|
|
7
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
8
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
7
|
+
} from "../../shared/@ai-setting/roy-agent-core-1zq3p19q.js";
|
|
8
|
+
import"../../shared/@ai-setting/roy-agent-core-9p43ap7h.js";
|
|
9
9
|
import {
|
|
10
10
|
SQLiteTaskStore
|
|
11
11
|
} from "../../shared/@ai-setting/roy-agent-core-hsxn8m1j.js";
|
|
12
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
12
|
+
import"../../shared/@ai-setting/roy-agent-core-fg3j215p.js";
|
|
13
13
|
import"../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
|
|
14
14
|
import"../../shared/@ai-setting/roy-agent-core-wa1kzqky.js";
|
|
15
15
|
import"../../shared/@ai-setting/roy-agent-core-t94ktchq.js";
|
package/dist/index.js
CHANGED
|
@@ -114,19 +114,19 @@ import"./shared/@ai-setting/roy-agent-core-1ce3fqrk.js";
|
|
|
114
114
|
import {
|
|
115
115
|
AgentComponent,
|
|
116
116
|
AgentComponentConfigSchema
|
|
117
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
117
|
+
} from "./shared/@ai-setting/roy-agent-core-r6rwsr54.js";
|
|
118
118
|
import {
|
|
119
119
|
AskUserError,
|
|
120
120
|
init_workflow_hil
|
|
121
121
|
} from "./shared/@ai-setting/roy-agent-core-e25xkv53.js";
|
|
122
122
|
import {
|
|
123
123
|
TaskComponent
|
|
124
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
125
|
-
import"./shared/@ai-setting/roy-agent-core-
|
|
124
|
+
} from "./shared/@ai-setting/roy-agent-core-1zq3p19q.js";
|
|
125
|
+
import"./shared/@ai-setting/roy-agent-core-9p43ap7h.js";
|
|
126
126
|
import"./shared/@ai-setting/roy-agent-core-hsxn8m1j.js";
|
|
127
127
|
import {
|
|
128
128
|
AgentRegistry
|
|
129
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
129
|
+
} from "./shared/@ai-setting/roy-agent-core-fg3j215p.js";
|
|
130
130
|
import {
|
|
131
131
|
XDG_PATHS,
|
|
132
132
|
getXDGPath,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_SUBAGENT_PROMPT
|
|
3
|
-
} from "./roy-agent-core-
|
|
3
|
+
} from "./roy-agent-core-fg3j215p.js";
|
|
4
4
|
import {
|
|
5
5
|
TaskHookPoints
|
|
6
6
|
} from "./roy-agent-core-92z6t4he.js";
|
|
@@ -53,13 +53,23 @@ async function resolveFromRegistry(subagentType, agentDef, builtIn, registry) {
|
|
|
53
53
|
fromRegistry: true
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
|
+
function buildAgentSelectionGuide(options) {
|
|
57
|
+
const customAgentNote = options.hasCustomAgents ? "- Custom agents from AgentRegistry are listed above." : "- Custom agents from AgentRegistry appear above when registered.";
|
|
58
|
+
return `
|
|
59
|
+
## Agent Selection Guide
|
|
60
|
+
|
|
61
|
+
- Choose \`subagent_type\` from the list above; use \`general\` when no specialized agent fits (default).
|
|
62
|
+
${customAgentNote}
|
|
63
|
+
- For full metadata: \`roy-agent agents list\`, \`roy-agent agents get <name>\`, \`roy-agent prompt list\`.`;
|
|
64
|
+
}
|
|
56
65
|
function listKnownSubagentDescriptions(registry) {
|
|
57
66
|
const builtInLines = builtInSubAgents.map((agent) => `- ${agent.id}: ${agent.description}`);
|
|
58
67
|
const registryAgents = registry?.listAgentsByType("sub") ?? [];
|
|
59
68
|
const customLines = registryAgents.filter((agent) => !builtInSubAgents.some((builtIn) => builtIn.id === agent.name)).map((agent) => `- ${agent.name}: ${agent.description || "Custom agent"}`);
|
|
60
69
|
const lines = [...builtInLines, ...customLines];
|
|
70
|
+
const guidance = buildAgentSelectionGuide({ hasCustomAgents: customLines.length > 0 });
|
|
61
71
|
return lines.join(`
|
|
62
|
-
`);
|
|
72
|
+
`) + guidance;
|
|
63
73
|
}
|
|
64
74
|
|
|
65
75
|
// src/env/task/delegate/delegate-tool.ts
|
|
@@ -497,16 +507,21 @@ ${prompt}
|
|
|
497
507
|
logger.info(`[BackgroundTaskManager] Disposed`);
|
|
498
508
|
}
|
|
499
509
|
}
|
|
510
|
+
function getAgentRegistry(taskComponent) {
|
|
511
|
+
const agentComponent = taskComponent.env?.getComponent?.("agent");
|
|
512
|
+
return agentComponent?.getRegistry?.();
|
|
513
|
+
}
|
|
500
514
|
function createDelegateTool(taskComponent) {
|
|
501
515
|
const env = taskComponent.env;
|
|
502
516
|
const backgroundTaskManager = new BackgroundTaskManager(env);
|
|
517
|
+
const registry = getAgentRegistry(taskComponent);
|
|
503
518
|
taskComponent._backgroundTaskManager = backgroundTaskManager;
|
|
504
519
|
const tool = {
|
|
505
520
|
name: "delegate_task",
|
|
506
521
|
description: `Launch a new sub-agent to handle complex, multistep tasks autonomously.
|
|
507
522
|
|
|
508
523
|
Available agent types:
|
|
509
|
-
${listKnownSubagentDescriptions()}
|
|
524
|
+
${listKnownSubagentDescriptions(registry)}
|
|
510
525
|
|
|
511
526
|
When using the delegate_task tool, you must specify a subagent_type parameter to select which agent type to use.
|
|
512
527
|
|
|
@@ -533,9 +548,8 @@ When using the delegate_task tool, you must specify a subagent_type parameter to
|
|
|
533
548
|
const { description, prompt, subagent_type = "general", background = false, timeout, cleanup, task_id, reason } = params;
|
|
534
549
|
const parentSessionId = ctx.session_id || "default";
|
|
535
550
|
logger.info(`[delegate_task] Called: description=${description}, subagent_type=${subagent_type}, background=${background}, task_id=${task_id}`);
|
|
536
|
-
const
|
|
537
|
-
|
|
538
|
-
if (!isKnownSubagentType(subagent_type, registry)) {
|
|
551
|
+
const registry2 = getAgentRegistry(taskComponent);
|
|
552
|
+
if (!isKnownSubagentType(subagent_type, registry2)) {
|
|
539
553
|
return {
|
|
540
554
|
success: false,
|
|
541
555
|
output: "",
|
|
@@ -616,7 +630,7 @@ async function handleSyncTask(taskComponent, parentSessionId, description, promp
|
|
|
616
630
|
};
|
|
617
631
|
}
|
|
618
632
|
const agentComponent = taskComponent.env?.getComponent?.("agent");
|
|
619
|
-
const registry =
|
|
633
|
+
const registry = getAgentRegistry(taskComponent);
|
|
620
634
|
const resolved = await resolveSubAgentConfig(subagentType, { registry });
|
|
621
635
|
const subAgent = getSubAgentSpec(subagentType);
|
|
622
636
|
let basePrompt = resolved?.basePrompt || subAgent?.promptOverride || `You are a subagent. Complete this task: {task_description}`;
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getXDGPath
|
|
3
3
|
} from "./roy-agent-core-qxnbvgwe.js";
|
|
4
|
+
import {
|
|
5
|
+
TracedAs,
|
|
6
|
+
init_decorator
|
|
7
|
+
} from "./roy-agent-core-q5qj0fes.js";
|
|
4
8
|
import {
|
|
5
9
|
createLogger,
|
|
6
10
|
init_logger
|
|
7
11
|
} from "./roy-agent-core-10n2jh7p.js";
|
|
12
|
+
import {
|
|
13
|
+
__legacyDecorateClassTS
|
|
14
|
+
} from "./roy-agent-core-fs0mn2jk.js";
|
|
8
15
|
|
|
9
16
|
// src/env/agent/agent-registry.ts
|
|
10
17
|
import { readdir, readFile, writeFile, mkdir, unlink } from "fs/promises";
|
|
@@ -13,6 +20,7 @@ import { join } from "path";
|
|
|
13
20
|
import { z } from "zod";
|
|
14
21
|
import yaml from "yaml";
|
|
15
22
|
init_logger();
|
|
23
|
+
init_decorator();
|
|
16
24
|
var logger = createLogger("agent:registry");
|
|
17
25
|
var AgentConfigSchema = z.object({
|
|
18
26
|
name: z.string(),
|
|
@@ -262,6 +270,24 @@ class AgentRegistry {
|
|
|
262
270
|
return join(this.configDir, `${name}.yaml`);
|
|
263
271
|
}
|
|
264
272
|
}
|
|
273
|
+
__legacyDecorateClassTS([
|
|
274
|
+
TracedAs("agent.registry.register", { recordParams: true, recordResult: true, log: true })
|
|
275
|
+
], AgentRegistry.prototype, "register", null);
|
|
276
|
+
__legacyDecorateClassTS([
|
|
277
|
+
TracedAs("agent.registry.unregister", { recordParams: true, recordResult: true, log: true })
|
|
278
|
+
], AgentRegistry.prototype, "unregister", null);
|
|
279
|
+
__legacyDecorateClassTS([
|
|
280
|
+
TracedAs("agent.registry.clear", { recordParams: false, recordResult: true, log: true })
|
|
281
|
+
], AgentRegistry.prototype, "clear", null);
|
|
282
|
+
__legacyDecorateClassTS([
|
|
283
|
+
TracedAs("agent.registry.getSystemPrompt", { recordParams: true, recordResult: true, log: true })
|
|
284
|
+
], AgentRegistry.prototype, "getSystemPrompt", null);
|
|
285
|
+
__legacyDecorateClassTS([
|
|
286
|
+
TracedAs("agent.registry.load", { recordParams: false, recordResult: true, log: true })
|
|
287
|
+
], AgentRegistry.prototype, "load", null);
|
|
288
|
+
__legacyDecorateClassTS([
|
|
289
|
+
TracedAs("agent.registry.loadFromDirectory", { recordParams: true, recordResult: true, log: true })
|
|
290
|
+
], AgentRegistry.prototype, "loadFromDirectory", null);
|
|
265
291
|
function isAgentConfigFile(fileName) {
|
|
266
292
|
return fileName.endsWith(".yaml") || fileName.endsWith(".yml");
|
|
267
293
|
}
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./roy-agent-core-e25xkv53.js";
|
|
5
5
|
import {
|
|
6
6
|
AgentRegistry
|
|
7
|
-
} from "./roy-agent-core-
|
|
7
|
+
} from "./roy-agent-core-fg3j215p.js";
|
|
8
8
|
import {
|
|
9
9
|
ContextError
|
|
10
10
|
} from "./roy-agent-core-ctdhjv68.js";
|
|
@@ -290,6 +290,7 @@ class AgentComponent extends BaseComponent {
|
|
|
290
290
|
this.registerAgent(agentDef.name, {
|
|
291
291
|
type: agentDef.type,
|
|
292
292
|
systemPrompt,
|
|
293
|
+
systemPromptRef: agentDef.systemPromptRef,
|
|
293
294
|
allowedTools: agentDef.allowedTools,
|
|
294
295
|
deniedTools: agentDef.deniedTools,
|
|
295
296
|
model: agentDef.model,
|
|
@@ -310,11 +311,17 @@ class AgentComponent extends BaseComponent {
|
|
|
310
311
|
const systemPrompt = await this.registry.getSystemPrompt(agentDef.name);
|
|
311
312
|
const existing = this.agents.get(agentDef.name);
|
|
312
313
|
if (existing) {
|
|
313
|
-
|
|
314
|
+
if (systemPrompt !== undefined) {
|
|
315
|
+
existing.config.systemPrompt = systemPrompt;
|
|
316
|
+
}
|
|
317
|
+
if (agentDef.systemPromptRef) {
|
|
318
|
+
existing.config.systemPromptRef = agentDef.systemPromptRef;
|
|
319
|
+
}
|
|
314
320
|
} else {
|
|
315
321
|
this.registerAgent(agentDef.name, {
|
|
316
322
|
type: agentDef.type,
|
|
317
323
|
systemPrompt,
|
|
324
|
+
systemPromptRef: agentDef.systemPromptRef,
|
|
318
325
|
allowedTools: agentDef.allowedTools,
|
|
319
326
|
deniedTools: agentDef.deniedTools,
|
|
320
327
|
model: agentDef.model,
|
|
@@ -363,6 +370,27 @@ class AgentComponent extends BaseComponent {
|
|
|
363
370
|
});
|
|
364
371
|
}
|
|
365
372
|
}
|
|
373
|
+
async resolveSystemPrompt(agent, agentName) {
|
|
374
|
+
if (agent.config.systemPrompt) {
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
if (!agent.config.systemPromptRef) {
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
if (!this.registry) {
|
|
381
|
+
logger.debug(`[resolveSystemPrompt] No registry available for ${agentName}`);
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
try {
|
|
385
|
+
const resolvedPrompt = await this.registry.getSystemPrompt(agentName);
|
|
386
|
+
if (resolvedPrompt) {
|
|
387
|
+
agent.config.systemPrompt = resolvedPrompt;
|
|
388
|
+
logger.debug(`[AgentComponent] Resolved systemPrompt for agent: ${agentName}`);
|
|
389
|
+
}
|
|
390
|
+
} catch (error) {
|
|
391
|
+
logger.warn(`[AgentComponent] Failed to resolve systemPrompt for agent ${agentName}: ${error}`);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
366
394
|
getAgent(agentName) {
|
|
367
395
|
return this.agents.get(agentName);
|
|
368
396
|
}
|
|
@@ -393,7 +421,8 @@ class AgentComponent extends BaseComponent {
|
|
|
393
421
|
doomLoopThreshold: config.doomLoopThreshold ?? this.config.defaultAgent.doomLoopThreshold,
|
|
394
422
|
toolTimeout: config.toolTimeout ?? this.config.defaultAgent.toolTimeout,
|
|
395
423
|
toolRetries: config.toolRetries ?? this.config.defaultAgent.toolRetries,
|
|
396
|
-
systemPrompt: config.systemPrompt ?? this.config.defaultAgent.systemPrompt,
|
|
424
|
+
systemPrompt: config.systemPrompt ?? (config.systemPromptRef ? undefined : this.config.defaultAgent.systemPrompt),
|
|
425
|
+
systemPromptRef: config.systemPromptRef,
|
|
397
426
|
model: config.model ?? this.config.defaultAgent.model,
|
|
398
427
|
behaviorSpecId: config.behaviorSpecId ?? this.config.defaultAgent.behaviorSpecId,
|
|
399
428
|
allowedTools: config.allowedTools ?? this.config.defaultAgent.allowedTools,
|
|
@@ -495,6 +524,7 @@ class AgentComponent extends BaseComponent {
|
|
|
495
524
|
if (!this.doomLoopCaches.has(runId)) {
|
|
496
525
|
this.doomLoopCaches.set(runId, new Map);
|
|
497
526
|
}
|
|
527
|
+
await this.resolveSystemPrompt(agent, agentName);
|
|
498
528
|
const effectiveContext = {
|
|
499
529
|
...context,
|
|
500
530
|
agentType: agent.config.type,
|
|
@@ -1200,6 +1230,15 @@ ${ctx.context.additionInfo}`
|
|
|
1200
1230
|
return messages;
|
|
1201
1231
|
}
|
|
1202
1232
|
}
|
|
1233
|
+
__legacyDecorateClassTS([
|
|
1234
|
+
TracedAs("agent.component.initRegistry", { recordParams: true, recordResult: true, log: true })
|
|
1235
|
+
], AgentComponent.prototype, "initRegistry", null);
|
|
1236
|
+
__legacyDecorateClassTS([
|
|
1237
|
+
TracedAs("agent.component.syncRegistryAgentsFromConfig", { recordParams: false, recordResult: true, log: true })
|
|
1238
|
+
], AgentComponent.prototype, "syncRegistryAgentsFromConfig", null);
|
|
1239
|
+
__legacyDecorateClassTS([
|
|
1240
|
+
TracedAs("agent.component.resolveSystemPrompt", { recordParams: true, recordResult: true, log: true })
|
|
1241
|
+
], AgentComponent.prototype, "resolveSystemPrompt", null);
|
|
1203
1242
|
__legacyDecorateClassTS([
|
|
1204
1243
|
TracedAs("agent.component.run", { recordParams: true, recordResult: true, log: true })
|
|
1205
1244
|
], AgentComponent.prototype, "_run", null);
|