@michael-joseph-miller/ant-bot 0.1.0 → 0.1.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/CHANGELOG.md +23 -5
- package/README.md +69 -24
- package/dist/{browser-OHRD7YI3.js → browser-3UAU6ARY.js} +3 -3
- package/dist/{browser-OHRD7YI3.js.map → browser-3UAU6ARY.js.map} +1 -1
- package/dist/{bundled-46DUK5PG.js → bundled-26SJR7EB.js} +5 -5
- package/dist/{bundled-46DUK5PG.js.map → bundled-26SJR7EB.js.map} +1 -1
- package/dist/{chunk-AHAON6J7.js → chunk-CNCHYZVD.js} +2 -2
- package/dist/{chunk-AHAON6J7.js.map → chunk-CNCHYZVD.js.map} +1 -1
- package/dist/{chunk-Z2YT2PZN.js → chunk-GYWJUW4E.js} +6 -6
- package/dist/{chunk-Z2YT2PZN.js.map → chunk-GYWJUW4E.js.map} +3 -3
- package/dist/{chunk-7BOHBPB2.js → chunk-JCZBDGBA.js} +3 -3
- package/dist/{chunk-7BOHBPB2.js.map → chunk-JCZBDGBA.js.map} +1 -1
- package/dist/{chunk-KSQOVWP5.js → chunk-MSSHR6SW.js} +6 -6
- package/dist/chunk-MSSHR6SW.js.map +7 -0
- package/dist/{chunk-DYIJTUMY.js → chunk-XMIPBKUY.js} +8 -7
- package/dist/{chunk-DYIJTUMY.js.map → chunk-XMIPBKUY.js.map} +3 -3
- package/dist/index.js +28 -28
- package/dist/index.js.map +2 -2
- package/dist/{install-IY2M3OUQ.js → install-KTEW2CW3.js} +3 -3
- package/dist/{plugin-POMHVGD4.js → plugin-WYUCG6F7.js} +2 -2
- package/dist/{plugin-POMHVGD4.js.map → plugin-WYUCG6F7.js.map} +1 -1
- package/dist/{scheduler-Q7OHNGP6.js → scheduler-VZVHQWGD.js} +3 -3
- package/dist/scheduler-VZVHQWGD.js.map +7 -0
- package/dist/server.js +41 -41
- package/dist/server.js.map +3 -3
- package/dist/{skills-66WRX64H.js → skills-JUHWFBD6.js} +2 -2
- package/dist/skills-spec.js +2 -2
- package/dist/skills-spec.js.map +1 -1
- package/dist/{tools-P5537ASX.js → tools-YNE7ZRPR.js} +2 -2
- package/dist/{tools-P5537ASX.js.map → tools-YNE7ZRPR.js.map} +1 -1
- package/package.json +1 -1
- package/skills/README.md +1 -1
- package/web/dist/assets/index-CrbtUidR.js +130 -0
- package/web/dist/index.html +1 -1
- package/dist/chunk-KSQOVWP5.js.map +0 -7
- package/dist/scheduler-Q7OHNGP6.js.map +0 -7
- package/web/dist/assets/index-BLQ8rPiN.js +0 -130
- /package/dist/{install-IY2M3OUQ.js.map → install-KTEW2CW3.js.map} +0 -0
- /package/dist/{skills-66WRX64H.js.map → skills-JUHWFBD6.js.map} +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../daemon/src/skills/skills.ts", "../../daemon/src/util/ids.ts"],
|
|
4
|
+
"sourcesContent": ["import fs from 'node:fs';\nimport path from 'node:path';\nimport type { Store } from '../db/store.js';\nimport { slugify } from '../util/ids.js';\nimport type { Skill } from '@antbot/contract';\n\n/**\n * A skill is a directory `<skillsDir>/<slug>/SKILL.md` with a YAML-ish frontmatter block\n * (name, description) followed by a markdown body in the 6-part shape from outline \u00A78:\n * when to use it, required inputs and access, sequence of work, how to validate the result,\n * what to return, what requires approval.\n */\n\nexport const SKILL_TEMPLATE = `## When to use it\n\nDescribe the trigger: what request or situation should make a bot reach for this skill instead\nof improvising. Be specific enough that a bot with this skill enabled recognizes the moment.\n\n## Required inputs and access\n\nList what the skill needs before it can run: source systems, connectors/MCP servers, files,\ncredentials, or information the user must supply. Say what happens if something required is\nmissing.\n\n## Sequence of work\n\nWrite the ordered steps the bot should follow. Prefer \"gather \u2192 draft/reconcile \u2192 recommend\"\nover \"act immediately\" \u2014 automate preparation before execution.\n\n## How to validate the result\n\nState how the bot should check its own output before returning it: what to cross-check, what\ncounts as \"current\" data, and what stale-data policy applies. Per outline \u00A78: **if the source\ndata is unavailable, report the failure instead of using old data.**\n\n## What to return\n\nDescribe the shape of the deliverable: a document, a spreadsheet, a draft message, a linked\nwatch list, or a recommendation with evidence. Separate facts found, assumptions, actions\nalready taken, actions waiting for approval, and open questions where relevant.\n\n## What requires approval\n\nName the actions this skill must never take without an explicit human \"go ahead\": sending,\npublishing, purchasing, deleting, overwriting, or any production change. This section should\nnever be empty \u2014 every skill has an approval boundary.\n`;\n\nexport interface WriteSkillInput {\n name: string;\n description?: string;\n bodyMd: string;\n source?: 'user' | 'taught' | 'imported';\n}\n\nexport interface InstalledSkill {\n skill: Skill;\n executables: string[];\n manifestText: string;\n replaced: boolean;\n}\n\nexport interface ParsedSkillFile {\n name: string;\n description: string;\n bodyMd: string;\n}\n\n/** Parse the `---\\nname: \"...\"\\ndescription: \"...\"\\n---\\n<body>` shape. Pure, no I/O. */\nexport function parseFrontmatter(md: string): ParsedSkillFile {\n const m = md.match(/^---\\r?\\n([\\s\\S]*?)\\r?\\n---\\r?\\n?([\\s\\S]*)$/);\n if (!m) return { name: '', description: '', bodyMd: md };\n const [, fm, rest] = m;\n const data: Record<string, string> = {};\n const lines = (fm ?? '').split(/\\r?\\n/);\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i]!;\n const idx = line.indexOf(':');\n if (idx === -1 || /^\\s/.test(line)) continue; // continuation lines are consumed below\n const key = line.slice(0, idx).trim();\n let value = line.slice(idx + 1).trim();\n\n // YAML block scalars: `>` folds newlines into spaces, `|` keeps them. Published\n // skills use both for long descriptions, and the description is what the model\n // matches on \u2014 dropping it to a bare \">\" makes the skill invisible.\n const block = /^([>|])([-+]?)$/.exec(value);\n if (block) {\n const folded = block[1] === '>';\n const collected: string[] = [];\n while (i + 1 < lines.length) {\n const next = lines[i + 1]!;\n if (next.trim() !== '' && !/^\\s/.test(next)) break; // next top-level key\n collected.push(next.trim());\n i++;\n }\n while (collected.length && collected[collected.length - 1] === '') collected.pop();\n value = folded\n ? collected.filter((l) => l !== '').join(' ')\n : collected.join('\\n');\n // A folded block separates paragraphs (blank lines) with a newline.\n if (folded && collected.includes('')) {\n value = collected\n .reduce<string[]>((acc, l) => {\n if (l === '') acc.push('');\n else if (acc.length && acc[acc.length - 1] !== '') acc[acc.length - 1] += ` ${l}`;\n else acc[acc.length - 1] = l;\n return acc;\n }, [''])\n .filter((para) => para !== '')\n .join('\\n');\n }\n data[key] = value;\n continue;\n }\n\n if (value.startsWith('\"') && value.endsWith('\"') && value.length >= 2) {\n value = value.slice(1, -1).replace(/\\\\\"/g, '\"');\n }\n data[key] = value;\n }\n return {\n name: data.name ?? '',\n description: data.description ?? '',\n bodyMd: (rest ?? '').replace(/^\\r?\\n/, ''),\n };\n}\n\n/** Render a SKILL.md file from its parts. Pure, no I/O. */\nexport function renderSkillFile(input: { name: string; description: string; bodyMd: string }): string {\n const esc = (s: string): string => s.replace(/\\\\/g, '\\\\\\\\').replace(/\"/g, '\\\\\"');\n return `---\\nname: \"${esc(input.name)}\"\\ndescription: \"${esc(input.description)}\"\\n---\\n\\n${input.bodyMd.trim()}\\n`;\n}\n\n/**\n * Raised when a source resolves to more than one skill and the caller did not opt in.\n * Carries the names so the caller can tell the human (or the model) what to narrow to.\n */\nexport class MultipleSkillsError extends Error {\n constructor(\n readonly source: string,\n readonly names: string[],\n ) {\n super(`\"${source}\" contains ${names.length} skills, not one.`);\n this.name = 'MultipleSkillsError';\n }\n}\n\nexport class SkillStore {\n constructor(\n private store: Store,\n private skillsDir: string,\n ) {}\n\n private slugDir(slug: string): string {\n return path.join(this.skillsDir, slug);\n }\n\n /** Resolve a stored skill path and assert it is inside the skills dir (no path traversal). */\n private assertInsideSkillsDir(candidate: string): string {\n const root = path.resolve(this.skillsDir) + path.sep;\n const resolved = path.resolve(candidate);\n if (resolved !== path.resolve(this.skillsDir) && !resolved.startsWith(root)) {\n throw new Error(`Refusing to touch a skill path outside the skills directory: ${candidate}`);\n }\n return resolved;\n }\n\n /** Create (or overwrite by slug) a skill directory + SKILL.md, and register it. */\n writeSkill(input: WriteSkillInput): Skill {\n const existing = new Set(this.store.listSkills().map((s) => s.slug));\n const slug = slugify(input.name, existing);\n const dir = this.assertInsideSkillsDir(this.slugDir(slug));\n fs.mkdirSync(dir, { recursive: true });\n const content = renderSkillFile({\n name: input.name,\n description: input.description ?? '',\n bodyMd: input.bodyMd,\n });\n fs.writeFileSync(path.join(dir, 'SKILL.md'), content, 'utf8');\n return this.store.createSkill({\n slug,\n name: input.name,\n description: input.description,\n path: dir,\n source: input.source,\n });\n }\n\n /**\n * Install every skill found at `source` and register it. Existing slugs are replaced in\n * place so re-installing upgrades rather than accumulating copies.\n *\n * Throws `MultipleSkillsError` if `source` holds more than one skill unless\n * `allowMultiple` is set, so a caller cannot install a hundred skills by accident.\n */\n async installFromSource(\n source: string,\n opts: { allowMultiple?: boolean } = {},\n ): Promise<InstalledSkill[]> {\n const { stage, copyTree, renderManifest } = await import('./install.js');\n const parsed = (await import('./install.js')).parseSkillSource(source);\n const { staged, cleanup } = await stage(parsed);\n try {\n // Installing a whole monorepo when one skill was wanted is easy to do by accident and\n // tedious to undo, so a multi-skill source has to be asked for explicitly.\n if (staged.length > 1 && !opts.allowMultiple) {\n throw new MultipleSkillsError(source, staged.map((sk) => sk.name));\n }\n const out: InstalledSkill[] = [];\n for (const skill of staged) {\n const existing = this.store.getSkillBySlug(slugify(skill.name, new Set()));\n const others = new Set(this.store.listSkills().map((x) => x.slug));\n if (existing) others.delete(existing.slug);\n const slug = existing?.slug ?? slugify(skill.name, others);\n\n const dir = this.assertInsideSkillsDir(this.slugDir(slug));\n fs.rmSync(dir, { recursive: true, force: true });\n copyTree(skill.dir, dir);\n\n const registered = existing\n ? (this.store.updateSkill?.(existing.id, { name: skill.name, description: skill.description }) ?? existing)\n : this.store.createSkill({\n slug, name: skill.name, description: skill.description, path: dir, source: 'imported',\n });\n\n // Installed skills are held to the same spec as the ones ant-bot ships. This never\n // blocks an install \u2014 a third-party skill with a sloppy frontmatter still works \u2014 but\n // a `name` that does not match its directory makes the skill impossible for a bot to\n // enable, and silence about that is how it stays broken.\n const { validateSkillDir, formatSpecViolations } = await import('./spec.js');\n const specNotes = formatSpecViolations(validateSkillDir(dir));\n\n out.push({\n skill: registered,\n executables: skill.manifest.executables,\n manifestText: renderManifest(skill, dir) + specNotes,\n replaced: Boolean(existing),\n });\n }\n return out;\n } finally {\n cleanup();\n }\n }\n\n /** Read a skill's SKILL.md and return it with the parsed body (frontmatter stripped). */\n readSkill(id: string): (Skill & { bodyMd: string }) | null {\n const skill = this.store.getSkill(id);\n if (!skill) return null;\n const file = path.join(skill.path, 'SKILL.md');\n if (!fs.existsSync(file)) return { ...skill, bodyMd: '' };\n const raw = fs.readFileSync(file, 'utf8');\n const { bodyMd } = parseFrontmatter(raw);\n return { ...skill, bodyMd };\n }\n\n /** Remove a skill's directory and its db row. Guards against a maliciously escaped path. */\n deleteSkill(id: string): void {\n const skill = this.store.getSkill(id);\n if (!skill) return;\n const resolved = this.assertInsideSkillsDir(skill.path);\n fs.rmSync(resolved, { recursive: true, force: true });\n this.store.deleteSkill(id);\n }\n\n /**\n * Bring the registry back in line with what is actually on disk.\n *\n * A row can outlive its directory \u2014 a skill removed by hand, or a layout migration that\n * moved files without rewriting paths \u2014 and the UI then lists skills that cannot load.\n * Rows whose directory moved are repaired in place so bot assignments survive; rows with\n * nothing left on disk are dropped. Returns what it did, for the boot log.\n */\n reconcile(): { repaired: string[]; removed: string[] } {\n const repaired: string[] = [];\n const removed: string[] = [];\n for (const skill of this.store.listSkills()) {\n if (fs.existsSync(path.join(skill.path, 'SKILL.md'))) continue;\n const expected = path.join(this.skillsDir, skill.slug);\n if (fs.existsSync(path.join(expected, 'SKILL.md'))) {\n this.store.updateSkill(skill.id, { path: expected });\n repaired.push(skill.slug);\n } else {\n this.store.deleteSkill(skill.id);\n removed.push(skill.slug);\n }\n }\n return { repaired, removed };\n }\n\n /**\n * Re-read `name`/`description` from disk for the given slugs and update their rows.\n *\n * Registered names are not cosmetic \u2014 `manager.ts` hands them to the SDK as `enabledSkills`,\n * so a row whose name has drifted from its SKILL.md silently stops matching and the skill\n * quietly disappears from every bot that had it enabled. Any writer of a skill file that a\n * row already points at has to call this; `syncFromDisk` cannot, since it only ever looks at\n * slugs the db has never seen. Returns the slugs whose stored metadata actually changed.\n */\n refreshFromDisk(slugs: string[]): string[] {\n const changed: string[] = [];\n for (const slug of slugs) {\n const registered = this.store.getSkillBySlug(slug);\n if (!registered) continue;\n const file = path.join(this.skillsDir, slug, 'SKILL.md');\n if (!fs.existsSync(file)) continue;\n const { name, description } = parseFrontmatter(fs.readFileSync(file, 'utf8'));\n const nextName = name || registered.name;\n if (nextName === registered.name && description === (registered.description ?? '')) continue;\n this.store.updateSkill(registered.id, { name: nextName, description });\n changed.push(slug);\n }\n return changed;\n }\n\n /**\n * Scan the skills dir at boot and register any SKILL.md not yet known to the db, so users\n * can drop skills in by hand. Idempotent: already-registered slugs are left untouched.\n */\n syncFromDisk(): Skill[] {\n if (!fs.existsSync(this.skillsDir)) return [];\n const added: Skill[] = [];\n for (const entry of fs.readdirSync(this.skillsDir, { withFileTypes: true })) {\n if (!entry.isDirectory()) continue;\n const slug = entry.name;\n const dir = path.join(this.skillsDir, slug);\n const file = path.join(dir, 'SKILL.md');\n if (!fs.existsSync(file)) continue;\n if (this.store.getSkillBySlug(slug)) continue;\n const raw = fs.readFileSync(file, 'utf8');\n const { name, description } = parseFrontmatter(raw);\n const skill = this.store.createSkill({\n slug,\n name: name || slug,\n description,\n path: dir,\n source: 'imported',\n });\n added.push(skill);\n }\n return added;\n }\n}\n", "import { randomUUID } from 'node:crypto';\nexport const newId = (): string => randomUUID();\nexport const now = (): number => Date.now();\nexport function slugify(name: string, existing: Set<string> = new Set()): string {\n const base =\n name.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 40) || 'bot';\n let slug = base;\n let n = 2;\n while (existing.has(slug)) slug = `${base}-${n++}`;\n return sl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YAAY,KAAK,WAAW,EAAE,eAAe,KAAK,CAAC,GAAG;AAC3E,UAAI,CAAC,MAAM,YAAY,EAAG;AAC1B,YAAM,OAAO,MAAM;AACnB,YAAM,MAAM,KAAK,KAAK,KAAK,WAAW,IAAI;AAC1C,YAAM,OAAO,KAAK,KAAK,KAAK,UAAU;AACtC,UAAI,CAAC,GAAG,WAAW,IAAI,EAAG;AAC1B,UAAI,KAAK,MAAM,eAAe,IAAI,EAAG;AACrC,YAAM,MAAM,GAAG,aAAa,MAAM,MAAM;AACxC,YAAM,EAAE,MAAM,YAAY,IAAI,iBAAiB,GAAG;AAClD,YAAM,QAAQ,KAAK,MAAM,YAAY;AAAA,QACnC;AAAA,QACA,MAAM,QAAQ;AAAA,QACd;AAAA,QACA,MAAM;AAAA,QACN,QAAQ;AAAA,MACV,CAAC;AACD,YAAM,KAAK,KAAK;AAAA,IAClB;AACA,WAAO;AAAA,EACT;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __antbotCreateRequire } from 'node:module';
|
|
2
2
|
const require = __antbotCreateRequire(import.meta.url);
|
|
3
3
|
|
|
4
|
-
//
|
|
4
|
+
// contract/dist/limits.js
|
|
5
5
|
var LIMITS = {
|
|
6
6
|
MAX_BOTS_AND_GROUPS: 50,
|
|
7
7
|
MIN_GROUP_MEMBERS: 2,
|
|
@@ -33,10 +33,10 @@ var LimitError = class extends Error {
|
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
//
|
|
36
|
+
// contract/dist/api.js
|
|
37
37
|
import { z as z2 } from "zod";
|
|
38
38
|
|
|
39
|
-
//
|
|
39
|
+
// contract/dist/entities.js
|
|
40
40
|
import { z } from "zod";
|
|
41
41
|
var BotStateSchema = z.enum([
|
|
42
42
|
"idle",
|
|
@@ -47,7 +47,8 @@ var BotStateSchema = z.enum([
|
|
|
47
47
|
"interrupted"
|
|
48
48
|
]);
|
|
49
49
|
var AttentionSchema = z.enum(["none", "unread", "needs_attention"]);
|
|
50
|
-
var
|
|
50
|
+
var MODEL_TIERS = ["fable", "opus", "sonnet", "haiku"];
|
|
51
|
+
var ModelTierSchema = z.enum(MODEL_TIERS);
|
|
51
52
|
var BotSchema = z.object({
|
|
52
53
|
id: z.string(),
|
|
53
54
|
slug: z.string().regex(/^[a-z0-9][a-z0-9-]*$/),
|
|
@@ -200,7 +201,7 @@ var UsageRowSchema = z.object({
|
|
|
200
201
|
});
|
|
201
202
|
var TurnOriginSchema = z.enum(["user", "bot", "routine", "system"]);
|
|
202
203
|
|
|
203
|
-
//
|
|
204
|
+
// contract/dist/api.js
|
|
204
205
|
var CreateBotRequest = z2.object({
|
|
205
206
|
name: z2.string().min(1).max(60),
|
|
206
207
|
title: z2.string().max(120).optional(),
|
|
@@ -283,7 +284,7 @@ var SearchResultSchema = z2.object({
|
|
|
283
284
|
createdAt: z2.number()
|
|
284
285
|
});
|
|
285
286
|
|
|
286
|
-
//
|
|
287
|
+
// contract/dist/events.js
|
|
287
288
|
import { z as z3 } from "zod";
|
|
288
289
|
var base = { seq: z3.number(), threadId: z3.string().nullable(), botId: z3.string().nullable() };
|
|
289
290
|
var ServerEventSchema = z3.discriminatedUnion("type", [
|
|
@@ -318,4 +319,4 @@ export {
|
|
|
318
319
|
SettingsSchema,
|
|
319
320
|
SettingsPatchSchema
|
|
320
321
|
};
|
|
321
|
-
//# sourceMappingURL=chunk-
|
|
322
|
+
//# sourceMappingURL=chunk-XMIPBKUY.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../
|
|
4
|
-
"sourcesContent": ["/** Operational limits \u2014 mirrors grok-bot-system-outline.md \u00A713. */\nexport const LIMITS = {\n MAX_BOTS_AND_GROUPS: 50,\n MIN_GROUP_MEMBERS: 2,\n MAX_GROUP_MEMBERS: 6,\n MAX_ROUTINES_PER_BOT: 50,\n ROUTINE_RUNS_RETAINED: 20,\n MAX_ATTACHMENTS_PER_MESSAGE: 6,\n MAX_ATTACHMENT_BYTES: 25 * 1024 * 1024,\n MAX_VIDEO_ATTACHMENT_BYTES: 200 * 1024 * 1024,\n MAX_BOT_TO_BOT_HOPS: 5,\n DEFAULT_MAX_CONCURRENT_SESSIONS: 2,\n APPROVAL_TIMEOUT_MS: 15 * 60 * 1000,\n TEACH_RECORDING_MAX_MS: 10 * 60 * 1000,\n} as const;\n\n/** Error codes returned by the service layer when a limit is violated. */\nexport const LIMIT_ERROR = {\n TOO_MANY_BOTS: 'TOO_MANY_BOTS',\n GROUP_SIZE: 'GROUP_SIZE',\n TOO_MANY_ROUTINES: 'TOO_MANY_ROUTINES',\n TOO_MANY_ATTACHMENTS: 'TOO_MANY_ATTACHMENTS',\n ATTACHMENT_TOO_LARGE: 'ATTACHMENT_TOO_LARGE',\n HOP_LIMIT: 'HOP_LIMIT',\n} as const;\nexport type LimitErrorCode = (typeof LIMIT_ERROR)[keyof typeof LIMIT_ERROR];\n\nexport class LimitError extends Error {\n constructor(\n public code: LimitErrorCode,\n message: string,\n ) {\n super(message);\n this.name = 'LimitError';\n }\n}\n", "import { z } from 'zod';\nimport {\n BotSchema, ThreadSchema, MessageSchema, ApprovalSchema, RuleSchema,\n SkillSchema, RoutineSchema, RoutineRunSchema, UsageRowSchema, ModelTierSchema,\n} from './entities.js';\n\nexport const CreateBotRequest = z.object({\n name: z.string().min(1).max(60),\n title: z.string().max(120).optional(),\n description: z.string().max(8000).optional(),\n avatarEmoji: z.string().max(8).optional(),\n modelTier: ModelTierSchema.optional(),\n});\nexport type CreateBotRequest = z.infer<typeof CreateBotRequest>;\n\nexport const UpdateBotRequest = CreateBotRequest.partial().extend({\n pinned: z.boolean().optional(),\n hidden: z.boolean().optional(),\n notifications: z.boolean().optional(),\n});\nexport type UpdateBotRequest = z.infer<typeof UpdateBotRequest>;\n\nexport const CreateThreadRequest = z.object({\n kind: z.enum(['dm', 'group']),\n title: z.string().optional(),\n memberBotIds: z.array(z.string()),\n});\nexport type CreateThreadRequest = z.infer<typeof CreateThreadRequest>;\n\nexport const PostMessageRequest = z.object({\n contentMd: z.string(),\n attachmentIds: z.array(z.string()).optional(),\n replyToId: z.string().nullable().optional(),\n /** explicit @-mention targets resolved by the client */\n mentionBotIds: z.array(z.string()).optional(),\n mentionEveryone: z.boolean().optional(),\n});\nexport type PostMessageRequest = z.infer<typeof PostMessageRequest>;\n\nexport const ApprovalDecisionRequest = z.object({\n decision: z.enum(['allow', 'deny']),\n alwaysRule: z\n .object({ toolPattern: z.string(), inputPattern: z.string().default(''), scopeNote: z.string().default('') })\n .optional(),\n});\nexport type ApprovalDecisionRequest = z.infer<typeof ApprovalDecisionRequest>;\n\nexport const CreateRuleRequest = z.object({\n kind: z.enum(['require', 'allow']),\n toolPattern: z.string().min(1),\n inputPattern: z.string().default(''),\n scopeNote: z.string().default(''),\n});\nexport type CreateRuleRequest = z.infer<typeof CreateRuleRequest>;\n\nexport const CreateRoutineRequest = z.object({\n botId: z.string(),\n name: z.string().min(1),\n cronExpr: z.string().min(1),\n timezone: z.string().optional(),\n instructionMd: z.string().min(1),\n enabled: z.boolean().optional(),\n});\nexport type CreateRoutineRequest = z.infer<typeof CreateRoutineRequest>;\n\nexport const CreateSkillRequest = z.object({\n name: z.string().min(1),\n description: z.string().default(''),\n bodyMd: z.string().min(1),\n source: z.enum(['user', 'taught', 'imported']).optional(),\n});\nexport type CreateSkillRequest = z.infer<typeof CreateSkillRequest>;\n\n/**\n * Field types, declared once and without defaults. `SettingsSchema` layers the\n * defaults on for reads; `SettingsPatchSchema` deliberately leaves them off.\n */\nconst settingsFields = {\n timezone: z.string(),\n maxConcurrentSessions: z.number().min(1).max(8),\n autoReviewEnabled: z.boolean(),\n theme: z.enum(['system', 'light', 'dark']),\n localExecution: z.enum(['ask', 'always', 'never']),\n dailyTokenBudget: z.number(),\n notificationsEnabled: z.boolean(),\n billingMode: z.enum(['subscription', 'api']),\n computerMode: z.enum(['host', 'container']),\n};\n\nexport const SettingsSchema = z.object({\n timezone: settingsFields.timezone.default('UTC'),\n maxConcurrentSessions: settingsFields.maxConcurrentSessions.default(2),\n autoReviewEnabled: settingsFields.autoReviewEnabled.default(true),\n theme: settingsFields.theme.default('system'),\n localExecution: settingsFields.localExecution.default('ask'),\n dailyTokenBudget: settingsFields.dailyTokenBudget.default(0),\n notificationsEnabled: settingsFields.notificationsEnabled.default(true),\n billingMode: settingsFields.billingMode.default('subscription'),\n computerMode: settingsFields.computerMode.default('host'),\n});\nexport type Settings = z.infer<typeof SettingsSchema>;\n\n/**\n * Body schema for `PATCH /api/settings`. It must NOT carry defaults: parsing a\n * one-field patch through a defaulted schema yields a complete object, and\n * persisting that would reset every setting the client didn't mention \u2014 including\n * `localExecution`, which is a security control (see docs/SECURITY.md).\n */\nexport const SettingsPatchSchema = z.object(settingsFields).partial();\nexport type SettingsPatch = z.infer<typeof SettingsPatchSchema>;\n\nexport const SearchResultSchema = z.object({\n kind: z.enum(['message', 'file', 'routine', 'bot']),\n id: z.string(),\n threadId: z.string().nullable(),\n botId: z.string().nullable(),\n title: z.string(),\n snippet: z.string(),\n createdAt: z.number(),\n});\nexport type SearchResult = z.infer<typeof SearchResultSchema>;\n\nexport type ApiBot = z.infer<typeof BotSchema>;\nexport type ApiThread = z.infer<typeof ThreadSchema>;\nexport type ApiMessage = z.infer<typeof MessageSchema>;\nexport type ApiApproval = z.infer<typeof ApprovalSchema>;\nexport type ApiRule = z.infer<typeof RuleSchema>;\nexport type ApiSkill = z.infer<typeof SkillSchema>;\nexport type ApiRoutine = z.infer<typeof RoutineSchema>;\nexport type ApiRoutineRun = z.infer<typeof RoutineRunSchema>;\nexport type ApiUsageRow = z.infer<typeof UsageRowSchema>;\n\nexport interface RosterEntry { bot: ApiBot; thread: ApiThread | null; lastMessageAt: number }\nexport interface ThreadWithMessages { thread: ApiThread; messages: ApiMessage[] }\nexport interface UsageSummary {\n totals: { inputTokens: number; outputTokens: number; cacheReadTokens: number };\n byBot: Array<{ botId: string; botName: string; inputTokens: number; outputTokens: number }>;\n byDay: Array<{ day: string; inputTokens: number; outputTokens: number }>;\n byModel: Array<{ model: string; inputTokens: number; outputTokens: number }>;\n}\n", "import { z } from 'zod';\n\nexport const BotStateSchema = z.enum([\n 'idle',\n 'queued',\n 'running',\n 'waiting_approval',\n 'waiting_input',\n 'interrupted',\n]);\nexport type BotState = z.infer<typeof BotStateSchema>;\n\nexport const AttentionSchema = z.enum(['none', 'unread', 'needs_attention']);\nexport type Attention = z.infer<typeof AttentionSchema>;\n\nexport const ModelTierSchema = z.enum(['sonnet', 'opus', 'haiku']);\nexport type ModelTier = z.infer<typeof ModelTierSchema>;\n\nexport const BotSchema = z.object({\n id: z.string(),\n slug: z.string().regex(/^[a-z0-9][a-z0-9-]*$/),\n name: z.string().min(1).max(60),\n title: z.string().max(120).default(''),\n description: z.string().max(8000).default(''),\n avatarEmoji: z.string().max(8).default('\uD83E\uDD16'),\n modelTier: ModelTierSchema.default('sonnet'),\n pinned: z.boolean().default(false),\n hidden: z.boolean().default(false),\n notifications: z.boolean().default(true),\n sessionId: z.string().nullable().default(null),\n state: BotStateSchema.default('idle'),\n attention: AttentionSchema.default('none'),\n threadId: z.string().nullable().default(null),\n createdAt: z.number(),\n deletedAt: z.number().nullable().default(null),\n});\nexport type Bot = z.infer<typeof BotSchema>;\n\nexport const ThreadKindSchema = z.enum(['dm', 'group']);\nexport type ThreadKind = z.infer<typeof ThreadKindSchema>;\n\nexport const ThreadSchema = z.object({\n id: z.string(),\n kind: ThreadKindSchema,\n title: z.string().default(''),\n memberBotIds: z.array(z.string()).default([]),\n pinned: z.boolean().default(false),\n hidden: z.boolean().default(false),\n lastReadAt: z.number().default(0),\n createdAt: z.number(),\n});\nexport type Thread = z.infer<typeof ThreadSchema>;\n\n/** Cards render structured, non-prose content inside a message. */\nexport const CardSchema = z.discriminatedUnion('type', [\n z.object({\n type: z.literal('tool'),\n toolName: z.string(),\n summary: z.string(),\n input: z.unknown().optional(),\n result: z.string().optional(),\n status: z.enum(['running', 'ok', 'error', 'denied']),\n }),\n z.object({\n type: z.literal('file'),\n path: z.string(),\n name: z.string(),\n mime: z.string(),\n bytes: z.number(),\n action: z.enum(['created', 'modified']).default('created'),\n }),\n z.object({ type: z.literal('approval'), approvalId: z.string() }),\n z.object({ type: z.literal('handoff'), fromBotId: z.string(), toBotId: z.string(), note: z.string() }),\n z.object({ type: z.literal('error'), message: z.string() }),\n]);\nexport type Card = z.infer<typeof CardSchema>;\n\nexport const AuthorKindSchema = z.enum(['user', 'bot', 'system']);\nexport type AuthorKind = z.infer<typeof AuthorKindSchema>;\n\nexport const MessageSchema = z.object({\n id: z.string(),\n threadId: z.string(),\n authorKind: AuthorKindSchema,\n authorBotId: z.string().nullable().default(null),\n replyToId: z.string().nullable().default(null),\n contentMd: z.string().default(''),\n cards: z.array(CardSchema).default([]),\n streaming: z.boolean().default(false),\n createdAt: z.number(),\n});\nexport type Message = z.infer<typeof MessageSchema>;\n\nexport const AttachmentSchema = z.object({\n id: z.string(),\n messageId: z.string().nullable(),\n path: z.string(),\n name: z.string(),\n mime: z.string(),\n bytes: z.number(),\n createdAt: z.number(),\n});\nexport type Attachment = z.infer<typeof AttachmentSchema>;\n\nexport const ApprovalStatusSchema = z.enum(['pending', 'allowed', 'denied', 'expired']);\nexport type ApprovalStatus = z.infer<typeof ApprovalStatusSchema>;\n\nexport const ApprovalSchema = z.object({\n id: z.string(),\n botId: z.string(),\n threadId: z.string(),\n toolName: z.string(),\n inputSummary: z.string(),\n rawInput: z.unknown(),\n status: ApprovalStatusSchema.default('pending'),\n decidedBy: z.enum(['user', 'rule', 'auto_review']).nullable().default(null),\n reason: z.string().default(''),\n ruleId: z.string().nullable().default(null),\n createdAt: z.number(),\n decidedAt: z.number().nullable().default(null),\n});\nexport type Approval = z.infer<typeof ApprovalSchema>;\n\nexport const RuleKindSchema = z.enum(['require', 'allow']);\nexport type RuleKind = z.infer<typeof RuleKindSchema>;\n\nexport const RuleSchema = z.object({\n id: z.string(),\n kind: RuleKindSchema,\n /** Glob over tool name, e.g. \"Bash\", \"browser_*\", \"*\" */\n toolPattern: z.string().default('*'),\n /** Optional regex tested against the serialized tool input. */\n inputPattern: z.string().default(''),\n scopeNote: z.string().default(''),\n builtin: z.boolean().default(false),\n enabled: z.boolean().default(true),\n createdAt: z.number(),\n});\nexport type Rule = z.infer<typeof RuleSchema>;\n\nexport const SkillSchema = z.object({\n id: z.string(),\n slug: z.string(),\n name: z.string(),\n description: z.string().default(''),\n path: z.string(),\n source: z.enum(['user', 'taught', 'imported']).default('user'),\n createdAt: z.number(),\n});\nexport type Skill = z.infer<typeof SkillSchema>;\n\nexport const RoutineSchema = z.object({\n id: z.string(),\n botId: z.string(),\n name: z.string().min(1),\n cronExpr: z.string(),\n timezone: z.string().default('UTC'),\n instructionMd: z.string(),\n enabled: z.boolean().default(true),\n lastRunAt: z.number().nullable().default(null),\n nextRunAt: z.number().nullable().default(null),\n createdAt: z.number(),\n});\nexport type Routine = z.infer<typeof RoutineSchema>;\n\nexport const RoutineRunSchema = z.object({\n id: z.string(),\n routineId: z.string(),\n startedAt: z.number(),\n finishedAt: z.number().nullable().default(null),\n status: z.enum(['running', 'ok', 'failed', 'interrupted']),\n summary: z.string().default(''),\n threadId: z.string().nullable().default(null),\n isTest: z.boolean().default(false),\n});\nexport type RoutineRun = z.infer<typeof RoutineRunSchema>;\n\nexport const MailboxEntrySchema = z.object({\n id: z.string(),\n fromBotId: z.string(),\n toBotId: z.string(),\n contentMd: z.string(),\n hops: z.number().default(1),\n delivered: z.boolean().default(false),\n createdAt: z.number(),\n});\nexport type MailboxEntry = z.infer<typeof MailboxEntrySchema>;\n\nexport const UsageRowSchema = z.object({\n id: z.string(),\n botId: z.string(),\n turnId: z.string(),\n model: z.string(),\n inputTokens: z.number().default(0),\n outputTokens: z.number().default(0),\n cacheReadTokens: z.number().default(0),\n costEstimate: z.number().default(0),\n createdAt: z.number(),\n});\nexport type UsageRow = z.infer<typeof UsageRowSchema>;\n\nexport const TurnOriginSchema = z.enum(['user', 'bot', 'routine', 'system']);\nexport type TurnOrigin = z.infer<typeof TurnOriginSchema>;\n", "import { z } from 'zod';\nimport { BotStateSchema, AttentionSchema, CardSchema, MessageSchema, ApprovalSchema, RoutineRunSchema } from './entities.js';\n\n/** Every server\u2192client event carries {threadId, botId, seq} for ordering/reconciliation. */\nconst base = { seq: z.number(), threadId: z.string().nullable(), botId: z.string().nullable() };\n\nexport const ServerEventSchema = z.discriminatedUnion('type', [\n /** Connection handshake. Carries the current seq so a client can detect gaps. */\n z.object({ ...base, type: z.literal('hello') }),\n z.object({ ...base, type: z.literal('message.created'), message: MessageSchema }),\n z.object({ ...base, type: z.literal('message.delta'), messageId: z.string(), delta: z.string() }),\n z.object({ ...base, type: z.literal('message.done'), messageId: z.string(), contentMd: z.string() }),\n z.object({ ...base, type: z.literal('message.card'), messageId: z.string(), card: CardSchema, cardIndex: z.number() }),\n z.object({ ...base, type: z.literal('bot.state'), state: BotStateSchema, attention: AttentionSchema }),\n z.object({ ...base, type: z.literal('approval.pending'), approval: ApprovalSchema }),\n z.object({ ...base, type: z.literal('approval.resolved'), approval: ApprovalSchema }),\n z.object({ ...base, type: z.literal('routine.run'), run: RoutineRunSchema }),\n z.object({ ...base, type: z.literal('usage.tick'), inputTokens: z.number(), outputTokens: z.number(), model: z.string() }),\n z.object({ ...base, type: z.literal('notify'), title: z.string(), body: z.string(), level: z.enum(['info', 'warn', 'error']) }),\n z.object({ ...base, type: z.literal('secret.request'), requestId: z.string(), name: z.string(), reason: z.string() }),\n z.object({ ...base, type: z.literal('thread.updated'), threadId2: z.string() }),\n]);\nexport type ServerEvent = z.infer<typeof ServerEventSchema>;\nexport type ServerEventType = ServerEvent['type'];\n"],
|
|
5
|
-
"mappings": ";;;;AACO,IAAM,SAAS;EACpB,qBAAqB;EACrB,mBAAmB;EACnB,mBAAmB;EACnB,sBAAsB;EACtB,uBAAuB;EACvB,6BAA6B;EAC7B,sBAAsB,KAAK,OAAO;EAClC,4BAA4B,MAAM,OAAO;EACzC,qBAAqB;EACrB,iCAAiC;EACjC,qBAAqB,KAAK,KAAK;EAC/B,wBAAwB,KAAK,KAAK;;AAI7B,IAAM,cAAc;EACzB,eAAe;EACf,YAAY;EACZ,mBAAmB;EACnB,sBAAsB;EACtB,sBAAsB;EACtB,WAAW;;AAIP,IAAO,aAAP,cAA0B,MAAK;EAE1B;EADT,YACS,MACP,SAAe;AAEf,UAAM,OAAO;AAHN,SAAA,OAAA;AAIP,SAAK,OAAO;EACd;;;;AClCF,SAAS,KAAAA,UAAS;;;ACAlB,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAAE,KAAK;EACnC;EACA;EACA;EACA;EACA;EACA;CACD;AAGM,IAAM,kBAAkB,EAAE,KAAK,CAAC,QAAQ,UAAU,iBAAiB,CAAC;
|
|
3
|
+
"sources": ["../../contract/src/limits.ts", "../../contract/src/api.ts", "../../contract/src/entities.ts", "../../contract/src/events.ts"],
|
|
4
|
+
"sourcesContent": ["/** Operational limits \u2014 mirrors grok-bot-system-outline.md \u00A713. */\nexport const LIMITS = {\n MAX_BOTS_AND_GROUPS: 50,\n MIN_GROUP_MEMBERS: 2,\n MAX_GROUP_MEMBERS: 6,\n MAX_ROUTINES_PER_BOT: 50,\n ROUTINE_RUNS_RETAINED: 20,\n MAX_ATTACHMENTS_PER_MESSAGE: 6,\n MAX_ATTACHMENT_BYTES: 25 * 1024 * 1024,\n MAX_VIDEO_ATTACHMENT_BYTES: 200 * 1024 * 1024,\n MAX_BOT_TO_BOT_HOPS: 5,\n DEFAULT_MAX_CONCURRENT_SESSIONS: 2,\n APPROVAL_TIMEOUT_MS: 15 * 60 * 1000,\n TEACH_RECORDING_MAX_MS: 10 * 60 * 1000,\n} as const;\n\n/** Error codes returned by the service layer when a limit is violated. */\nexport const LIMIT_ERROR = {\n TOO_MANY_BOTS: 'TOO_MANY_BOTS',\n GROUP_SIZE: 'GROUP_SIZE',\n TOO_MANY_ROUTINES: 'TOO_MANY_ROUTINES',\n TOO_MANY_ATTACHMENTS: 'TOO_MANY_ATTACHMENTS',\n ATTACHMENT_TOO_LARGE: 'ATTACHMENT_TOO_LARGE',\n HOP_LIMIT: 'HOP_LIMIT',\n} as const;\nexport type LimitErrorCode = (typeof LIMIT_ERROR)[keyof typeof LIMIT_ERROR];\n\nexport class LimitError extends Error {\n constructor(\n public code: LimitErrorCode,\n message: string,\n ) {\n super(message);\n this.name = 'LimitError';\n }\n}\n", "import { z } from 'zod';\nimport {\n BotSchema, ThreadSchema, MessageSchema, ApprovalSchema, RuleSchema,\n SkillSchema, RoutineSchema, RoutineRunSchema, UsageRowSchema, ModelTierSchema,\n} from './entities.js';\n\nexport const CreateBotRequest = z.object({\n name: z.string().min(1).max(60),\n title: z.string().max(120).optional(),\n description: z.string().max(8000).optional(),\n avatarEmoji: z.string().max(8).optional(),\n modelTier: ModelTierSchema.optional(),\n});\nexport type CreateBotRequest = z.infer<typeof CreateBotRequest>;\n\nexport const UpdateBotRequest = CreateBotRequest.partial().extend({\n pinned: z.boolean().optional(),\n hidden: z.boolean().optional(),\n notifications: z.boolean().optional(),\n});\nexport type UpdateBotRequest = z.infer<typeof UpdateBotRequest>;\n\nexport const CreateThreadRequest = z.object({\n kind: z.enum(['dm', 'group']),\n title: z.string().optional(),\n memberBotIds: z.array(z.string()),\n});\nexport type CreateThreadRequest = z.infer<typeof CreateThreadRequest>;\n\nexport const PostMessageRequest = z.object({\n contentMd: z.string(),\n attachmentIds: z.array(z.string()).optional(),\n replyToId: z.string().nullable().optional(),\n /** explicit @-mention targets resolved by the client */\n mentionBotIds: z.array(z.string()).optional(),\n mentionEveryone: z.boolean().optional(),\n});\nexport type PostMessageRequest = z.infer<typeof PostMessageRequest>;\n\nexport const ApprovalDecisionRequest = z.object({\n decision: z.enum(['allow', 'deny']),\n alwaysRule: z\n .object({ toolPattern: z.string(), inputPattern: z.string().default(''), scopeNote: z.string().default('') })\n .optional(),\n});\nexport type ApprovalDecisionRequest = z.infer<typeof ApprovalDecisionRequest>;\n\nexport const CreateRuleRequest = z.object({\n kind: z.enum(['require', 'allow']),\n toolPattern: z.string().min(1),\n inputPattern: z.string().default(''),\n scopeNote: z.string().default(''),\n});\nexport type CreateRuleRequest = z.infer<typeof CreateRuleRequest>;\n\nexport const CreateRoutineRequest = z.object({\n botId: z.string(),\n name: z.string().min(1),\n cronExpr: z.string().min(1),\n timezone: z.string().optional(),\n instructionMd: z.string().min(1),\n enabled: z.boolean().optional(),\n});\nexport type CreateRoutineRequest = z.infer<typeof CreateRoutineRequest>;\n\nexport const CreateSkillRequest = z.object({\n name: z.string().min(1),\n description: z.string().default(''),\n bodyMd: z.string().min(1),\n source: z.enum(['user', 'taught', 'imported']).optional(),\n});\nexport type CreateSkillRequest = z.infer<typeof CreateSkillRequest>;\n\n/**\n * Field types, declared once and without defaults. `SettingsSchema` layers the\n * defaults on for reads; `SettingsPatchSchema` deliberately leaves them off.\n */\nconst settingsFields = {\n timezone: z.string(),\n maxConcurrentSessions: z.number().min(1).max(8),\n autoReviewEnabled: z.boolean(),\n theme: z.enum(['system', 'light', 'dark']),\n localExecution: z.enum(['ask', 'always', 'never']),\n dailyTokenBudget: z.number(),\n notificationsEnabled: z.boolean(),\n billingMode: z.enum(['subscription', 'api']),\n computerMode: z.enum(['host', 'container']),\n};\n\nexport const SettingsSchema = z.object({\n timezone: settingsFields.timezone.default('UTC'),\n maxConcurrentSessions: settingsFields.maxConcurrentSessions.default(2),\n autoReviewEnabled: settingsFields.autoReviewEnabled.default(true),\n theme: settingsFields.theme.default('system'),\n localExecution: settingsFields.localExecution.default('ask'),\n dailyTokenBudget: settingsFields.dailyTokenBudget.default(0),\n notificationsEnabled: settingsFields.notificationsEnabled.default(true),\n billingMode: settingsFields.billingMode.default('subscription'),\n computerMode: settingsFields.computerMode.default('host'),\n});\nexport type Settings = z.infer<typeof SettingsSchema>;\n\n/**\n * Body schema for `PATCH /api/settings`. It must NOT carry defaults: parsing a\n * one-field patch through a defaulted schema yields a complete object, and\n * persisting that would reset every setting the client didn't mention \u2014 including\n * `localExecution`, which is a security control (see docs/SECURITY.md).\n */\nexport const SettingsPatchSchema = z.object(settingsFields).partial();\nexport type SettingsPatch = z.infer<typeof SettingsPatchSchema>;\n\nexport const SearchResultSchema = z.object({\n kind: z.enum(['message', 'file', 'routine', 'bot']),\n id: z.string(),\n threadId: z.string().nullable(),\n botId: z.string().nullable(),\n title: z.string(),\n snippet: z.string(),\n createdAt: z.number(),\n});\nexport type SearchResult = z.infer<typeof SearchResultSchema>;\n\nexport type ApiBot = z.infer<typeof BotSchema>;\nexport type ApiThread = z.infer<typeof ThreadSchema>;\nexport type ApiMessage = z.infer<typeof MessageSchema>;\nexport type ApiApproval = z.infer<typeof ApprovalSchema>;\nexport type ApiRule = z.infer<typeof RuleSchema>;\nexport type ApiSkill = z.infer<typeof SkillSchema>;\nexport type ApiRoutine = z.infer<typeof RoutineSchema>;\nexport type ApiRoutineRun = z.infer<typeof RoutineRunSchema>;\nexport type ApiUsageRow = z.infer<typeof UsageRowSchema>;\n\nexport interface RosterEntry { bot: ApiBot; thread: ApiThread | null; lastMessageAt: number }\nexport interface ThreadWithMessages { thread: ApiThread; messages: ApiMessage[] }\nexport interface UsageSummary {\n totals: { inputTokens: number; outputTokens: number; cacheReadTokens: number };\n byBot: Array<{ botId: string; botName: string; inputTokens: number; outputTokens: number }>;\n byDay: Array<{ day: string; inputTokens: number; outputTokens: number }>;\n byModel: Array<{ model: string; inputTokens: number; outputTokens: number }>;\n}\n", "import { z } from 'zod';\n\nexport const BotStateSchema = z.enum([\n 'idle',\n 'queued',\n 'running',\n 'waiting_approval',\n 'waiting_input',\n 'interrupted',\n]);\nexport type BotState = z.infer<typeof BotStateSchema>;\n\nexport const AttentionSchema = z.enum(['none', 'unread', 'needs_attention']);\nexport type Attention = z.infer<typeof AttentionSchema>;\n\n/**\n * Model tiers a Bot can run on, ordered most to least capable \u2014 this is also the order the UI\n * renders them in, so both pickers stay consistent without repeating the list.\n *\n * Each value is a `claude` CLI model alias, passed through verbatim by `resolveModel()`. Adding a\n * tier here means adding an alias the CLI accepts (`claude --model`), not an API model ID.\n */\nexport const MODEL_TIERS = ['fable', 'opus', 'sonnet', 'haiku'] as const;\nexport const ModelTierSchema = z.enum(MODEL_TIERS);\nexport type ModelTier = z.infer<typeof ModelTierSchema>;\n\nexport const BotSchema = z.object({\n id: z.string(),\n slug: z.string().regex(/^[a-z0-9][a-z0-9-]*$/),\n name: z.string().min(1).max(60),\n title: z.string().max(120).default(''),\n description: z.string().max(8000).default(''),\n avatarEmoji: z.string().max(8).default('\uD83E\uDD16'),\n modelTier: ModelTierSchema.default('sonnet'),\n pinned: z.boolean().default(false),\n hidden: z.boolean().default(false),\n notifications: z.boolean().default(true),\n sessionId: z.string().nullable().default(null),\n state: BotStateSchema.default('idle'),\n attention: AttentionSchema.default('none'),\n threadId: z.string().nullable().default(null),\n createdAt: z.number(),\n deletedAt: z.number().nullable().default(null),\n});\nexport type Bot = z.infer<typeof BotSchema>;\n\nexport const ThreadKindSchema = z.enum(['dm', 'group']);\nexport type ThreadKind = z.infer<typeof ThreadKindSchema>;\n\nexport const ThreadSchema = z.object({\n id: z.string(),\n kind: ThreadKindSchema,\n title: z.string().default(''),\n memberBotIds: z.array(z.string()).default([]),\n pinned: z.boolean().default(false),\n hidden: z.boolean().default(false),\n lastReadAt: z.number().default(0),\n createdAt: z.number(),\n});\nexport type Thread = z.infer<typeof ThreadSchema>;\n\n/** Cards render structured, non-prose content inside a message. */\nexport const CardSchema = z.discriminatedUnion('type', [\n z.object({\n type: z.literal('tool'),\n toolName: z.string(),\n summary: z.string(),\n input: z.unknown().optional(),\n result: z.string().optional(),\n status: z.enum(['running', 'ok', 'error', 'denied']),\n }),\n z.object({\n type: z.literal('file'),\n path: z.string(),\n name: z.string(),\n mime: z.string(),\n bytes: z.number(),\n action: z.enum(['created', 'modified']).default('created'),\n }),\n z.object({ type: z.literal('approval'), approvalId: z.string() }),\n z.object({ type: z.literal('handoff'), fromBotId: z.string(), toBotId: z.string(), note: z.string() }),\n z.object({ type: z.literal('error'), message: z.string() }),\n]);\nexport type Card = z.infer<typeof CardSchema>;\n\nexport const AuthorKindSchema = z.enum(['user', 'bot', 'system']);\nexport type AuthorKind = z.infer<typeof AuthorKindSchema>;\n\nexport const MessageSchema = z.object({\n id: z.string(),\n threadId: z.string(),\n authorKind: AuthorKindSchema,\n authorBotId: z.string().nullable().default(null),\n replyToId: z.string().nullable().default(null),\n contentMd: z.string().default(''),\n cards: z.array(CardSchema).default([]),\n streaming: z.boolean().default(false),\n createdAt: z.number(),\n});\nexport type Message = z.infer<typeof MessageSchema>;\n\nexport const AttachmentSchema = z.object({\n id: z.string(),\n messageId: z.string().nullable(),\n path: z.string(),\n name: z.string(),\n mime: z.string(),\n bytes: z.number(),\n createdAt: z.number(),\n});\nexport type Attachment = z.infer<typeof AttachmentSchema>;\n\nexport const ApprovalStatusSchema = z.enum(['pending', 'allowed', 'denied', 'expired']);\nexport type ApprovalStatus = z.infer<typeof ApprovalStatusSchema>;\n\nexport const ApprovalSchema = z.object({\n id: z.string(),\n botId: z.string(),\n threadId: z.string(),\n toolName: z.string(),\n inputSummary: z.string(),\n rawInput: z.unknown(),\n status: ApprovalStatusSchema.default('pending'),\n decidedBy: z.enum(['user', 'rule', 'auto_review']).nullable().default(null),\n reason: z.string().default(''),\n ruleId: z.string().nullable().default(null),\n createdAt: z.number(),\n decidedAt: z.number().nullable().default(null),\n});\nexport type Approval = z.infer<typeof ApprovalSchema>;\n\nexport const RuleKindSchema = z.enum(['require', 'allow']);\nexport type RuleKind = z.infer<typeof RuleKindSchema>;\n\nexport const RuleSchema = z.object({\n id: z.string(),\n kind: RuleKindSchema,\n /** Glob over tool name, e.g. \"Bash\", \"browser_*\", \"*\" */\n toolPattern: z.string().default('*'),\n /** Optional regex tested against the serialized tool input. */\n inputPattern: z.string().default(''),\n scopeNote: z.string().default(''),\n builtin: z.boolean().default(false),\n enabled: z.boolean().default(true),\n createdAt: z.number(),\n});\nexport type Rule = z.infer<typeof RuleSchema>;\n\nexport const SkillSchema = z.object({\n id: z.string(),\n slug: z.string(),\n name: z.string(),\n description: z.string().default(''),\n path: z.string(),\n source: z.enum(['user', 'taught', 'imported']).default('user'),\n createdAt: z.number(),\n});\nexport type Skill = z.infer<typeof SkillSchema>;\n\nexport const RoutineSchema = z.object({\n id: z.string(),\n botId: z.string(),\n name: z.string().min(1),\n cronExpr: z.string(),\n timezone: z.string().default('UTC'),\n instructionMd: z.string(),\n enabled: z.boolean().default(true),\n lastRunAt: z.number().nullable().default(null),\n nextRunAt: z.number().nullable().default(null),\n createdAt: z.number(),\n});\nexport type Routine = z.infer<typeof RoutineSchema>;\n\nexport const RoutineRunSchema = z.object({\n id: z.string(),\n routineId: z.string(),\n startedAt: z.number(),\n finishedAt: z.number().nullable().default(null),\n status: z.enum(['running', 'ok', 'failed', 'interrupted']),\n summary: z.string().default(''),\n threadId: z.string().nullable().default(null),\n isTest: z.boolean().default(false),\n});\nexport type RoutineRun = z.infer<typeof RoutineRunSchema>;\n\nexport const MailboxEntrySchema = z.object({\n id: z.string(),\n fromBotId: z.string(),\n toBotId: z.string(),\n contentMd: z.string(),\n hops: z.number().default(1),\n delivered: z.boolean().default(false),\n createdAt: z.number(),\n});\nexport type MailboxEntry = z.infer<typeof MailboxEntrySchema>;\n\nexport const UsageRowSchema = z.object({\n id: z.string(),\n botId: z.string(),\n turnId: z.string(),\n model: z.string(),\n inputTokens: z.number().default(0),\n outputTokens: z.number().default(0),\n cacheReadTokens: z.number().default(0),\n costEstimate: z.number().default(0),\n createdAt: z.number(),\n});\nexport type UsageRow = z.infer<typeof UsageRowSchema>;\n\nexport const TurnOriginSchema = z.enum(['user', 'bot', 'routine', 'system']);\nexport type TurnOrigin = z.infer<typeof TurnOriginSchema>;\n", "import { z } from 'zod';\nimport { BotStateSchema, AttentionSchema, CardSchema, MessageSchema, ApprovalSchema, RoutineRunSchema } from './entities.js';\n\n/** Every server\u2192client event carries {threadId, botId, seq} for ordering/reconciliation. */\nconst base = { seq: z.number(), threadId: z.string().nullable(), botId: z.string().nullable() };\n\nexport const ServerEventSchema = z.discriminatedUnion('type', [\n /** Connection handshake. Carries the current seq so a client can detect gaps. */\n z.object({ ...base, type: z.literal('hello') }),\n z.object({ ...base, type: z.literal('message.created'), message: MessageSchema }),\n z.object({ ...base, type: z.literal('message.delta'), messageId: z.string(), delta: z.string() }),\n z.object({ ...base, type: z.literal('message.done'), messageId: z.string(), contentMd: z.string() }),\n z.object({ ...base, type: z.literal('message.card'), messageId: z.string(), card: CardSchema, cardIndex: z.number() }),\n z.object({ ...base, type: z.literal('bot.state'), state: BotStateSchema, attention: AttentionSchema }),\n z.object({ ...base, type: z.literal('approval.pending'), approval: ApprovalSchema }),\n z.object({ ...base, type: z.literal('approval.resolved'), approval: ApprovalSchema }),\n z.object({ ...base, type: z.literal('routine.run'), run: RoutineRunSchema }),\n z.object({ ...base, type: z.literal('usage.tick'), inputTokens: z.number(), outputTokens: z.number(), model: z.string() }),\n z.object({ ...base, type: z.literal('notify'), title: z.string(), body: z.string(), level: z.enum(['info', 'warn', 'error']) }),\n z.object({ ...base, type: z.literal('secret.request'), requestId: z.string(), name: z.string(), reason: z.string() }),\n z.object({ ...base, type: z.literal('thread.updated'), threadId2: z.string() }),\n]);\nexport type ServerEvent = z.infer<typeof ServerEventSchema>;\nexport type ServerEventType = ServerEvent['type'];\n"],
|
|
5
|
+
"mappings": ";;;;AACO,IAAM,SAAS;EACpB,qBAAqB;EACrB,mBAAmB;EACnB,mBAAmB;EACnB,sBAAsB;EACtB,uBAAuB;EACvB,6BAA6B;EAC7B,sBAAsB,KAAK,OAAO;EAClC,4BAA4B,MAAM,OAAO;EACzC,qBAAqB;EACrB,iCAAiC;EACjC,qBAAqB,KAAK,KAAK;EAC/B,wBAAwB,KAAK,KAAK;;AAI7B,IAAM,cAAc;EACzB,eAAe;EACf,YAAY;EACZ,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E;EACpFA,GAAE,OAAO,EAAE,GAAG,MAAM,MAAMA,GAAE,QAAQ,aAAa,GAAG,KAAK,iBAAgB,CAAE;EAC3EA,GAAE,OAAO,EAAE,GAAG,MAAM,MAAMA,GAAE,QAAQ,YAAY,GAAG,aAAaA,GAAE,OAAM,GAAI,cAAcA,GAAE,OAAM,GAAI,OAAOA,GAAE,OAAM,EAAE,CAAE;EACzHA,GAAE,OAAO,EAAE,GAAG,MAAM,MAAMA,GAAE,QAAQ,QAAQ,GAAG,OAAOA,GAAE,OAAM,GAAI,MAAMA,GAAE,OAAM,GAAI,OAAOA,GAAE,KAAK,CAAC,QAAQ,QAAQ,OAAO,CAAC,EAAC,CAAE;EAC9HA,GAAE,OAAO,EAAE,GAAG,MAAM,MAAMA,GAAE,QAAQ,gBAAgB,GAAG,WAAWA,GAAE,OAAM,GAAI,MAAMA,GAAE,OAAM,GAAI,QAAQA,GAAE,OAAM,EAAE,CAAE;EACpHA,GAAE,OAAO,EAAE,GAAG,MAAM,MAAMA,GAAE,QAAQ,gBAAgB,GAAG,WAAWA,GAAE,OAAM,EAAE,CAAE;CAC/E;",
|
|
6
6
|
"names": ["z", "z", "z", "z"]
|
|
7
7
|
}
|
package/dist/index.js
CHANGED
|
@@ -3,14 +3,14 @@ import { createRequire as __antbotCreateRequire } from 'node:module';
|
|
|
3
3
|
const require = __antbotCreateRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
SettingsSchema
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-XMIPBKUY.js";
|
|
7
7
|
|
|
8
|
-
//
|
|
8
|
+
// cli/src/index.ts
|
|
9
9
|
import fs10 from "node:fs";
|
|
10
10
|
import readline2 from "node:readline/promises";
|
|
11
11
|
import path11 from "node:path";
|
|
12
12
|
|
|
13
|
-
//
|
|
13
|
+
// cli/src/args.ts
|
|
14
14
|
var KNOWN_COMMANDS = [
|
|
15
15
|
"start",
|
|
16
16
|
"stop",
|
|
@@ -123,7 +123,7 @@ Run "antbot --help" for usage.`);
|
|
|
123
123
|
return { command, help, version: false, positionals, flags };
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
//
|
|
126
|
+
// cli/src/help.ts
|
|
127
127
|
var GLOBAL_HELP = `antbot \u2014 a local daemon and web UI for a roster of persistent Claude teammates.
|
|
128
128
|
|
|
129
129
|
Usage: antbot <command> [options]
|
|
@@ -268,7 +268,7 @@ function commandHelp(command) {
|
|
|
268
268
|
return COMMAND_HELP[command];
|
|
269
269
|
}
|
|
270
270
|
|
|
271
|
-
//
|
|
271
|
+
// cli/src/version.ts
|
|
272
272
|
import fs from "node:fs";
|
|
273
273
|
import path from "node:path";
|
|
274
274
|
import { fileURLToPath } from "node:url";
|
|
@@ -296,7 +296,7 @@ function getCliVersion() {
|
|
|
296
296
|
);
|
|
297
297
|
}
|
|
298
298
|
|
|
299
|
-
//
|
|
299
|
+
// cli/src/doctor.ts
|
|
300
300
|
import path2 from "node:path";
|
|
301
301
|
function pass(name, message) {
|
|
302
302
|
return { name, status: "pass", message };
|
|
@@ -438,7 +438,7 @@ async function runDoctor(deps) {
|
|
|
438
438
|
return { results, exitCode };
|
|
439
439
|
}
|
|
440
440
|
|
|
441
|
-
//
|
|
441
|
+
// cli/src/proc.ts
|
|
442
442
|
import { spawn } from "node:child_process";
|
|
443
443
|
function runCommand(cmd, args, opts = {}) {
|
|
444
444
|
return new Promise((resolve, reject) => {
|
|
@@ -456,7 +456,7 @@ function runCommand(cmd, args, opts = {}) {
|
|
|
456
456
|
});
|
|
457
457
|
}
|
|
458
458
|
|
|
459
|
-
//
|
|
459
|
+
// cli/src/net.ts
|
|
460
460
|
import net from "node:net";
|
|
461
461
|
function sleep(ms) {
|
|
462
462
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -542,11 +542,11 @@ async function deleteJson(port, path12) {
|
|
|
542
542
|
);
|
|
543
543
|
}
|
|
544
544
|
|
|
545
|
-
//
|
|
545
|
+
// daemon/dist/config/config.js
|
|
546
546
|
import fs3 from "node:fs";
|
|
547
547
|
import { parse as parseToml, stringify as stringifyToml } from "smol-toml";
|
|
548
548
|
|
|
549
|
-
//
|
|
549
|
+
// daemon/dist/config/paths.js
|
|
550
550
|
import os from "node:os";
|
|
551
551
|
import path3 from "node:path";
|
|
552
552
|
import fs2 from "node:fs";
|
|
@@ -580,7 +580,7 @@ function ensureDirs(p) {
|
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
582
|
|
|
583
|
-
//
|
|
583
|
+
// daemon/dist/config/config.js
|
|
584
584
|
var DEFAULT_PORT = 4780;
|
|
585
585
|
var DEFAULT_HOST = "127.0.0.1";
|
|
586
586
|
function loadConfig(root) {
|
|
@@ -613,7 +613,7 @@ function writeConfig(cfg) {
|
|
|
613
613
|
fs3.writeFileSync(cfg.paths.config, stringifyToml({ server: { port: cfg.port, host: cfg.host }, settings: cfg.settings }));
|
|
614
614
|
}
|
|
615
615
|
|
|
616
|
-
//
|
|
616
|
+
// cli/src/serverBridge.ts
|
|
617
617
|
import fs4 from "node:fs";
|
|
618
618
|
import path4 from "node:path";
|
|
619
619
|
import { createRequire } from "node:module";
|
|
@@ -629,12 +629,12 @@ function packageRootOf(from, exists) {
|
|
|
629
629
|
}
|
|
630
630
|
function resolveServerPackageDir(deps) {
|
|
631
631
|
try {
|
|
632
|
-
return deps.realpath(path4.dirname(deps.resolve("@antbot/
|
|
632
|
+
return deps.realpath(path4.dirname(deps.resolve("@antbot/daemon/package.json")));
|
|
633
633
|
} catch {
|
|
634
634
|
}
|
|
635
635
|
const pkg = packageRootOf(deps.here, deps.exists);
|
|
636
636
|
if (pkg) {
|
|
637
|
-
const link = path4.join(pkg, "node_modules", "@antbot", "
|
|
637
|
+
const link = path4.join(pkg, "node_modules", "@antbot", "daemon");
|
|
638
638
|
if (deps.exists(link)) {
|
|
639
639
|
try {
|
|
640
640
|
return deps.realpath(link);
|
|
@@ -657,7 +657,7 @@ function findServerPackageDir() {
|
|
|
657
657
|
async function importServerDependency(specifier) {
|
|
658
658
|
const serverDir = findServerPackageDir();
|
|
659
659
|
if (!serverDir) {
|
|
660
|
-
throw new Error(`could not locate the @antbot/
|
|
660
|
+
throw new Error(`could not locate the @antbot/daemon package to resolve "${specifier}"`);
|
|
661
661
|
}
|
|
662
662
|
const req = createRequire(path4.join(serverDir, "package.json"));
|
|
663
663
|
const resolved = req.resolve(specifier);
|
|
@@ -690,20 +690,20 @@ async function importFirst(specs, what) {
|
|
|
690
690
|
throw new Error(`could not load ${what}: ${firstError?.message ?? "not found"}`);
|
|
691
691
|
}
|
|
692
692
|
async function startAntbotServer(opts) {
|
|
693
|
-
const mod = await importFirst(candidates("@antbot/
|
|
693
|
+
const mod = await importFirst(candidates("@antbot/daemon", "server.js"), "the ant-bot daemon");
|
|
694
694
|
if (typeof mod.startServer !== "function") {
|
|
695
|
-
throw new Error("@antbot/
|
|
695
|
+
throw new Error("@antbot/daemon does not export startServer() yet.");
|
|
696
696
|
}
|
|
697
697
|
return mod.startServer(opts);
|
|
698
698
|
}
|
|
699
699
|
async function importSkillSpec() {
|
|
700
700
|
return await importFirst(
|
|
701
|
-
candidates("@antbot/
|
|
701
|
+
candidates("@antbot/daemon/skills/spec.js", "skills-spec.js"),
|
|
702
702
|
"the skill spec validator"
|
|
703
703
|
);
|
|
704
704
|
}
|
|
705
705
|
|
|
706
|
-
//
|
|
706
|
+
// cli/src/color.ts
|
|
707
707
|
var noColor = Boolean(process.env.NO_COLOR) || !process.stdout.isTTY;
|
|
708
708
|
function wrap(code) {
|
|
709
709
|
return (s) => noColor ? s : `\x1B[${code}m${s}\x1B[0m`;
|
|
@@ -715,12 +715,12 @@ var green = wrap("32");
|
|
|
715
715
|
var yellow = wrap("33");
|
|
716
716
|
var cyan = wrap("36");
|
|
717
717
|
|
|
718
|
-
//
|
|
718
|
+
// cli/src/daemon.ts
|
|
719
719
|
import { spawn as spawn2 } from "node:child_process";
|
|
720
720
|
import fs6 from "node:fs";
|
|
721
721
|
import path6 from "node:path";
|
|
722
722
|
|
|
723
|
-
//
|
|
723
|
+
// cli/src/pid.ts
|
|
724
724
|
import fs5 from "node:fs";
|
|
725
725
|
import path5 from "node:path";
|
|
726
726
|
function pidFilePath(dataDir) {
|
|
@@ -757,7 +757,7 @@ function isProcessAlive(pid) {
|
|
|
757
757
|
}
|
|
758
758
|
}
|
|
759
759
|
|
|
760
|
-
//
|
|
760
|
+
// cli/src/daemon.ts
|
|
761
761
|
function sleep2(ms) {
|
|
762
762
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
763
763
|
}
|
|
@@ -933,7 +933,7 @@ async function cmdOpen() {
|
|
|
933
933
|
return 0;
|
|
934
934
|
}
|
|
935
935
|
|
|
936
|
-
//
|
|
936
|
+
// cli/src/backup.ts
|
|
937
937
|
import fs7 from "node:fs";
|
|
938
938
|
import path7 from "node:path";
|
|
939
939
|
function computeBackupItems(input) {
|
|
@@ -1007,7 +1007,7 @@ async function restoreBackup(opts) {
|
|
|
1007
1007
|
}
|
|
1008
1008
|
}
|
|
1009
1009
|
|
|
1010
|
-
//
|
|
1010
|
+
// cli/src/skill.ts
|
|
1011
1011
|
import fs8 from "node:fs";
|
|
1012
1012
|
import path8 from "node:path";
|
|
1013
1013
|
var USAGE = `Usage:
|
|
@@ -1160,13 +1160,13 @@ async function lintSkills(args) {
|
|
|
1160
1160
|
return 0;
|
|
1161
1161
|
}
|
|
1162
1162
|
|
|
1163
|
-
//
|
|
1163
|
+
// cli/src/updateCommand.ts
|
|
1164
1164
|
import fs9 from "node:fs";
|
|
1165
1165
|
import path10 from "node:path";
|
|
1166
1166
|
import readline from "node:readline/promises";
|
|
1167
1167
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
1168
1168
|
|
|
1169
|
-
//
|
|
1169
|
+
// cli/src/update.ts
|
|
1170
1170
|
import path9 from "node:path";
|
|
1171
1171
|
var PACKAGE_NAME = "@michael-joseph-miller/ant-bot";
|
|
1172
1172
|
var REGISTRY_URL = `https://registry.npmjs.org/${encodeURIComponent(PACKAGE_NAME)}/latest`;
|
|
@@ -1284,7 +1284,7 @@ async function fetchLatestVersion(timeoutMs = 3e3) {
|
|
|
1284
1284
|
}
|
|
1285
1285
|
}
|
|
1286
1286
|
|
|
1287
|
-
//
|
|
1287
|
+
// cli/src/updateCommand.ts
|
|
1288
1288
|
var CACHE_FILE = "update-check.json";
|
|
1289
1289
|
function cachePath() {
|
|
1290
1290
|
return path10.join(loadPaths().root, CACHE_FILE);
|
|
@@ -1365,7 +1365,7 @@ async function runUpdateCommand(opts) {
|
|
|
1365
1365
|
return 0;
|
|
1366
1366
|
}
|
|
1367
1367
|
|
|
1368
|
-
//
|
|
1368
|
+
// cli/src/index.ts
|
|
1369
1369
|
async function runDoctorCommand() {
|
|
1370
1370
|
const paths = loadPaths();
|
|
1371
1371
|
const port = 4780;
|