pi-landstrip 0.18.32 → 0.18.33

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.
Files changed (3) hide show
  1. package/README.md +7 -3
  2. package/dist/index.ts +19 -12
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -136,12 +136,16 @@ forms at one scope is an error.
136
136
  Agent definitions accept `name`, `description`, `prompt`, `mode`, `model`,
137
137
  `variant`, `temperature`, `top_p`, `steps`, `color`, `hidden`, `disable`,
138
138
  `options`, and `permission`. `mode` is `primary`, `subagent`, or `all` and
139
- defaults to `all`.
139
+ defaults to `all`. `/agents` Primary lists only `mode: primary` agents. The
140
+ Subagent tab lists `mode: subagent` and `mode: all` agents, including JSON and
141
+ Markdown definitions.
140
142
 
141
143
  The built-in primary agents are `build` and `plan`; built-in subagents are
142
144
  `general`, `scout`, and `explore`. Pi also loads Markdown agents from
143
- `~/.pi/agent/agents/` and `.pi/agents/`. Project definitions override global
144
- definitions, and configured agents override Markdown agents with the same name.
145
+ `~/.pi/agent/agents/` and `.pi/agents/`. Project definitions overlay global
146
+ definitions. Configured fields overlay Markdown agents with the same name, so a
147
+ model-only `landstrip.json` entry keeps the Markdown agent's mode, prompt, and
148
+ permissions.
145
149
 
146
150
  ## Commands and tasks
147
151
 
package/dist/index.ts CHANGED
@@ -996,16 +996,20 @@ function loadAgentCatalog(cwd, piAgentDir = getAgentDir2(), includeProject = tru
996
996
  continue;
997
997
  }
998
998
  const imported = normalized.get(name);
999
- if (Object.keys(value).every((key) => key === "disable")) {
1000
- if (imported) {
1001
- normalized.set(name, {
1002
- ...imported,
1003
- disabled: value.disable === true,
1004
- raw: { ...imported.raw, disable: value.disable }
1005
- });
999
+ if (imported) {
1000
+ try {
1001
+ const source = agentSources.get(name) ?? imported.source;
1002
+ normalized.set(name, normalizeAgent(name, { ...imported.raw, ...value }, source, imported.origin ?? {
1003
+ kind: "pi-markdown",
1004
+ source: imported.source
1005
+ }));
1006
+ } catch (error) {
1007
+ diagnostics.push(formatError(error));
1006
1008
  }
1007
1009
  continue;
1008
1010
  }
1011
+ if (Object.keys(value).every((key) => key === "disable"))
1012
+ continue;
1009
1013
  try {
1010
1014
  const source = agentSources.get(name) ?? "built-in";
1011
1015
  normalized.set(name, normalizeAgent(name, value, source, {
@@ -1058,6 +1062,9 @@ function mergePermissionRules(...values) {
1058
1062
  function availableAgents(catalog) {
1059
1063
  return [...catalog.agents.values()].filter((agent) => !agent.hidden && !agent.disabled);
1060
1064
  }
1065
+ function isPrimaryAgent(agent) {
1066
+ return agent.mode === "primary";
1067
+ }
1061
1068
  function agentSupportsMode(agent, mode) {
1062
1069
  return agent.mode === mode || agent.mode === "all";
1063
1070
  }
@@ -2744,7 +2751,7 @@ ${this.primaryAgent.prompt}` };
2744
2751
  let disabledOverrides = loadAgentDisabledOverrides(ctx.cwd, projectTrusted);
2745
2752
  let maxSubagentsSettings = loadMaxSubagentsSettings(ctx.cwd, projectTrusted);
2746
2753
  let tab = requested ? "log" : "primary";
2747
- const agentsForTab = () => agents.filter((agent) => agentSupportsMode(agent, tab === "subagent" ? "subagent" : "primary"));
2754
+ const agentsForTab = () => agents.filter((agent) => tab === "subagent" ? agentSupportsMode(agent, "subagent") : isPrimaryAgent(agent));
2748
2755
  let selectedAgent = Math.max(0, agentsForTab().findIndex((agent) => agent.name === this.primaryAgent?.name));
2749
2756
  let selectedTask = requested ? tasks.findIndex((task) => task.id === requested || task.id.startsWith(requested)) : 0;
2750
2757
  if (selectedTask < 0) {
@@ -3105,7 +3112,7 @@ ${this.primaryAgent.prompt}` };
3105
3112
  tui.requestRender();
3106
3113
  });
3107
3114
  return;
3108
- } else if (tab === "primary" && matchesKey(data, "return") && agent && !agent.disabled && agentSupportsMode(agent, "primary")) {
3115
+ } else if (tab === "primary" && matchesKey(data, "return") && agent && !agent.disabled && isPrimaryAgent(agent)) {
3109
3116
  this.selectPrimaryAgent(agent.name, ctx).then(() => tui.requestRender()).catch((error) => ctx.ui.notify(`Could not select primary agent: ${formatError(error)}`, "error"));
3110
3117
  return;
3111
3118
  } else if (tab === "primary" && matchesKey(data, "return") && agent) {
@@ -3314,7 +3321,7 @@ ${this.primaryAgent.prompt}` };
3314
3321
  ctx.ui.notify(diagnostic, "warning");
3315
3322
  if (catalog.diagnostics.length > 0)
3316
3323
  return false;
3317
- const agent = availableAgents(catalog).find((candidate) => candidate.name === name && agentSupportsMode(candidate, "primary"));
3324
+ const agent = availableAgents(catalog).find((candidate) => candidate.name === name && isPrimaryAgent(candidate));
3318
3325
  if (!agent) {
3319
3326
  ctx.ui.notify(`Unknown primary agent: ${name}`, "error");
3320
3327
  return false;
@@ -3335,7 +3342,7 @@ ${this.primaryAgent.prompt}` };
3335
3342
  ctx.ui.notify(diagnostic, "warning");
3336
3343
  if (catalog.diagnostics.length > 0)
3337
3344
  return;
3338
- const agents = availableAgents(catalog).filter((agent) => agentSupportsMode(agent, "primary"));
3345
+ const agents = availableAgents(catalog).filter(isPrimaryAgent);
3339
3346
  if (agents.length === 0) {
3340
3347
  ctx.ui.notify("No primary agents are available", "warning");
3341
3348
  return;
@@ -4256,7 +4263,7 @@ ${renderTaskResult(task.id, failed ? "error" : "completed", value)}`;
4256
4263
  if (typeof value?.name === "string")
4257
4264
  name = value.name;
4258
4265
  }
4259
- const agents = availableAgents(catalog).filter((agent2) => agentSupportsMode(agent2, "primary"));
4266
+ const agents = availableAgents(catalog).filter(isPrimaryAgent);
4260
4267
  const agent = agents.find((candidate) => candidate.name === name) ?? agents[0];
4261
4268
  if (agent && !await this.activatePrimaryAgent(agent, catalog, ctx, false)) {
4262
4269
  this.invalidatePrimaryAgent(catalog, ctx);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-landstrip",
3
- "version": "0.18.32",
3
+ "version": "0.18.33",
4
4
  "description": "Sandboxed Bash and process-backed agents for Pi",
5
5
  "keywords": [
6
6
  "landstrip",
@@ -39,7 +39,7 @@
39
39
  "ci:test": "npm run test"
40
40
  },
41
41
  "dependencies": {
42
- "@landstrip/landstrip": "^0.18.32",
42
+ "@landstrip/landstrip": "^0.18.33",
43
43
  "jsonc-parser": "^3.3.1",
44
44
  "minimatch": "^10.2.5",
45
45
  "yaml": "^2.9.0"