@alisio/plugin-subagents 0.1.0-alpha.8 → 0.1.0-alpha.9

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/config.d.ts CHANGED
@@ -23,6 +23,11 @@ export declare const subagentsConfigSchema: z.ZodObject<{
23
23
  prompt: z.ZodDefault<z.ZodString>;
24
24
  tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
25
25
  model: z.ZodOptional<z.ZodString>;
26
+ mode: z.ZodOptional<z.ZodEnum<{
27
+ all: "all";
28
+ primary: "primary";
29
+ subagent: "subagent";
30
+ }>>;
26
31
  }, z.core.$strip>>>;
27
32
  worktreeDir: z.ZodOptional<z.ZodString>;
28
33
  }, z.core.$strict>;
package/dist/config.js CHANGED
@@ -4,6 +4,8 @@ const cliAgent = z.object({
4
4
  prompt: z.string().default(""),
5
5
  tools: z.array(z.string()).optional(),
6
6
  model: z.string().optional(),
7
+ /** `primary`/`all` makes the definition available as an ACTIVE (main-session) agent in `/agents`. */
8
+ mode: z.enum(["subagent", "primary", "all"]).optional(),
7
9
  });
8
10
  /** Options under `builtinPlugins.subagents`. */
9
11
  export const subagentsConfigSchema = z
@@ -37,6 +37,7 @@ export interface CliAgent {
37
37
  prompt: string;
38
38
  tools?: string[];
39
39
  model?: string;
40
+ mode?: "subagent" | "primary" | "all";
40
41
  }
41
42
  /**
42
43
  * Discovery, first match wins by name: CLI `--agents` > project `.alisio/agents` >
@@ -224,7 +224,13 @@ export async function discoverAgents(options) {
224
224
  agents.set(definition.name, definition);
225
225
  };
226
226
  for (const [name, spec] of Object.entries(options.cli ?? {})) {
227
- const { definition, warnings: w } = parseAgentDefinition(`---\n${JSON.stringify({ name, description: spec.description, ...(spec.tools ? { tools: spec.tools } : {}), ...(spec.model ? { model: spec.model } : {}) })}\n---\n${spec.prompt ?? ""}`, { source: "cli" });
227
+ const { definition, warnings: w } = parseAgentDefinition(`---\n${JSON.stringify({
228
+ name,
229
+ description: spec.description,
230
+ ...(spec.tools ? { tools: spec.tools } : {}),
231
+ ...(spec.model ? { model: spec.model } : {}),
232
+ ...(spec.mode ? { mode: spec.mode } : {}),
233
+ })}\n---\n${spec.prompt ?? ""}`, { source: "cli" });
228
234
  warnings.push(...w);
229
235
  if (definition)
230
236
  add(definition);
package/dist/index.d.ts CHANGED
@@ -2,6 +2,8 @@ import { type Plugin } from "@alisio/sdk";
2
2
  export type { AgentDefinition } from "./definitions.ts";
3
3
  export { BUILTIN_AGENTS, discoverAgents, parseAgentDefinition } from "./definitions.ts";
4
4
  export { SubagentManager } from "./manager.ts";
5
+ /** Plugin-state key under which the plugin publishes main-session-capable (mode primary/all) agents. */
6
+ export declare const MAIN_AGENTS_STATE_KEY = "mainAgents";
5
7
  export interface SubagentsPluginContext {
6
8
  workspace: string;
7
9
  stateHome: string;
package/dist/index.js CHANGED
@@ -11,6 +11,8 @@ import { SubagentManager } from "./manager.js";
11
11
  import { loadVersion } from "./version.js";
12
12
  export { BUILTIN_AGENTS, discoverAgents, parseAgentDefinition } from "./definitions.js";
13
13
  export { SubagentManager } from "./manager.js";
14
+ /** Plugin-state key under which the plugin publishes main-session-capable (mode primary/all) agents. */
15
+ export const MAIN_AGENTS_STATE_KEY = "mainAgents";
14
16
  const schema = (properties, required) => ({
15
17
  type: "object",
16
18
  properties,
@@ -46,6 +48,20 @@ export function createSubagentsPlugin(rawOptions, context) {
46
48
  plugins: api.resources.list("agents"),
47
49
  });
48
50
  warnings = found.warnings;
51
+ // Publish the main-session-capable definitions (mode `primary`/`all`) for the TUI's `/agents`
52
+ // picker. The host reads them through `pluginState`, so the TUI never imports this package.
53
+ // Only the fields the ACTIVE agent needs are persisted; prompts stay bounded.
54
+ api.state.set(MAIN_AGENTS_STATE_KEY, [...found.agents.values()]
55
+ .filter((a) => a.mode !== "subagent" && !a.hidden)
56
+ .map((a) => ({
57
+ name: a.name,
58
+ description: a.description,
59
+ prompt: a.prompt.slice(0, 24_000),
60
+ ...(a.model ? { model: a.model } : {}),
61
+ ...(a.readOnly ? { readOnly: true } : {}),
62
+ source: a.source,
63
+ ...(a.path ? { path: a.path } : {}),
64
+ })));
49
65
  const m = new SubagentManager(api, config, context, found.agents);
50
66
  manager = m;
51
67
  const status = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alisio/plugin-subagents",
3
- "version": "0.1.0-alpha.8",
3
+ "version": "0.1.0-alpha.9",
4
4
  "description": "Subagents for Alisio: delegate tasks to specialized agents in separate child sessions with narrowed permissions, parallel execution, git worktree isolation and a live agent tree. Built-in, disableable plugin.",
5
5
  "author": "Gustavo Gutiérrez",
6
6
  "license": "MIT",
@@ -46,10 +46,10 @@
46
46
  "zod": "4.6.5"
47
47
  },
48
48
  "peerDependencies": {
49
- "@alisio/sdk": "^0.1.0-alpha.7"
49
+ "@alisio/sdk": "^0.1.0-alpha.8"
50
50
  },
51
51
  "devDependencies": {
52
- "@alisio/sdk": "0.1.0-alpha.7"
52
+ "@alisio/sdk": "0.1.0-alpha.8"
53
53
  },
54
54
  "publishConfig": {
55
55
  "access": "public",