pi-landstrip 0.17.37 → 0.17.39
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/index.ts +23 -12
- package/dist/subagents.json +0 -1
- package/package.json +2 -2
- package/subagents.json +0 -1
package/dist/index.ts
CHANGED
|
@@ -192,7 +192,7 @@ function normalizeOpenCode(value, path) {
|
|
|
192
192
|
result.showLocalAgents = showLocalAgents;
|
|
193
193
|
return result;
|
|
194
194
|
}
|
|
195
|
-
function readConfig(path) {
|
|
195
|
+
function readConfig(path, isGlobal = false) {
|
|
196
196
|
if (!existsSync(path))
|
|
197
197
|
return {};
|
|
198
198
|
let value;
|
|
@@ -209,6 +209,14 @@ function readConfig(path) {
|
|
|
209
209
|
throw new Error(`${path}: unknown top-level field ${key}`);
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
|
+
if (!isGlobal) {
|
|
213
|
+
if ("maxSubagents" in value) {
|
|
214
|
+
throw new Error(`${path}: maxSubagents is only allowed in global subagents.json`);
|
|
215
|
+
}
|
|
216
|
+
if ("opencode" in value) {
|
|
217
|
+
throw new Error(`${path}: opencode is only allowed in global subagents.json`);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
212
220
|
const config = {};
|
|
213
221
|
if ("maxSubagents" in value) {
|
|
214
222
|
if (typeof value.maxSubagents !== "number") {
|
|
@@ -256,24 +264,26 @@ function getPiConfigPaths(cwd, fileName, agentDir = getAgentDir()) {
|
|
|
256
264
|
};
|
|
257
265
|
}
|
|
258
266
|
async function setMaxSubagentsConfigForScope(cwd, maxSubagents, scope, agentDir = getAgentDir()) {
|
|
267
|
+
if (scope !== "global") {
|
|
268
|
+
throw new Error("maxSubagents is only allowed in global subagents.json");
|
|
269
|
+
}
|
|
259
270
|
if (!Number.isInteger(maxSubagents) || maxSubagents < 0 || maxSubagents > MAX_SUBAGENTS) {
|
|
260
271
|
throw new Error(`maxSubagents must be an integer from 0 to ${MAX_SUBAGENTS}`);
|
|
261
272
|
}
|
|
262
|
-
const { globalPath
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
const config = readConfig(path);
|
|
273
|
+
const { globalPath } = getPiConfigPaths(cwd, "subagents.json", agentDir);
|
|
274
|
+
await withFileMutationQueue(globalPath, async () => {
|
|
275
|
+
const config = readConfig(globalPath, true);
|
|
266
276
|
config.maxSubagents = maxSubagents;
|
|
267
|
-
mkdirSync(dirname(
|
|
268
|
-
writeFileSync(
|
|
277
|
+
mkdirSync(dirname(globalPath), { recursive: true });
|
|
278
|
+
writeFileSync(globalPath, `${JSON.stringify(config, null, 2)}
|
|
269
279
|
`, { mode: 384 });
|
|
270
280
|
});
|
|
271
281
|
}
|
|
272
282
|
function loadLandstripConfig(cwd, includeProject = true, agentDir = getAgentDir()) {
|
|
273
283
|
const { globalPath, projectPath } = getPiConfigPaths(cwd, "subagents.json", agentDir);
|
|
274
|
-
const builtInConfig = readConfig(join2(packageDir, "subagents.json"));
|
|
275
|
-
const globalConfig = readConfig(globalPath);
|
|
276
|
-
const projectConfig = includeProject ? readConfig(projectPath) : undefined;
|
|
284
|
+
const builtInConfig = readConfig(join2(packageDir, "subagents.json"), false);
|
|
285
|
+
const globalConfig = readConfig(globalPath, true);
|
|
286
|
+
const projectConfig = includeProject ? readConfig(projectPath, false) : undefined;
|
|
277
287
|
const agentSources = new Map;
|
|
278
288
|
recordAgentSources(agentSources, builtInConfig, "built-in");
|
|
279
289
|
recordAgentSources(agentSources, globalConfig, "global");
|
|
@@ -282,7 +292,8 @@ function loadLandstripConfig(cwd, includeProject = true, agentDir = getAgentDir(
|
|
|
282
292
|
let config = mergeValue(builtInConfig, globalConfig);
|
|
283
293
|
if (projectConfig)
|
|
284
294
|
config = mergeValue(config, projectConfig);
|
|
285
|
-
|
|
295
|
+
const maxSubagents = config.maxSubagents ?? 0;
|
|
296
|
+
if (!Number.isInteger(maxSubagents) || maxSubagents < 0 || maxSubagents > MAX_SUBAGENTS) {
|
|
286
297
|
throw new Error(`maxSubagents must be an integer from 0 to ${MAX_SUBAGENTS}`);
|
|
287
298
|
}
|
|
288
299
|
if (!isRecord2(config.subagents))
|
|
@@ -291,7 +302,7 @@ function loadLandstripConfig(cwd, includeProject = true, agentDir = getAgentDir(
|
|
|
291
302
|
...DEFAULT_OPENCODE,
|
|
292
303
|
...config.opencode
|
|
293
304
|
};
|
|
294
|
-
return { ...config, opencode, agentSources };
|
|
305
|
+
return { ...config, maxSubagents, opencode, agentSources };
|
|
295
306
|
}
|
|
296
307
|
|
|
297
308
|
// opencode-agents.ts
|
package/dist/subagents.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-landstrip",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.39",
|
|
4
4
|
"description": "Sandbox-aware Pi subagents and interactive command permissions",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"landstrip",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"ci:test": "npm run test"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@landstrip/landstrip": "^0.17.
|
|
43
|
+
"@landstrip/landstrip": "^0.17.39",
|
|
44
44
|
"minimatch": "^10.2.5",
|
|
45
45
|
"yaml": "^2.9.0"
|
|
46
46
|
},
|