@soft-boy/agentschema 0.5.0 → 0.5.1

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/README.md CHANGED
@@ -14,7 +14,7 @@ my-agent/
14
14
  ├── system_prompt/
15
15
  │ └── rules.md # more of the system prompt
16
16
  ├── tools/
17
- │ ├── agent_toolset_20260401.md # the pre-built tools to enable
17
+ │ ├── agent_toolset_20260401.md # the computer tools to enable
18
18
  │ └── get_weather.md # a custom tool
19
19
  ├── skills/
20
20
  │ └── code-review/
@@ -100,7 +100,7 @@ The computer the agent runs on. The frontmatter uses the fields of a [Managed Ag
100
100
 
101
101
  Every `.md` file under `tools/`, at any depth, is a tool file, and subfolders are only for organizing. `agentschema tools create` writes any of the three kinds.
102
102
 
103
- **Pre-built tools** run in the agent's container. One file lists them, with a Permission of `always_allow`, `always_ask` or `auto`:
103
+ **Computer tools** run in the agent's container. One file lists them, with a Permission of `always_allow`, `always_ask` or `auto`:
104
104
 
105
105
  ```markdown
106
106
  ---
@@ -207,7 +207,7 @@ agentschema deploy [dir] # create or update the agent and everythin
207
207
  agentschema run [dir] # chat with the deployed agent in the terminal
208
208
  agentschema list # list the agents in your workspace
209
209
  agentschema delete <agent_id> # archive an agent
210
- agentschema tools create [dir] # add pre-built tools, a custom tool or an MCP server
210
+ agentschema tools create [dir] # add computer tools, a custom tool or an MCP server
211
211
  agentschema sessions list # list the sessions in your workspace
212
212
  agentschema sessions delete <id> # delete a session
213
213
  agentschema cred create [dir] # add a credential to a vault, asking a few questions
@@ -27,7 +27,7 @@ Commands:
27
27
  run [dir] Chat with the deployed agent in a new session, loading dir/.env for your tools
28
28
  list List the agents in your workspace
29
29
  delete <agent_id> Archive an agent (agents can't be deleted outright)
30
- tools <command> Add pre-built tools, custom tools and MCP servers (agentschema tools -h)
30
+ tools <command> Add computer tools, custom tools and MCP servers (agentschema tools -h)
31
31
  sessions <command> List and delete sessions (agentschema sessions -h)
32
32
  cred <command> Create and manage the credentials in vaults/ (agentschema cred -h)
33
33
 
@@ -43,11 +43,11 @@ Options:
43
43
  ${FOOTER}`;
44
44
  const TOOLS_USAGE = `Usage: agentschema tools <command> [options]
45
45
 
46
- Each tool is a file in tools/. The pre-built tools share one file, each custom tool has its own,
46
+ Each tool is a file in tools/. The computer tools share one file, each custom tool has its own,
47
47
  and so does each MCP server.
48
48
 
49
49
  Commands:
50
- create [dir] Add a tool: asks whether it's the pre-built tools, a custom tool or an
50
+ create [dir] Add a tool: asks whether it's the computer tools, a custom tool or an
51
51
  MCP server, then writes its file
52
52
 
53
53
  Options:
@@ -4,6 +4,7 @@ import { type Frontmatter, type MarkdownFile } from "./markdown.ts";
4
4
  import { type AgentbookCatalog, type Tool } from "./tools.ts";
5
5
  export declare const CHANNELS_DIR = "channels";
6
6
  export declare const ANYONE = "*";
7
+ export declare const CONTACTS = "contacts";
7
8
  export interface Channel extends MarkdownFile {
8
9
  file: string;
9
10
  name: string;
@@ -20,6 +21,11 @@ export interface ChannelType {
20
21
  hasGroups: boolean;
21
22
  expiresAfter?: string;
22
23
  allow: Check;
24
+ sendTo?: {
25
+ place: Check;
26
+ contacts: boolean;
27
+ anyone: boolean;
28
+ };
23
29
  fields: Record<string, ChannelField>;
24
30
  identity?: (data: Frontmatter) => string | null;
25
31
  }
@@ -61,5 +67,8 @@ export declare function checkChannels(channels: Channel[], { agent, systemPrompt
61
67
  };
62
68
  export declare function durationMs(value: unknown): number | null;
63
69
  export declare function channelSettings({ data }: Pick<Channel, "data">): ChannelSettings;
70
+ export declare function maySendTo({ sendTo }: Pick<ChannelSettings, "sendTo">, to: string, { isContact }?: {
71
+ isContact?: boolean;
72
+ }): boolean;
64
73
  export declare const channelSystem: (instance: ChannelSystemSource, channel: Pick<Channel, "body">) => string;
65
74
  export {};
@@ -8,13 +8,15 @@ import { AGENTBOOK, MCP_TOOLSET } from "./tools.js";
8
8
  // doesn't receive these messages and `run` shouldn't either. So nothing here is sent to the API.
9
9
  export const CHANNELS_DIR = "channels";
10
10
  export const ANYONE = "*";
11
+ // In `send_to`, everyone who has messaged the agent on the channel.
12
+ export const CONTACTS = "contacts";
11
13
  const DEFAULT_RESPOND_TO = ["direct", "mention"];
12
14
  const DEFAULT_EXPIRES_AFTER = "24h";
13
15
  // An email thread can go quiet for days and still be one conversation.
14
16
  const EMAIL_EXPIRES_AFTER = "7d";
15
17
  const RESPOND_TO = ["direct", "mention", "reply", "all"];
16
18
  const LIMITS = ["messages_per_sender_per_hour", "messages_per_day", "messages_sent_per_hour"];
17
- const SHARED_FIELDS = ["type", "enabled", "allow", "respond_to", "scope", "expires_after", "approvals", "limits", "greeting"];
19
+ const SHARED_FIELDS = ["type", "enabled", "allow", "respond_to", "scope", "expires_after", "approvals", "limits", "greeting", "send_to"];
18
20
  const MAX_GREETING = 1000;
19
21
  const MAX_SYSTEM_PROMPT = 100_000;
20
22
  const code = (value) => `\`${value}\``;
@@ -47,6 +49,8 @@ export const CHANNEL_TYPES = {
47
49
  approvals: ["deny", "sender"],
48
50
  hasGroups: true,
49
51
  allow: matches(/^(\d+|@[A-Za-z0-9_]{5,32})$/, "a numeric user ID or an @username"),
52
+ // A bot can only message a chat that has started it, so there's no one else to send to.
53
+ sendTo: { place: matches(/^-?\d+$/, "a numeric chat ID"), contacts: true, anyone: false },
50
54
  fields: {},
51
55
  },
52
56
  twilio: {
@@ -55,6 +59,7 @@ export const CHANNEL_TYPES = {
55
59
  approvals: ["deny", "sender"],
56
60
  hasGroups: false,
57
61
  allow: matches(PHONE, "a phone number like +14155550123"),
62
+ sendTo: { place: matches(PHONE, "a phone number like +14155550123"), contacts: true, anyone: true },
58
63
  fields: {
59
64
  transport: { required: true, check: oneOf("sms", "whatsapp") },
60
65
  from: { required: true, check: matches(PHONE, "a phone number like +14155550123") },
@@ -69,6 +74,7 @@ export const CHANNEL_TYPES = {
69
74
  hasGroups: false,
70
75
  expiresAfter: EMAIL_EXPIRES_AFTER,
71
76
  allow: EMAIL_ALLOW,
77
+ sendTo: { place: EMAIL_ALLOW, contacts: true, anyone: true },
72
78
  fields: {
73
79
  address: { required: true, check: matches(EMAIL, "an email address") },
74
80
  from_name: { check: text },
@@ -84,6 +90,7 @@ export const CHANNEL_TYPES = {
84
90
  hasGroups: false,
85
91
  expiresAfter: EMAIL_EXPIRES_AFTER,
86
92
  allow: EMAIL_ALLOW,
93
+ sendTo: { place: EMAIL_ALLOW, contacts: true, anyone: true },
87
94
  fields: {
88
95
  address: { check: matches(EMAIL, "an email address") },
89
96
  from_name: { check: text },
@@ -106,13 +113,13 @@ export const CHANNEL_TYPES = {
106
113
  approvals: ["deny", "sender"],
107
114
  hasGroups: true,
108
115
  allow: matches(DISCORD_ID, "a numeric user ID"),
116
+ sendTo: { place: matches(DISCORD_ID, "a numeric channel ID"), contacts: false, anyone: false },
109
117
  fields: {
110
118
  application_id: { required: true, check: matches(DISCORD_ID, "a numeric application ID") },
111
119
  public_key: { required: true, check: matches(/^[0-9a-f]{64}$/, "the 64-character public key") },
112
120
  guilds: { check: listOf(matches(DISCORD_ID, "a numeric server ID")) },
113
121
  channels: { check: listOf(matches(DISCORD_ID, "a numeric channel ID")) },
114
122
  dedicated_channels: { check: listOf(matches(DISCORD_ID, "a numeric channel ID")) },
115
- send_to: { check: listOf(matches(DISCORD_ID, "a numeric channel ID")) },
116
123
  command: { check: matches(/^[a-z0-9_-]{1,32}$/, "a slash command's name, like ask") },
117
124
  },
118
125
  identity: ({ application_id: id }) => id,
@@ -169,6 +176,7 @@ export function checkChannels(channels, { agent = { body: "" }, systemPrompt = [
169
176
  }
170
177
  checkAllow(data, type, err, warn);
171
178
  checkShared(data, type, err, warn);
179
+ checkSendTo(data, type, err, warn);
172
180
  for (const [field, { required, check }] of Object.entries(type.fields)) {
173
181
  if (data[field] === undefined) {
174
182
  if (required)
@@ -197,7 +205,8 @@ export function checkChannels(channels, { agent = { body: "" }, systemPrompt = [
197
205
  else
198
206
  identities.set(identity, channel.file);
199
207
  }
200
- if (Array.isArray(data.send_to)) {
208
+ // A Discord channel can only be in one file's `send_to`. An address or number can be in several.
209
+ if (data.type === "discord" && Array.isArray(data.send_to)) {
201
210
  for (const place of data.send_to) {
202
211
  if (typeof place !== "string")
203
212
  continue;
@@ -235,6 +244,45 @@ function checkAllow({ allow, approvals }, type, err, warn) {
235
244
  warn(`\`allow\`: ${entry} can change hands, because Telegram usernames can be given up and reclaimed; a numeric user ID is safer`);
236
245
  }
237
246
  }
247
+ // `send_to`: where the agent may send on its own, through a host's tool. A list of places, which can
248
+ // include "contacts", for everyone who has messaged the agent on the channel, or "*" for anywhere, alone.
249
+ // Email takes "*@" and a domain, for anyone there.
250
+ function checkSendTo({ send_to: sendTo, type: name, allow }, type, err, warn) {
251
+ if (sendTo === undefined)
252
+ return;
253
+ if (!type.sendTo)
254
+ return err(`\`send_to\` isn't available on ${name} yet`);
255
+ const { place, contacts, anyone } = type.sendTo;
256
+ if (sendTo === ANYONE || sendTo === CONTACTS) {
257
+ if (sendTo === ANYONE && !anyone)
258
+ return err(`\`send_to: "${ANYONE}"\` isn't available on ${name}${contacts ? `; use ${CONTACTS} for everyone who's messaged it` : "; list where it can send"}`);
259
+ if (sendTo === CONTACTS && !contacts)
260
+ return err(`\`send_to: ${CONTACTS}\` isn't available on ${name}; list where it can send`);
261
+ }
262
+ else if (!Array.isArray(sendTo)) {
263
+ return err(`\`send_to\` must be a list of where it can send${anyone ? `, or "${ANYONE}"` : ""}`);
264
+ }
265
+ else {
266
+ for (const entry of sendTo) {
267
+ if (entry === ANYONE)
268
+ return err(anyone ? `write \`send_to: "${ANYONE}"\` on its own, not in a list` : `\`send_to\` can't be "${ANYONE}" on ${name}`);
269
+ if (entry === CONTACTS) {
270
+ if (!contacts)
271
+ err(`\`send_to\`: ${CONTACTS} isn't available on ${name}`);
272
+ continue;
273
+ }
274
+ const problem = place(entry);
275
+ if (problem)
276
+ err(`\`send_to\`: ${JSON.stringify(entry)} ${problem}${contacts ? `, or ${CONTACTS}` : ""}`);
277
+ }
278
+ }
279
+ if (sendTo === ANYONE && name === "twilio") {
280
+ warn(`\`send_to: "${ANYONE}"\` lets the agent text any number. Texting people who haven't agreed to hear from you can break US law and carrier rules, so ${CONTACTS} or a list is safer`);
281
+ }
282
+ else if (sendTo === ANYONE && allow === ANYONE) {
283
+ warn(`anyone can message this channel, and \`send_to: "${ANYONE}"\` lets the agent send anywhere; a host should only let the owner's own conversations send to places that aren't listed`);
284
+ }
285
+ }
238
286
  function checkShared(data, type, err, warn) {
239
287
  if (data.enabled !== undefined && typeof data.enabled !== "boolean")
240
288
  err("`enabled` must be true or false");
@@ -286,7 +334,7 @@ function checkShared(data, type, err, warn) {
286
334
  }
287
335
  }
288
336
  // The tools that act through the owner's sign-ins and connections without anyone approving each call.
289
- // Pre-built tools aren't here, since they run in the session's own container. In a toolset's table, a
337
+ // Computer tools aren't here, since they run in the session's own container. In a toolset's table, a
290
338
  // blank permission means the file's default, which for an MCP server is the API's default of asking.
291
339
  function toolsThatRunUnasked(tools, toolsets) {
292
340
  const isOn = (row) => row.enabled.toLowerCase() === "true";
@@ -324,7 +372,7 @@ export function channelSettings({ data }) {
324
372
  allow: data.allow,
325
373
  respondTo: data.respond_to ?? DEFAULT_RESPOND_TO,
326
374
  dedicatedChannels: data.dedicated_channels ?? [],
327
- sendTo: data.send_to ?? [],
375
+ sendTo: data.send_to === undefined ? [] : Array.isArray(data.send_to) ? data.send_to : [data.send_to],
328
376
  scope: data.scope ?? type.scopes[0],
329
377
  expiresAfterMs: durationMs(data.expires_after ?? type.expiresAfter ?? DEFAULT_EXPIRES_AFTER),
330
378
  approvals: data.approvals ?? "deny",
@@ -332,6 +380,22 @@ export function channelSettings({ data }) {
332
380
  greeting: data.greeting ?? null,
333
381
  };
334
382
  }
383
+ // Whether a channel's `send_to` lets the agent send to `to`, given whether `to` has messaged the agent
384
+ // on that channel before. Email addresses are compared without regard to case.
385
+ export function maySendTo({ sendTo }, to, { isContact = false } = {}) {
386
+ if (sendTo.includes(ANYONE))
387
+ return true;
388
+ if (isContact && sendTo.includes(CONTACTS))
389
+ return true;
390
+ const address = to.toLowerCase();
391
+ return sendTo.some((place) => {
392
+ if (place === CONTACTS || place === ANYONE)
393
+ return false;
394
+ if (place.startsWith("*@"))
395
+ return address.endsWith(place.slice(1).toLowerCase());
396
+ return place.includes("@") ? place.toLowerCase() === address : place === to;
397
+ });
398
+ }
335
399
  // The system prompt for a conversation on this channel: the agent's, then the channel's own instructions.
336
400
  // A session can override `system` for itself, so a channel doesn't need its own copy of the agent.
337
401
  // `instance` is what checkFiles returns, so the agent's prompt includes system_prompt/. An agent alone,
package/dist/lib/check.js CHANGED
@@ -58,7 +58,7 @@ export function checkFiles(files, options = {}) {
58
58
  checkScheduled(scheduled, { tools }, errors, warnings);
59
59
  const vaultFiles = vaults.flatMap((v) => [...(v.file ? [[`${v.path}/${VAULT_FILE}`, v.file]] : []), ...v.credentials.map((c) => [c.file, c])]);
60
60
  const skillTexts = skills.flatMap((s) => s.files.map((f) => [`${s.path}/${f.rel}`, { raw: textOf(f.bytes) }]));
61
- const scanned = [[AGENT_FILE, agent], [env?.file, env], ...tools.map((t) => [t.file, t]), ...vaultFiles, ...skillTexts, ...channels.map((c) => [c.file, c]), ...scheduled.map((t) => [t.file, t]), ...systemPrompt.map((p) => [p.file, { raw: p.text }])];
61
+ const scanned = [[AGENT_FILE, agent], [env?.file, env], ...tools.flatMap((t) => [[t.file, t], ...(t.members ?? []).map((m) => [m.file, m])]), ...vaultFiles, ...skillTexts, ...channels.map((c) => [c.file, c]), ...scheduled.map((t) => [t.file, t]), ...systemPrompt.map((p) => [p.file, { raw: p.text }])];
62
62
  for (const [file, parsed] of scanned) {
63
63
  if (!parsed)
64
64
  continue;
@@ -1,4 +1,4 @@
1
- export { ANYONE, CHANNELS_DIR, CHANNEL_TYPES, channelSettings, channelSystem, durationMs, readChannels } from "./channels.ts";
1
+ export { ANYONE, CHANNELS_DIR, CHANNEL_TYPES, CONTACTS, channelSettings, channelSystem, durationMs, maySendTo, readChannels } from "./channels.ts";
2
2
  export { checkFiles } from "./check.ts";
3
3
  export { bytesOf, isIgnoredPath, pathsUnder, textOf } from "./files.ts";
4
4
  export { AGENT_FILE, COMPUTER_FILE, ENVIRONMENT_KEY, OLD_COMPUTER_FILE, agentBody, envBody, environmentEntry, readInstance, upgradeLock, } from "./instance.ts";
@@ -8,7 +8,7 @@ export { SCHEDULED_DIR, cronProblem, isTimeZone, readScheduled, taskBody, taskKe
8
8
  export { SYSTEM_PROMPT_DIR, readSystemPrompt, systemPromptOf } from "./system-prompt.ts";
9
9
  export { MAX_UPLOAD_BYTES, SKILLS_DIR, SKILL_FILE, readSkills, skillKey, skillRefs } from "./skills.ts";
10
10
  export { agentMessageText, textStream } from "./stream.ts";
11
- export { AGENTBOOK, MCP_TOOLSET, POLICIES, PREBUILT_TOOLS, TOOLSET, TOOLSET_FILE, TOOLS_DIR, agentbookTools, compileTools, mcpToolsetFile, readTools, } from "./tools.ts";
11
+ export { AGENTBOOK, MCP_TOOLSET, OWNER_NOTES, POLICIES, COMPUTER_TOOLS, PREBUILT_TOOLS, TOOLSET, TOOLSET_FILE, TOOLSET_FOLDER_FILE, TOOLS_DIR, agentbookTools, agentbookToolsetFiles, compileTools, mcpToolsetFile, readTools, } from "./tools.ts";
12
12
  export { CREDENTIAL_TYPES, ENV_VAR, MCP_OAUTH, SECRET_FIELDS, TOKEN_ENDPOINT_AUTH, VAULTS_DIR, VAULT_FILE, changedImmutableFields, credentialCreateBody, credentialKey, credentialSettings, readVaults, secretsNeeded, vaultBody, vaultKey, } from "./vaults.ts";
13
13
  export type { Channel, ChannelSettings, ChannelSystemSource, ChannelType, CheckChannelsOptions, ReadChannelsResult, } from "./channels.ts";
14
14
  export type { CheckOptions, CheckResult } from "./check.ts";
@@ -20,5 +20,5 @@ export type { ReadScheduledResult, ScheduledTask, TaskBody, TaskSettings } from
20
20
  export type { ReadSkillsResult, Skill, SkillFile, SkillRef } from "./skills.ts";
21
21
  export type { AgentMessageEvent, ContentBlock, StreamEvent, TextStream } from "./stream.ts";
22
22
  export type { ReadSystemPromptResult, SystemPromptPart } from "./system-prompt.ts";
23
- export type { AgentbookCatalog, AgentbookTool, AgentbookToolDefinition, CheckToolsOptions, CompileOptions, CompiledTool, InputSchema, JsonSchema, ReadToolsResult, Tool, ToolCode, ToolParam, ToolRow, } from "./tools.ts";
23
+ export type { AgentbookCatalog, AgentbookTool, AgentbookToolDefinition, CheckToolsOptions, CompileOptions, CompiledTool, InputSchema, JsonSchema, ReadToolsResult, Tool, ToolCode, ToolMember, ToolParam, ToolRow, } from "./tools.ts";
24
24
  export type { Credential, CredentialSecrets, CredentialSettings, ReadVaultsResult, SecretsNeeded, Vault, VaultBody, } from "./vaults.ts";
package/dist/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // The browser-safe core of agentschema: no Node APIs, and `yaml` as the only dependency. It works
2
2
  // on file maps (see files.js), so it doesn't care whether an agent lives on disk or in a database.
3
- export { ANYONE, CHANNELS_DIR, CHANNEL_TYPES, channelSettings, channelSystem, durationMs, readChannels } from "./channels.js";
3
+ export { ANYONE, CHANNELS_DIR, CHANNEL_TYPES, CONTACTS, channelSettings, channelSystem, durationMs, maySendTo, readChannels } from "./channels.js";
4
4
  export { checkFiles } from "./check.js";
5
5
  export { bytesOf, isIgnoredPath, pathsUnder, textOf } from "./files.js";
6
6
  export { AGENT_FILE, COMPUTER_FILE, ENVIRONMENT_KEY, OLD_COMPUTER_FILE, agentBody, envBody, environmentEntry, readInstance, upgradeLock, } from "./instance.js";
@@ -10,5 +10,5 @@ export { SCHEDULED_DIR, cronProblem, isTimeZone, readScheduled, taskBody, taskKe
10
10
  export { SYSTEM_PROMPT_DIR, readSystemPrompt, systemPromptOf } from "./system-prompt.js";
11
11
  export { MAX_UPLOAD_BYTES, SKILLS_DIR, SKILL_FILE, readSkills, skillKey, skillRefs } from "./skills.js";
12
12
  export { agentMessageText, textStream } from "./stream.js";
13
- export { AGENTBOOK, MCP_TOOLSET, POLICIES, PREBUILT_TOOLS, TOOLSET, TOOLSET_FILE, TOOLS_DIR, agentbookTools, compileTools, mcpToolsetFile, readTools, } from "./tools.js";
13
+ export { AGENTBOOK, MCP_TOOLSET, OWNER_NOTES, POLICIES, COMPUTER_TOOLS, PREBUILT_TOOLS, TOOLSET, TOOLSET_FILE, TOOLSET_FOLDER_FILE, TOOLS_DIR, agentbookTools, agentbookToolsetFiles, compileTools, mcpToolsetFile, readTools, } from "./tools.js";
14
14
  export { CREDENTIAL_TYPES, ENV_VAR, MCP_OAUTH, SECRET_FIELDS, TOKEN_ENDPOINT_AUTH, VAULTS_DIR, VAULT_FILE, changedImmutableFields, credentialCreateBody, credentialKey, credentialSettings, readVaults, secretsNeeded, vaultBody, vaultKey, } from "./vaults.js";
@@ -1,6 +1,6 @@
1
1
  import { stringify } from "yaml";
2
2
  import { AGENT_FILE, COMPUTER_FILE } from "./instance.js";
3
- import { PREBUILT_TOOLS, TOOLSET, TOOLSET_FILE, TOOLS_DIR } from "./tools.js";
3
+ import { COMPUTER_TOOLS, TOOLSET, TOOLSET_FILE, TOOLS_DIR } from "./tools.js";
4
4
  export const MODELS = ["claude-opus-5-5", "claude-sonnet-5-5", "claude-haiku-5-5"];
5
5
  export const NETWORKING = ["limited", "unrestricted"];
6
6
  // The answers used for a new agent called `name`, when a question is skipped.
@@ -18,7 +18,7 @@ export function defaultAnswers(name) {
18
18
  };
19
19
  }
20
20
  // Returns { path: text } for a set of answers: agent.md, env.md, and tools/agent_toolset_20260401.md
21
- // listing every pre-built tool when the agent gets them.
21
+ // listing every computer tool when the agent gets them.
22
22
  export function scaffold(answers) {
23
23
  const agent = { name: answers.name, model: answers.model };
24
24
  const networking = { type: answers.networking };
@@ -33,11 +33,11 @@ export function scaffold(answers) {
33
33
  [COMPUTER_FILE]: `---\n${stringify(env)}---\nCloud container with ${access}.\n`,
34
34
  };
35
35
  if (answers.tools) {
36
- files[`${TOOLS_DIR}/${TOOLSET_FILE}`] = builtInFile(PREBUILT_TOOLS, PREBUILT_TOOLS, answers.permission);
36
+ files[`${TOOLS_DIR}/${TOOLSET_FILE}`] = builtInFile(COMPUTER_TOOLS, COMPUTER_TOOLS, answers.permission);
37
37
  }
38
38
  return files;
39
39
  }
40
- // The pre-built toolset file, with a row for each of `names`: on if it's in `enabled`, each with
40
+ // The computer toolset file, with a row for each of `names`: on if it's in `enabled`, each with
41
41
  // `permission`, so what's chosen is there to read and change. `auto` is what the API recommends for
42
42
  // these tools: Anthropic judges each call, and asks when it can't tell.
43
43
  export function builtInFile(names, enabled = names, permission = "auto") {
@@ -5,6 +5,9 @@ export declare const TOOLSET = "agent_toolset_20260401";
5
5
  export declare const TOOLSET_FILE = "agent_toolset_20260401.md";
6
6
  export declare const MCP_TOOLSET = "mcp_toolset";
7
7
  export declare const AGENTBOOK = "agentbook";
8
+ export declare const TOOLSET_FOLDER_FILE = "toolset.md";
9
+ export declare const COMPUTER_TOOLS: string[];
10
+ /** @deprecated Their old name: use COMPUTER_TOOLS. */
8
11
  export declare const PREBUILT_TOOLS: string[];
9
12
  export declare const POLICIES: string[];
10
13
  export interface ToolParam {
@@ -18,6 +21,10 @@ export interface ToolRow {
18
21
  enabled: string;
19
22
  permission?: string;
20
23
  }
24
+ export interface ToolMember extends MarkdownFile {
25
+ file: string;
26
+ name: string;
27
+ }
21
28
  export interface ToolCode {
22
29
  lang: string;
23
30
  source: string;
@@ -28,6 +35,7 @@ export interface Tool extends MarkdownFile {
28
35
  params: ToolParam[] | null;
29
36
  code: ToolCode | null;
30
37
  rows: ToolRow[] | null;
38
+ members?: ToolMember[];
31
39
  path?: string;
32
40
  }
33
41
  export interface ReadToolsResult {
@@ -47,8 +55,10 @@ export type AgentbookCatalog = Record<string, {
47
55
  }>;
48
56
  export interface AgentbookTool extends AgentbookToolDefinition {
49
57
  file: string;
58
+ group: string;
50
59
  toolset: string;
51
60
  permission: string;
61
+ notes: string;
52
62
  }
53
63
  export interface CompileOptions {
54
64
  toolsets?: AgentbookCatalog;
@@ -101,5 +111,17 @@ export declare function mcpToolsetFile({ name, tools, permission }: {
101
111
  permission?: string;
102
112
  }): string;
103
113
  export declare function agentbookTools(tools: Tool[], toolsets?: AgentbookCatalog): AgentbookTool[];
114
+ export declare const OWNER_NOTES = "Notes from the agent's owner:";
115
+ export declare function agentbookToolsetFiles({ folder, toolset, note, tools }: {
116
+ folder: string;
117
+ toolset: string;
118
+ note?: string;
119
+ tools: {
120
+ name: string;
121
+ permission?: string;
122
+ enabled?: boolean;
123
+ notes?: string;
124
+ }[];
125
+ }): FileMap;
104
126
  export declare function compileTools(tools: Tool[], { toolsets }?: CompileOptions): CompiledTool[];
105
127
  export declare const wrapToolCode: (source: string) => string;
package/dist/lib/tools.js CHANGED
@@ -6,7 +6,12 @@ export const TOOLSET = "agent_toolset_20260401";
6
6
  export const TOOLSET_FILE = `${TOOLSET}.md`;
7
7
  export const MCP_TOOLSET = "mcp_toolset";
8
8
  export const AGENTBOOK = "agentbook";
9
- export const PREBUILT_TOOLS = ["bash", "edit", "glob", "grep", "read", "web_fetch", "web_search", "write"];
9
+ // A folder of an agentbook toolset's tools has this file, saying which toolset it is.
10
+ export const TOOLSET_FOLDER_FILE = "toolset.md";
11
+ // The tools Claude runs on the agent's computer, its container, which computer.md describes.
12
+ export const COMPUTER_TOOLS = ["bash", "edit", "glob", "grep", "read", "web_fetch", "web_search", "write"];
13
+ /** @deprecated Their old name: use COMPUTER_TOOLS. */
14
+ export const PREBUILT_TOOLS = COMPUTER_TOOLS;
10
15
  export const POLICIES = ["always_allow", "always_ask", "auto"];
11
16
  // agentbook tools reach the API as custom tools, which have no permission policy: agentbook
12
17
  // enforces these itself, and has nothing like the API's per-call `auto` judgement.
@@ -14,7 +19,7 @@ const AGENTBOOK_POLICIES = ["always_allow", "always_ask"];
14
19
  const TYPES = ["string", "number", "integer", "boolean", "object", "array"];
15
20
  // Reads every .md file under tools/, in any subfolder, sorted by name. Folders are only for
16
21
  // organizing: a custom tool's name is its file name, and its path isn't compiled into anything.
17
- // The pre-built toolset is one file (by convention tools/agent_toolset_20260401.md) that lists its tools.
22
+ // The computer toolset is one file (by convention tools/agent_toolset_20260401.md) that lists its tools.
18
23
  // No tools/ folder means no tools.
19
24
  // Returns { tools, errors }; a tool file that can't be parsed has an entry in errors.
20
25
  export function readTools(files) {
@@ -22,17 +27,71 @@ export function readTools(files) {
22
27
  return { tools: [], errors: [`${TOOLS_DIR}: not a directory`] };
23
28
  const tools = [];
24
29
  const errors = [];
25
- for (const file of pathsUnder(files, TOOLS_DIR).filter((path) => path.endsWith(".md"))) {
30
+ const parse = (file) => {
26
31
  try {
27
- const parsed = parseMarkdown(textOf(files[file]), file);
28
- const name = file.slice(file.lastIndexOf("/") + 1, -".md".length);
29
- tools.push({ file, name, ...parsed, ...parseSections(parsed.body, file) });
32
+ return parseMarkdown(textOf(files[file]), file);
30
33
  }
31
34
  catch (err) {
32
35
  if (!(err instanceof FileError))
33
36
  throw err;
34
37
  errors.push(err.message);
38
+ return null;
35
39
  }
40
+ };
41
+ // A tool file, with its tables and code. A table that can't be read is an error too.
42
+ const asTool = (file, name, parsed, extra = {}) => {
43
+ try {
44
+ return { file, name, ...parsed, ...parseSections(parsed.body, file), ...extra };
45
+ }
46
+ catch (err) {
47
+ if (!(err instanceof FileError))
48
+ throw err;
49
+ errors.push(err.message);
50
+ return null;
51
+ }
52
+ };
53
+ const paths = pathsUnder(files, TOOLS_DIR).filter((path) => path.endsWith(".md"));
54
+ const folderOf = (path) => path.slice(0, path.lastIndexOf("/"));
55
+ const nameOf = (path) => path.slice(path.lastIndexOf("/") + 1).replace(/\.md$/, "");
56
+ // A folder with a toolset.md of `type: agentbook` is one toolset, and every other file in it is one of
57
+ // its tools. tools/ itself can't be one, since its files are tools of every kind.
58
+ const folders = new Set();
59
+ for (const path of paths) {
60
+ if (!path.endsWith(`/${TOOLSET_FOLDER_FILE}`) || folderOf(path) === TOOLS_DIR)
61
+ continue;
62
+ const parsed = parse(path);
63
+ if (!parsed || parsed.data.type !== AGENTBOOK)
64
+ continue;
65
+ const folder = folderOf(path);
66
+ folders.add(folder);
67
+ const members = [];
68
+ for (const file of paths) {
69
+ if (file === path || !file.startsWith(`${folder}/`))
70
+ continue;
71
+ if (folderOf(file) !== folder) {
72
+ errors.push(`${file}: a toolset's folder holds its tools' files directly, without folders inside it`);
73
+ continue;
74
+ }
75
+ // A tool's file can be only notes, without properties.
76
+ const text = textOf(files[file]).replace(/^\uFEFF/, "");
77
+ const member = /^---\r?\n/.test(text) ? parse(file) : { data: {}, body: text.trim(), raw: text };
78
+ if (member)
79
+ members.push({ file, name: nameOf(file), ...member });
80
+ }
81
+ members.sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
82
+ const rows = members.map(({ name, data }) => ({ name, enabled: data.enabled === false ? "false" : "true", permission: typeof data.permission === "string" ? data.permission : "" }));
83
+ const tool = asTool(path, nameOf(folder), parsed, { rows, members });
84
+ if (tool)
85
+ tools.push(tool);
86
+ }
87
+ const inFolder = (path) => [...folders].some((folder) => path.startsWith(`${folder}/`));
88
+ for (const file of paths) {
89
+ if (inFolder(file))
90
+ continue;
91
+ const parsed = parse(file);
92
+ const tool = parsed && asTool(file, nameOf(file), parsed);
93
+ if (tool)
94
+ tools.push(tool);
36
95
  }
37
96
  // Names must be unique across folders, since the folders are dropped.
38
97
  for (const [type, what] of [["custom", "tool"], [MCP_TOOLSET, "MCP server"], [AGENTBOOK, "agentbook toolset"]]) {
@@ -41,9 +100,14 @@ export function readTools(files) {
41
100
  errors.push(`${TOOLS_DIR}: more than one ${what} is named \`${name}\` (${same.map((t) => t.file).join(", ")})`);
42
101
  }
43
102
  }
103
+ for (const [toolset, same] of groupBy(tools.filter((t) => t.data.type === AGENTBOOK && typeof t.data.toolset === "string"), (t) => t.data.toolset)) {
104
+ if (same.length > 1 && new Set(same.map((t) => t.name)).size > 1) {
105
+ errors.push(`${TOOLS_DIR}: more than one file turns on the agentbook toolset \`${toolset}\` (${same.map((t) => t.file).join(", ")})`);
106
+ }
107
+ }
44
108
  const toolsets = tools.filter((t) => t.data.type === TOOLSET);
45
109
  if (toolsets.length > 1) {
46
- errors.push(`${TOOLS_DIR}: more than one \`${TOOLSET}\` file (${toolsets.map((t) => t.file).join(", ")}); list every pre-built tool in one file`);
110
+ errors.push(`${TOOLS_DIR}: more than one \`${TOOLSET}\` file (${toolsets.map((t) => t.file).join(", ")}); list every computer tool in one file`);
47
111
  }
48
112
  return { tools: tools.sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0)), errors };
49
113
  }
@@ -148,11 +212,11 @@ export function checkTools(tools, errors, warnings = [], options = {}) {
148
212
  extra(["type", "name", "description"]);
149
213
  }
150
214
  else if (type === AGENTBOOK) {
151
- checkAgentbook(tool, err, (msg) => warnings.push(`${tool.file}: ${msg}`), options);
215
+ checkAgentbook(tool, err, (msg) => warnings.push(`${tool.file}: ${msg}`), options, (file, msg) => errors.push(`${file}: ${msg}`));
152
216
  extra(["type", "toolset"]);
153
217
  }
154
218
  else {
155
- err(`\`type\` must be \`${TOOLSET}\` (the pre-built tools), \`${MCP_TOOLSET}\` (an MCP server), \`custom\` or \`${AGENTBOOK}\``);
219
+ err(`\`type\` must be \`${TOOLSET}\` (the computer tools), \`${MCP_TOOLSET}\` (an MCP server), \`custom\` or \`${AGENTBOOK}\``);
156
220
  }
157
221
  }
158
222
  }
@@ -188,28 +252,54 @@ function checkMcpToolset(tool, err) {
188
252
  }
189
253
  // A toolset from agentbook's catalog. `## Tools` turns its tools on one by one, so a tool without
190
254
  // a row is off: a new tool in the catalog never reaches a deployed agent by itself.
191
- function checkAgentbook(tool, err, warn, { toolsets }) {
255
+ //
256
+ // It's either one file with a `## Tools` table, named after the toolset, or a folder: a toolset.md, and a
257
+ // file for each tool, named after it, whose body is notes for the agent. A tool without a row, or a
258
+ // file, is off.
259
+ function checkAgentbook(tool, err, warn, { toolsets }, errAt) {
192
260
  const { toolset } = tool.data;
193
261
  if (typeof toolset !== "string" || toolset === "")
194
262
  return err("`toolset` is required");
195
- if (toolset !== tool.name)
196
- err(`\`toolset\` must match the file name (${tool.name})`);
197
- if (!tool.rows)
198
- err("a `## Tools` table listing the tools to enable is required");
263
+ if (tool.members) {
264
+ const hasTable = /^##\s+tools\s*$/im.test(tool.body);
265
+ if (hasTable)
266
+ err("a toolset's folder lists its tools as files beside this one, not as a `## Tools` table");
267
+ }
268
+ else {
269
+ if (toolset !== tool.name)
270
+ err(`\`toolset\` must match the file name (${tool.name})`);
271
+ if (!tool.rows)
272
+ err("a `## Tools` table listing the tools to enable is required");
273
+ }
199
274
  if (!toolsets)
200
275
  warn("this toolset runs on agentbook, so `agentschema deploy` can't deploy it");
201
276
  else if (!Object.hasOwn(toolsets, toolset))
202
277
  err(`\`${toolset}\` isn't an agentbook toolset; use ${Object.keys(toolsets).join(", ")}`);
203
278
  const known = toolsets && Object.hasOwn(toolsets, toolset) ? toolsets[toolset].tools.map((t) => t.name) : null;
204
- checkRows(tool.rows ?? [], err, { known, what: `a tool in \`${toolset}\``, policies: AGENTBOOK_POLICIES });
279
+ if (!tool.members)
280
+ return checkRows(tool.rows ?? [], err, { known, what: `a tool in \`${toolset}\``, policies: AGENTBOOK_POLICIES });
281
+ for (const member of tool.members) {
282
+ const memberErr = (msg) => errAt(member.file, msg);
283
+ if (known && !known.includes(member.name))
284
+ memberErr(`\`${member.name}\` is not a tool in \`${toolset}\`; use ${known.join(", ")}`);
285
+ const { enabled, permission } = member.data;
286
+ if (enabled !== undefined && typeof enabled !== "boolean")
287
+ memberErr("`enabled` must be true or false");
288
+ if (permission !== undefined && permission !== null && !AGENTBOOK_POLICIES.includes(permission)) {
289
+ memberErr(`\`permission\` must be ${AGENTBOOK_POLICIES.join(" or ")}, or left out`);
290
+ }
291
+ for (const key of Object.keys(member.data))
292
+ if (!["enabled", "permission"].includes(key))
293
+ memberErr(`unknown field \`${key}\``);
294
+ }
205
295
  }
206
296
  function checkToolset(tool, err) {
207
297
  if (!tool.rows) {
208
- // 0.2.0 had one file per pre-built tool, with no table.
209
- const hint = PREBUILT_TOOLS.includes(tool.name) ? `; since 0.2.1 all pre-built tools go in one file, ${TOOLS_DIR}/${TOOLSET_FILE}` : "";
210
- return err(`a \`## Tools\` table listing the pre-built tools to enable is required${hint}`);
298
+ // 0.2.0 had one file per computer tool, with no table.
299
+ const hint = COMPUTER_TOOLS.includes(tool.name) ? `; since 0.2.1 all computer tools go in one file, ${TOOLS_DIR}/${TOOLSET_FILE}` : "";
300
+ return err(`a \`## Tools\` table listing the computer tools to enable is required${hint}`);
211
301
  }
212
- checkRows(tool.rows, err, { known: PREBUILT_TOOLS, what: "a pre-built tool" });
302
+ checkRows(tool.rows, err, { known: COMPUTER_TOOLS, what: "a computer tool" });
213
303
  }
214
304
  // The rows of a `## Tools` table. `known` is the list of valid tool names, when there is one.
215
305
  function checkRows(rows, err, { known, what, policies = POLICIES }) {
@@ -235,8 +325,8 @@ function checkCustom(tool, err) {
235
325
  err(`\`name\` must match the file name (${tool.name})`);
236
326
  if (!/^[a-zA-Z0-9_-]{1,64}$/.test(tool.name))
237
327
  err("the name may only use letters, digits, _ and -, up to 64 characters");
238
- if (PREBUILT_TOOLS.includes(tool.name))
239
- err(`\`${tool.name}\` is a pre-built tool's name; the API rejects custom tools that reuse one`);
328
+ if (COMPUTER_TOOLS.includes(tool.name))
329
+ err(`\`${tool.name}\` is a computer tool's name; the API rejects custom tools that reuse one`);
240
330
  if (/^(mcp__|ant__)/.test(tool.name))
241
331
  err("custom tool names can't start with mcp__ or ant__");
242
332
  if (typeof description !== "string" || description.trim() === "")
@@ -285,9 +375,10 @@ export function mcpToolsetFile({ name, tools = [], permission = "always_ask" })
285
375
  front.default_config = { permission_policy: { type: permission } };
286
376
  return `---\n${stringify(front)}---\n\nEvery tool the server offers is on. Its tools get listed here once it's been signed in to.\n`;
287
377
  }
288
- // The agentbook tools a folder turns on, as { file, toolset, name, description, input_schema,
289
- // permission }. `toolsets` is the catalog, { [toolset]: { tools: [{ name, description, input_schema }] } }.
290
- // A blank permission means `always_ask`, the safe choice for a tool with no policy of its own.
378
+ // The agentbook tools a folder turns on, as { file, group, toolset, name, description, input_schema,
379
+ // permission, notes }. `toolsets` is the catalog, { [toolset]: { tools: [{ name, description,
380
+ // input_schema }] } }. A blank permission means `always_ask`, the safe choice for a tool with no policy of
381
+ // its own. A tool's own file in a toolset folder can add notes, which follow the catalog's description.
291
382
  export function agentbookTools(tools, toolsets = {}) {
292
383
  return byName(tools.filter((t) => t.data.type === AGENTBOOK)).flatMap((tool) => {
293
384
  const { toolset } = tool.data;
@@ -297,18 +388,39 @@ export function agentbookTools(tools, toolsets = {}) {
297
388
  const row = tool.rows?.find((r) => r.name === definition.name);
298
389
  if (row?.enabled.toLowerCase() !== "true")
299
390
  return [];
300
- return [{ ...definition, file: tool.file, toolset, permission: row.permission || "always_ask" }];
391
+ const member = tool.members?.find((m) => m.name === definition.name);
392
+ const notes = member?.body.trim() ?? "";
393
+ const description = notes ? `${definition.description}\n\n${OWNER_NOTES}\n${notes}` : definition.description;
394
+ return [{ ...definition, description, file: member?.file ?? tool.file, group: tool.name, toolset, permission: row.permission || "always_ask", notes }];
301
395
  });
302
396
  });
303
397
  }
304
- // The tools list sent to the API, each kind sorted by name: the pre-built toolset with a config
398
+ // What comes before a tool's notes from its file, in the description the agent gets.
399
+ export const OWNER_NOTES = "Notes from the agent's owner:";
400
+ // The files of an agentbook toolset as a folder: tools/<folder>/toolset.md, saying which toolset, with
401
+ // `note` for people in its body, and a file for each tool in `tools`, with its permission and notes.
402
+ export function agentbookToolsetFiles({ folder, toolset, note = "", tools }) {
403
+ const dir = `${TOOLS_DIR}/${folder}`;
404
+ const files = { [`${dir}/${TOOLSET_FOLDER_FILE}`]: `---\n${stringify({ type: AGENTBOOK, toolset })}---\n${note ? `\n${note.trim()}\n` : ""}` };
405
+ for (const { name, permission, enabled, notes = "" } of tools) {
406
+ const front = {};
407
+ if (enabled === false)
408
+ front.enabled = false;
409
+ if (permission)
410
+ front.permission = permission;
411
+ const head = Object.keys(front).length > 0 ? `---\n${stringify(front)}---\n` : "";
412
+ files[`${dir}/${name}.md`] = `${head}${notes ? `${head ? "\n" : ""}${notes.trim()}\n` : ""}`;
413
+ }
414
+ return files;
415
+ }
416
+ // The tools list sent to the API, each kind sorted by name: the computer toolset with a config
305
417
  // for each row of its table (tools it doesn't list keep the API's defaults), then a toolset for
306
418
  // each MCP server, then the custom tools, and last agentbook's tools, which reach the API as
307
419
  // custom tools. Only their name, description and input schema are sent.
308
420
  export function compileTools(tools, { toolsets } = {}) {
309
421
  const compiled = [];
310
422
  const toolset = tools.find((t) => t.data.type === TOOLSET);
311
- // check requires the pre-built toolset's table, so its rows are there.
423
+ // check requires the computer toolset's table, so its rows are there.
312
424
  if (toolset)
313
425
  compiled.push({ type: TOOLSET, configs: configs(toolset.rows) });
314
426
  for (const tool of byName(tools.filter((t) => t.data.type === MCP_TOOLSET))) {
package/dist/src/init.js CHANGED
@@ -23,7 +23,7 @@ export async function init(dir, { yes = false, input = process.stdin, output = p
23
23
  mkdirSync(dirname(resolve(dir, file)), { recursive: true });
24
24
  writeFileSync(resolve(dir, file), text);
25
25
  }
26
- const tools = answers.tools ? `, and ${dir}/${TOOLS_DIR}/${TOOLSET_FILE} with the pre-built tools (set Enabled to false to turn one off)` : "";
26
+ const tools = answers.tools ? `, and ${dir}/${TOOLS_DIR}/${TOOLSET_FILE} with the computer tools (set Enabled to false to turn one off)` : "";
27
27
  output.write(`\nCreated ${dir}/${AGENT_FILE} and ${dir}/${COMPUTER_FILE}${tools}.\n\nNext:\n`);
28
28
  output.write(` agentschema deploy ${dir}\n agentschema run ${dir}\n`);
29
29
  return files;
@@ -8,8 +8,8 @@ import { AGENT_FILE, COMPUTER_FILE, OLD_COMPUTER_FILE } from "../lib/instance.js
8
8
  import { builtInFile } from "../lib/scaffold.js";
9
9
  import { updateFrontmatter } from "./folder.js";
10
10
  import { listMcpTools } from "./mcp.js";
11
- import { MCP_TOOLSET, POLICIES, PREBUILT_TOOLS, TOOLSET, TOOLSET_FILE, TOOLS_DIR, mcpToolsetFile } from "../lib/tools.js";
12
- const PREBUILT = "Pre-built tools (bash, files, web search)";
11
+ import { MCP_TOOLSET, POLICIES, COMPUTER_TOOLS, TOOLSET, TOOLSET_FILE, TOOLS_DIR, mcpToolsetFile } from "../lib/tools.js";
12
+ const COMPUTER = "Computer tools (bash, files, web search)";
13
13
  const CUSTOM = "Custom tool (JavaScript that runs on your machine)";
14
14
  const MCP = "MCP server";
15
15
  const INPUT_TYPES = ["string", "number", "integer", "boolean", "object", "string[]", "number[]", "integer[]", "boolean[]", "object[]"];
@@ -19,8 +19,8 @@ export async function toolsCreate(dir = ".", { io, fetch = globalThis.fetch, log
19
19
  const { errors, instance } = check(dir);
20
20
  if (!instance)
21
21
  throw new DeployError(`${dir} isn't an agent folder:\n ${errors.join("\n ")}`);
22
- const kind = await io.select("What kind of tool?", [PREBUILT, CUSTOM, MCP], PREBUILT);
23
- const write = kind === PREBUILT ? prebuilt : kind === CUSTOM ? custom : mcp;
22
+ const kind = await io.select("What kind of tool?", [COMPUTER, CUSTOM, MCP], COMPUTER);
23
+ const write = kind === COMPUTER ? computerTools : kind === CUSTOM ? custom : mcp;
24
24
  const { path, text, addServer } = await write(dir, instance, io, { fetch, log });
25
25
  const file = join(dir, path);
26
26
  mkdirSync(dirname(file), { recursive: true });
@@ -49,19 +49,19 @@ export async function toolsCreate(dir = ".", { io, fetch = globalThis.fetch, log
49
49
  log(`\nDeploy with:\n agentschema deploy ${dir}`);
50
50
  return file;
51
51
  }
52
- // The pre-built toolset: one file, with a row for each tool.
53
- async function prebuilt(dir, { tools }, io) {
52
+ // The computer toolset: one file, with a row for each tool.
53
+ async function computerTools(dir, { tools }, io) {
54
54
  const existing = tools.find((t) => t.data.type === TOOLSET);
55
55
  if (existing)
56
- throw new DeployError(`the agent already has its pre-built tools in ${existing.file}; edit that file's table to turn tools on or off`);
57
- let enabled = PREBUILT_TOOLS;
58
- if (!(await io.confirm(`Turn on all eight (${PREBUILT_TOOLS.join(", ")})?`, true))) {
56
+ throw new DeployError(`the agent already has its computer tools in ${existing.file}; edit that file's table to turn tools on or off`);
57
+ let enabled = COMPUTER_TOOLS;
58
+ if (!(await io.confirm(`Turn on all eight (${COMPUTER_TOOLS.join(", ")})?`, true))) {
59
59
  enabled = [];
60
- for (const name of PREBUILT_TOOLS)
60
+ for (const name of COMPUTER_TOOLS)
61
61
  if (await io.confirm(` ${name}?`, true))
62
62
  enabled.push(name);
63
63
  }
64
- return { path: `${TOOLS_DIR}/${TOOLSET_FILE}`, text: builtInFile(PREBUILT_TOOLS, enabled, await choosePermission(io, "auto")) };
64
+ return { path: `${TOOLS_DIR}/${TOOLSET_FILE}`, text: builtInFile(COMPUTER_TOOLS, enabled, await choosePermission(io, "auto")) };
65
65
  }
66
66
  // A custom tool: its name, description and inputs, with a code block to fill in.
67
67
  async function custom(dir, { tools }, io) {
@@ -70,8 +70,8 @@ async function custom(dir, { tools }, io) {
70
70
  validate: (n) => {
71
71
  if (!/^[a-zA-Z0-9_-]{1,64}$/.test(n))
72
72
  return "Use letters, digits, _ and -, up to 64 characters";
73
- if (PREBUILT_TOOLS.includes(n))
74
- return `${n} is a pre-built tool's name`;
73
+ if (COMPUTER_TOOLS.includes(n))
74
+ return `${n} is a computer tool's name`;
75
75
  if (/^(mcp__|ant__)/.test(n))
76
76
  return "A custom tool's name can't start with mcp__ or ant__";
77
77
  if (taken.has(n) || existsSync(join(dir, TOOLS_DIR, `${n}.md`)))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soft-boy/agentschema",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Markdown based AI agent schema",
5
5
  "type": "module",
6
6
  "bin": {