@pi-unipi/subagents 2.14.2 → 2.16.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 +2 -2
- package/src/custom-agents.ts +22 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-unipi/subagents",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.16.0",
|
|
4
4
|
"description": "Subagents for UniPi — parallel execution, file locking, workflow integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"test": "npx tsx --test src/__tests__/*.test.ts"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@pi-unipi/core": "2.
|
|
12
|
+
"@pi-unipi/core": "2.16.0",
|
|
13
13
|
"@earendil-works/pi-agent-core": "^0.84.0",
|
|
14
14
|
"acorn": "8.18.0"
|
|
15
15
|
},
|
package/src/custom-agents.ts
CHANGED
|
@@ -151,8 +151,28 @@ function listAgentFilesRecursive(dir: string): string[] {
|
|
|
151
151
|
return files;
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
/**
|
|
155
|
-
|
|
154
|
+
/**
|
|
155
|
+
* Builtin agent definition files shipped in packages/subagents/agents/.
|
|
156
|
+
*
|
|
157
|
+
* Layout-aware (issue #35): when loaded from source (packages/subagents/src/)
|
|
158
|
+
* the agents dir is one level up; when loaded from the umbrella bundle
|
|
159
|
+
* (packages/unipi/bundled.js — the file npm ships and pi actually executes)
|
|
160
|
+
* `import.meta.url` points at packages/unipi/, so the files are two levels up
|
|
161
|
+
* under ../subagents/agents. The first candidate that exists wins, so both
|
|
162
|
+
* layouts resolve without build-time path injection.
|
|
163
|
+
*/
|
|
164
|
+
export function resolveBuiltinAgentsDir(fromUrl: string = import.meta.url): string {
|
|
165
|
+
const here = dirname(fileURLToPath(fromUrl));
|
|
166
|
+
for (const candidate of [
|
|
167
|
+
join(here, "..", "agents"), // source layout: src/ → agents/
|
|
168
|
+
join(here, "..", "subagents", "agents"), // bundle layout: packages/unipi/bundled.js → packages/subagents/agents
|
|
169
|
+
]) {
|
|
170
|
+
if (existsSync(candidate)) return candidate;
|
|
171
|
+
}
|
|
172
|
+
return join(here, "..", "agents");
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const BUILTIN_AGENTS_DIR = resolveBuiltinAgentsDir();
|
|
156
176
|
|
|
157
177
|
/** Frontmatter fields stored as-is on the config for later phases. */
|
|
158
178
|
function collectExtraFields(frontmatter: Record<string, unknown>): Record<string, string> | undefined {
|