@agentyx/core 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +151 -5
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +404 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/skills/api-documentation/SKILL.md +34 -0
- package/skills/aria-patterns/SKILL.md +36 -0
- package/skills/auth-patterns/SKILL.md +35 -0
- package/skills/branching-strategy/SKILL.md +34 -0
- package/skills/ci-pipelines/SKILL.md +34 -0
- package/skills/commit-hygiene/SKILL.md +34 -0
- package/skills/containerization/SKILL.md +38 -0
- package/skills/data-modeling/SKILL.md +34 -0
- package/skills/decision-records/SKILL.md +34 -0
- package/skills/dependency-hygiene/SKILL.md +34 -0
- package/skills/dependency-security/SKILL.md +35 -0
- package/skills/deployment-safety/SKILL.md +33 -0
- package/skills/e2e-testing/SKILL.md +34 -0
- package/skills/flaky-tests/SKILL.md +29 -0
- package/skills/incident-response/SKILL.md +34 -0
- package/skills/infrastructure-as-code/SKILL.md +34 -0
- package/skills/keyboard-navigation/SKILL.md +34 -0
- package/skills/legacy-code/SKILL.md +34 -0
- package/skills/metrics-and-tracing/SKILL.md +33 -0
- package/skills/performance-profiling/SKILL.md +34 -0
- package/skills/pull-requests/SKILL.md +34 -0
- package/skills/query-performance/SKILL.md +34 -0
- package/skills/refactoring-safely/SKILL.md +34 -0
- package/skills/schema-migrations/SKILL.md +34 -0
- package/skills/secrets-handling/SKILL.md +34 -0
- package/skills/secure-coding/SKILL.md +33 -0
- package/skills/semantic-html/SKILL.md +34 -0
- package/skills/structured-logging/SKILL.md +34 -0
- package/skills/technical-writing/SKILL.md +34 -0
- package/skills/test-doubles/SKILL.md +30 -0
- package/skills/test-strategy/SKILL.md +35 -0
- package/skills/transactions-and-consistency/SKILL.md +34 -0
- package/skills/web-vitals/SKILL.md +34 -0
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["formatIssues"],"sources":["../src/errors.ts","../src/config/errors.ts","../src/mcp/schema.ts","../src/skill/schema.ts","../src/tool/schema.ts","../src/pack/schema.ts","../src/config/schema.ts","../src/config/json-schema.ts","../src/config/loader.ts","../src/mcp/errors.ts","../src/mcp/registry.ts","../src/mcp/built-in.ts","../src/pack/errors.ts","../src/pack/registry.ts","../src/pack/resolver.ts","../src/mcp/resolver.ts","../src/assets.ts","../src/skill/errors.ts","../src/skill/markdown.ts","../src/skill/registry.ts","../src/skill/built-in.ts","../src/skill/resolver.ts","../src/tool/errors.ts","../src/tool/registry.ts","../src/tool/built-in.ts","../src/tool/resolver.ts","../src/config/resolver.ts","../src/meta.ts","../src/project/detector.ts"],"sourcesContent":["/**\n * Base class for every failure Agentyx raises deliberately.\n *\n * Consumers can catch `AgentyxError` to separate expected domain failures from\n * unexpected runtime errors, and branch on the stable `code` when they need to\n * handle a specific failure.\n */\nexport class AgentyxError extends Error {\n readonly code: string;\n\n constructor(code: string, message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"AgentyxError\";\n this.code = code;\n }\n}\n","import type { ZodError } from \"zod\";\nimport { AgentyxError } from \"../errors.js\";\n\n/** A single configuration problem, addressed by its location in the document. */\nexport interface AgentyxConfigIssue {\n /** Dotted path to the offending value, or `(root)` for the document itself. */\n readonly path: string;\n readonly message: string;\n}\n\n/** Raised when the supplied directory has no `.agentyx.json`. */\nexport class AgentyxConfigNotFoundError extends AgentyxError {\n readonly filePath: string;\n\n constructor(filePath: string, options?: ErrorOptions) {\n super(\"agentyx_config_not_found\", `Agentyx configuration file not found: ${filePath}`, options);\n this.name = \"AgentyxConfigNotFoundError\";\n this.filePath = filePath;\n }\n}\n\n/** Raised when `.agentyx.json` is not valid JSON. */\nexport class AgentyxConfigParseError extends AgentyxError {\n readonly filePath: string;\n\n constructor(filePath: string, reason: string, options?: ErrorOptions) {\n super(\"agentyx_config_parse_error\", `${filePath} is not valid JSON: ${reason}`, options);\n this.name = \"AgentyxConfigParseError\";\n this.filePath = filePath;\n }\n}\n\n/** Raised when the document parses as JSON but violates the Agentyx schema. */\nexport class AgentyxConfigValidationError extends AgentyxError {\n readonly issues: readonly AgentyxConfigIssue[];\n /** The file the configuration came from, when it was read from disk. */\n readonly filePath: string | undefined;\n\n constructor(error: ZodError, filePath?: string) {\n const issues = toConfigIssues(error);\n const location = filePath === undefined ? \"\" : ` in ${filePath}`;\n const details = issues.map((issue) => ` - ${issue.path}: ${issue.message}`).join(\"\\n\");\n\n super(\"agentyx_config_invalid\", `Invalid Agentyx configuration${location}:\\n${details}`);\n this.name = \"AgentyxConfigValidationError\";\n this.issues = issues;\n this.filePath = filePath;\n }\n}\n\nexport class UnknownEnabledCapabilityError extends AgentyxError {\n readonly capabilityName: string;\n readonly knownCapabilities: readonly string[];\n\n constructor(capabilityName: string, knownCapabilities: readonly string[]) {\n const known = knownCapabilities.length > 0 ? [...knownCapabilities].sort().join(\", \") : \"none\";\n\n super(\n \"unknown_enabled_capability\",\n `Unknown enabled capability \"${capabilityName}\". Known optional capabilities: ${known}.`,\n );\n this.name = \"UnknownEnabledCapabilityError\";\n this.capabilityName = capabilityName;\n this.knownCapabilities = knownCapabilities;\n }\n}\n\nfunction toConfigIssues(error: ZodError): readonly AgentyxConfigIssue[] {\n return error.issues.map((issue) => ({\n path: formatIssuePath(issue.path),\n message: issue.message,\n }));\n}\n\nfunction formatIssuePath(path: readonly PropertyKey[]): string {\n if (path.length === 0) {\n return \"(root)\";\n }\n\n return path.reduce<string>((formatted, segment) => {\n if (typeof segment === \"number\") {\n return `${formatted}[${segment}]`;\n }\n\n return formatted === \"\" ? String(segment) : `${formatted}.${String(segment)}`;\n }, \"\");\n}\n","import { z } from \"zod\";\n\nexport const MCP_CAPABILITY_LEVELS = [\"default\", \"optional\"] as const;\n\nexport const mcpCapabilityLevelSchema = z.enum(MCP_CAPABILITY_LEVELS);\n\nexport const MCP_CONTEXT_COSTS = [\"low\", \"medium\", \"high\"] as const;\n\nexport const mcpContextCostSchema = z.enum(MCP_CONTEXT_COSTS);\n\nexport const mcpServerNameSchema = z\n .string()\n .min(1, \"MCP server names must be non-empty strings.\")\n .regex(\n /^[a-z0-9]+(?:-[a-z0-9]+)*$/,\n 'MCP server names must be lowercase kebab-case, for example \"context7\".',\n );\n\nexport const mcpEnvReferenceSchema = z.strictObject({\n fromEnv: z\n .string()\n .trim()\n .min(1, \"Environment variable references must be non-empty strings.\")\n .regex(/^[A-Za-z_][A-Za-z0-9_]*$/, \"Environment variable names must be valid shell names.\"),\n});\n\nconst commonMcpServerDefinitionSchema = z.strictObject({\n name: mcpServerNameSchema.describe(\"Unique MCP server identifier.\"),\n description: z.string().trim().min(1, \"MCP server descriptions must be non-empty strings.\"),\n transport: z.enum([\"stdio\", \"http\"]),\n contextCost: mcpContextCostSchema\n .describe(\"Qualitative context/tool-schema overhead classification; not token accounting.\")\n .optional(),\n});\n\nconst explicitMcpServerReferenceSchema = z.strictObject({\n name: mcpServerNameSchema.describe(\"MCP server identifier.\"),\n activation: mcpCapabilityLevelSchema\n .describe(\"Whether this MCP capability is active by default or explicit opt-in.\")\n .default(\"default\"),\n});\n\nexport const mcpServerReferenceSchema = z\n .union([mcpServerNameSchema, explicitMcpServerReferenceSchema])\n .transform((value) =>\n typeof value === \"string\"\n ? {\n name: value,\n activation: \"default\" as const,\n }\n : value,\n )\n .pipe(\n z.strictObject({\n name: mcpServerNameSchema.describe(\"MCP server identifier.\"),\n activation: mcpCapabilityLevelSchema.describe(\n \"Whether this MCP capability is active by default or explicit opt-in.\",\n ),\n }),\n );\n\nexport const stdioMcpServerDefinitionSchema = commonMcpServerDefinitionSchema.extend({\n transport: z.literal(\"stdio\"),\n command: z.string().trim().min(1, \"MCP stdio command must be a non-empty string.\"),\n args: z.array(z.string()).default([]),\n env: z.record(z.string().min(1), mcpEnvReferenceSchema).default({}),\n});\n\nexport const httpMcpServerDefinitionSchema = commonMcpServerDefinitionSchema.extend({\n transport: z.literal(\"http\"),\n url: z.url(\"MCP HTTP URL must be a valid URL.\"),\n headers: z.record(z.string().min(1), mcpEnvReferenceSchema).default({}),\n});\n\nexport const mcpServerDefinitionSchema = z.discriminatedUnion(\"transport\", [\n stdioMcpServerDefinitionSchema,\n httpMcpServerDefinitionSchema,\n]);\n\nexport type McpEnvReference = z.infer<typeof mcpEnvReferenceSchema>;\nexport type McpCapabilityLevel = z.infer<typeof mcpCapabilityLevelSchema>;\nexport type McpContextCost = z.infer<typeof mcpContextCostSchema>;\nexport type McpServerDefinition = z.infer<typeof mcpServerDefinitionSchema>;\nexport type McpServerDefinitionInput = z.input<typeof mcpServerDefinitionSchema>;\nexport type McpServerReference = z.infer<typeof mcpServerReferenceSchema>;\nexport type McpServerReferenceInput = z.input<typeof mcpServerReferenceSchema>;\n","import { z } from \"zod\";\n\n/**\n * Skill names double as directory names for `SKILL.md` files, so they are\n * constrained to a lowercase slug. That keeps them stable across filesystems\n * and makes them safe to join onto a path.\n */\nexport const skillNameSchema = z\n .string()\n .min(1, \"Skill names must be non-empty strings.\")\n .regex(\n /^[a-z0-9]+(?:-[a-z0-9]+)*$/,\n 'Skill names must be lowercase kebab-case, for example \"typescript-modern\".',\n );\n\n/**\n * The metadata a Skill carries, and exactly what a `SKILL.md` frontmatter block\n * may declare. Kept separate from the full definition so the parser can reject\n * a frontmatter key that tries to supply the body.\n */\nexport const skillMetadataSchema = z.strictObject({\n name: skillNameSchema.describe(\"Unique skill identifier.\"),\n description: z\n .string()\n .trim()\n .min(1, \"Skill descriptions must be non-empty strings.\")\n .describe(\"One-line summary of what the skill tells an agent to do.\"),\n});\n\n/**\n * A Skill is reusable instruction text for a coding agent. It is deliberately\n * provider-independent: nothing here says how or where a provider installs it.\n */\nexport const skillDefinitionSchema = skillMetadataSchema.extend({\n content: z\n .string()\n .trim()\n .min(1, \"Skill content must be non-empty.\")\n .describe(\"The Markdown instructions handed to an agent.\"),\n});\n\n/** A validated skill definition. */\nexport type SkillDefinition = z.infer<typeof skillDefinitionSchema>;\n\n/** The shape accepted when authoring a skill definition. */\nexport type SkillDefinitionInput = z.input<typeof skillDefinitionSchema>;\n","import { z } from \"zod\";\n\nexport const TOOL_ACTIVATION_LEVELS = [\"default\", \"optional\"] as const;\n\nexport const toolActivationLevelSchema = z.enum(TOOL_ACTIVATION_LEVELS);\n\nexport const toolNameSchema = z\n .string()\n .min(1, \"Tool names must be non-empty strings.\")\n .regex(\n /^[a-z0-9]+(?:-[a-z0-9]+)*$/,\n 'Tool names must be lowercase kebab-case, for example \"rtk\".',\n );\n\nexport const toolReferenceSchema = z\n .union([\n toolNameSchema,\n z.strictObject({\n name: toolNameSchema.describe(\"Tool identifier.\"),\n activation: toolActivationLevelSchema.default(\"default\"),\n }),\n ])\n .transform((value) =>\n typeof value === \"string\"\n ? {\n name: value,\n activation: \"default\" as const,\n }\n : value,\n )\n .pipe(\n z.strictObject({\n name: toolNameSchema.describe(\"Tool identifier.\"),\n activation: toolActivationLevelSchema,\n }),\n );\n\nexport const toolDefinitionSchema = z.strictObject({\n name: toolNameSchema.describe(\"Unique tool identifier.\"),\n description: z.string().trim().min(1, \"Tool descriptions must be non-empty strings.\"),\n kind: z.literal(\"executable\"),\n command: z.string().trim().min(1, \"Tool executable command must be a non-empty string.\"),\n optional: z.boolean().default(true),\n installHint: z.string().trim().min(1, \"Tool install hints must be non-empty strings.\").optional(),\n});\n\nexport type ToolActivationLevel = z.infer<typeof toolActivationLevelSchema>;\nexport type ToolDefinition = z.infer<typeof toolDefinitionSchema>;\nexport type ToolDefinitionInput = z.input<typeof toolDefinitionSchema>;\nexport type ToolReference = z.infer<typeof toolReferenceSchema>;\nexport type ToolReferenceInput = z.input<typeof toolReferenceSchema>;\n","import { z } from \"zod\";\nimport { mcpServerReferenceSchema } from \"../mcp/schema.js\";\nimport { skillNameSchema } from \"../skill/schema.js\";\nimport { toolReferenceSchema } from \"../tool/schema.js\";\n\nexport const PACK_CATEGORIES = [\n \"engineering\",\n \"language\",\n \"framework\",\n \"efficiency\",\n \"workflow\",\n] as const;\n\nexport const packCategorySchema = z.enum(PACK_CATEGORIES);\n\n/**\n * Pack names are plain identifiers. They are intentionally not constrained to\n * a closed list so that external registries can contribute packs later.\n */\nexport const packNameSchema = z.string().min(1, \"Pack names must be non-empty strings.\");\n\n/** A pack is a composable provider-neutral capability bundle. */\nexport const packDefinitionSchema = z.strictObject({\n name: packNameSchema.describe(\"Unique pack identifier.\"),\n category: packCategorySchema\n .describe(\"Discoverability category; does not affect resolution.\")\n .default(\"engineering\"),\n description: z\n .string()\n .min(1, \"Pack descriptions must be non-empty when provided.\")\n .describe(\"Short human-readable summary of the pack.\")\n .optional(),\n skills: z\n .array(skillNameSchema)\n .describe(\"Skills this pack contributes, in declaration order.\")\n .default([]),\n mcpServers: z\n .array(mcpServerReferenceSchema)\n .describe(\"MCP servers this pack contributes, in declaration order.\")\n .default([]),\n tools: z\n .array(toolReferenceSchema)\n .describe(\"Local tools this pack contributes, in declaration order.\")\n .default([]),\n});\n\n/** A validated pack definition, with defaults always present. */\nexport type PackDefinition = z.infer<typeof packDefinitionSchema>;\nexport type PackCategory = z.infer<typeof packCategorySchema>;\n\n/** The shape accepted when authoring a pack definition. */\nexport type PackDefinitionInput = z.input<typeof packDefinitionSchema>;\n","import { z } from \"zod\";\nimport { packNameSchema } from \"../pack/schema.js\";\n\n/**\n * Targets stay free-form strings on purpose: third-party adapters should be\n * able to register providers without a change to this schema.\n */\nexport const agentyxTargetSchema = z.string().min(1, \"Targets must be non-empty strings.\");\n\nexport const enabledCapabilityNameSchema = z\n .string()\n .min(1, \"Enabled capability names must be non-empty strings.\")\n .regex(\n /^[a-z0-9]+(?:-[a-z0-9]+)*$/,\n 'Enabled capability names must be lowercase kebab-case, for example \"rtk\".',\n );\n\n/** The `.agentyx.json` project configuration. */\nexport const agentyxConfigSchema = z.strictObject({\n $schema: z\n .string()\n .min(1, \"$schema must be a non-empty string.\")\n .describe(\"Optional path or URL to the Agentyx JSON Schema.\")\n .optional(),\n packs: z.array(packNameSchema).describe(\"Capability packs this project selects.\").default([]),\n enable: z\n .array(enabledCapabilityNameSchema)\n .describe(\"Optional capabilities to activate by explicit identifier.\")\n .default([]),\n targets: z\n .array(agentyxTargetSchema)\n .describe(\"Coding-agent providers this project targets.\")\n .default([]),\n});\n\n/** A validated configuration, with defaults applied. */\nexport type AgentyxConfig = z.infer<typeof agentyxConfigSchema>;\n\n/** The shape accepted in a `.agentyx.json` file. */\nexport type AgentyxConfigInput = z.input<typeof agentyxConfigSchema>;\n","import { z } from \"zod\";\nimport { agentyxConfigSchema } from \"./schema.js\";\n\n/** Canonical identifier of the published `.agentyx.json` schema. */\nexport const AGENTYX_CONFIG_SCHEMA_ID = \"https://agentyx.dev/schema/agentyx.schema.json\";\n\n/**\n * Derives the JSON Schema for `.agentyx.json` from the Zod model, which stays the\n * single source of truth. The committed `schema/agentyx.schema.json` is generated\n * from this function and verified by tests.\n *\n * The `input` view is used so that fields with defaults stay optional, which is\n * what an author writing the file cares about.\n */\nexport function buildAgentyxConfigJsonSchema(): Record<string, unknown> {\n return {\n $schema: \"https://json-schema.org/draft/2020-12/schema\",\n $id: AGENTYX_CONFIG_SCHEMA_ID,\n title: \"Agentyx project configuration\",\n description: \"Configuration for an Agentyx project (.agentyx.json).\",\n ...z.toJSONSchema(agentyxConfigSchema, { io: \"input\" }),\n };\n}\n","import { readFile } from \"node:fs/promises\";\nimport { resolve } from \"node:path\";\nimport {\n AgentyxConfigNotFoundError,\n AgentyxConfigParseError,\n AgentyxConfigValidationError,\n} from \"./errors.js\";\nimport { type AgentyxConfig, agentyxConfigSchema } from \"./schema.js\";\n\nexport const AGENTYX_CONFIG_FILENAME = \".agentyx.json\";\n\n/** The absolute path `.agentyx.json` is read from for a given project. */\nexport function agentyxConfigPath(projectPath: string = process.cwd()): string {\n return resolve(projectPath, AGENTYX_CONFIG_FILENAME);\n}\n\n/**\n * Validates an already-parsed configuration document.\n *\n * @throws {AgentyxConfigValidationError} when the document violates the schema.\n */\nexport function parseAgentyxConfig(value: unknown, filePath?: string): AgentyxConfig {\n const result = agentyxConfigSchema.safeParse(value);\n\n if (!result.success) {\n throw new AgentyxConfigValidationError(result.error, filePath);\n }\n\n return result.data;\n}\n\n/**\n * Reads and validates `.agentyx.json` from `projectPath`.\n *\n * Parent directories are not searched, and invalid configurations are never\n * silently repaired.\n *\n * @throws {AgentyxConfigNotFoundError} when the file does not exist.\n * @throws {AgentyxConfigParseError} when the file is not valid JSON.\n * @throws {AgentyxConfigValidationError} when the document violates the schema.\n */\nexport async function loadAgentyxConfig(\n projectPath: string = process.cwd(),\n): Promise<AgentyxConfig> {\n const filePath = agentyxConfigPath(projectPath);\n let contents: string;\n\n try {\n contents = await readFile(filePath, \"utf8\");\n } catch (cause) {\n if (isFileNotFound(cause)) {\n throw new AgentyxConfigNotFoundError(filePath, { cause });\n }\n\n throw cause;\n }\n\n let document: unknown;\n\n try {\n document = JSON.parse(contents);\n } catch (cause) {\n const reason = cause instanceof Error ? cause.message : String(cause);\n throw new AgentyxConfigParseError(filePath, reason, { cause });\n }\n\n return parseAgentyxConfig(document, filePath);\n}\n\nfunction isFileNotFound(cause: unknown): boolean {\n return cause instanceof Error && (cause as NodeJS.ErrnoException).code === \"ENOENT\";\n}\n","import type { ZodError } from \"zod\";\nimport { AgentyxError } from \"../errors.js\";\n\nexport class UnknownMcpServerError extends AgentyxError {\n readonly serverName: string;\n readonly requiredBy: string | undefined;\n readonly knownServers: readonly string[];\n\n constructor(serverName: string, requiredBy: string | undefined, knownServers: readonly string[]) {\n const origin = requiredBy === undefined ? \"\" : ` (required by \"${requiredBy}\")`;\n const known = knownServers.length > 0 ? [...knownServers].sort().join(\", \") : \"none\";\n\n super(\n \"unknown_mcp_server\",\n `Unknown MCP server \"${serverName}\"${origin}. Known MCP servers: ${known}.`,\n );\n this.name = \"UnknownMcpServerError\";\n this.serverName = serverName;\n this.requiredBy = requiredBy;\n this.knownServers = knownServers;\n }\n}\n\nexport class DuplicateMcpServerError extends AgentyxError {\n readonly serverName: string;\n\n constructor(serverName: string) {\n super(\"duplicate_mcp_server\", `Duplicate MCP server definition: \"${serverName}\".`);\n this.name = \"DuplicateMcpServerError\";\n this.serverName = serverName;\n }\n}\n\nexport class InvalidMcpServerError extends AgentyxError {\n readonly origin: string;\n readonly reason: string;\n\n constructor(origin: string, reason: string | ZodError, options?: ErrorOptions) {\n const detail = typeof reason === \"string\" ? reason : formatIssues(reason);\n\n super(\"invalid_mcp_server\", `Invalid MCP server in ${origin}: ${detail}`, options);\n this.name = \"InvalidMcpServerError\";\n this.origin = origin;\n this.reason = detail;\n }\n}\n\nfunction formatIssues(error: ZodError): string {\n return error.issues\n .map((issue) => {\n const path = issue.path.map(String).join(\".\");\n\n return path === \"\" ? issue.message : `${path}: ${issue.message}`;\n })\n .join(\"; \");\n}\n","import { DuplicateMcpServerError, InvalidMcpServerError, UnknownMcpServerError } from \"./errors.js\";\nimport {\n type McpServerDefinition,\n type McpServerDefinitionInput,\n mcpServerDefinitionSchema,\n mcpServerNameSchema,\n} from \"./schema.js\";\n\nexport interface McpServerSource {\n readonly name: string;\n load(): McpServerDefinitionInput;\n}\n\nexport interface McpServerMetadata {\n readonly name: string;\n readonly description: string;\n readonly transport: McpServerDefinition[\"transport\"];\n readonly contextCost?: McpServerDefinition[\"contextCost\"];\n}\n\nexport interface McpServerRegistry {\n readonly names: readonly string[];\n has(name: string): boolean;\n listMetadata(): readonly McpServerMetadata[];\n get(name: string): McpServerDefinition;\n}\n\nexport function createMcpServerRegistry(sources: Iterable<McpServerSource>): McpServerRegistry {\n const byName = new Map<string, McpServerSource>();\n\n for (const source of sources) {\n const name = mcpServerNameSchema.safeParse(source.name);\n\n if (!name.success) {\n throw new InvalidMcpServerError(`MCP server source \"${source.name}\"`, name.error);\n }\n\n if (byName.has(name.data)) {\n throw new DuplicateMcpServerError(name.data);\n }\n\n byName.set(name.data, source);\n }\n\n const names = [...byName.keys()];\n const loaded = new Map<string, McpServerDefinition>();\n const get = (name: string): McpServerDefinition => {\n const cached = loaded.get(name);\n\n if (cached !== undefined) {\n return cached;\n }\n\n const source = byName.get(name);\n\n if (source === undefined) {\n throw new UnknownMcpServerError(name, undefined, names);\n }\n\n const origin = `MCP server \"${name}\"`;\n const server = mcpServerDefinitionSchema.safeParse(source.load());\n\n if (!server.success) {\n throw new InvalidMcpServerError(origin, server.error);\n }\n\n if (server.data.name !== name) {\n throw new InvalidMcpServerError(origin, `it declares the name \"${server.data.name}\"`);\n }\n\n loaded.set(name, server.data);\n\n return server.data;\n };\n\n return {\n names,\n has: (name) => byName.has(name),\n listMetadata: () =>\n names.map((name) => {\n const server = get(name);\n\n return {\n name: server.name,\n description: server.description,\n transport: server.transport,\n contextCost: server.contextCost,\n };\n }),\n get,\n };\n}\n","import { createMcpServerRegistry, type McpServerSource } from \"./registry.js\";\n\nexport const builtInMcpServerSources: readonly McpServerSource[] = [\n {\n name: \"context7\",\n load: () => ({\n name: \"context7\",\n description: \"Fetch up-to-date library documentation from Context7.\",\n transport: \"http\",\n contextCost: \"medium\",\n url: \"https://mcp.context7.com/mcp\",\n }),\n },\n {\n name: \"playwright\",\n load: () => ({\n name: \"playwright\",\n description: \"Automate and inspect browsers through Playwright MCP.\",\n transport: \"stdio\",\n contextCost: \"high\",\n command: \"npx\",\n args: [\"@playwright/mcp@latest\"],\n }),\n },\n {\n name: \"codebase-memory\",\n load: () => ({\n name: \"codebase-memory\",\n description: \"Structural code-intelligence MCP backed by a persistent code knowledge graph.\",\n transport: \"stdio\",\n contextCost: \"high\",\n command: \"codebase-memory-mcp\",\n }),\n },\n];\n\nexport const builtInMcpServerRegistry = createMcpServerRegistry(builtInMcpServerSources);\n\nexport const builtInMcpServerNames: readonly string[] = builtInMcpServerRegistry.names;\n","import { AgentyxError } from \"../errors.js\";\n\n/** Raised when a requested pack is not present in the registry. */\nexport class UnknownPackError extends AgentyxError {\n readonly packName: string;\n readonly requiredBy: string | undefined;\n readonly knownPacks: readonly string[];\n\n constructor(packName: string, requiredBy: string | undefined, knownPacks: readonly string[]) {\n const origin = requiredBy === undefined ? \"\" : ` (required by \"${requiredBy}\")`;\n const known = knownPacks.length > 0 ? [...knownPacks].sort().join(\", \") : \"none\";\n\n super(\"unknown_pack\", `Unknown pack \"${packName}\"${origin}. Known packs: ${known}.`);\n this.name = \"UnknownPackError\";\n this.packName = packName;\n this.requiredBy = requiredBy;\n this.knownPacks = knownPacks;\n }\n}\n\n/** @deprecated Packs no longer inherit from other packs. */\nexport class CircularPackDependencyError extends AgentyxError {\n /** The cycle path, starting and ending with the same pack. */\n readonly cycle: readonly string[];\n\n constructor(cycle: readonly string[]) {\n super(\"circular_pack_dependency\", `Circular pack dependency: ${cycle.join(\" -> \")}.`);\n this.name = \"CircularPackDependencyError\";\n this.cycle = cycle;\n }\n}\n\n/** Raised when a registry is built from definitions that reuse a pack name. */\nexport class DuplicatePackError extends AgentyxError {\n readonly packName: string;\n\n constructor(packName: string) {\n super(\"duplicate_pack\", `Duplicate pack definition: \"${packName}\".`);\n this.name = \"DuplicatePackError\";\n this.packName = packName;\n }\n}\n","import { DuplicatePackError } from \"./errors.js\";\nimport { type PackDefinition, type PackDefinitionInput, packDefinitionSchema } from \"./schema.js\";\n\n/**\n * A registry is a name lookup over pack definitions. Keeping it a plain map\n * means the resolver stays independent of where definitions come from, so\n * external registries can be added later without touching resolution.\n */\nexport type PackRegistry = ReadonlyMap<string, PackDefinition>;\n\n/** Validates definitions and indexes them by name. */\nexport function createPackRegistry(definitions: Iterable<PackDefinitionInput>): PackRegistry {\n const registry = new Map<string, PackDefinition>();\n\n for (const definition of definitions) {\n const pack = packDefinitionSchema.parse(definition);\n\n if (registry.has(pack.name)) {\n throw new DuplicatePackError(pack.name);\n }\n\n registry.set(pack.name, pack);\n }\n\n return registry;\n}\n\n/**\n * The packs Agentyx ships with, expressed as data. Relationships live here, not\n * in the resolver.\n */\nexport const builtInPacks: readonly PackDefinitionInput[] = [\n {\n name: \"technical\",\n category: \"engineering\",\n description: \"General software-engineering quality independent of language or framework.\",\n skills: [\"engineering-principles\", \"code-quality\", \"api-design\", \"code-review\"],\n },\n {\n name: \"typescript\",\n category: \"language\",\n description: \"TypeScript language conventions for strict, modern code.\",\n skills: [\"typescript-strict\", \"typescript-modeling\", \"typescript-modern\"],\n },\n {\n name: \"angular\",\n category: \"framework\",\n description: \"Modern Angular development environment.\",\n skills: [\"angular-modern\", \"angular-signals\", \"angular-architecture\", \"angular-testing\"],\n mcpServers: [\"context7\"],\n },\n {\n name: \"efficiency\",\n category: \"efficiency\",\n description: \"Reduce context and tool overhead without weakening verification.\",\n skills: [\n \"context-efficient-development\",\n \"concise-output\",\n \"targeted-exploration\",\n \"focused-verification\",\n ],\n mcpServers: [{ name: \"codebase-memory\", activation: \"optional\" }],\n tools: [{ name: \"rtk\", activation: \"optional\" }],\n },\n {\n name: \"agentic\",\n category: \"workflow\",\n description: \"Provider-neutral development workflows for substantial coding-agent work.\",\n skills: [\n \"brainstorming\",\n \"planning\",\n \"systematic-debugging\",\n \"verification\",\n \"parallel-work\",\n \"worktree-workflow\",\n \"subagent-driven-development\",\n \"requesting-code-review\",\n ],\n },\n];\n\n/** The registry used by default when no explicit registry is supplied. */\nexport const builtInPackRegistry: PackRegistry = createPackRegistry(builtInPacks);\n","import { UnknownPackError } from \"./errors.js\";\nimport { builtInPackRegistry, type PackRegistry } from \"./registry.js\";\n\n/**\n * Resolves selected packs without hidden inheritance.\n *\n * The result preserves configured order, removes duplicates by first\n * occurrence, and validates every requested pack.\n *\n * @throws {UnknownPackError} when a requested pack is missing.\n */\nexport function resolvePacks(\n requestedPacks: readonly string[],\n registry: PackRegistry = builtInPackRegistry,\n): string[] {\n const resolved: string[] = [];\n const seen = new Set<string>();\n\n for (const name of requestedPacks) {\n if (seen.has(name)) {\n continue;\n }\n\n if (!registry.has(name)) {\n throw new UnknownPackError(name, undefined, [...registry.keys()]);\n }\n\n seen.add(name);\n resolved.push(name);\n }\n\n return resolved;\n}\n","import { builtInPackRegistry, type PackRegistry } from \"../pack/registry.js\";\nimport { resolvePacks } from \"../pack/resolver.js\";\nimport { builtInMcpServerRegistry } from \"./built-in.js\";\nimport { UnknownMcpServerError } from \"./errors.js\";\nimport type { McpServerRegistry } from \"./registry.js\";\nimport type { McpServerReference } from \"./schema.js\";\n\nexport function collectPackMcpServerReferences(\n resolvedPacks: readonly string[],\n packRegistry: PackRegistry,\n mcpRegistry: McpServerRegistry,\n): McpServerReference[] {\n const servers: McpServerReference[] = [];\n const seen = new Set<string>();\n\n for (const packName of resolvedPacks) {\n for (const server of packRegistry.get(packName)?.mcpServers ?? []) {\n const serverName = server.name;\n\n if (seen.has(serverName)) {\n continue;\n }\n\n if (!mcpRegistry.has(serverName)) {\n throw new UnknownMcpServerError(serverName, packName, mcpRegistry.names);\n }\n\n seen.add(serverName);\n servers.push(server);\n }\n }\n\n return servers;\n}\n\nexport function filterEffectiveMcpServers(\n servers: readonly McpServerReference[],\n enabledCapabilities: readonly string[],\n): string[] {\n const enabled = new Set(enabledCapabilities);\n\n return servers\n .filter((server) => server.activation === \"default\" || enabled.has(server.name))\n .map((server) => server.name);\n}\n\nexport function collectPackMcpServers(\n resolvedPacks: readonly string[],\n packRegistry: PackRegistry,\n mcpRegistry: McpServerRegistry,\n enabledCapabilities: readonly string[] = [],\n): string[] {\n return filterEffectiveMcpServers(\n collectPackMcpServerReferences(resolvedPacks, packRegistry, mcpRegistry),\n enabledCapabilities,\n );\n}\n\nexport function resolvePackMcpServerReferences(\n requestedPacks: readonly string[],\n packRegistry: PackRegistry = builtInPackRegistry,\n mcpRegistry: McpServerRegistry = builtInMcpServerRegistry,\n): McpServerReference[] {\n return collectPackMcpServerReferences(\n resolvePacks(requestedPacks, packRegistry),\n packRegistry,\n mcpRegistry,\n );\n}\n\nexport function resolvePackMcpServers(\n requestedPacks: readonly string[],\n packRegistry: PackRegistry = builtInPackRegistry,\n mcpRegistry: McpServerRegistry = builtInMcpServerRegistry,\n enabledCapabilities: readonly string[] = [],\n): string[] {\n return collectPackMcpServers(\n resolvePacks(requestedPacks, packRegistry),\n packRegistry,\n mcpRegistry,\n enabledCapabilities,\n );\n}\n","import { fileURLToPath } from \"node:url\";\n\n/**\n * Location of the non-code assets that ship with `@agentyx/core`.\n *\n * **This module must stay directly under `src/`.** The path is derived from\n * `import.meta.url` rather than the working directory, and `src/assets.ts` and\n * the bundled `dist/index.mjs` sit at the same depth below the package root, so\n * one relative path is correct both in development and in the published\n * package. Moving this file into a subdirectory breaks built-in skill loading;\n * `packages/core/test/built-in-skills.test.ts` guards against that.\n *\n * `skills/` is listed in the package's `files`, so it is published alongside\n * `dist/`.\n */\nexport const BUILT_IN_SKILLS_PATH = fileURLToPath(new URL(\"../skills\", import.meta.url));\n","import type { ZodError } from \"zod\";\nimport { AgentyxError } from \"../errors.js\";\n\n/**\n * Raised when a pack references a skill the registry does not know.\n *\n * The offending name is exposed as `skillName`; `pack` stays the JS pack\n * trace inherited from `Error`.\n */\nexport class UnknownSkillError extends AgentyxError {\n readonly skillName: string;\n /** The pack that declared the skill, when the failure came from resolution. */\n readonly requiredBy: string | undefined;\n readonly knownSkills: readonly string[];\n\n constructor(skillName: string, requiredBy: string | undefined, knownSkills: readonly string[]) {\n const origin = requiredBy === undefined ? \"\" : ` (required by pack \"${requiredBy}\")`;\n const known = knownSkills.length > 0 ? [...knownSkills].sort().join(\", \") : \"none\";\n\n super(\"unknown_skill\", `Unknown skill \"${skillName}\"${origin}. Known skills: ${known}.`);\n this.name = \"UnknownSkillError\";\n this.skillName = skillName;\n this.requiredBy = requiredBy;\n this.knownSkills = knownSkills;\n }\n}\n\n/** Raised when a registry is built from sources that reuse a skill name. */\nexport class DuplicateSkillError extends AgentyxError {\n readonly skillName: string;\n\n constructor(skillName: string) {\n super(\"duplicate_skill\", `Duplicate skill definition: \"${skillName}\".`);\n this.name = \"DuplicateSkillError\";\n this.skillName = skillName;\n }\n}\n\n/**\n * Raised when a skill exists but cannot be turned into a valid definition —\n * malformed `SKILL.md` frontmatter, a missing field, an unreadable file.\n *\n * Built-in skills ship with Agentyx, so this is a programmer error rather than\n * something a user can fix in their project.\n */\nexport class InvalidSkillError extends AgentyxError {\n /** Where the skill came from: a file path, or a label for an in-memory source. */\n readonly origin: string;\n readonly reason: string;\n\n constructor(origin: string, reason: string | ZodError, options?: ErrorOptions) {\n const detail = typeof reason === \"string\" ? reason : formatIssues(reason);\n\n super(\"invalid_skill\", `Invalid skill in ${origin}: ${detail}`, options);\n this.name = \"InvalidSkillError\";\n this.origin = origin;\n this.reason = detail;\n }\n}\n\nfunction formatIssues(error: ZodError): string {\n return error.issues\n .map((issue) => {\n const path = issue.path.map(String).join(\".\");\n\n return path === \"\" ? issue.message : `${path}: ${issue.message}`;\n })\n .join(\"; \");\n}\n","import { InvalidSkillError } from \"./errors.js\";\nimport {\n type SkillDefinition,\n type SkillDefinitionInput,\n skillDefinitionSchema,\n skillMetadataSchema,\n} from \"./schema.js\";\n\nconst DELIMITER = \"---\";\nconst BYTE_ORDER_MARK = /^\\uFEFF/;\nconst LINE_BREAK = /[\\r\\n]/;\n\n/**\n * A `SKILL.md` file is a frontmatter block followed by the Markdown body:\n *\n * ```md\n * ---\n * name: planning\n * description: Plan non-trivial work before editing.\n * ---\n *\n * Instructions...\n * ```\n *\n * The frontmatter is a deliberately small YAML subset — a flat block of\n * `key: value` pairs, values optionally quoted — so that core keeps depending\n * on Zod alone. Anything richer is rejected rather than guessed at.\n *\n * The body is preserved as written apart from trimming the blank lines around\n * it, and `origin` is only used to make errors readable.\n *\n * @throws {InvalidSkillError} when the frontmatter or the resulting skill is invalid.\n */\nexport function parseSkillMarkdown(markdown: string, origin: string): SkillDefinition {\n const lines = markdown.replace(BYTE_ORDER_MARK, \"\").split(/\\r?\\n/);\n\n if (lines[0]?.trim() !== DELIMITER) {\n throw new InvalidSkillError(\n origin,\n `the file must start with a \"${DELIMITER}\" frontmatter line`,\n );\n }\n\n const closing = lines.findIndex((line, index) => index > 0 && line.trim() === DELIMITER);\n\n if (closing === -1) {\n throw new InvalidSkillError(\n origin,\n `the frontmatter block is never closed with \"${DELIMITER}\"`,\n );\n }\n\n const metadata = skillMetadataSchema.safeParse(parseFrontmatter(lines.slice(1, closing), origin));\n\n if (!metadata.success) {\n throw new InvalidSkillError(origin, metadata.error);\n }\n\n const skill = skillDefinitionSchema.safeParse({\n ...metadata.data,\n content: lines.slice(closing + 1).join(\"\\n\"),\n });\n\n if (!skill.success) {\n throw new InvalidSkillError(origin, skill.error);\n }\n\n return skill.data;\n}\n\n/**\n * Renders a skill as canonical `SKILL.md` text — the inverse of\n * `parseSkillMarkdown`, and the single representation every consumer installs.\n *\n * Keeping this in core is what stops a provider from owning a copy of a skill\n * body: an adapter decides *where* a skill goes, never what it says.\n *\n * The output is deterministic. Frontmatter is always `name` then `description`,\n * the body is the trimmed content, and the file ends with exactly one newline,\n * so re-rendering an unchanged skill produces a byte-identical file and an\n * installer can compare content instead of guessing.\n *\n * @throws {InvalidSkillError} when the definition is invalid, or when the\n * description cannot be represented in the flat frontmatter subset the parser\n * accepts.\n */\nexport function formatSkillMarkdown(skill: SkillDefinitionInput): string {\n const origin = typeof skill.name === \"string\" ? `skill \"${skill.name}\"` : \"skill definition\";\n const parsed = skillDefinitionSchema.safeParse(skill);\n\n if (!parsed.success) {\n throw new InvalidSkillError(origin, parsed.error);\n }\n\n const { name, description, content } = parsed.data;\n\n if (LINE_BREAK.test(description)) {\n throw new InvalidSkillError(origin, \"the description must not contain a line break\");\n }\n\n return `${DELIMITER}\\nname: ${name}\\ndescription: ${description}\\n${DELIMITER}\\n\\n${content}\\n`;\n}\n\nfunction parseFrontmatter(lines: readonly string[], origin: string): Record<string, string> {\n const entries = new Map<string, string>();\n\n for (const [index, line] of lines.entries()) {\n if (line.trim() === \"\") {\n continue;\n }\n\n const separator = line.indexOf(\":\");\n // +2: the opening delimiter line, plus the shift from a zero-based index.\n const lineNumber = index + 2;\n\n if (separator === -1) {\n throw new InvalidSkillError(\n origin,\n `frontmatter line ${lineNumber} is not \"key: value\": ${line}`,\n );\n }\n\n const key = line.slice(0, separator).trim();\n\n if (key === \"\") {\n throw new InvalidSkillError(origin, `frontmatter line ${lineNumber} has an empty key`);\n }\n\n if (entries.has(key)) {\n throw new InvalidSkillError(\n origin,\n `duplicate frontmatter key \"${key}\" on line ${lineNumber}`,\n );\n }\n\n entries.set(key, unquote(line.slice(separator + 1).trim()));\n }\n\n return Object.fromEntries(entries);\n}\n\nfunction unquote(value: string): string {\n const quoted = /^\"(.*)\"$|^'(.*)'$/.exec(value);\n\n return quoted?.[1] ?? quoted?.[2] ?? value;\n}\n","import { DuplicateSkillError, InvalidSkillError, UnknownSkillError } from \"./errors.js\";\nimport {\n type SkillDefinition,\n type SkillDefinitionInput,\n skillDefinitionSchema,\n skillNameSchema,\n} from \"./schema.js\";\n\n/**\n * Where a single skill comes from. The name is known up front so that listing\n * and existence checks stay cheap, and `load` is only called when something\n * actually needs the instructions — a design that keeps `resolve` working on\n * identifiers alone.\n *\n * This is also the seam an external or remote registry would plug into later.\n */\nexport interface SkillSource {\n readonly name: string;\n /** Produces the definition. Called at most once per registry. */\n load(): SkillDefinitionInput;\n}\n\n/** A name lookup over skills, independent of where the definitions live. */\nexport interface SkillRegistry {\n /** Registered names in registration order. Never reads a skill body. */\n readonly names: readonly string[];\n has(name: string): boolean;\n /**\n * Loads, validates and caches a skill.\n *\n * @throws {UnknownSkillError} when the name is not registered.\n * @throws {InvalidSkillError} when the source yields an invalid definition.\n */\n get(name: string): SkillDefinition;\n}\n\n/**\n * Indexes skill sources by name.\n *\n * Names and duplicates are validated here; the definitions themselves are\n * validated the first time each skill is loaded.\n *\n * @throws {DuplicateSkillError} when two sources share a name.\n * @throws {InvalidSkillError} when a source name is not a valid skill name.\n */\nexport function createSkillRegistry(sources: Iterable<SkillSource>): SkillRegistry {\n const byName = new Map<string, SkillSource>();\n\n for (const source of sources) {\n const name = skillNameSchema.safeParse(source.name);\n\n if (!name.success) {\n throw new InvalidSkillError(`skill source \"${source.name}\"`, name.error);\n }\n\n if (byName.has(name.data)) {\n throw new DuplicateSkillError(name.data);\n }\n\n byName.set(name.data, source);\n }\n\n const names = [...byName.keys()];\n const loaded = new Map<string, SkillDefinition>();\n\n return {\n names,\n has: (name) => byName.has(name),\n get: (name) => {\n const cached = loaded.get(name);\n\n if (cached !== undefined) {\n return cached;\n }\n\n const source = byName.get(name);\n\n if (source === undefined) {\n throw new UnknownSkillError(name, undefined, names);\n }\n\n const origin = `skill \"${name}\"`;\n const skill = skillDefinitionSchema.safeParse(source.load());\n\n if (!skill.success) {\n throw new InvalidSkillError(origin, skill.error);\n }\n\n if (skill.data.name !== name) {\n throw new InvalidSkillError(origin, `it declares the name \"${skill.data.name}\"`);\n }\n\n loaded.set(name, skill.data);\n\n return skill.data;\n },\n };\n}\n","import { readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { BUILT_IN_SKILLS_PATH } from \"../assets.js\";\nimport { InvalidSkillError } from \"./errors.js\";\nimport { parseSkillMarkdown } from \"./markdown.js\";\nimport { createSkillRegistry, type SkillRegistry } from \"./registry.js\";\nimport type { SkillDefinition } from \"./schema.js\";\n\n/**\n * The skills Agentyx ships with. The names are the directory names under\n * `packages/core/skills`, and knowing them without touching the filesystem is\n * what lets pack resolution validate references without reading any body.\n */\nexport const builtInSkillNames = [\n \"engineering-principles\",\n \"code-quality\",\n \"api-design\",\n \"code-review\",\n \"planning\",\n \"systematic-debugging\",\n \"verification\",\n \"brainstorming\",\n \"parallel-work\",\n \"worktree-workflow\",\n \"subagent-driven-development\",\n \"requesting-code-review\",\n \"typescript-strict\",\n \"typescript-modeling\",\n \"typescript-modern\",\n \"angular-modern\",\n \"angular-signals\",\n \"angular-architecture\",\n \"angular-testing\",\n \"context-efficient-development\",\n \"concise-output\",\n \"targeted-exploration\",\n \"focused-verification\",\n] as const;\n\n/** The absolute path of a built-in skill's `SKILL.md`. */\nexport function builtInSkillPath(name: string): string {\n return join(BUILT_IN_SKILLS_PATH, name, \"SKILL.md\");\n}\n\n/** The registry used by default when no explicit registry is supplied. */\nexport const builtInSkillRegistry: SkillRegistry = createSkillRegistry(\n builtInSkillNames.map((name) => ({ name, load: () => loadBuiltInSkill(name) })),\n);\n\n/**\n * Reads one built-in `SKILL.md`.\n *\n * Reading is synchronous on purpose: the files are small package assets, they\n * are only touched when a command asks for instructions, and a synchronous read\n * keeps `SkillRegistry.get` a plain lookup instead of infecting every caller\n * with a promise.\n */\nfunction loadBuiltInSkill(name: string): SkillDefinition {\n const filePath = builtInSkillPath(name);\n let markdown: string;\n\n try {\n markdown = readFileSync(filePath, \"utf8\");\n } catch (cause) {\n const reason = cause instanceof Error ? cause.message : String(cause);\n\n throw new InvalidSkillError(filePath, `the file could not be read: ${reason}`, { cause });\n }\n\n return parseSkillMarkdown(markdown, filePath);\n}\n","import { builtInPackRegistry, type PackRegistry } from \"../pack/registry.js\";\nimport { resolvePacks } from \"../pack/resolver.js\";\nimport { builtInSkillRegistry } from \"./built-in.js\";\nimport { UnknownSkillError } from \"./errors.js\";\nimport type { SkillRegistry } from \"./registry.js\";\n\n/**\n * Collects the skills contributed by an already-resolved pack chain.\n *\n * Only identifiers are produced — no skill body is read — so this stays cheap\n * enough to run on every `resolve`.\n *\n * @throws {UnknownSkillError} when a pack references a skill the registry lacks.\n */\nexport function collectPackSkills(\n resolvedPacks: readonly string[],\n packRegistry: PackRegistry,\n skillRegistry: SkillRegistry,\n): string[] {\n const skills: string[] = [];\n const seen = new Set<string>();\n\n for (const packName of resolvedPacks) {\n for (const skillName of packRegistry.get(packName)?.skills ?? []) {\n if (seen.has(skillName)) {\n continue;\n }\n\n if (!skillRegistry.has(skillName)) {\n throw new UnknownSkillError(skillName, packName, skillRegistry.names);\n }\n\n seen.add(skillName);\n skills.push(skillName);\n }\n }\n\n return skills;\n}\n\n/**\n * Resolves the requested packs and returns the skills they contribute.\n *\n * The result follows the resolved pack order, then each pack's declaration\n * order, and is de-duplicated by first occurrence. Skills do not extend other\n * skills, so there is nothing further to expand.\n *\n * @throws {UnknownPackError} when a requested pack is missing.\n * @throws {UnknownSkillError} when a pack references a skill the registry lacks.\n */\nexport function resolvePackSkills(\n requestedPacks: readonly string[],\n packRegistry: PackRegistry = builtInPackRegistry,\n skillRegistry: SkillRegistry = builtInSkillRegistry,\n): string[] {\n return collectPackSkills(resolvePacks(requestedPacks, packRegistry), packRegistry, skillRegistry);\n}\n","import { AgentyxError } from \"../errors.js\";\n\nexport class UnknownToolError extends AgentyxError {\n readonly toolName: string;\n readonly requiredBy: string | undefined;\n readonly knownTools: readonly string[];\n\n constructor(toolName: string, requiredBy: string | undefined, knownTools: readonly string[]) {\n const origin = requiredBy === undefined ? \"\" : ` (required by \"${requiredBy}\")`;\n const known = knownTools.length > 0 ? [...knownTools].sort().join(\", \") : \"none\";\n\n super(\"unknown_tool\", `Unknown tool \"${toolName}\"${origin}. Known tools: ${known}.`);\n this.name = \"UnknownToolError\";\n this.toolName = toolName;\n this.requiredBy = requiredBy;\n this.knownTools = knownTools;\n }\n}\n\nexport class DuplicateToolError extends AgentyxError {\n readonly toolName: string;\n\n constructor(toolName: string) {\n super(\"duplicate_tool\", `Duplicate tool definition: \"${toolName}\".`);\n this.name = \"DuplicateToolError\";\n this.toolName = toolName;\n }\n}\n\nexport class InvalidToolError extends AgentyxError {\n constructor(origin: string, reason: unknown, options?: ErrorOptions) {\n const message = reason instanceof Error ? reason.message : String(reason);\n\n super(\"invalid_tool\", `Invalid ${origin}: ${message}.`, options);\n this.name = \"InvalidToolError\";\n }\n}\n","import { DuplicateToolError, InvalidToolError, UnknownToolError } from \"./errors.js\";\nimport {\n type ToolDefinition,\n type ToolDefinitionInput,\n toolDefinitionSchema,\n toolNameSchema,\n} from \"./schema.js\";\n\nexport interface ToolSource {\n readonly name: string;\n load(): ToolDefinitionInput;\n}\n\nexport interface ToolMetadata {\n readonly name: string;\n readonly description: string;\n readonly kind: ToolDefinition[\"kind\"];\n readonly command: string;\n readonly optional: boolean;\n}\n\nexport interface ToolRegistry {\n readonly names: readonly string[];\n has(name: string): boolean;\n listMetadata(): readonly ToolMetadata[];\n get(name: string): ToolDefinition;\n}\n\nexport function createToolRegistry(sources: Iterable<ToolSource>): ToolRegistry {\n const byName = new Map<string, ToolSource>();\n\n for (const source of sources) {\n const name = toolNameSchema.safeParse(source.name);\n\n if (!name.success) {\n throw new InvalidToolError(`tool source \"${source.name}\"`, name.error);\n }\n\n if (byName.has(name.data)) {\n throw new DuplicateToolError(name.data);\n }\n\n byName.set(name.data, source);\n }\n\n const names = [...byName.keys()];\n const loaded = new Map<string, ToolDefinition>();\n const get = (name: string): ToolDefinition => {\n const cached = loaded.get(name);\n\n if (cached !== undefined) {\n return cached;\n }\n\n const source = byName.get(name);\n\n if (source === undefined) {\n throw new UnknownToolError(name, undefined, names);\n }\n\n const origin = `tool \"${name}\"`;\n const tool = toolDefinitionSchema.safeParse(source.load());\n\n if (!tool.success) {\n throw new InvalidToolError(origin, tool.error);\n }\n\n if (tool.data.name !== name) {\n throw new InvalidToolError(origin, `it declares the name \"${tool.data.name}\"`);\n }\n\n loaded.set(name, tool.data);\n\n return tool.data;\n };\n\n return {\n names,\n has: (name) => byName.has(name),\n listMetadata: () =>\n names.map((name) => {\n const tool = get(name);\n\n return {\n name: tool.name,\n description: tool.description,\n kind: tool.kind,\n command: tool.command,\n optional: tool.optional,\n };\n }),\n get,\n };\n}\n","import { createToolRegistry, type ToolSource } from \"./registry.js\";\n\nexport const builtInToolSources: readonly ToolSource[] = [\n {\n name: \"rtk\",\n load: () => ({\n name: \"rtk\",\n description:\n \"Rust Token Killer command-output proxy for reducing coding-agent context noise.\",\n kind: \"executable\",\n command: \"rtk\",\n optional: true,\n installHint: \"Install from the rtk-ai/rtk project if your local workflow benefits from it.\",\n }),\n },\n];\n\nexport const builtInToolRegistry = createToolRegistry(builtInToolSources);\n\nexport const builtInToolNames: readonly string[] = builtInToolRegistry.names;\n","import { builtInPackRegistry, type PackRegistry } from \"../pack/registry.js\";\nimport { resolvePacks } from \"../pack/resolver.js\";\nimport { builtInToolRegistry } from \"./built-in.js\";\nimport { UnknownToolError } from \"./errors.js\";\nimport type { ToolRegistry } from \"./registry.js\";\nimport type { ToolReference } from \"./schema.js\";\n\nexport function collectPackToolReferences(\n resolvedPacks: readonly string[],\n packRegistry: PackRegistry,\n toolRegistry: ToolRegistry,\n): ToolReference[] {\n const tools: ToolReference[] = [];\n const seen = new Set<string>();\n\n for (const packName of resolvedPacks) {\n for (const tool of packRegistry.get(packName)?.tools ?? []) {\n if (seen.has(tool.name)) {\n continue;\n }\n\n if (!toolRegistry.has(tool.name)) {\n throw new UnknownToolError(tool.name, packName, toolRegistry.names);\n }\n\n seen.add(tool.name);\n tools.push(tool);\n }\n }\n\n return tools;\n}\n\nexport function filterEffectiveTools(\n tools: readonly ToolReference[],\n enabledCapabilities: readonly string[],\n): string[] {\n const enabled = new Set(enabledCapabilities);\n\n return tools\n .filter((tool) => tool.activation === \"default\" || enabled.has(tool.name))\n .map((tool) => tool.name);\n}\n\nexport function resolvePackToolReferences(\n requestedPacks: readonly string[],\n packRegistry: PackRegistry = builtInPackRegistry,\n toolRegistry: ToolRegistry = builtInToolRegistry,\n): ToolReference[] {\n return collectPackToolReferences(\n resolvePacks(requestedPacks, packRegistry),\n packRegistry,\n toolRegistry,\n );\n}\n\nexport function resolvePackTools(\n requestedPacks: readonly string[],\n packRegistry: PackRegistry = builtInPackRegistry,\n toolRegistry: ToolRegistry = builtInToolRegistry,\n enabledCapabilities: readonly string[] = [],\n): string[] {\n return filterEffectiveTools(\n resolvePackToolReferences(requestedPacks, packRegistry, toolRegistry),\n enabledCapabilities,\n );\n}\n","import { builtInMcpServerRegistry } from \"../mcp/built-in.js\";\nimport type { McpServerRegistry } from \"../mcp/registry.js\";\nimport { collectPackMcpServerReferences, filterEffectiveMcpServers } from \"../mcp/resolver.js\";\nimport type { McpServerReference } from \"../mcp/schema.js\";\nimport { builtInPackRegistry, type PackRegistry } from \"../pack/registry.js\";\nimport { resolvePacks } from \"../pack/resolver.js\";\nimport { builtInSkillRegistry } from \"../skill/built-in.js\";\nimport type { SkillRegistry } from \"../skill/registry.js\";\nimport { collectPackSkills } from \"../skill/resolver.js\";\nimport { builtInToolRegistry } from \"../tool/built-in.js\";\nimport type { ToolRegistry } from \"../tool/registry.js\";\nimport { collectPackToolReferences, filterEffectiveTools } from \"../tool/resolver.js\";\nimport type { ToolReference } from \"../tool/schema.js\";\nimport { UnknownEnabledCapabilityError } from \"./errors.js\";\nimport type { AgentyxConfig } from \"./schema.js\";\n\n/** A project configuration with its pack inheritance expanded. */\nexport interface ResolvedAgentyxConfig {\n /** The packs the project asked for, in configuration order. */\n readonly requestedPacks: readonly string[];\n /** Selected packs, de-duplicated while preserving configuration order. */\n readonly resolvedPacks: readonly string[];\n /**\n * Skill identifiers contributed by the resolved packs, in resolution order.\n * Identifiers only — reading the instructions is a separate, explicit step.\n */\n readonly skills: readonly string[];\n readonly declaredMcpServers: readonly McpServerReference[];\n readonly mcpServers: readonly string[];\n readonly declaredTools: readonly ToolReference[];\n readonly tools: readonly string[];\n readonly enabled: readonly string[];\n readonly targets: readonly string[];\n}\n\n/**\n * Combines a validated project configuration with pack and skill resolution.\n * The input is never mutated.\n *\n * @throws {UnknownPackError} when a configured pack is missing.\n * @throws {CircularPackDependencyError} when inheritance forms a cycle.\n * @throws {UnknownSkillError} when a pack references an unknown skill.\n */\nexport function resolveAgentyxConfig(\n config: AgentyxConfig,\n registry: PackRegistry = builtInPackRegistry,\n skillRegistry: SkillRegistry = builtInSkillRegistry,\n mcpRegistry: McpServerRegistry = builtInMcpServerRegistry,\n toolRegistry: ToolRegistry = builtInToolRegistry,\n): ResolvedAgentyxConfig {\n const requestedPacks = [...config.packs];\n const resolvedPacks = resolvePacks(requestedPacks, registry);\n const declaredMcpServers = collectPackMcpServerReferences(resolvedPacks, registry, mcpRegistry);\n const declaredTools = collectPackToolReferences(resolvedPacks, registry, toolRegistry);\n const knownOptionalCapabilities = [\n ...declaredMcpServers\n .filter((server) => server.activation === \"optional\")\n .map((server) => server.name),\n ...declaredTools.filter((tool) => tool.activation === \"optional\").map((tool) => tool.name),\n ];\n\n for (const capability of config.enable) {\n if (!knownOptionalCapabilities.includes(capability)) {\n throw new UnknownEnabledCapabilityError(capability, knownOptionalCapabilities);\n }\n }\n\n return {\n requestedPacks,\n resolvedPacks,\n skills: collectPackSkills(resolvedPacks, registry, skillRegistry),\n declaredMcpServers,\n mcpServers: filterEffectiveMcpServers(declaredMcpServers, config.enable),\n declaredTools,\n tools: filterEffectiveTools(declaredTools, config.enable),\n enabled: [...config.enable],\n targets: [...config.targets],\n };\n}\n","export const agentyxCoreName = \"agentyx-core\";\n\nexport function getCoreStatus(): string {\n return \"ready\";\n}\n","import { access, readFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport type { AgentyxConfigInput } from \"../config/schema.js\";\n\nexport const PACKAGE_MANAGERS = [\"pnpm\", \"npm\", \"yarn\", \"bun\"] as const;\n\nexport type PackageManagerName = (typeof PACKAGE_MANAGERS)[number];\n\nexport interface PackageManagerDetection {\n readonly name: PackageManagerName | undefined;\n readonly source: \"lockfile\" | \"package-json\" | undefined;\n readonly lockfiles: readonly string[];\n readonly ambiguous: boolean;\n}\n\nexport interface ProjectPackageJsonDetection {\n readonly present: boolean;\n readonly valid: boolean;\n readonly path: string;\n readonly name: string | undefined;\n readonly packageManager: string | undefined;\n readonly error: string | undefined;\n}\n\nexport interface ProjectDetection {\n readonly projectDir: string;\n readonly packageJson: ProjectPackageJsonDetection;\n readonly packageManager: PackageManagerDetection;\n readonly detectedPacks: readonly string[];\n readonly recommendedPacks: readonly string[];\n}\n\ninterface PackageJson {\n readonly name?: unknown;\n readonly packageManager?: unknown;\n readonly dependencies?: unknown;\n readonly devDependencies?: unknown;\n readonly peerDependencies?: unknown;\n readonly optionalDependencies?: unknown;\n}\n\nconst lockfileManagers: ReadonlyMap<string, PackageManagerName> = new Map([\n [\"pnpm-lock.yaml\", \"pnpm\"],\n [\"package-lock.json\", \"npm\"],\n [\"yarn.lock\", \"yarn\"],\n [\"bun.lock\", \"bun\"],\n [\"bun.lockb\", \"bun\"],\n]);\n\nexport async function detectProject(projectDir: string): Promise<ProjectDetection> {\n const packageJsonPath = join(projectDir, \"package.json\");\n const packageJson = await readPackageJson(packageJsonPath);\n const packageManager = await detectPackageManager(projectDir, packageJson.data);\n const detectedPacks = await detectPacks(projectDir, packageJson.data);\n\n return {\n projectDir,\n packageJson: {\n present: packageJson.present,\n valid: packageJson.valid,\n path: packageJsonPath,\n name: getString(packageJson.data?.name),\n packageManager: getString(packageJson.data?.packageManager),\n error: packageJson.error,\n },\n packageManager,\n detectedPacks,\n recommendedPacks: recommendPacks(detectedPacks),\n };\n}\n\nexport function buildAgentyxConfig(input: {\n readonly packs: readonly string[];\n readonly enable?: readonly string[];\n readonly targets: readonly string[];\n}): AgentyxConfigInput {\n return {\n packs: [...input.packs],\n enable: [...(input.enable ?? [])],\n targets: [...input.targets],\n };\n}\n\nexport function formatAgentyxConfig(config: AgentyxConfigInput): string {\n return `${JSON.stringify(config, null, 2)}\\n`;\n}\n\nfunction recommendPacks(detectedPacks: readonly string[]): readonly string[] {\n if (detectedPacks.includes(\"angular\")) {\n return [\"technical\", \"typescript\", \"angular\"];\n }\n\n if (detectedPacks.includes(\"typescript\")) {\n return [\"technical\", \"typescript\"];\n }\n\n return [\"technical\"];\n}\n\nasync function detectPacks(\n projectDir: string,\n packageJson: PackageJson | undefined,\n): Promise<readonly string[]> {\n const packs: string[] = [];\n const dependencies = collectDependencies(packageJson);\n const hasAngular = dependencies.has(\"@angular/core\");\n const hasTypeScript =\n dependencies.has(\"typescript\") || (await exists(join(projectDir, \"tsconfig.json\")));\n\n if (hasTypeScript || hasAngular) {\n packs.push(\"typescript\");\n }\n\n if (hasAngular) {\n packs.push(\"angular\");\n }\n\n return packs;\n}\n\nasync function detectPackageManager(\n projectDir: string,\n packageJson: PackageJson | undefined,\n): Promise<PackageManagerDetection> {\n const lockfiles: string[] = [];\n const managers = new Set<PackageManagerName>();\n\n for (const [file, manager] of lockfileManagers) {\n if (await exists(join(projectDir, file))) {\n lockfiles.push(file);\n managers.add(manager);\n }\n }\n\n if (managers.size === 1) {\n return {\n name: [...managers][0],\n source: \"lockfile\",\n lockfiles,\n ambiguous: false,\n };\n }\n\n if (managers.size > 1) {\n return {\n name: undefined,\n source: \"lockfile\",\n lockfiles,\n ambiguous: true,\n };\n }\n\n const declared = parsePackageManagerName(getString(packageJson?.packageManager));\n\n return {\n name: declared,\n source: declared === undefined ? undefined : \"package-json\",\n lockfiles,\n ambiguous: false,\n };\n}\n\nasync function readPackageJson(path: string): Promise<{\n readonly present: boolean;\n readonly valid: boolean;\n readonly data: PackageJson | undefined;\n readonly error: string | undefined;\n}> {\n let contents: string;\n\n try {\n contents = await readFile(path, \"utf8\");\n } catch (cause) {\n if (isNotFound(cause)) {\n return { present: false, valid: false, data: undefined, error: undefined };\n }\n\n const reason = cause instanceof Error ? cause.message : String(cause);\n return { present: true, valid: false, data: undefined, error: reason };\n }\n\n try {\n return { present: true, valid: true, data: JSON.parse(contents), error: undefined };\n } catch (cause) {\n const reason = cause instanceof Error ? cause.message : String(cause);\n return { present: true, valid: false, data: undefined, error: reason };\n }\n}\n\nfunction collectDependencies(packageJson: PackageJson | undefined): ReadonlySet<string> {\n const dependencies = new Set<string>();\n\n for (const field of [\n packageJson?.dependencies,\n packageJson?.devDependencies,\n packageJson?.peerDependencies,\n packageJson?.optionalDependencies,\n ]) {\n if (isRecord(field)) {\n for (const name of Object.keys(field)) {\n dependencies.add(name);\n }\n }\n }\n\n return dependencies;\n}\n\nfunction parsePackageManagerName(value: string | undefined): PackageManagerName | undefined {\n const name = value?.split(\"@\")[0];\n\n return PACKAGE_MANAGERS.includes(name as PackageManagerName)\n ? (name as PackageManagerName)\n : undefined;\n}\n\nfunction getString(value: unknown): string | undefined {\n return typeof value === \"string\" ? value : undefined;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nasync function exists(path: string): Promise<boolean> {\n try {\n await access(path);\n return true;\n } catch (cause) {\n if (isNotFound(cause)) {\n return false;\n }\n\n throw cause;\n }\n}\n\nfunction isNotFound(cause: unknown): boolean {\n return cause instanceof Error && (cause as NodeJS.ErrnoException).code === \"ENOENT\";\n}\n"],"mappings":";;;;;;;;;;;;;AAOA,IAAa,eAAb,cAAkC,MAAM;CACtC;CAEA,YAAY,MAAc,SAAiB,SAAwB;EACjE,MAAM,SAAS,OAAO;EACtB,KAAK,OAAO;EACZ,KAAK,OAAO;CACd;AACF;;;;ACJA,IAAa,6BAAb,cAAgD,aAAa;CAC3D;CAEA,YAAY,UAAkB,SAAwB;EACpD,MAAM,4BAA4B,yCAAyC,YAAY,OAAO;EAC9F,KAAK,OAAO;EACZ,KAAK,WAAW;CAClB;AACF;;AAGA,IAAa,0BAAb,cAA6C,aAAa;CACxD;CAEA,YAAY,UAAkB,QAAgB,SAAwB;EACpE,MAAM,8BAA8B,GAAG,SAAS,sBAAsB,UAAU,OAAO;EACvF,KAAK,OAAO;EACZ,KAAK,WAAW;CAClB;AACF;;AAGA,IAAa,+BAAb,cAAkD,aAAa;CAC7D;;CAEA;CAEA,YAAY,OAAiB,UAAmB;EAC9C,MAAM,SAAS,eAAe,KAAK;EACnC,MAAM,WAAW,aAAa,KAAA,IAAY,KAAK,OAAO;EACtD,MAAM,UAAU,OAAO,KAAK,UAAU,OAAO,MAAM,KAAK,IAAI,MAAM,SAAS,CAAC,CAAC,KAAK,IAAI;EAEtF,MAAM,0BAA0B,gCAAgC,SAAS,KAAK,SAAS;EACvF,KAAK,OAAO;EACZ,KAAK,SAAS;EACd,KAAK,WAAW;CAClB;AACF;AAEA,IAAa,gCAAb,cAAmD,aAAa;CAC9D;CACA;CAEA,YAAY,gBAAwB,mBAAsC;EACxE,MAAM,QAAQ,kBAAkB,SAAS,IAAI,CAAC,GAAG,iBAAi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AAO,iBAAiB,SAAS,IAA0B,IACtD,OACD,KAAA;AACN;AAEA,SAAS,UAAU,OAAoC;CACrD,OAAO,OAAO,UAAU,WAAW,QAAQ,KAAA;AAC7C;AAEA,SAAS,SAAS,OAAkD;CAClE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAEA,eAAe,OAAO,MAAgC;CACpD,IAAI;EACF,MAAM,OAAO,IAAI;EACjB,OAAO;CACT,SAAS,OAAO;EACd,IAAI,WAAW,KAAK,GAClB,OAAO;EAGT,MAAM;CACR;AACF;AAEA,SAAS,WAAW,OAAyB;CAC3C,OAAO,iBAAiB,SAAU,MAAgC,SAAS;AAC7E"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["formatIssues"],"sources":["../src/errors.ts","../src/issues.ts","../src/config/errors.ts","../src/mcp/schema.ts","../src/skill/schema.ts","../src/tool/schema.ts","../src/pack/schema.ts","../src/config/schema.ts","../src/config/json-schema.ts","../src/config/loader.ts","../src/mcp/errors.ts","../src/mcp/registry.ts","../src/mcp/built-in.ts","../src/pack/errors.ts","../src/pack/registry.ts","../src/pack/resolver.ts","../src/mcp/resolver.ts","../src/assets.ts","../src/skill/errors.ts","../src/skill/markdown.ts","../src/skill/registry.ts","../src/skill/built-in.ts","../src/skill/resolver.ts","../src/tool/errors.ts","../src/tool/registry.ts","../src/tool/built-in.ts","../src/tool/resolver.ts","../src/config/resolver.ts","../src/manifest/errors.ts","../src/manifest/schema.ts","../src/manifest/io.ts","../src/meta.ts","../src/project/detector.ts"],"sourcesContent":["/**\n * Base class for every failure Agentyx raises deliberately.\n *\n * Consumers can catch `AgentyxError` to separate expected domain failures from\n * unexpected runtime errors, and branch on the stable `code` when they need to\n * handle a specific failure.\n */\nexport class AgentyxError extends Error {\n readonly code: string;\n\n constructor(code: string, message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"AgentyxError\";\n this.code = code;\n }\n}\n","import type { ZodError } from \"zod\";\n\n/** A single problem in an Agentyx document, addressed by its location in it. */\nexport interface AgentyxIssue {\n /** Dotted path to the offending value, or `(root)` for the document itself. */\n readonly path: string;\n readonly message: string;\n}\n\n/**\n * Turns a Zod failure into locations a reader can find in the file.\n *\n * Shared by every document Agentyx validates, so a problem in `.agentyx.json`\n * and a problem in `.agentyx.lock.json` are reported the same way.\n */\nexport function toAgentyxIssues(error: ZodError): readonly AgentyxIssue[] {\n return error.issues.map((issue) => ({\n path: formatIssuePath(issue.path),\n message: issue.message,\n }));\n}\n\nfunction formatIssuePath(path: readonly PropertyKey[]): string {\n if (path.length === 0) {\n return \"(root)\";\n }\n\n return path.reduce<string>((formatted, segment) => {\n if (typeof segment === \"number\") {\n return `${formatted}[${segment}]`;\n }\n\n return formatted === \"\" ? String(segment) : `${formatted}.${String(segment)}`;\n }, \"\");\n}\n","import type { ZodError } from \"zod\";\nimport { AgentyxError } from \"../errors.js\";\nimport { type AgentyxIssue, toAgentyxIssues } from \"../issues.js\";\n\n/** A single configuration problem, addressed by its location in the document. */\nexport type AgentyxConfigIssue = AgentyxIssue;\n\n/** Raised when the supplied directory has no `.agentyx.json`. */\nexport class AgentyxConfigNotFoundError extends AgentyxError {\n readonly filePath: string;\n\n constructor(filePath: string, options?: ErrorOptions) {\n super(\"agentyx_config_not_found\", `Agentyx configuration file not found: ${filePath}`, options);\n this.name = \"AgentyxConfigNotFoundError\";\n this.filePath = filePath;\n }\n}\n\n/** Raised when `.agentyx.json` is not valid JSON. */\nexport class AgentyxConfigParseError extends AgentyxError {\n readonly filePath: string;\n\n constructor(filePath: string, reason: string, options?: ErrorOptions) {\n super(\"agentyx_config_parse_error\", `${filePath} is not valid JSON: ${reason}`, options);\n this.name = \"AgentyxConfigParseError\";\n this.filePath = filePath;\n }\n}\n\n/** Raised when the document parses as JSON but violates the Agentyx schema. */\nexport class AgentyxConfigValidationError extends AgentyxError {\n readonly issues: readonly AgentyxConfigIssue[];\n /** The file the configuration came from, when it was read from disk. */\n readonly filePath: string | undefined;\n\n constructor(error: ZodError, filePath?: string) {\n const issues = toAgentyxIssues(error);\n const location = filePath === undefined ? \"\" : ` in ${filePath}`;\n const details = issues.map((issue) => ` - ${issue.path}: ${issue.message}`).join(\"\\n\");\n\n super(\"agentyx_config_invalid\", `Invalid Agentyx configuration${location}:\\n${details}`);\n this.name = \"AgentyxConfigValidationError\";\n this.issues = issues;\n this.filePath = filePath;\n }\n}\n\nexport class UnknownEnabledCapabilityError extends AgentyxError {\n readonly capabilityName: string;\n readonly knownCapabilities: readonly string[];\n\n constructor(capabilityName: string, knownCapabilities: readonly string[]) {\n const known = knownCapabilities.length > 0 ? [...knownCapabilities].sort().join(\", \") : \"none\";\n\n super(\n \"unknown_enabled_capability\",\n `Unknown enabled capability \"${capabilityName}\". Known optional capabilities: ${known}.`,\n );\n this.name = \"UnknownEnabledCapabilityError\";\n this.capabilityName = capabilityName;\n this.knownCapabilities = knownCapabilities;\n }\n}\n","import { z } from \"zod\";\n\nexport const MCP_CAPABILITY_LEVELS = [\"default\", \"optional\"] as const;\n\nexport const mcpCapabilityLevelSchema = z.enum(MCP_CAPABILITY_LEVELS);\n\nexport const MCP_CONTEXT_COSTS = [\"low\", \"medium\", \"high\"] as const;\n\nexport const mcpContextCostSchema = z.enum(MCP_CONTEXT_COSTS);\n\nexport const mcpServerNameSchema = z\n .string()\n .min(1, \"MCP server names must be non-empty strings.\")\n .regex(\n /^[a-z0-9]+(?:-[a-z0-9]+)*$/,\n 'MCP server names must be lowercase kebab-case, for example \"context7\".',\n );\n\nexport const mcpEnvReferenceSchema = z.strictObject({\n fromEnv: z\n .string()\n .trim()\n .min(1, \"Environment variable references must be non-empty strings.\")\n .regex(/^[A-Za-z_][A-Za-z0-9_]*$/, \"Environment variable names must be valid shell names.\"),\n});\n\nconst commonMcpServerDefinitionSchema = z.strictObject({\n name: mcpServerNameSchema.describe(\"Unique MCP server identifier.\"),\n description: z.string().trim().min(1, \"MCP server descriptions must be non-empty strings.\"),\n transport: z.enum([\"stdio\", \"http\"]),\n contextCost: mcpContextCostSchema\n .describe(\"Qualitative context/tool-schema overhead classification; not token accounting.\")\n .optional(),\n});\n\nconst explicitMcpServerReferenceSchema = z.strictObject({\n name: mcpServerNameSchema.describe(\"MCP server identifier.\"),\n activation: mcpCapabilityLevelSchema\n .describe(\"Whether this MCP capability is active by default or explicit opt-in.\")\n .default(\"default\"),\n});\n\nexport const mcpServerReferenceSchema = z\n .union([mcpServerNameSchema, explicitMcpServerReferenceSchema])\n .transform((value) =>\n typeof value === \"string\"\n ? {\n name: value,\n activation: \"default\" as const,\n }\n : value,\n )\n .pipe(\n z.strictObject({\n name: mcpServerNameSchema.describe(\"MCP server identifier.\"),\n activation: mcpCapabilityLevelSchema.describe(\n \"Whether this MCP capability is active by default or explicit opt-in.\",\n ),\n }),\n );\n\nexport const stdioMcpServerDefinitionSchema = commonMcpServerDefinitionSchema.extend({\n transport: z.literal(\"stdio\"),\n command: z.string().trim().min(1, \"MCP stdio command must be a non-empty string.\"),\n args: z.array(z.string()).default([]),\n env: z.record(z.string().min(1), mcpEnvReferenceSchema).default({}),\n});\n\nexport const httpMcpServerDefinitionSchema = commonMcpServerDefinitionSchema.extend({\n transport: z.literal(\"http\"),\n url: z.url(\"MCP HTTP URL must be a valid URL.\"),\n headers: z.record(z.string().min(1), mcpEnvReferenceSchema).default({}),\n});\n\nexport const mcpServerDefinitionSchema = z.discriminatedUnion(\"transport\", [\n stdioMcpServerDefinitionSchema,\n httpMcpServerDefinitionSchema,\n]);\n\nexport type McpEnvReference = z.infer<typeof mcpEnvReferenceSchema>;\nexport type McpCapabilityLevel = z.infer<typeof mcpCapabilityLevelSchema>;\nexport type McpContextCost = z.infer<typeof mcpContextCostSchema>;\nexport type McpServerDefinition = z.infer<typeof mcpServerDefinitionSchema>;\nexport type McpServerDefinitionInput = z.input<typeof mcpServerDefinitionSchema>;\nexport type McpServerReference = z.infer<typeof mcpServerReferenceSchema>;\nexport type McpServerReferenceInput = z.input<typeof mcpServerReferenceSchema>;\n","import { z } from \"zod\";\n\n/**\n * Skill names double as directory names for `SKILL.md` files, so they are\n * constrained to a lowercase slug. That keeps them stable across filesystems\n * and makes them safe to join onto a path.\n */\nexport const skillNameSchema = z\n .string()\n .min(1, \"Skill names must be non-empty strings.\")\n .regex(\n /^[a-z0-9]+(?:-[a-z0-9]+)*$/,\n 'Skill names must be lowercase kebab-case, for example \"typescript-modern\".',\n );\n\n/**\n * The metadata a Skill carries, and exactly what a `SKILL.md` frontmatter block\n * may declare. Kept separate from the full definition so the parser can reject\n * a frontmatter key that tries to supply the body.\n */\nexport const skillMetadataSchema = z.strictObject({\n name: skillNameSchema.describe(\"Unique skill identifier.\"),\n description: z\n .string()\n .trim()\n .min(1, \"Skill descriptions must be non-empty strings.\")\n .describe(\"One-line summary of what the skill tells an agent to do.\"),\n});\n\n/**\n * A Skill is reusable instruction text for a coding agent. It is deliberately\n * provider-independent: nothing here says how or where a provider installs it.\n */\nexport const skillDefinitionSchema = skillMetadataSchema.extend({\n content: z\n .string()\n .trim()\n .min(1, \"Skill content must be non-empty.\")\n .describe(\"The Markdown instructions handed to an agent.\"),\n});\n\n/** A validated skill definition. */\nexport type SkillDefinition = z.infer<typeof skillDefinitionSchema>;\n\n/** The shape accepted when authoring a skill definition. */\nexport type SkillDefinitionInput = z.input<typeof skillDefinitionSchema>;\n","import { z } from \"zod\";\n\nexport const TOOL_ACTIVATION_LEVELS = [\"default\", \"optional\"] as const;\n\nexport const toolActivationLevelSchema = z.enum(TOOL_ACTIVATION_LEVELS);\n\nexport const toolNameSchema = z\n .string()\n .min(1, \"Tool names must be non-empty strings.\")\n .regex(\n /^[a-z0-9]+(?:-[a-z0-9]+)*$/,\n 'Tool names must be lowercase kebab-case, for example \"rtk\".',\n );\n\nexport const toolReferenceSchema = z\n .union([\n toolNameSchema,\n z.strictObject({\n name: toolNameSchema.describe(\"Tool identifier.\"),\n activation: toolActivationLevelSchema.default(\"default\"),\n }),\n ])\n .transform((value) =>\n typeof value === \"string\"\n ? {\n name: value,\n activation: \"default\" as const,\n }\n : value,\n )\n .pipe(\n z.strictObject({\n name: toolNameSchema.describe(\"Tool identifier.\"),\n activation: toolActivationLevelSchema,\n }),\n );\n\nexport const toolDefinitionSchema = z.strictObject({\n name: toolNameSchema.describe(\"Unique tool identifier.\"),\n description: z.string().trim().min(1, \"Tool descriptions must be non-empty strings.\"),\n kind: z.literal(\"executable\"),\n command: z.string().trim().min(1, \"Tool executable command must be a non-empty string.\"),\n optional: z.boolean().default(true),\n installHint: z.string().trim().min(1, \"Tool install hints must be non-empty strings.\").optional(),\n});\n\nexport type ToolActivationLevel = z.infer<typeof toolActivationLevelSchema>;\nexport type ToolDefinition = z.infer<typeof toolDefinitionSchema>;\nexport type ToolDefinitionInput = z.input<typeof toolDefinitionSchema>;\nexport type ToolReference = z.infer<typeof toolReferenceSchema>;\nexport type ToolReferenceInput = z.input<typeof toolReferenceSchema>;\n","import { z } from \"zod\";\nimport { mcpServerReferenceSchema } from \"../mcp/schema.js\";\nimport { skillNameSchema } from \"../skill/schema.js\";\nimport { toolReferenceSchema } from \"../tool/schema.js\";\n\nexport const PACK_CATEGORIES = [\n \"engineering\",\n \"language\",\n \"framework\",\n \"efficiency\",\n \"workflow\",\n] as const;\n\nexport const packCategorySchema = z.enum(PACK_CATEGORIES);\n\n/**\n * Pack names are plain identifiers. They are intentionally not constrained to\n * a closed list so that external registries can contribute packs later.\n */\nexport const packNameSchema = z.string().min(1, \"Pack names must be non-empty strings.\");\n\n/** A pack is a composable provider-neutral capability bundle. */\nexport const packDefinitionSchema = z.strictObject({\n name: packNameSchema.describe(\"Unique pack identifier.\"),\n category: packCategorySchema\n .describe(\"Discoverability category; does not affect resolution.\")\n .default(\"engineering\"),\n description: z\n .string()\n .min(1, \"Pack descriptions must be non-empty when provided.\")\n .describe(\"Short human-readable summary of the pack.\")\n .optional(),\n skills: z\n .array(skillNameSchema)\n .describe(\"Skills this pack contributes, in declaration order.\")\n .default([]),\n mcpServers: z\n .array(mcpServerReferenceSchema)\n .describe(\"MCP servers this pack contributes, in declaration order.\")\n .default([]),\n tools: z\n .array(toolReferenceSchema)\n .describe(\"Local tools this pack contributes, in declaration order.\")\n .default([]),\n});\n\n/** A validated pack definition, with defaults always present. */\nexport type PackDefinition = z.infer<typeof packDefinitionSchema>;\nexport type PackCategory = z.infer<typeof packCategorySchema>;\n\n/** The shape accepted when authoring a pack definition. */\nexport type PackDefinitionInput = z.input<typeof packDefinitionSchema>;\n","import { z } from \"zod\";\nimport { packNameSchema } from \"../pack/schema.js\";\n\n/**\n * Targets stay free-form strings on purpose: third-party adapters should be\n * able to register providers without a change to this schema.\n */\nexport const agentyxTargetSchema = z.string().min(1, \"Targets must be non-empty strings.\");\n\nexport const enabledCapabilityNameSchema = z\n .string()\n .min(1, \"Enabled capability names must be non-empty strings.\")\n .regex(\n /^[a-z0-9]+(?:-[a-z0-9]+)*$/,\n 'Enabled capability names must be lowercase kebab-case, for example \"rtk\".',\n );\n\n/** The `.agentyx.json` project configuration. */\nexport const agentyxConfigSchema = z.strictObject({\n $schema: z\n .string()\n .min(1, \"$schema must be a non-empty string.\")\n .describe(\"Optional path or URL to the Agentyx JSON Schema.\")\n .optional(),\n packs: z.array(packNameSchema).describe(\"Capability packs this project selects.\").default([]),\n enable: z\n .array(enabledCapabilityNameSchema)\n .describe(\"Optional capabilities to activate by explicit identifier.\")\n .default([]),\n targets: z\n .array(agentyxTargetSchema)\n .describe(\"Coding-agent providers this project targets.\")\n .default([]),\n});\n\n/** A validated configuration, with defaults applied. */\nexport type AgentyxConfig = z.infer<typeof agentyxConfigSchema>;\n\n/** The shape accepted in a `.agentyx.json` file. */\nexport type AgentyxConfigInput = z.input<typeof agentyxConfigSchema>;\n","import { z } from \"zod\";\nimport { agentyxConfigSchema } from \"./schema.js\";\n\n/** Canonical identifier of the published `.agentyx.json` schema. */\nexport const AGENTYX_CONFIG_SCHEMA_ID = \"https://agentyx.dev/schema/agentyx.schema.json\";\n\n/**\n * Derives the JSON Schema for `.agentyx.json` from the Zod model, which stays the\n * single source of truth. The committed `schema/agentyx.schema.json` is generated\n * from this function and verified by tests.\n *\n * The `input` view is used so that fields with defaults stay optional, which is\n * what an author writing the file cares about.\n */\nexport function buildAgentyxConfigJsonSchema(): Record<string, unknown> {\n return {\n $schema: \"https://json-schema.org/draft/2020-12/schema\",\n $id: AGENTYX_CONFIG_SCHEMA_ID,\n title: \"Agentyx project configuration\",\n description: \"Configuration for an Agentyx project (.agentyx.json).\",\n ...z.toJSONSchema(agentyxConfigSchema, { io: \"input\" }),\n };\n}\n","import { readFile } from \"node:fs/promises\";\nimport { resolve } from \"node:path\";\nimport {\n AgentyxConfigNotFoundError,\n AgentyxConfigParseError,\n AgentyxConfigValidationError,\n} from \"./errors.js\";\nimport { type AgentyxConfig, agentyxConfigSchema } from \"./schema.js\";\n\nexport const AGENTYX_CONFIG_FILENAME = \".agentyx.json\";\n\n/** The absolute path `.agentyx.json` is read from for a given project. */\nexport function agentyxConfigPath(projectPath: string = process.cwd()): string {\n return resolve(projectPath, AGENTYX_CONFIG_FILENAME);\n}\n\n/**\n * Validates an already-parsed configuration document.\n *\n * @throws {AgentyxConfigValidationError} when the document violates the schema.\n */\nexport function parseAgentyxConfig(value: unknown, filePath?: string): AgentyxConfig {\n const result = agentyxConfigSchema.safeParse(value);\n\n if (!result.success) {\n throw new AgentyxConfigValidationError(result.error, filePath);\n }\n\n return result.data;\n}\n\n/**\n * Reads and validates `.agentyx.json` from `projectPath`.\n *\n * Parent directories are not searched, and invalid configurations are never\n * silently repaired.\n *\n * @throws {AgentyxConfigNotFoundError} when the file does not exist.\n * @throws {AgentyxConfigParseError} when the file is not valid JSON.\n * @throws {AgentyxConfigValidationError} when the document violates the schema.\n */\nexport async function loadAgentyxConfig(\n projectPath: string = process.cwd(),\n): Promise<AgentyxConfig> {\n const filePath = agentyxConfigPath(projectPath);\n let contents: string;\n\n try {\n contents = await readFile(filePath, \"utf8\");\n } catch (cause) {\n if (isFileNotFound(cause)) {\n throw new AgentyxConfigNotFoundError(filePath, { cause });\n }\n\n throw cause;\n }\n\n let document: unknown;\n\n try {\n document = JSON.parse(contents);\n } catch (cause) {\n const reason = cause instanceof Error ? cause.message : String(cause);\n throw new AgentyxConfigParseError(filePath, reason, { cause });\n }\n\n return parseAgentyxConfig(document, filePath);\n}\n\nfunction isFileNotFound(cause: unknown): boolean {\n return cause instanceof Error && (cause as NodeJS.ErrnoException).code === \"ENOENT\";\n}\n","import type { ZodError } from \"zod\";\nimport { AgentyxError } from \"../errors.js\";\n\nexport class UnknownMcpServerError extends AgentyxError {\n readonly serverName: string;\n readonly requiredBy: string | undefined;\n readonly knownServers: readonly string[];\n\n constructor(serverName: string, requiredBy: string | undefined, knownServers: readonly string[]) {\n const origin = requiredBy === undefined ? \"\" : ` (required by \"${requiredBy}\")`;\n const known = knownServers.length > 0 ? [...knownServers].sort().join(\", \") : \"none\";\n\n super(\n \"unknown_mcp_server\",\n `Unknown MCP server \"${serverName}\"${origin}. Known MCP servers: ${known}.`,\n );\n this.name = \"UnknownMcpServerError\";\n this.serverName = serverName;\n this.requiredBy = requiredBy;\n this.knownServers = knownServers;\n }\n}\n\nexport class DuplicateMcpServerError extends AgentyxError {\n readonly serverName: string;\n\n constructor(serverName: string) {\n super(\"duplicate_mcp_server\", `Duplicate MCP server definition: \"${serverName}\".`);\n this.name = \"DuplicateMcpServerError\";\n this.serverName = serverName;\n }\n}\n\nexport class InvalidMcpServerError extends AgentyxError {\n readonly origin: string;\n readonly reason: string;\n\n constructor(origin: string, reason: string | ZodError, options?: ErrorOptions) {\n const detail = typeof reason === \"string\" ? reason : formatIssues(reason);\n\n super(\"invalid_mcp_server\", `Invalid MCP server in ${origin}: ${detail}`, options);\n this.name = \"InvalidMcpServerError\";\n this.origin = origin;\n this.reason = detail;\n }\n}\n\nfunction formatIssues(error: ZodError): string {\n return error.issues\n .map((issue) => {\n const path = issue.path.map(String).join(\".\");\n\n return path === \"\" ? issue.message : `${path}: ${issue.message}`;\n })\n .join(\"; \");\n}\n","import { DuplicateMcpServerError, InvalidMcpServerError, UnknownMcpServerError } from \"./errors.js\";\nimport {\n type McpServerDefinition,\n type McpServerDefinitionInput,\n mcpServerDefinitionSchema,\n mcpServerNameSchema,\n} from \"./schema.js\";\n\nexport interface McpServerSource {\n readonly name: string;\n load(): McpServerDefinitionInput;\n}\n\nexport interface McpServerMetadata {\n readonly name: string;\n readonly description: string;\n readonly transport: McpServerDefinition[\"transport\"];\n readonly contextCost?: McpServerDefinition[\"contextCost\"];\n}\n\nexport interface McpServerRegistry {\n readonly names: readonly string[];\n has(name: string): boolean;\n listMetadata(): readonly McpServerMetadata[];\n get(name: string): McpServerDefinition;\n}\n\nexport function createMcpServerRegistry(sources: Iterable<McpServerSource>): McpServerRegistry {\n const byName = new Map<string, McpServerSource>();\n\n for (const source of sources) {\n const name = mcpServerNameSchema.safeParse(source.name);\n\n if (!name.success) {\n throw new InvalidMcpServerError(`MCP server source \"${source.name}\"`, name.error);\n }\n\n if (byName.has(name.data)) {\n throw new DuplicateMcpServerError(name.data);\n }\n\n byName.set(name.data, source);\n }\n\n const names = [...byName.keys()];\n const loaded = new Map<string, McpServerDefinition>();\n const get = (name: string): McpServerDefinition => {\n const cached = loaded.get(name);\n\n if (cached !== undefined) {\n return cached;\n }\n\n const source = byName.get(name);\n\n if (source === undefined) {\n throw new UnknownMcpServerError(name, undefined, names);\n }\n\n const origin = `MCP server \"${name}\"`;\n const server = mcpServerDefinitionSchema.safeParse(source.load());\n\n if (!server.success) {\n throw new InvalidMcpServerError(origin, server.error);\n }\n\n if (server.data.name !== name) {\n throw new InvalidMcpServerError(origin, `it declares the name \"${server.data.name}\"`);\n }\n\n loaded.set(name, server.data);\n\n return server.data;\n };\n\n return {\n names,\n has: (name) => byName.has(name),\n listMetadata: () =>\n names.map((name) => {\n const server = get(name);\n\n return {\n name: server.name,\n description: server.description,\n transport: server.transport,\n contextCost: server.contextCost,\n };\n }),\n get,\n };\n}\n","import { createMcpServerRegistry, type McpServerSource } from \"./registry.js\";\n\nexport const builtInMcpServerSources: readonly McpServerSource[] = [\n {\n name: \"context7\",\n load: () => ({\n name: \"context7\",\n description: \"Fetch up-to-date library documentation from Context7.\",\n transport: \"http\",\n contextCost: \"medium\",\n url: \"https://mcp.context7.com/mcp\",\n }),\n },\n {\n name: \"playwright\",\n load: () => ({\n name: \"playwright\",\n description: \"Automate and inspect browsers through Playwright MCP.\",\n transport: \"stdio\",\n contextCost: \"high\",\n command: \"npx\",\n args: [\"@playwright/mcp@latest\"],\n }),\n },\n {\n name: \"codebase-memory\",\n load: () => ({\n name: \"codebase-memory\",\n description: \"Structural code-intelligence MCP backed by a persistent code knowledge graph.\",\n transport: \"stdio\",\n contextCost: \"high\",\n command: \"codebase-memory-mcp\",\n }),\n },\n {\n name: \"github\",\n load: () => ({\n name: \"github\",\n description: \"Read repositories, issues, pull requests and workflow runs on GitHub.\",\n transport: \"http\",\n contextCost: \"high\",\n url: \"https://api.githubcopilot.com/mcp/\",\n }),\n },\n {\n name: \"sentry\",\n load: () => ({\n name: \"sentry\",\n description: \"Inspect production issues, events and stack traces recorded by Sentry.\",\n transport: \"http\",\n contextCost: \"medium\",\n url: \"https://mcp.sentry.dev/mcp\",\n }),\n },\n {\n name: \"chrome-devtools\",\n load: () => ({\n name: \"chrome-devtools\",\n description: \"Record performance traces and inspect pages through Chrome DevTools.\",\n transport: \"stdio\",\n contextCost: \"high\",\n command: \"npx\",\n args: [\"-y\", \"chrome-devtools-mcp@latest\"],\n }),\n },\n {\n name: \"supabase\",\n load: () => ({\n name: \"supabase\",\n description: \"Inspect and query Supabase project schemas, tables and logs.\",\n transport: \"stdio\",\n contextCost: \"high\",\n command: \"npx\",\n args: [\"-y\", \"@supabase/mcp-server-supabase@latest\"],\n env: { SUPABASE_ACCESS_TOKEN: { fromEnv: \"SUPABASE_ACCESS_TOKEN\" } },\n }),\n },\n];\n\nexport const builtInMcpServerRegistry = createMcpServerRegistry(builtInMcpServerSources);\n\nexport const builtInMcpServerNames: readonly string[] = builtInMcpServerRegistry.names;\n","import { AgentyxError } from \"../errors.js\";\n\n/** Raised when a requested pack is not present in the registry. */\nexport class UnknownPackError extends AgentyxError {\n readonly packName: string;\n readonly requiredBy: string | undefined;\n readonly knownPacks: readonly string[];\n\n constructor(packName: string, requiredBy: string | undefined, knownPacks: readonly string[]) {\n const origin = requiredBy === undefined ? \"\" : ` (required by \"${requiredBy}\")`;\n const known = knownPacks.length > 0 ? [...knownPacks].sort().join(\", \") : \"none\";\n\n super(\"unknown_pack\", `Unknown pack \"${packName}\"${origin}. Known packs: ${known}.`);\n this.name = \"UnknownPackError\";\n this.packName = packName;\n this.requiredBy = requiredBy;\n this.knownPacks = knownPacks;\n }\n}\n\n/** @deprecated Packs no longer inherit from other packs. */\nexport class CircularPackDependencyError extends AgentyxError {\n /** The cycle path, starting and ending with the same pack. */\n readonly cycle: readonly string[];\n\n constructor(cycle: readonly string[]) {\n super(\"circular_pack_dependency\", `Circular pack dependency: ${cycle.join(\" -> \")}.`);\n this.name = \"CircularPackDependencyError\";\n this.cycle = cycle;\n }\n}\n\n/** Raised when a registry is built from definitions that reuse a pack name. */\nexport class DuplicatePackError extends AgentyxError {\n readonly packName: string;\n\n constructor(packName: string) {\n super(\"duplicate_pack\", `Duplicate pack definition: \"${packName}\".`);\n this.name = \"DuplicatePackError\";\n this.packName = packName;\n }\n}\n","import { DuplicatePackError } from \"./errors.js\";\nimport { type PackDefinition, type PackDefinitionInput, packDefinitionSchema } from \"./schema.js\";\n\n/**\n * A registry is a name lookup over pack definitions. Keeping it a plain map\n * means the resolver stays independent of where definitions come from, so\n * external registries can be added later without touching resolution.\n */\nexport type PackRegistry = ReadonlyMap<string, PackDefinition>;\n\n/** Validates definitions and indexes them by name. */\nexport function createPackRegistry(definitions: Iterable<PackDefinitionInput>): PackRegistry {\n const registry = new Map<string, PackDefinition>();\n\n for (const definition of definitions) {\n const pack = packDefinitionSchema.parse(definition);\n\n if (registry.has(pack.name)) {\n throw new DuplicatePackError(pack.name);\n }\n\n registry.set(pack.name, pack);\n }\n\n return registry;\n}\n\n/**\n * The packs Agentyx ships with, expressed as data. Relationships live here, not\n * in the resolver.\n */\nexport const builtInPacks: readonly PackDefinitionInput[] = [\n {\n name: \"technical\",\n category: \"engineering\",\n description: \"General software-engineering quality independent of language or framework.\",\n skills: [\"engineering-principles\", \"code-quality\", \"api-design\", \"code-review\"],\n },\n {\n name: \"typescript\",\n category: \"language\",\n description: \"TypeScript language conventions for strict, modern code.\",\n skills: [\"typescript-strict\", \"typescript-modeling\", \"typescript-modern\"],\n },\n {\n name: \"angular\",\n category: \"framework\",\n description: \"Modern Angular development environment.\",\n skills: [\"angular-modern\", \"angular-signals\", \"angular-architecture\", \"angular-testing\"],\n mcpServers: [\"context7\"],\n },\n {\n name: \"efficiency\",\n category: \"efficiency\",\n description: \"Reduce context and tool overhead without weakening verification.\",\n skills: [\n \"context-efficient-development\",\n \"concise-output\",\n \"targeted-exploration\",\n \"focused-verification\",\n ],\n mcpServers: [{ name: \"codebase-memory\", activation: \"optional\" }],\n tools: [{ name: \"rtk\", activation: \"optional\" }],\n },\n {\n name: \"agentic\",\n category: \"workflow\",\n description: \"Provider-neutral development workflows for substantial coding-agent work.\",\n skills: [\n \"brainstorming\",\n \"planning\",\n \"systematic-debugging\",\n \"verification\",\n \"parallel-work\",\n \"worktree-workflow\",\n \"subagent-driven-development\",\n \"requesting-code-review\",\n ],\n },\n {\n name: \"testing\",\n category: \"engineering\",\n description: \"Test design, isolation and stability at every level of the pyramid.\",\n skills: [\"test-strategy\", \"test-doubles\", \"e2e-testing\", \"flaky-tests\"],\n mcpServers: [{ name: \"playwright\", activation: \"optional\" }],\n },\n {\n name: \"security\",\n category: \"engineering\",\n description: \"Application security fundamentals for untrusted input, secrets and access.\",\n skills: [\"secure-coding\", \"secrets-handling\", \"dependency-security\", \"auth-patterns\"],\n },\n {\n name: \"performance\",\n category: \"engineering\",\n description: \"Measure before optimizing, across application, browser and database.\",\n skills: [\"performance-profiling\", \"web-vitals\", \"query-performance\"],\n mcpServers: [{ name: \"chrome-devtools\", activation: \"optional\" }],\n },\n {\n name: \"accessibility\",\n category: \"engineering\",\n description: \"Accessible markup, ARIA and keyboard interaction for web interfaces.\",\n skills: [\"semantic-html\", \"aria-patterns\", \"keyboard-navigation\"],\n mcpServers: [{ name: \"chrome-devtools\", activation: \"optional\" }],\n },\n {\n name: \"refactoring\",\n category: \"engineering\",\n description: \"Change structure safely, including in legacy code with weak tests.\",\n skills: [\"refactoring-safely\", \"legacy-code\", \"dependency-hygiene\"],\n },\n {\n name: \"documentation\",\n category: \"engineering\",\n description: \"Documentation, interface reference and decision records that stay useful.\",\n skills: [\"technical-writing\", \"api-documentation\", \"decision-records\"],\n },\n {\n name: \"observability\",\n category: \"engineering\",\n description: \"Logging, metrics, tracing and incident response for running systems.\",\n skills: [\"structured-logging\", \"metrics-and-tracing\", \"incident-response\"],\n mcpServers: [{ name: \"sentry\", activation: \"optional\" }],\n },\n {\n name: \"data\",\n category: \"engineering\",\n description: \"Schema design, migrations and transactional correctness.\",\n skills: [\"data-modeling\", \"schema-migrations\", \"transactions-and-consistency\"],\n mcpServers: [{ name: \"supabase\", activation: \"optional\" }],\n },\n {\n name: \"git\",\n category: \"workflow\",\n description: \"Commit, branch and pull-request practice for reviewable history.\",\n skills: [\"commit-hygiene\", \"branching-strategy\", \"pull-requests\"],\n mcpServers: [{ name: \"github\", activation: \"optional\" }],\n },\n {\n name: \"devops\",\n category: \"workflow\",\n description: \"Continuous integration, containers, deployment safety and infrastructure.\",\n skills: [\"ci-pipelines\", \"containerization\", \"deployment-safety\", \"infrastructure-as-code\"],\n },\n];\n\n/** The registry used by default when no explicit registry is supplied. */\nexport const builtInPackRegistry: PackRegistry = createPackRegistry(builtInPacks);\n","import { UnknownPackError } from \"./errors.js\";\nimport { builtInPackRegistry, type PackRegistry } from \"./registry.js\";\n\n/**\n * Resolves selected packs without hidden inheritance.\n *\n * The result preserves configured order, removes duplicates by first\n * occurrence, and validates every requested pack.\n *\n * @throws {UnknownPackError} when a requested pack is missing.\n */\nexport function resolvePacks(\n requestedPacks: readonly string[],\n registry: PackRegistry = builtInPackRegistry,\n): string[] {\n const resolved: string[] = [];\n const seen = new Set<string>();\n\n for (const name of requestedPacks) {\n if (seen.has(name)) {\n continue;\n }\n\n if (!registry.has(name)) {\n throw new UnknownPackError(name, undefined, [...registry.keys()]);\n }\n\n seen.add(name);\n resolved.push(name);\n }\n\n return resolved;\n}\n","import { builtInPackRegistry, type PackRegistry } from \"../pack/registry.js\";\nimport { resolvePacks } from \"../pack/resolver.js\";\nimport { builtInMcpServerRegistry } from \"./built-in.js\";\nimport { UnknownMcpServerError } from \"./errors.js\";\nimport type { McpServerRegistry } from \"./registry.js\";\nimport type { McpServerReference } from \"./schema.js\";\n\nexport function collectPackMcpServerReferences(\n resolvedPacks: readonly string[],\n packRegistry: PackRegistry,\n mcpRegistry: McpServerRegistry,\n): McpServerReference[] {\n const servers: McpServerReference[] = [];\n const seen = new Set<string>();\n\n for (const packName of resolvedPacks) {\n for (const server of packRegistry.get(packName)?.mcpServers ?? []) {\n const serverName = server.name;\n\n if (seen.has(serverName)) {\n continue;\n }\n\n if (!mcpRegistry.has(serverName)) {\n throw new UnknownMcpServerError(serverName, packName, mcpRegistry.names);\n }\n\n seen.add(serverName);\n servers.push(server);\n }\n }\n\n return servers;\n}\n\nexport function filterEffectiveMcpServers(\n servers: readonly McpServerReference[],\n enabledCapabilities: readonly string[],\n): string[] {\n const enabled = new Set(enabledCapabilities);\n\n return servers\n .filter((server) => server.activation === \"default\" || enabled.has(server.name))\n .map((server) => server.name);\n}\n\nexport function collectPackMcpServers(\n resolvedPacks: readonly string[],\n packRegistry: PackRegistry,\n mcpRegistry: McpServerRegistry,\n enabledCapabilities: readonly string[] = [],\n): string[] {\n return filterEffectiveMcpServers(\n collectPackMcpServerReferences(resolvedPacks, packRegistry, mcpRegistry),\n enabledCapabilities,\n );\n}\n\nexport function resolvePackMcpServerReferences(\n requestedPacks: readonly string[],\n packRegistry: PackRegistry = builtInPackRegistry,\n mcpRegistry: McpServerRegistry = builtInMcpServerRegistry,\n): McpServerReference[] {\n return collectPackMcpServerReferences(\n resolvePacks(requestedPacks, packRegistry),\n packRegistry,\n mcpRegistry,\n );\n}\n\nexport function resolvePackMcpServers(\n requestedPacks: readonly string[],\n packRegistry: PackRegistry = builtInPackRegistry,\n mcpRegistry: McpServerRegistry = builtInMcpServerRegistry,\n enabledCapabilities: readonly string[] = [],\n): string[] {\n return collectPackMcpServers(\n resolvePacks(requestedPacks, packRegistry),\n packRegistry,\n mcpRegistry,\n enabledCapabilities,\n );\n}\n","import { fileURLToPath } from \"node:url\";\n\n/**\n * Location of the non-code assets that ship with `@agentyx/core`.\n *\n * **This module must stay directly under `src/`.** The path is derived from\n * `import.meta.url` rather than the working directory, and `src/assets.ts` and\n * the bundled `dist/index.mjs` sit at the same depth below the package root, so\n * one relative path is correct both in development and in the published\n * package. Moving this file into a subdirectory breaks built-in skill loading;\n * `packages/core/test/built-in-skills.test.ts` guards against that.\n *\n * `skills/` is listed in the package's `files`, so it is published alongside\n * `dist/`.\n */\nexport const BUILT_IN_SKILLS_PATH = fileURLToPath(new URL(\"../skills\", import.meta.url));\n","import type { ZodError } from \"zod\";\nimport { AgentyxError } from \"../errors.js\";\n\n/**\n * Raised when a pack references a skill the registry does not know.\n *\n * The offending name is exposed as `skillName`; `pack` stays the JS pack\n * trace inherited from `Error`.\n */\nexport class UnknownSkillError extends AgentyxError {\n readonly skillName: string;\n /** The pack that declared the skill, when the failure came from resolution. */\n readonly requiredBy: string | undefined;\n readonly knownSkills: readonly string[];\n\n constructor(skillName: string, requiredBy: string | undefined, knownSkills: readonly string[]) {\n const origin = requiredBy === undefined ? \"\" : ` (required by pack \"${requiredBy}\")`;\n const known = knownSkills.length > 0 ? [...knownSkills].sort().join(\", \") : \"none\";\n\n super(\"unknown_skill\", `Unknown skill \"${skillName}\"${origin}. Known skills: ${known}.`);\n this.name = \"UnknownSkillError\";\n this.skillName = skillName;\n this.requiredBy = requiredBy;\n this.knownSkills = knownSkills;\n }\n}\n\n/** Raised when a registry is built from sources that reuse a skill name. */\nexport class DuplicateSkillError extends AgentyxError {\n readonly skillName: string;\n\n constructor(skillName: string) {\n super(\"duplicate_skill\", `Duplicate skill definition: \"${skillName}\".`);\n this.name = \"DuplicateSkillError\";\n this.skillName = skillName;\n }\n}\n\n/**\n * Raised when a skill exists but cannot be turned into a valid definition —\n * malformed `SKILL.md` frontmatter, a missing field, an unreadable file.\n *\n * Built-in skills ship with Agentyx, so this is a programmer error rather than\n * something a user can fix in their project.\n */\nexport class InvalidSkillError extends AgentyxError {\n /** Where the skill came from: a file path, or a label for an in-memory source. */\n readonly origin: string;\n readonly reason: string;\n\n constructor(origin: string, reason: string | ZodError, options?: ErrorOptions) {\n const detail = typeof reason === \"string\" ? reason : formatIssues(reason);\n\n super(\"invalid_skill\", `Invalid skill in ${origin}: ${detail}`, options);\n this.name = \"InvalidSkillError\";\n this.origin = origin;\n this.reason = detail;\n }\n}\n\nfunction formatIssues(error: ZodError): string {\n return error.issues\n .map((issue) => {\n const path = issue.path.map(String).join(\".\");\n\n return path === \"\" ? issue.message : `${path}: ${issue.message}`;\n })\n .join(\"; \");\n}\n","import { InvalidSkillError } from \"./errors.js\";\nimport {\n type SkillDefinition,\n type SkillDefinitionInput,\n skillDefinitionSchema,\n skillMetadataSchema,\n} from \"./schema.js\";\n\nconst DELIMITER = \"---\";\nconst BYTE_ORDER_MARK = /^\\uFEFF/;\nconst LINE_BREAK = /[\\r\\n]/;\n\n/**\n * A `SKILL.md` file is a frontmatter block followed by the Markdown body:\n *\n * ```md\n * ---\n * name: planning\n * description: Plan non-trivial work before editing.\n * ---\n *\n * Instructions...\n * ```\n *\n * The frontmatter is a deliberately small YAML subset — a flat block of\n * `key: value` pairs, values optionally quoted — so that core keeps depending\n * on Zod alone. Anything richer is rejected rather than guessed at.\n *\n * The body is preserved as written apart from trimming the blank lines around\n * it, and `origin` is only used to make errors readable.\n *\n * @throws {InvalidSkillError} when the frontmatter or the resulting skill is invalid.\n */\nexport function parseSkillMarkdown(markdown: string, origin: string): SkillDefinition {\n const lines = markdown.replace(BYTE_ORDER_MARK, \"\").split(/\\r?\\n/);\n\n if (lines[0]?.trim() !== DELIMITER) {\n throw new InvalidSkillError(\n origin,\n `the file must start with a \"${DELIMITER}\" frontmatter line`,\n );\n }\n\n const closing = lines.findIndex((line, index) => index > 0 && line.trim() === DELIMITER);\n\n if (closing === -1) {\n throw new InvalidSkillError(\n origin,\n `the frontmatter block is never closed with \"${DELIMITER}\"`,\n );\n }\n\n const metadata = skillMetadataSchema.safeParse(parseFrontmatter(lines.slice(1, closing), origin));\n\n if (!metadata.success) {\n throw new InvalidSkillError(origin, metadata.error);\n }\n\n const skill = skillDefinitionSchema.safeParse({\n ...metadata.data,\n content: lines.slice(closing + 1).join(\"\\n\"),\n });\n\n if (!skill.success) {\n throw new InvalidSkillError(origin, skill.error);\n }\n\n return skill.data;\n}\n\n/**\n * Renders a skill as canonical `SKILL.md` text — the inverse of\n * `parseSkillMarkdown`, and the single representation every consumer installs.\n *\n * Keeping this in core is what stops a provider from owning a copy of a skill\n * body: an adapter decides *where* a skill goes, never what it says.\n *\n * The output is deterministic. Frontmatter is always `name` then `description`,\n * the body is the trimmed content, and the file ends with exactly one newline,\n * so re-rendering an unchanged skill produces a byte-identical file and an\n * installer can compare content instead of guessing.\n *\n * @throws {InvalidSkillError} when the definition is invalid, or when the\n * description cannot be represented in the flat frontmatter subset the parser\n * accepts.\n */\nexport function formatSkillMarkdown(skill: SkillDefinitionInput): string {\n const origin = typeof skill.name === \"string\" ? `skill \"${skill.name}\"` : \"skill definition\";\n const parsed = skillDefinitionSchema.safeParse(skill);\n\n if (!parsed.success) {\n throw new InvalidSkillError(origin, parsed.error);\n }\n\n const { name, description, content } = parsed.data;\n\n if (LINE_BREAK.test(description)) {\n throw new InvalidSkillError(origin, \"the description must not contain a line break\");\n }\n\n return `${DELIMITER}\\nname: ${name}\\ndescription: ${description}\\n${DELIMITER}\\n\\n${content}\\n`;\n}\n\nfunction parseFrontmatter(lines: readonly string[], origin: string): Record<string, string> {\n const entries = new Map<string, string>();\n\n for (const [index, line] of lines.entries()) {\n if (line.trim() === \"\") {\n continue;\n }\n\n const separator = line.indexOf(\":\");\n // +2: the opening delimiter line, plus the shift from a zero-based index.\n const lineNumber = index + 2;\n\n if (separator === -1) {\n throw new InvalidSkillError(\n origin,\n `frontmatter line ${lineNumber} is not \"key: value\": ${line}`,\n );\n }\n\n const key = line.slice(0, separator).trim();\n\n if (key === \"\") {\n throw new InvalidSkillError(origin, `frontmatter line ${lineNumber} has an empty key`);\n }\n\n if (entries.has(key)) {\n throw new InvalidSkillError(\n origin,\n `duplicate frontmatter key \"${key}\" on line ${lineNumber}`,\n );\n }\n\n entries.set(key, unquote(line.slice(separator + 1).trim()));\n }\n\n return Object.fromEntries(entries);\n}\n\nfunction unquote(value: string): string {\n const quoted = /^\"(.*)\"$|^'(.*)'$/.exec(value);\n\n return quoted?.[1] ?? quoted?.[2] ?? value;\n}\n","import { DuplicateSkillError, InvalidSkillError, UnknownSkillError } from \"./errors.js\";\nimport {\n type SkillDefinition,\n type SkillDefinitionInput,\n skillDefinitionSchema,\n skillNameSchema,\n} from \"./schema.js\";\n\n/**\n * Where a single skill comes from. The name is known up front so that listing\n * and existence checks stay cheap, and `load` is only called when something\n * actually needs the instructions — a design that keeps `resolve` working on\n * identifiers alone.\n *\n * This is also the seam an external or remote registry would plug into later.\n */\nexport interface SkillSource {\n readonly name: string;\n /** Produces the definition. Called at most once per registry. */\n load(): SkillDefinitionInput;\n}\n\n/** A name lookup over skills, independent of where the definitions live. */\nexport interface SkillRegistry {\n /** Registered names in registration order. Never reads a skill body. */\n readonly names: readonly string[];\n has(name: string): boolean;\n /**\n * Loads, validates and caches a skill.\n *\n * @throws {UnknownSkillError} when the name is not registered.\n * @throws {InvalidSkillError} when the source yields an invalid definition.\n */\n get(name: string): SkillDefinition;\n}\n\n/**\n * Indexes skill sources by name.\n *\n * Names and duplicates are validated here; the definitions themselves are\n * validated the first time each skill is loaded.\n *\n * @throws {DuplicateSkillError} when two sources share a name.\n * @throws {InvalidSkillError} when a source name is not a valid skill name.\n */\nexport function createSkillRegistry(sources: Iterable<SkillSource>): SkillRegistry {\n const byName = new Map<string, SkillSource>();\n\n for (const source of sources) {\n const name = skillNameSchema.safeParse(source.name);\n\n if (!name.success) {\n throw new InvalidSkillError(`skill source \"${source.name}\"`, name.error);\n }\n\n if (byName.has(name.data)) {\n throw new DuplicateSkillError(name.data);\n }\n\n byName.set(name.data, source);\n }\n\n const names = [...byName.keys()];\n const loaded = new Map<string, SkillDefinition>();\n\n return {\n names,\n has: (name) => byName.has(name),\n get: (name) => {\n const cached = loaded.get(name);\n\n if (cached !== undefined) {\n return cached;\n }\n\n const source = byName.get(name);\n\n if (source === undefined) {\n throw new UnknownSkillError(name, undefined, names);\n }\n\n const origin = `skill \"${name}\"`;\n const skill = skillDefinitionSchema.safeParse(source.load());\n\n if (!skill.success) {\n throw new InvalidSkillError(origin, skill.error);\n }\n\n if (skill.data.name !== name) {\n throw new InvalidSkillError(origin, `it declares the name \"${skill.data.name}\"`);\n }\n\n loaded.set(name, skill.data);\n\n return skill.data;\n },\n };\n}\n","import { readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { BUILT_IN_SKILLS_PATH } from \"../assets.js\";\nimport { InvalidSkillError } from \"./errors.js\";\nimport { parseSkillMarkdown } from \"./markdown.js\";\nimport { createSkillRegistry, type SkillRegistry } from \"./registry.js\";\nimport type { SkillDefinition } from \"./schema.js\";\n\n/**\n * The skills Agentyx ships with. The names are the directory names under\n * `packages/core/skills`, and knowing them without touching the filesystem is\n * what lets pack resolution validate references without reading any body.\n */\nexport const builtInSkillNames = [\n \"engineering-principles\",\n \"code-quality\",\n \"api-design\",\n \"code-review\",\n \"planning\",\n \"systematic-debugging\",\n \"verification\",\n \"brainstorming\",\n \"parallel-work\",\n \"worktree-workflow\",\n \"subagent-driven-development\",\n \"requesting-code-review\",\n \"typescript-strict\",\n \"typescript-modeling\",\n \"typescript-modern\",\n \"angular-modern\",\n \"angular-signals\",\n \"angular-architecture\",\n \"angular-testing\",\n \"context-efficient-development\",\n \"concise-output\",\n \"targeted-exploration\",\n \"focused-verification\",\n \"test-strategy\",\n \"test-doubles\",\n \"e2e-testing\",\n \"flaky-tests\",\n \"secure-coding\",\n \"secrets-handling\",\n \"dependency-security\",\n \"auth-patterns\",\n \"performance-profiling\",\n \"web-vitals\",\n \"query-performance\",\n \"semantic-html\",\n \"aria-patterns\",\n \"keyboard-navigation\",\n \"refactoring-safely\",\n \"legacy-code\",\n \"dependency-hygiene\",\n \"technical-writing\",\n \"api-documentation\",\n \"decision-records\",\n \"structured-logging\",\n \"metrics-and-tracing\",\n \"incident-response\",\n \"data-modeling\",\n \"schema-migrations\",\n \"transactions-and-consistency\",\n \"commit-hygiene\",\n \"branching-strategy\",\n \"pull-requests\",\n \"ci-pipelines\",\n \"containerization\",\n \"deployment-safety\",\n \"infrastructure-as-code\",\n] as const;\n\n/** The absolute path of a built-in skill's `SKILL.md`. */\nexport function builtInSkillPath(name: string): string {\n return join(BUILT_IN_SKILLS_PATH, name, \"SKILL.md\");\n}\n\n/** The registry used by default when no explicit registry is supplied. */\nexport const builtInSkillRegistry: SkillRegistry = createSkillRegistry(\n builtInSkillNames.map((name) => ({ name, load: () => loadBuiltInSkill(name) })),\n);\n\n/**\n * Reads one built-in `SKILL.md`.\n *\n * Reading is synchronous on purpose: the files are small package assets, they\n * are only touched when a command asks for instructions, and a synchronous read\n * keeps `SkillRegistry.get` a plain lookup instead of infecting every caller\n * with a promise.\n */\nfunction loadBuiltInSkill(name: string): SkillDefinition {\n const filePath = builtInSkillPath(name);\n let markdown: string;\n\n try {\n markdown = readFileSync(filePath, \"utf8\");\n } catch (cause) {\n const reason = cause instanceof Error ? cause.message : String(cause);\n\n throw new InvalidSkillError(filePath, `the file could not be read: ${reason}`, { cause });\n }\n\n return parseSkillMarkdown(markdown, filePath);\n}\n","import { builtInPackRegistry, type PackRegistry } from \"../pack/registry.js\";\nimport { resolvePacks } from \"../pack/resolver.js\";\nimport { builtInSkillRegistry } from \"./built-in.js\";\nimport { UnknownSkillError } from \"./errors.js\";\nimport type { SkillRegistry } from \"./registry.js\";\n\n/**\n * Collects the skills contributed by an already-resolved pack chain.\n *\n * Only identifiers are produced — no skill body is read — so this stays cheap\n * enough to run on every `resolve`.\n *\n * @throws {UnknownSkillError} when a pack references a skill the registry lacks.\n */\nexport function collectPackSkills(\n resolvedPacks: readonly string[],\n packRegistry: PackRegistry,\n skillRegistry: SkillRegistry,\n): string[] {\n const skills: string[] = [];\n const seen = new Set<string>();\n\n for (const packName of resolvedPacks) {\n for (const skillName of packRegistry.get(packName)?.skills ?? []) {\n if (seen.has(skillName)) {\n continue;\n }\n\n if (!skillRegistry.has(skillName)) {\n throw new UnknownSkillError(skillName, packName, skillRegistry.names);\n }\n\n seen.add(skillName);\n skills.push(skillName);\n }\n }\n\n return skills;\n}\n\n/**\n * Resolves the requested packs and returns the skills they contribute.\n *\n * The result follows the resolved pack order, then each pack's declaration\n * order, and is de-duplicated by first occurrence. Skills do not extend other\n * skills, so there is nothing further to expand.\n *\n * @throws {UnknownPackError} when a requested pack is missing.\n * @throws {UnknownSkillError} when a pack references a skill the registry lacks.\n */\nexport function resolvePackSkills(\n requestedPacks: readonly string[],\n packRegistry: PackRegistry = builtInPackRegistry,\n skillRegistry: SkillRegistry = builtInSkillRegistry,\n): string[] {\n return collectPackSkills(resolvePacks(requestedPacks, packRegistry), packRegistry, skillRegistry);\n}\n","import { AgentyxError } from \"../errors.js\";\n\nexport class UnknownToolError extends AgentyxError {\n readonly toolName: string;\n readonly requiredBy: string | undefined;\n readonly knownTools: readonly string[];\n\n constructor(toolName: string, requiredBy: string | undefined, knownTools: readonly string[]) {\n const origin = requiredBy === undefined ? \"\" : ` (required by \"${requiredBy}\")`;\n const known = knownTools.length > 0 ? [...knownTools].sort().join(\", \") : \"none\";\n\n super(\"unknown_tool\", `Unknown tool \"${toolName}\"${origin}. Known tools: ${known}.`);\n this.name = \"UnknownToolError\";\n this.toolName = toolName;\n this.requiredBy = requiredBy;\n this.knownTools = knownTools;\n }\n}\n\nexport class DuplicateToolError extends AgentyxError {\n readonly toolName: string;\n\n constructor(toolName: string) {\n super(\"duplicate_tool\", `Duplicate tool definition: \"${toolName}\".`);\n this.name = \"DuplicateToolError\";\n this.toolName = toolName;\n }\n}\n\nexport class InvalidToolError extends AgentyxError {\n constructor(origin: string, reason: unknown, options?: ErrorOptions) {\n const message = reason instanceof Error ? reason.message : String(reason);\n\n super(\"invalid_tool\", `Invalid ${origin}: ${message}.`, options);\n this.name = \"InvalidToolError\";\n }\n}\n","import { DuplicateToolError, InvalidToolError, UnknownToolError } from \"./errors.js\";\nimport {\n type ToolDefinition,\n type ToolDefinitionInput,\n toolDefinitionSchema,\n toolNameSchema,\n} from \"./schema.js\";\n\nexport interface ToolSource {\n readonly name: string;\n load(): ToolDefinitionInput;\n}\n\nexport interface ToolMetadata {\n readonly name: string;\n readonly description: string;\n readonly kind: ToolDefinition[\"kind\"];\n readonly command: string;\n readonly optional: boolean;\n}\n\nexport interface ToolRegistry {\n readonly names: readonly string[];\n has(name: string): boolean;\n listMetadata(): readonly ToolMetadata[];\n get(name: string): ToolDefinition;\n}\n\nexport function createToolRegistry(sources: Iterable<ToolSource>): ToolRegistry {\n const byName = new Map<string, ToolSource>();\n\n for (const source of sources) {\n const name = toolNameSchema.safeParse(source.name);\n\n if (!name.success) {\n throw new InvalidToolError(`tool source \"${source.name}\"`, name.error);\n }\n\n if (byName.has(name.data)) {\n throw new DuplicateToolError(name.data);\n }\n\n byName.set(name.data, source);\n }\n\n const names = [...byName.keys()];\n const loaded = new Map<string, ToolDefinition>();\n const get = (name: string): ToolDefinition => {\n const cached = loaded.get(name);\n\n if (cached !== undefined) {\n return cached;\n }\n\n const source = byName.get(name);\n\n if (source === undefined) {\n throw new UnknownToolError(name, undefined, names);\n }\n\n const origin = `tool \"${name}\"`;\n const tool = toolDefinitionSchema.safeParse(source.load());\n\n if (!tool.success) {\n throw new InvalidToolError(origin, tool.error);\n }\n\n if (tool.data.name !== name) {\n throw new InvalidToolError(origin, `it declares the name \"${tool.data.name}\"`);\n }\n\n loaded.set(name, tool.data);\n\n return tool.data;\n };\n\n return {\n names,\n has: (name) => byName.has(name),\n listMetadata: () =>\n names.map((name) => {\n const tool = get(name);\n\n return {\n name: tool.name,\n description: tool.description,\n kind: tool.kind,\n command: tool.command,\n optional: tool.optional,\n };\n }),\n get,\n };\n}\n","import { createToolRegistry, type ToolSource } from \"./registry.js\";\n\nexport const builtInToolSources: readonly ToolSource[] = [\n {\n name: \"rtk\",\n load: () => ({\n name: \"rtk\",\n description:\n \"Rust Token Killer command-output proxy for reducing coding-agent context noise.\",\n kind: \"executable\",\n command: \"rtk\",\n optional: true,\n installHint: \"Install from the rtk-ai/rtk project if your local workflow benefits from it.\",\n }),\n },\n];\n\nexport const builtInToolRegistry = createToolRegistry(builtInToolSources);\n\nexport const builtInToolNames: readonly string[] = builtInToolRegistry.names;\n","import { builtInPackRegistry, type PackRegistry } from \"../pack/registry.js\";\nimport { resolvePacks } from \"../pack/resolver.js\";\nimport { builtInToolRegistry } from \"./built-in.js\";\nimport { UnknownToolError } from \"./errors.js\";\nimport type { ToolRegistry } from \"./registry.js\";\nimport type { ToolReference } from \"./schema.js\";\n\nexport function collectPackToolReferences(\n resolvedPacks: readonly string[],\n packRegistry: PackRegistry,\n toolRegistry: ToolRegistry,\n): ToolReference[] {\n const tools: ToolReference[] = [];\n const seen = new Set<string>();\n\n for (const packName of resolvedPacks) {\n for (const tool of packRegistry.get(packName)?.tools ?? []) {\n if (seen.has(tool.name)) {\n continue;\n }\n\n if (!toolRegistry.has(tool.name)) {\n throw new UnknownToolError(tool.name, packName, toolRegistry.names);\n }\n\n seen.add(tool.name);\n tools.push(tool);\n }\n }\n\n return tools;\n}\n\nexport function filterEffectiveTools(\n tools: readonly ToolReference[],\n enabledCapabilities: readonly string[],\n): string[] {\n const enabled = new Set(enabledCapabilities);\n\n return tools\n .filter((tool) => tool.activation === \"default\" || enabled.has(tool.name))\n .map((tool) => tool.name);\n}\n\nexport function resolvePackToolReferences(\n requestedPacks: readonly string[],\n packRegistry: PackRegistry = builtInPackRegistry,\n toolRegistry: ToolRegistry = builtInToolRegistry,\n): ToolReference[] {\n return collectPackToolReferences(\n resolvePacks(requestedPacks, packRegistry),\n packRegistry,\n toolRegistry,\n );\n}\n\nexport function resolvePackTools(\n requestedPacks: readonly string[],\n packRegistry: PackRegistry = builtInPackRegistry,\n toolRegistry: ToolRegistry = builtInToolRegistry,\n enabledCapabilities: readonly string[] = [],\n): string[] {\n return filterEffectiveTools(\n resolvePackToolReferences(requestedPacks, packRegistry, toolRegistry),\n enabledCapabilities,\n );\n}\n","import { builtInMcpServerRegistry } from \"../mcp/built-in.js\";\nimport type { McpServerRegistry } from \"../mcp/registry.js\";\nimport { collectPackMcpServerReferences, filterEffectiveMcpServers } from \"../mcp/resolver.js\";\nimport type { McpServerReference } from \"../mcp/schema.js\";\nimport { builtInPackRegistry, type PackRegistry } from \"../pack/registry.js\";\nimport { resolvePacks } from \"../pack/resolver.js\";\nimport { builtInSkillRegistry } from \"../skill/built-in.js\";\nimport type { SkillRegistry } from \"../skill/registry.js\";\nimport { collectPackSkills } from \"../skill/resolver.js\";\nimport { builtInToolRegistry } from \"../tool/built-in.js\";\nimport type { ToolRegistry } from \"../tool/registry.js\";\nimport { collectPackToolReferences, filterEffectiveTools } from \"../tool/resolver.js\";\nimport type { ToolReference } from \"../tool/schema.js\";\nimport { UnknownEnabledCapabilityError } from \"./errors.js\";\nimport type { AgentyxConfig } from \"./schema.js\";\n\n/** A project configuration with its pack inheritance expanded. */\nexport interface ResolvedAgentyxConfig {\n /** The packs the project asked for, in configuration order. */\n readonly requestedPacks: readonly string[];\n /** Selected packs, de-duplicated while preserving configuration order. */\n readonly resolvedPacks: readonly string[];\n /**\n * Skill identifiers contributed by the resolved packs, in resolution order.\n * Identifiers only — reading the instructions is a separate, explicit step.\n */\n readonly skills: readonly string[];\n readonly declaredMcpServers: readonly McpServerReference[];\n readonly mcpServers: readonly string[];\n readonly declaredTools: readonly ToolReference[];\n readonly tools: readonly string[];\n readonly enabled: readonly string[];\n readonly targets: readonly string[];\n}\n\n/**\n * Combines a validated project configuration with pack and skill resolution.\n * The input is never mutated.\n *\n * @throws {UnknownPackError} when a configured pack is missing.\n * @throws {CircularPackDependencyError} when inheritance forms a cycle.\n * @throws {UnknownSkillError} when a pack references an unknown skill.\n */\nexport function resolveAgentyxConfig(\n config: AgentyxConfig,\n registry: PackRegistry = builtInPackRegistry,\n skillRegistry: SkillRegistry = builtInSkillRegistry,\n mcpRegistry: McpServerRegistry = builtInMcpServerRegistry,\n toolRegistry: ToolRegistry = builtInToolRegistry,\n): ResolvedAgentyxConfig {\n const requestedPacks = [...config.packs];\n const resolvedPacks = resolvePacks(requestedPacks, registry);\n const declaredMcpServers = collectPackMcpServerReferences(resolvedPacks, registry, mcpRegistry);\n const declaredTools = collectPackToolReferences(resolvedPacks, registry, toolRegistry);\n const knownOptionalCapabilities = [\n ...declaredMcpServers\n .filter((server) => server.activation === \"optional\")\n .map((server) => server.name),\n ...declaredTools.filter((tool) => tool.activation === \"optional\").map((tool) => tool.name),\n ];\n\n for (const capability of config.enable) {\n if (!knownOptionalCapabilities.includes(capability)) {\n throw new UnknownEnabledCapabilityError(capability, knownOptionalCapabilities);\n }\n }\n\n return {\n requestedPacks,\n resolvedPacks,\n skills: collectPackSkills(resolvedPacks, registry, skillRegistry),\n declaredMcpServers,\n mcpServers: filterEffectiveMcpServers(declaredMcpServers, config.enable),\n declaredTools,\n tools: filterEffectiveTools(declaredTools, config.enable),\n enabled: [...config.enable],\n targets: [...config.targets],\n };\n}\n","import type { ZodError } from \"zod\";\nimport { AgentyxError } from \"../errors.js\";\nimport { type AgentyxIssue, toAgentyxIssues } from \"../issues.js\";\n\n/** Raised when `.agentyx.lock.json` is not valid JSON. */\nexport class AgentyxManifestParseError extends AgentyxError {\n readonly filePath: string;\n\n constructor(filePath: string, reason: string, options?: ErrorOptions) {\n super(\"agentyx_manifest_parse_error\", `${filePath} is not valid JSON: ${reason}`, options);\n this.name = \"AgentyxManifestParseError\";\n this.filePath = filePath;\n }\n}\n\n/**\n * Raised when the manifest parses as JSON but is not a manifest Agentyx\n * understands.\n *\n * This is never repaired. The manifest is what tells Agentyx which files it is\n * allowed to overwrite and delete, so guessing at a damaged one would be\n * guessing about destructive operations.\n */\nexport class AgentyxManifestValidationError extends AgentyxError {\n readonly issues: readonly AgentyxIssue[];\n readonly filePath: string | undefined;\n\n constructor(error: ZodError, filePath?: string) {\n const issues = toAgentyxIssues(error);\n const location = filePath === undefined ? \"\" : ` in ${filePath}`;\n const details = issues.map((issue) => ` - ${issue.path}: ${issue.message}`).join(\"\\n\");\n\n super(\n \"agentyx_manifest_invalid\",\n `Invalid Agentyx install manifest${location}:\\n${details}\\nDelete the file to start from a clean install record.`,\n );\n this.name = \"AgentyxManifestValidationError\";\n this.issues = issues;\n this.filePath = filePath;\n }\n}\n","import { z } from \"zod\";\n\n/**\n * The manifest format version.\n *\n * A manifest written by a newer Agentyx fails validation instead of being\n * reinterpreted, because acting on a half-understood record of managed files is\n * how an installer deletes something it should not.\n */\nexport const INSTALL_MANIFEST_VERSION = 1;\n\n/**\n * A path Agentyx manages, relative to the project root and always written with\n * `/` separators so a manifest reads the same on every platform.\n */\nexport const managedPathSchema = z\n .string()\n .min(1, \"Managed paths must be non-empty strings.\")\n .refine((value) => !value.startsWith(\"/\"), \"Managed paths must be relative to the project root.\")\n .refine((value) => !value.includes(\"\\\\\"), \"Managed paths must use `/` separators.\")\n .refine(\n (value) => !value.split(\"/\").includes(\"..\"),\n \"Managed paths must not traverse outside the project root.\",\n );\n\n/** A SHA-256 digest of the exact bytes Agentyx last wrote to a managed path. */\nexport const contentHashSchema = z\n .string()\n .regex(/^[0-9a-f]{64}$/, \"Content hashes must be lowercase hexadecimal SHA-256 digests.\");\n\nconst targetsSchema = z\n .array(z.string().min(1, \"Targets must be non-empty strings.\"))\n .min(1, \"A manifest entry must record at least one target.\");\n\n/** A `SKILL.md` file Agentyx wrote, owned entirely by Agentyx. */\nexport const skillManifestEntrySchema = z.strictObject({\n kind: z.literal(\"skill\"),\n path: managedPathSchema,\n skill: z.string().min(1, \"Skill names must be non-empty strings.\"),\n targets: targetsSchema,\n hash: contentHashSchema,\n});\n\n/**\n * A provider MCP configuration file Agentyx contributed entries to.\n *\n * Unlike a skill file this one is shared with the user, so the entry records\n * the server keys Agentyx added rather than claiming the whole document.\n * `created` says whether the file existed before Agentyx first wrote it, which\n * is the only thing that makes removing the file itself safe.\n */\nexport const mcpManifestEntrySchema = z.strictObject({\n kind: z.literal(\"mcp\"),\n path: managedPathSchema,\n servers: z.array(z.string().min(1, \"MCP server names must be non-empty strings.\")),\n targets: targetsSchema,\n hash: contentHashSchema,\n created: z.boolean(),\n});\n\nexport const installManifestEntrySchema = z.discriminatedUnion(\"kind\", [\n skillManifestEntrySchema,\n mcpManifestEntrySchema,\n]);\n\n/** The `.agentyx.lock.json` record of everything Agentyx installed into a project. */\nexport const installManifestSchema = z.strictObject({\n version: z.literal(INSTALL_MANIFEST_VERSION),\n entries: z.array(installManifestEntrySchema).default([]),\n});\n\nexport type SkillManifestEntry = z.infer<typeof skillManifestEntrySchema>;\nexport type McpManifestEntry = z.infer<typeof mcpManifestEntrySchema>;\nexport type InstallManifestEntry = z.infer<typeof installManifestEntrySchema>;\n\n/** A validated manifest, with defaults applied. */\nexport type InstallManifest = z.infer<typeof installManifestSchema>;\n\n/** The shape accepted in a `.agentyx.lock.json` file. */\nexport type InstallManifestInput = z.input<typeof installManifestSchema>;\n","import { createHash } from \"node:crypto\";\nimport { readFile } from \"node:fs/promises\";\nimport { resolve } from \"node:path\";\nimport { AgentyxManifestParseError, AgentyxManifestValidationError } from \"./errors.js\";\nimport {\n INSTALL_MANIFEST_VERSION,\n type InstallManifest,\n type InstallManifestEntry,\n installManifestSchema,\n} from \"./schema.js\";\n\nexport const AGENTYX_MANIFEST_FILENAME = \".agentyx.lock.json\";\n\n/** The absolute path `.agentyx.lock.json` is read from for a given project. */\nexport function agentyxManifestPath(projectPath: string = process.cwd()): string {\n return resolve(projectPath, AGENTYX_MANIFEST_FILENAME);\n}\n\n/** A manifest that claims nothing — what a project has before its first install. */\nexport function emptyInstallManifest(): InstallManifest {\n return { version: INSTALL_MANIFEST_VERSION, entries: [] };\n}\n\n/**\n * The SHA-256 digest Agentyx records for managed content.\n *\n * Comparing this digest with the file on disk is what separates \"Agentyx wrote\n * this and may replace it\" from \"someone else owns this file\", so it is\n * computed over the exact bytes written, never over a normalised form.\n */\nexport function hashContent(content: string): string {\n return createHash(\"sha256\").update(content, \"utf8\").digest(\"hex\");\n}\n\n/**\n * Validates an already-parsed manifest document.\n *\n * @throws {AgentyxManifestValidationError} when the document violates the schema.\n */\nexport function parseInstallManifest(value: unknown, filePath?: string): InstallManifest {\n const result = installManifestSchema.safeParse(value);\n\n if (!result.success) {\n throw new AgentyxManifestValidationError(result.error, filePath);\n }\n\n return result.data;\n}\n\n/**\n * Reads `.agentyx.lock.json` from `projectPath`.\n *\n * A missing manifest is a legitimate state — the project has simply never been\n * installed into — and yields an empty manifest. A manifest that exists but\n * cannot be understood is a hard failure: it governs which files Agentyx may\n * overwrite and delete, and a damaged one is never guessed at.\n *\n * @throws {AgentyxManifestParseError} when the file is not valid JSON.\n * @throws {AgentyxManifestValidationError} when the document violates the schema.\n */\nexport async function loadInstallManifest(\n projectPath: string = process.cwd(),\n): Promise<InstallManifest> {\n const filePath = agentyxManifestPath(projectPath);\n let contents: string;\n\n try {\n contents = await readFile(filePath, \"utf8\");\n } catch (cause) {\n if (cause instanceof Error && (cause as NodeJS.ErrnoException).code === \"ENOENT\") {\n return emptyInstallManifest();\n }\n\n throw cause;\n }\n\n let document: unknown;\n\n try {\n document = JSON.parse(contents);\n } catch (cause) {\n const reason = cause instanceof Error ? cause.message : String(cause);\n throw new AgentyxManifestParseError(filePath, reason, { cause });\n }\n\n return parseInstallManifest(document, filePath);\n}\n\n/**\n * Serialises a manifest for writing.\n *\n * Entries and their lists are sorted so that reinstalling an unchanged project\n * produces a byte-identical file and the manifest never shows up as noise in a\n * diff. Writing is deliberately not done here — only the install executor\n * touches the filesystem.\n */\nexport function formatInstallManifest(manifest: InstallManifest): string {\n const entries = [...manifest.entries]\n .map((entry) =>\n entry.kind === \"skill\"\n ? { ...entry, targets: sorted(entry.targets) }\n : { ...entry, targets: sorted(entry.targets), servers: sorted(entry.servers) },\n )\n .sort((left, right) => left.path.localeCompare(right.path));\n\n return `${JSON.stringify({ version: manifest.version, entries }, null, 2)}\\n`;\n}\n\n/**\n * Indexes manifest entries by managed path.\n *\n * Every ownership question — may this file be overwritten, may it be deleted —\n * is a lookup by path, so callers do not scan the list themselves.\n */\nexport function manifestEntriesByPath(\n manifest: InstallManifest,\n): ReadonlyMap<string, InstallManifestEntry> {\n return new Map(manifest.entries.map((entry) => [entry.path, entry]));\n}\n\nfunction sorted(values: readonly string[]): string[] {\n return [...values].sort();\n}\n","export const agentyxCoreName = \"agentyx-core\";\n\nexport function getCoreStatus(): string {\n return \"ready\";\n}\n","import { access, readFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport type { AgentyxConfigInput } from \"../config/schema.js\";\n\nexport const PACKAGE_MANAGERS = [\"pnpm\", \"npm\", \"yarn\", \"bun\"] as const;\n\nexport type PackageManagerName = (typeof PACKAGE_MANAGERS)[number];\n\nexport interface PackageManagerDetection {\n readonly name: PackageManagerName | undefined;\n readonly source: \"lockfile\" | \"package-json\" | undefined;\n readonly lockfiles: readonly string[];\n readonly ambiguous: boolean;\n}\n\nexport interface ProjectPackageJsonDetection {\n readonly present: boolean;\n readonly valid: boolean;\n readonly path: string;\n readonly name: string | undefined;\n readonly packageManager: string | undefined;\n readonly error: string | undefined;\n}\n\nexport interface ProjectDetection {\n readonly projectDir: string;\n readonly packageJson: ProjectPackageJsonDetection;\n readonly packageManager: PackageManagerDetection;\n readonly detectedPacks: readonly string[];\n readonly recommendedPacks: readonly string[];\n}\n\ninterface PackageJson {\n readonly name?: unknown;\n readonly packageManager?: unknown;\n readonly dependencies?: unknown;\n readonly devDependencies?: unknown;\n readonly peerDependencies?: unknown;\n readonly optionalDependencies?: unknown;\n}\n\nconst lockfileManagers: ReadonlyMap<string, PackageManagerName> = new Map([\n [\"pnpm-lock.yaml\", \"pnpm\"],\n [\"package-lock.json\", \"npm\"],\n [\"yarn.lock\", \"yarn\"],\n [\"bun.lock\", \"bun\"],\n [\"bun.lockb\", \"bun\"],\n]);\n\nexport async function detectProject(projectDir: string): Promise<ProjectDetection> {\n const packageJsonPath = join(projectDir, \"package.json\");\n const packageJson = await readPackageJson(packageJsonPath);\n const packageManager = await detectPackageManager(projectDir, packageJson.data);\n const detectedPacks = await detectPacks(projectDir, packageJson.data);\n\n return {\n projectDir,\n packageJson: {\n present: packageJson.present,\n valid: packageJson.valid,\n path: packageJsonPath,\n name: getString(packageJson.data?.name),\n packageManager: getString(packageJson.data?.packageManager),\n error: packageJson.error,\n },\n packageManager,\n detectedPacks,\n recommendedPacks: recommendPacks(detectedPacks),\n };\n}\n\nexport function buildAgentyxConfig(input: {\n readonly packs: readonly string[];\n readonly enable?: readonly string[];\n readonly targets: readonly string[];\n}): AgentyxConfigInput {\n return {\n packs: [...input.packs],\n enable: [...(input.enable ?? [])],\n targets: [...input.targets],\n };\n}\n\nexport function formatAgentyxConfig(config: AgentyxConfigInput): string {\n return `${JSON.stringify(config, null, 2)}\\n`;\n}\n\nfunction recommendPacks(detectedPacks: readonly string[]): readonly string[] {\n if (detectedPacks.includes(\"angular\")) {\n return [\"technical\", \"typescript\", \"angular\"];\n }\n\n if (detectedPacks.includes(\"typescript\")) {\n return [\"technical\", \"typescript\"];\n }\n\n return [\"technical\"];\n}\n\nasync function detectPacks(\n projectDir: string,\n packageJson: PackageJson | undefined,\n): Promise<readonly string[]> {\n const packs: string[] = [];\n const dependencies = collectDependencies(packageJson);\n const hasAngular = dependencies.has(\"@angular/core\");\n const hasTypeScript =\n dependencies.has(\"typescript\") || (await exists(join(projectDir, \"tsconfig.json\")));\n\n if (hasTypeScript || hasAngular) {\n packs.push(\"typescript\");\n }\n\n if (hasAngular) {\n packs.push(\"angular\");\n }\n\n return packs;\n}\n\nasync function detectPackageManager(\n projectDir: string,\n packageJson: PackageJson | undefined,\n): Promise<PackageManagerDetection> {\n const lockfiles: string[] = [];\n const managers = new Set<PackageManagerName>();\n\n for (const [file, manager] of lockfileManagers) {\n if (await exists(join(projectDir, file))) {\n lockfiles.push(file);\n managers.add(manager);\n }\n }\n\n if (managers.size === 1) {\n return {\n name: [...managers][0],\n source: \"lockfile\",\n lockfiles,\n ambiguous: false,\n };\n }\n\n if (managers.size > 1) {\n return {\n name: undefined,\n source: \"lockfile\",\n lockfiles,\n ambiguous: true,\n };\n }\n\n const declared = parsePackageManagerName(getString(packageJson?.packageManager));\n\n return {\n name: declared,\n source: declared === undefined ? undefined : \"package-json\",\n lockfiles,\n ambiguous: false,\n };\n}\n\nasync function readPackageJson(path: string): Promise<{\n readonly present: boolean;\n readonly valid: boolean;\n readonly data: PackageJson | undefined;\n readonly error: string | undefined;\n}> {\n let contents: string;\n\n try {\n contents = await readFile(path, \"utf8\");\n } catch (cause) {\n if (isNotFound(cause)) {\n return { present: false, valid: false, data: undefined, error: undefined };\n }\n\n const reason = cause instanceof Error ? cause.message : String(cause);\n return { present: true, valid: false, data: undefined, error: reason };\n }\n\n try {\n return { present: true, valid: true, data: JSON.parse(contents), error: undefined };\n } catch (cause) {\n const reason = cause instanceof Error ? cause.message : String(cause);\n return { present: true, valid: false, data: undefined, error: reason };\n }\n}\n\nfunction collectDependencies(packageJson: PackageJson | undefined): ReadonlySet<string> {\n const dependencies = new Set<string>();\n\n for (const field of [\n packageJson?.dependencies,\n packageJson?.devDependencies,\n packageJson?.peerDependencies,\n packageJson?.optionalDependencies,\n ]) {\n if (isRecord(field)) {\n for (const name of Object.keys(field)) {\n dependencies.add(name);\n }\n }\n }\n\n return dependencies;\n}\n\nfunction parsePackageManagerName(value: string | undefined): PackageManagerName | undefined {\n const name = value?.split(\"@\")[0];\n\n return PACKAGE_MANAGERS.includes(name as PackageManagerName)\n ? (name as PackageManagerName)\n : undefined;\n}\n\nfunction getString(value: unknown): string | undefined {\n return typeof value === \"string\" ? value : undefined;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nasync function exists(path: string): Promise<boolean> {\n try {\n await access(path);\n return true;\n } catch (cause) {\n if (isNotFound(cause)) {\n return false;\n }\n\n throw cause;\n }\n}\n\nfunction isNotFound(cause: unknown): boolean {\n return cause instanceof Error && (cause as NodeJS.ErrnoException).code === \"ENOENT\";\n}\n"],"mappings":";;;;;;;;;;;;;;AAOA,IAAa,eAAb,cAAkC,MAAM;CACtC;CAEA,YAAY,MAAc,SAAiB,SAAwB;EACjE,MAAM,SAAS,OAAO;EACtB,KAAK,OAAO;EACZ,KAAK,OAAO;CACd;AACF;;;;;;;;;ACAA,SAAgB,gBAAgB,OAA0C;CACxE,OAAO,MAAM,OAAO,KAAK,WAAW;EAClC,MAAM,gBAAgB,MAAM,IAAI;EAChC,SAAS,MAAM;CACjB,EAAE;AACJ;AAEA,SAAS,gBAAgB,MAAsC;CAC7D,IAAI,KAAK,WAAW,GAClB,OAAO;CAGT,OAAO,KAAK,QAAgB,WAAW,YAAY;EACjD,IAAI,OAAO,YAAY,UACrB,OAAO,GAAG,UAAU,GAAG,QAAQ;EAGjC,OAAO,cAAc,KAAK,OAAO,OAAO,IAAI,GAAG,UAAU,GAAG,OAAO,OAAO;CAC5E,GAAG,EAAE;AACP;;;;AC1BA,IAAa,6BAAb,cAAgD,aAAa;CAC3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KAAK,MAAM,QAAQ;GAAG,OAAO,KAAA;EAAU;CACpF,SAAS,OAAO;EAEd,OAAO;GAAE,SAAS;GAAM,OAAO;GAAO,MAAM,KAAA;GAAW,OADxC,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;EACC;CACvE;AACF;AAEA,SAAS,oBAAoB,aAA2D;CACtF,MAAM,+BAAe,IAAI,IAAY;CAErC,KAAK,MAAM,SAAS;EAClB,aAAa;EACb,aAAa;EACb,aAAa;EACb,aAAa;CACf,GACE,IAAI,SAAS,KAAK,GAChB,KAAK,MAAM,QAAQ,OAAO,KAAK,KAAK,GAClC,aAAa,IAAI,IAAI;CAK3B,OAAO;AACT;AAEA,SAAS,wBAAwB,OAA2D;CAC1F,MAAM,OAAO,OAAO,MAAM,GAAG,CAAC,CAAC;CAE/B,OAAO,iBAAiB,SAAS,IAA0B,IACtD,OACD,KAAA;AACN;AAEA,SAAS,UAAU,OAAoC;CACrD,OAAO,OAAO,UAAU,WAAW,QAAQ,KAAA;AAC7C;AAEA,SAAS,SAAS,OAAkD;CAClE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAEA,eAAe,OAAO,MAAgC;CACpD,IAAI;EACF,MAAM,OAAO,IAAI;EACjB,OAAO;CACT,SAAS,OAAO;EACd,IAAI,WAAW,KAAK,GAClB,OAAO;EAGT,MAAM;CACR;AACF;AAEA,SAAS,WAAW,OAAyB;CAC3C,OAAO,iBAAiB,SAAU,MAAgC,SAAS;AAC7E"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: api-documentation
|
|
3
|
+
description: Document interfaces so a caller can use them without reading the source.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# API documentation
|
|
7
|
+
|
|
8
|
+
The test of interface documentation is whether someone can call it correctly on the first attempt
|
|
9
|
+
without opening the implementation.
|
|
10
|
+
|
|
11
|
+
## Document the contract
|
|
12
|
+
|
|
13
|
+
State what the operation does, what it requires, what it guarantees, and what it does not promise.
|
|
14
|
+
Behavior a caller can rely on must be written down; everything else stays free to change.
|
|
15
|
+
|
|
16
|
+
## Cover errors as first-class
|
|
17
|
+
|
|
18
|
+
List the failure modes, how they are signalled, and what the caller should do about each. Error
|
|
19
|
+
behavior is the least documented and most needed part of any interface.
|
|
20
|
+
|
|
21
|
+
## Explain the why, not the what
|
|
22
|
+
|
|
23
|
+
Restating the signature in prose adds nothing. Explain constraints, units, ownership, lifetimes and
|
|
24
|
+
side effects — the things the type cannot express.
|
|
25
|
+
|
|
26
|
+
## Generate from the source of truth
|
|
27
|
+
|
|
28
|
+
Derive reference documentation from the schema, types or annotations that define the interface.
|
|
29
|
+
Hand-maintained copies drift, and a drifted reference misleads with authority.
|
|
30
|
+
|
|
31
|
+
## Version and describe changes
|
|
32
|
+
|
|
33
|
+
Say when behavior changed and what callers must do. Migration notes matter more than a changelog
|
|
34
|
+
entry, because they tell the reader what action to take.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: aria-patterns
|
|
3
|
+
description: Apply ARIA only where native semantics fall short, and keep state accurate.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# ARIA patterns
|
|
7
|
+
|
|
8
|
+
ARIA changes how assistive technology reports an element. It adds no behavior, so incorrect ARIA is
|
|
9
|
+
worse than none.
|
|
10
|
+
|
|
11
|
+
## Prefer native semantics
|
|
12
|
+
|
|
13
|
+
Reach for ARIA only when no native element expresses the pattern. The first rule of ARIA is not to
|
|
14
|
+
use ARIA when markup can do the job.
|
|
15
|
+
|
|
16
|
+
## Keep state synchronized
|
|
17
|
+
|
|
18
|
+
Expanded, selected, checked, pressed and disabled states must update whenever the visual state
|
|
19
|
+
changes. Stale ARIA state describes an interface the user is no longer looking at.
|
|
20
|
+
|
|
21
|
+
## Implement the whole pattern
|
|
22
|
+
|
|
23
|
+
A composite widget such as a menu, tab set, combobox or dialog has an expected set of roles,
|
|
24
|
+
relationships and keyboard interactions. Adopting the role without the behavior leaves the control
|
|
25
|
+
unusable.
|
|
26
|
+
|
|
27
|
+
## Manage focus in overlays
|
|
28
|
+
|
|
29
|
+
Move focus into a dialog when it opens, keep it inside while it is open, and return it to the
|
|
30
|
+
trigger on close. Content behind a modal must be inert to assistive technology as well as to
|
|
31
|
+
pointers.
|
|
32
|
+
|
|
33
|
+
## Announce changes sparingly
|
|
34
|
+
|
|
35
|
+
Use live regions for updates the user must know about, such as errors and completions. Announcing
|
|
36
|
+
everything makes the page unusable with a screen reader.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: auth-patterns
|
|
3
|
+
description: Separate authentication from authorization and enforce both server side.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Authentication and authorization
|
|
7
|
+
|
|
8
|
+
Authentication establishes who is calling. Authorization decides what they may do. Conflating the two
|
|
9
|
+
is the most common access-control defect.
|
|
10
|
+
|
|
11
|
+
## Enforce on the server
|
|
12
|
+
|
|
13
|
+
Client-side checks are user experience, not security. Every request must be authorized independently
|
|
14
|
+
on the server, whatever the interface already hid.
|
|
15
|
+
|
|
16
|
+
## Authorize the object, not just the route
|
|
17
|
+
|
|
18
|
+
Verify that the authenticated principal may act on the specific resource named in the request.
|
|
19
|
+
Route-level checks that skip ownership let one user read another user's data by changing an
|
|
20
|
+
identifier.
|
|
21
|
+
|
|
22
|
+
## Keep sessions and tokens short
|
|
23
|
+
|
|
24
|
+
Prefer short-lived tokens with refresh over long-lived credentials. Give every session an expiry, and
|
|
25
|
+
support revocation for logout, password change and suspected compromise.
|
|
26
|
+
|
|
27
|
+
## Store credentials correctly
|
|
28
|
+
|
|
29
|
+
Hash passwords with a current memory-hard algorithm and per-user salts. Never encrypt or encode them,
|
|
30
|
+
and never implement the primitive yourself.
|
|
31
|
+
|
|
32
|
+
## Deny by default
|
|
33
|
+
|
|
34
|
+
New endpoints require explicit authorization rather than inheriting open access. A permission model
|
|
35
|
+
where forgetting a check means public access will eventually leak data.
|