agent-lyceum 0.47.1 → 0.49.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.
@@ -30,6 +30,9 @@ export function buildClaudeSettings(project, agent, override) {
30
30
  allow.push("WebSearch");
31
31
  if (agent.allowWeb === "fetch")
32
32
  allow.push("WebFetch");
33
+ // MCP tools are opt-in by exact name: in dontAsk mode a connected server's tools are denied unless listed here.
34
+ if (agent.allowMcp)
35
+ allow.push(...agent.allowMcp);
33
36
  allow.push(rule("Edit", `${repo}/**`));
34
37
  for (const d of pol.allowDirs)
35
38
  allow.push(rule("Edit", `${d}/**`));
package/dist/config.d.ts CHANGED
@@ -28,6 +28,8 @@ export interface ResolvedAgent {
28
28
  canAskUser: boolean;
29
29
  /** Web access for this agent; undefined = not configured, so the runtime keeps its own default. */
30
30
  allowWeb?: WebLevel;
31
+ /** Exact MCP tool names added to the Claude Code allow list (agents run in dontAsk mode, so an unlisted MCP tool is denied). Unset = none. */
32
+ allowMcp?: string[];
31
33
  /** Spec 25 allowances; unset when none is requested (the only switch that keeps output identical). Paths are absolute, `~` expanded, not yet canonical. */
32
34
  sandbox?: SandboxAllowances;
33
35
  /** Ordered failover chain (runtime and model filled in); empty = no fallback. */
@@ -124,6 +126,7 @@ export declare function loadGlobal(home: string): {
124
126
  can_edit_agent_md?: boolean | undefined;
125
127
  can_ask_user?: boolean | undefined;
126
128
  allow_web?: "fetch" | "none" | "search" | undefined;
129
+ allow_mcp?: string[] | undefined;
127
130
  fallback?: {
128
131
  runtime?: "claude-code" | "codex" | "cursor" | undefined;
129
132
  model?: string | undefined;
@@ -191,6 +194,7 @@ export declare function loadProjectRaw(home: string, name: string): {
191
194
  can_edit_agent_md?: boolean | undefined;
192
195
  can_ask_user?: boolean | undefined;
193
196
  allow_web?: "fetch" | "none" | "search" | undefined;
197
+ allow_mcp?: string[] | undefined;
194
198
  fallback?: {
195
199
  runtime?: "claude-code" | "codex" | "cursor" | undefined;
196
200
  model?: string | undefined;
package/dist/config.js CHANGED
@@ -168,6 +168,7 @@ export function resolveProjectFrom(home, name, g, p) {
168
168
  const canEdit = pick("can_edit_agent_md");
169
169
  const canAsk = pick("can_ask_user");
170
170
  const allowWeb = pick("allow_web");
171
+ const allowMcp = pick("allow_mcp");
171
172
  const sandbox = resolveSandbox(agentName, pick("sandbox"));
172
173
  const shipRaw = pick("ship");
173
174
  const ship = shipRaw === true
@@ -180,6 +181,8 @@ export function resolveProjectFrom(home, name, g, p) {
180
181
  : undefined;
181
182
  if (!ship)
182
183
  delete sources.ship;
184
+ if (!allowMcp?.length)
185
+ delete sources.allow_mcp; // an empty list is "off": keep sources ⊆ values
183
186
  // `ship: false` is explicit off (same as unset for resolution): `pick` recorded a source but no
184
187
  // `ship` value is flattened, so drop it to keep "sources ⊆ values". Do not invent a `sources.ship`
185
188
  // default when unset: doctor --resolved fixtures and "sources ⊆ values" assume absent optional keys stay absent.
@@ -204,6 +207,7 @@ export function resolveProjectFrom(home, name, g, p) {
204
207
  canEditAgentMd: canEdit ?? isLead,
205
208
  canAskUser: canAsk ?? isLead,
206
209
  allowWeb,
210
+ ...(allowMcp?.length ? { allowMcp } : {}),
207
211
  ...(sandbox ? { sandbox } : {}),
208
212
  ...(ship ? { ship } : {}),
209
213
  fallback,
@@ -298,7 +302,7 @@ export function findProjectForCwd(home, cwd) {
298
302
  }
299
303
  return best?.name;
300
304
  }
301
- const AGENT_FIELDS = ["runtime", "model", "effort", "agent_md", "memory.global", "memory.project", "resume", "can_message", "can_edit_agent_md", "can_ask_user", "allow_web", "fallback", "sandbox", "ship"];
305
+ const AGENT_FIELDS = ["runtime", "model", "effort", "agent_md", "memory.global", "memory.project", "resume", "can_message", "can_edit_agent_md", "can_ask_user", "allow_web", "allow_mcp", "fallback", "sandbox", "ship"];
302
306
  /** Claude pattern metacharacters and control characters: refused in sandbox paths instead of escaped (spec 25.4.1). */
303
307
  const PATH_CHARS = /[*?[\]{}()!\\]/;
304
308
  const PATH_META = { test: (p) => PATH_CHARS.test(p) || [...p].some((c) => c.charCodeAt(0) < 32 || c.charCodeAt(0) === 127) };
@@ -415,6 +419,8 @@ export function flattenResolved(project) {
415
419
  v[`${p}.can_edit_agent_md`] = a.canEditAgentMd;
416
420
  v[`${p}.can_ask_user`] = a.canAskUser;
417
421
  v[`${p}.allow_web`] = a.allowWeb;
422
+ if (a.allowMcp)
423
+ v[`${p}.allow_mcp`] = a.allowMcp;
418
424
  if (a.ship)
419
425
  v[`${p}.ship`] = a.ship;
420
426
  if (a.fallback.length)
package/dist/prompt.js CHANGED
@@ -135,7 +135,7 @@ export function buildSoloSystemPrompt(project, agent) {
135
135
  ? "Do the task you are given. Your final reply text is printed to the user as your answer, so end with the answer or a short report of what you did; nothing else is delivered."
136
136
  : "");
137
137
  if (!isCall) {
138
- lines.push("## Finishing", `When the job is finished, create a Markdown file (any name ending in \`.md\`) directly inside \`${outboxDir(project, agent.name)}\` with this exact shape:`, "", "```", "---", "type: done", "subject: <short subject>", "outcome: completed|partial|blocked|failed", "---", "", "## Result", "## Files", "## Verification", "## Not done", "```", "", "That ends the run. `## Result` is the actual deliverable or conclusion (not just \"done\"), `## Files` the paths you created or changed, `## Verification` what you ran or checked and what it showed, `## Decisions` the choices you made that the task did not specify and the assumptions you relied on (or `None`), `## Not done` anything skipped or unverified (or `None`). Only `completed` means success and it needs all five headings; it should also carry `## Spot-check` (which sources you re-opened and what they showed) and `## Quiz` (questions the user should be able to answer if they read your work), which are not enforced but flagged when missing; if work remains or is blocked say `partial`/`blocked`/`failed` (those need only `## Result` and `## Not done`). A summary in your reply text is never delivered: without a `done` mail the run ends as idle with no report. " + OPEN_PR_RULE);
138
+ lines.push("## Finishing", `When the job is finished, create a Markdown file (any name ending in \`.md\`) directly inside \`${outboxDir(project, agent.name)}\` with this exact shape:`, "", "```", "---", "type: done", "subject: <short subject>", "outcome: completed|partial|blocked|failed", "---", "", "## Result", "## Files", "## Verification", "## Not done", "```", "", "That ends the run. `## Result` is the actual deliverable or conclusion (not just \"done\"), `## Files` the paths you created or changed, `## Verification` what you ran or checked and what it showed, `## Decisions` the choices you made that the task did not specify and the assumptions you relied on (or `None`), one entry per choice: what you chose, then what you rejected and why; leave follow-ups to `## Not done`, `## Not done` anything skipped or unverified (or `None`). Only `completed` means success and it needs all five headings; it should also carry `## Spot-check` (which sources you re-opened and what they showed) and `## Quiz` (questions the user should be able to answer if they read your work), which are not enforced but flagged when missing; if work remains or is blocked say `partial`/`blocked`/`failed` (those need only `## Result` and `## Not done`). A summary in your reply text is never delivered: without a `done` mail the run ends as idle with no report. " + OPEN_PR_RULE);
139
139
  }
140
140
  const shared = sharedDir(project);
141
141
  if (!isCall && shared)
@@ -276,7 +276,7 @@ export function buildSystemPrompt(project, agent) {
276
276
  : `Report results to the lead by mail; the lead decides what happens next.`, isLead
277
277
  ? "Each wake-up handles one message, except that several `reply`/`failure` messages waiting together are handed to you in one wake-up: weigh them together, then decide the next step once."
278
278
  : "Each wake-up handles one message, except that consecutive `reply`/`failure` messages on the same thread may be handed to you together: handle them together. Do the work it asks, then send the replies that are needed, then stop.", "Mail that repeats an earlier mail of yours to the same agent (same type, same text) is not sent again; you are told, and should wait for the answer or ask for something different instead of resending.", "", "## Message format", "The body of every `task` and `reply` must contain these `##` headings, exactly as written (write `None` under a heading if there is nothing to say).", "A `task` or `reply` missing a heading is sent back to you (at most twice per sender + type + subject); after that it is delivered with a warning flagged to the recipient.", "", `- \`task\`: ${REQUIRED_SECTIONS.task.map((h) => `\`## ${h}\``).join(", ")} (Upstream = id of the mail this task derives from, or \`None\`).`, `- \`reply\`: ${REQUIRED_SECTIONS.reply.map((h) => `\`## ${h}\``).join(", ")}.`, isLead
279
- ? "- `done`: your final report to the user (shown when the run ends, saved as `result.md`). Its frontmatter must contain `outcome: completed|partial|blocked|failed`, and the body the headings `## Result` (the actual deliverable or conclusion, not just \"done\"), `## Files` (paths created or changed), `## Verification` (what you ran or checked, and what it showed), `## Decisions` (choices you made that the task did not specify and assumptions you relied on, or `None`) and `## Not done` (anything skipped or unverified, or `None`). Only `completed` means success, and it needs all five headings and every checklist step ticked; it should also carry `## Spot-check` (which sources you re-opened and what they showed) and `## Quiz` (questions the user should be able to answer if they read your work), which are not enforced but flagged when missing; if work remains or is blocked, say `partial`/`blocked`/`failed` (those need only `## Result` and `## Not done`). A `done` that breaks this is sent back to you and does not end the run. " + OPEN_PR_RULE
279
+ ? "- `done`: your final report to the user (shown when the run ends, saved as `result.md`). Its frontmatter must contain `outcome: completed|partial|blocked|failed`, and the body the headings `## Result` (the actual deliverable or conclusion, not just \"done\"), `## Files` (paths created or changed), `## Verification` (what you ran or checked, and what it showed), `## Decisions` (choices you made that the task did not specify and assumptions you relied on, or `None`; one entry per choice: what you chose, then what you rejected and why; leave follow-ups to `## Not done`) and `## Not done` (anything skipped or unverified, or `None`). Only `completed` means success, and it needs all five headings and every checklist step ticked; it should also carry `## Spot-check` (which sources you re-opened and what they showed) and `## Quiz` (questions the user should be able to answer if they read your work), which are not enforced but flagged when missing; if work remains or is blocked, say `partial`/`blocked`/`failed` (those need only `## Result` and `## Not done`). A `done` that breaks this is sent back to you and does not end the run. " + OPEN_PR_RULE
280
280
  : "- `done` has no required headings.", ...(agent.canAskUser
281
281
  ? [
282
282
  "",
package/dist/schema.d.ts CHANGED
@@ -82,6 +82,7 @@ export declare const AgentPartial: z.ZodObject<{
82
82
  none: "none";
83
83
  search: "search";
84
84
  }>>;
85
+ allow_mcp: z.ZodOptional<z.ZodArray<z.ZodString>>;
85
86
  fallback: z.ZodOptional<z.ZodArray<z.ZodObject<{
86
87
  runtime: z.ZodOptional<z.ZodEnum<{
87
88
  "claude-code": "claude-code";
@@ -185,6 +186,7 @@ export declare const GlobalConfig: z.ZodObject<{
185
186
  none: "none";
186
187
  search: "search";
187
188
  }>>;
189
+ allow_mcp: z.ZodOptional<z.ZodArray<z.ZodString>>;
188
190
  fallback: z.ZodOptional<z.ZodArray<z.ZodObject<{
189
191
  runtime: z.ZodOptional<z.ZodEnum<{
190
192
  "claude-code": "claude-code";
@@ -315,6 +317,7 @@ export declare const ProjectConfig: z.ZodObject<{
315
317
  none: "none";
316
318
  search: "search";
317
319
  }>>;
320
+ allow_mcp: z.ZodOptional<z.ZodArray<z.ZodString>>;
318
321
  fallback: z.ZodOptional<z.ZodArray<z.ZodObject<{
319
322
  runtime: z.ZodOptional<z.ZodEnum<{
320
323
  "claude-code": "claude-code";
package/dist/schema.js CHANGED
@@ -76,6 +76,8 @@ export const AgentPartial = z
76
76
  can_edit_agent_md: z.boolean().optional(),
77
77
  can_ask_user: z.boolean().optional(),
78
78
  allow_web: z.enum(WEB_LEVELS).optional(),
79
+ /** Exact MCP tool names (`mcp__<server>__<tool>`) the agent may call without a prompt (Claude Code only). No wildcards, so write tools stay out unless named. */
80
+ allow_mcp: z.array(z.string().regex(/^mcp__[\w.-]+__[\w.-]+$/, "must be an exact MCP tool name like mcp__<server>__<tool> (no wildcards)")).optional(),
79
81
  fallback: z.array(FallbackEntryPartial).optional(),
80
82
  sandbox: SandboxPartial.optional(),
81
83
  /** Opt-in: wake writes a ship session and documents the `agent-lyceum ship` CLI (Claude Code and Codex). */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-lyceum",
3
- "version": "0.47.1",
3
+ "version": "0.49.0",
4
4
  "description": "Config + dispatcher for teams of Claude Code / Codex agents with scoped context and file-based mailboxes",
5
5
  "keywords": [
6
6
  "ai",