@nt-ai-lab/opencode-skillz 0.2.5 → 0.2.6
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/index.js +20 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -97,6 +97,25 @@ function loadAgents(commands) {
|
|
|
97
97
|
|
|
98
98
|
const agents = {}
|
|
99
99
|
|
|
100
|
+
function collectPreloadedCommands(agentName, stack = new Set()) {
|
|
101
|
+
const rawAgent = rawAgents[agentName]
|
|
102
|
+
if (!rawAgent) return []
|
|
103
|
+
if (stack.has(agentName)) return parseCsvList(rawAgent.meta.preload_commands)
|
|
104
|
+
|
|
105
|
+
stack.add(agentName)
|
|
106
|
+
|
|
107
|
+
const merged = []
|
|
108
|
+
const parentAgentName = typeof rawAgent.meta.extends === "string" ? rawAgent.meta.extends.trim() : ""
|
|
109
|
+
if (parentAgentName && rawAgents[parentAgentName]) {
|
|
110
|
+
merged.push(...collectPreloadedCommands(parentAgentName, stack))
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
merged.push(...parseCsvList(rawAgent.meta.preload_commands))
|
|
114
|
+
stack.delete(agentName)
|
|
115
|
+
|
|
116
|
+
return [...new Set(merged)]
|
|
117
|
+
}
|
|
118
|
+
|
|
100
119
|
for (const [name, raw] of Object.entries(rawAgents)) {
|
|
101
120
|
const { meta, body } = raw
|
|
102
121
|
const promptParts = []
|
|
@@ -111,7 +130,7 @@ function loadAgents(commands) {
|
|
|
111
130
|
promptParts.push(body)
|
|
112
131
|
}
|
|
113
132
|
|
|
114
|
-
const preloadedCommands =
|
|
133
|
+
const preloadedCommands = collectPreloadedCommands(name)
|
|
115
134
|
for (const commandName of preloadedCommands) {
|
|
116
135
|
const command = commands[commandName]
|
|
117
136
|
if (!command || !command.template) continue
|