@agentyx/core 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Andersseen
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,77 @@
1
+ # @agentyx/core
2
+
3
+ Domain foundations for [Agentyx](https://github.com/Andersseen/agentyx): the `.agentyx.json` configuration
4
+ model, stack definitions, built-in stack/skill/MCP registries, optimization profiles, and
5
+ resolution.
6
+
7
+ This package has no dependency on Commander or any terminal UI — CLI concerns live in
8
+ [`@agentyx/cli`](https://github.com/Andersseen/agentyx/tree/main/packages/cli).
9
+
10
+ ```ts
11
+ import {
12
+ builtInSkillRegistry,
13
+ builtInStacks,
14
+ loadAgentyxConfig,
15
+ resolveAgentyxConfig,
16
+ resolveStackMcpServerReferences,
17
+ resolveStacks,
18
+ resolveStackSkills,
19
+ } from "@agentyx/core";
20
+
21
+ resolveStacks(["angular"]);
22
+ // ["core", "typescript", "angular"]
23
+
24
+ resolveStackSkills(["angular"]);
25
+ // ["planning", "systematic-debugging", "verification", "typescript-modern", "angular-modern"]
26
+
27
+ resolveStackMcpServerReferences(["angular"]);
28
+ // [{ name: "context7", level: "recommended" }]
29
+
30
+ resolveAgentyxConfig(await loadAgentyxConfig(process.cwd()));
31
+ // { requestedStacks, resolvedStacks, skills, declaredMcpServers, mcpServers, profile, targets }
32
+ ```
33
+
34
+ ## Skills
35
+
36
+ A skill is provider-independent instruction text: `{ name, description, content }` and nothing else.
37
+ The built-in skills ship as `SKILL.md` files under `skills/`, with YAML frontmatter for the metadata
38
+ and the Markdown body as the content, and are published alongside `dist/`.
39
+
40
+ Resolution works on identifiers, and `SkillRegistry.get(name)` is what reads a body:
41
+
42
+ ```ts
43
+ builtInSkillRegistry.names; // identifiers, no file is read
44
+ builtInSkillRegistry.has("planning"); // no file is read
45
+ builtInSkillRegistry.get("planning"); // reads, validates and caches SKILL.md
46
+ ```
47
+
48
+ `createSkillRegistry(sources)` builds an independent registry from `{ name, load }` sources — the
49
+ seam an external registry would use later. `parseSkillMarkdown(markdown, origin)` parses one
50
+ `SKILL.md`, and `formatSkillMarkdown(skill)` renders one deterministically. That serializer is the
51
+ canonical form every provider installs, which is why it lives here: an adapter decides where a skill
52
+ goes, never what it says.
53
+
54
+ MCP resolution keeps both declared and effective capabilities visible. Profiles are provider-neutral:
55
+ `lean` enables essential MCP only, `balanced` enables essential and recommended MCP, and
56
+ `autonomous` enables essential, recommended and optional MCP. Skill identifiers are not filtered by
57
+ profile.
58
+
59
+ The JSON Schema for `.agentyx.json` ships with the package:
60
+
61
+ ```json
62
+ {
63
+ "$schema": "./node_modules/@agentyx/core/schema/agentyx.schema.json"
64
+ }
65
+ ```
66
+
67
+ Resolution failures throw domain errors — `UnknownStackError`, `CircularStackDependencyError`,
68
+ `UnknownSkillError`, `DuplicateSkillError`, `InvalidSkillError`, `AgentyxConfigNotFoundError`,
69
+ `AgentyxConfigParseError`, `AgentyxConfigValidationError` — all extending `AgentyxError` with a stable
70
+ `code`.
71
+
72
+ Installing skills and effective MCP capabilities into an agent is
73
+ [`@agentyx/adapters`](https://github.com/Andersseen/agentyx/tree/main/packages/adapters); core knows
74
+ nothing about providers. See the [main README](https://github.com/Andersseen/agentyx#readme) for the
75
+ full picture.
76
+
77
+ MIT © Andersseen
@@ -0,0 +1,541 @@
1
+ import { ZodError, z } from "zod";
2
+ //#region src/errors.d.ts
3
+ /**
4
+ * Base class for every failure Agentyx raises deliberately.
5
+ *
6
+ * Consumers can catch `AgentyxError` to separate expected domain failures from
7
+ * unexpected runtime errors, and branch on the stable `code` when they need to
8
+ * handle a specific failure.
9
+ */
10
+ declare class AgentyxError extends Error {
11
+ readonly code: string;
12
+ constructor(code: string, message: string, options?: ErrorOptions);
13
+ }
14
+ //#endregion
15
+ //#region src/config/errors.d.ts
16
+ /** A single configuration problem, addressed by its location in the document. */
17
+ interface AgentyxConfigIssue {
18
+ /** Dotted path to the offending value, or `(root)` for the document itself. */
19
+ readonly path: string;
20
+ readonly message: string;
21
+ }
22
+ /** Raised when the supplied directory has no `.agentyx.json`. */
23
+ declare class AgentyxConfigNotFoundError extends AgentyxError {
24
+ readonly filePath: string;
25
+ constructor(filePath: string, options?: ErrorOptions);
26
+ }
27
+ /** Raised when `.agentyx.json` is not valid JSON. */
28
+ declare class AgentyxConfigParseError extends AgentyxError {
29
+ readonly filePath: string;
30
+ constructor(filePath: string, reason: string, options?: ErrorOptions);
31
+ }
32
+ /** Raised when the document parses as JSON but violates the Agentyx schema. */
33
+ declare class AgentyxConfigValidationError extends AgentyxError {
34
+ readonly issues: readonly AgentyxConfigIssue[];
35
+ /** The file the configuration came from, when it was read from disk. */
36
+ readonly filePath: string | undefined;
37
+ constructor(error: ZodError, filePath?: string);
38
+ }
39
+ //#endregion
40
+ //#region src/config/json-schema.d.ts
41
+ /** Canonical identifier of the published `.agentyx.json` schema. */
42
+ declare const AGENTYX_CONFIG_SCHEMA_ID = "https://agentyx.dev/schema/agentyx.schema.json";
43
+ /**
44
+ * Derives the JSON Schema for `.agentyx.json` from the Zod model, which stays the
45
+ * single source of truth. The committed `schema/agentyx.schema.json` is generated
46
+ * from this function and verified by tests.
47
+ *
48
+ * The `input` view is used so that fields with defaults stay optional, which is
49
+ * what an author writing the file cares about.
50
+ */
51
+ declare function buildAgentyxConfigJsonSchema(): Record<string, unknown>;
52
+ //#endregion
53
+ //#region src/config/schema.d.ts
54
+ /** How much autonomy the generated environment should grant an agent. */
55
+ declare const AGENTYX_PROFILES: readonly ["lean", "balanced", "autonomous"];
56
+ declare const agentyxProfileSchema: z.ZodEnum<{
57
+ lean: "lean";
58
+ balanced: "balanced";
59
+ autonomous: "autonomous";
60
+ }>;
61
+ type AgentyxProfile = z.infer<typeof agentyxProfileSchema>;
62
+ /** Applied when a configuration omits `profile`. */
63
+ declare const DEFAULT_AGENTYX_PROFILE: AgentyxProfile;
64
+ /** The `.agentyx.json` project configuration. */
65
+ declare const agentyxConfigSchema: z.ZodObject<{
66
+ $schema: z.ZodOptional<z.ZodString>;
67
+ extends: z.ZodDefault<z.ZodArray<z.ZodString>>;
68
+ profile: z.ZodDefault<z.ZodEnum<{
69
+ lean: "lean";
70
+ balanced: "balanced";
71
+ autonomous: "autonomous";
72
+ }>>;
73
+ targets: z.ZodDefault<z.ZodArray<z.ZodString>>;
74
+ }, z.core.$strict>;
75
+ /** A validated configuration, with defaults applied. */
76
+ type AgentyxConfig = z.infer<typeof agentyxConfigSchema>;
77
+ /** The shape accepted in a `.agentyx.json` file. */
78
+ type AgentyxConfigInput = z.input<typeof agentyxConfigSchema>;
79
+ //#endregion
80
+ //#region src/config/loader.d.ts
81
+ declare const AGENTYX_CONFIG_FILENAME = ".agentyx.json";
82
+ /** The absolute path `.agentyx.json` is read from for a given project. */
83
+ declare function agentyxConfigPath(projectPath?: string): string;
84
+ /**
85
+ * Validates an already-parsed configuration document.
86
+ *
87
+ * @throws {AgentyxConfigValidationError} when the document violates the schema.
88
+ */
89
+ declare function parseAgentyxConfig(value: unknown, filePath?: string): AgentyxConfig;
90
+ /**
91
+ * Reads and validates `.agentyx.json` from `projectPath`.
92
+ *
93
+ * Parent directories are not searched, and invalid configurations are never
94
+ * silently repaired.
95
+ *
96
+ * @throws {AgentyxConfigNotFoundError} when the file does not exist.
97
+ * @throws {AgentyxConfigParseError} when the file is not valid JSON.
98
+ * @throws {AgentyxConfigValidationError} when the document violates the schema.
99
+ */
100
+ declare function loadAgentyxConfig(projectPath?: string): Promise<AgentyxConfig>;
101
+ //#endregion
102
+ //#region src/mcp/schema.d.ts
103
+ declare const MCP_CAPABILITY_LEVELS: readonly ["essential", "recommended", "optional"];
104
+ declare const mcpCapabilityLevelSchema: z.ZodEnum<{
105
+ optional: "optional";
106
+ essential: "essential";
107
+ recommended: "recommended";
108
+ }>;
109
+ declare const MCP_CONTEXT_COSTS: readonly ["low", "medium", "high"];
110
+ declare const mcpContextCostSchema: z.ZodEnum<{
111
+ low: "low";
112
+ medium: "medium";
113
+ high: "high";
114
+ }>;
115
+ declare const mcpEnvReferenceSchema: z.ZodObject<{
116
+ fromEnv: z.ZodString;
117
+ }, z.core.$strict>;
118
+ declare const mcpServerReferenceSchema: z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
119
+ name: z.ZodString;
120
+ level: z.ZodDefault<z.ZodEnum<{
121
+ optional: "optional";
122
+ essential: "essential";
123
+ recommended: "recommended";
124
+ }>>;
125
+ }, z.core.$strict>]>, z.ZodTransform<{
126
+ name: string;
127
+ level: "optional" | "essential" | "recommended";
128
+ }, string | {
129
+ name: string;
130
+ level: "optional" | "essential" | "recommended";
131
+ }>>, z.ZodObject<{
132
+ name: z.ZodString;
133
+ level: z.ZodEnum<{
134
+ optional: "optional";
135
+ essential: "essential";
136
+ recommended: "recommended";
137
+ }>;
138
+ }, z.core.$strict>>;
139
+ declare const mcpServerDefinitionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
140
+ name: z.ZodString;
141
+ description: z.ZodString;
142
+ contextCost: z.ZodOptional<z.ZodEnum<{
143
+ low: "low";
144
+ medium: "medium";
145
+ high: "high";
146
+ }>>;
147
+ transport: z.ZodLiteral<"stdio">;
148
+ command: z.ZodString;
149
+ args: z.ZodDefault<z.ZodArray<z.ZodString>>;
150
+ env: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
151
+ fromEnv: z.ZodString;
152
+ }, z.core.$strict>>>;
153
+ }, z.core.$strict>, z.ZodObject<{
154
+ name: z.ZodString;
155
+ description: z.ZodString;
156
+ contextCost: z.ZodOptional<z.ZodEnum<{
157
+ low: "low";
158
+ medium: "medium";
159
+ high: "high";
160
+ }>>;
161
+ transport: z.ZodLiteral<"http">;
162
+ url: z.ZodURL;
163
+ headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
164
+ fromEnv: z.ZodString;
165
+ }, z.core.$strict>>>;
166
+ }, z.core.$strict>], "transport">;
167
+ type McpEnvReference = z.infer<typeof mcpEnvReferenceSchema>;
168
+ type McpCapabilityLevel = z.infer<typeof mcpCapabilityLevelSchema>;
169
+ type McpContextCost = z.infer<typeof mcpContextCostSchema>;
170
+ type McpServerDefinition = z.infer<typeof mcpServerDefinitionSchema>;
171
+ type McpServerDefinitionInput = z.input<typeof mcpServerDefinitionSchema>;
172
+ type McpServerReference = z.infer<typeof mcpServerReferenceSchema>;
173
+ type McpServerReferenceInput = z.input<typeof mcpServerReferenceSchema>;
174
+ //#endregion
175
+ //#region src/mcp/registry.d.ts
176
+ interface McpServerSource {
177
+ readonly name: string;
178
+ load(): McpServerDefinitionInput;
179
+ }
180
+ interface McpServerMetadata {
181
+ readonly name: string;
182
+ readonly description: string;
183
+ readonly transport: McpServerDefinition["transport"];
184
+ readonly contextCost?: McpServerDefinition["contextCost"];
185
+ }
186
+ interface McpServerRegistry {
187
+ readonly names: readonly string[];
188
+ has(name: string): boolean;
189
+ listMetadata(): readonly McpServerMetadata[];
190
+ get(name: string): McpServerDefinition;
191
+ }
192
+ declare function createMcpServerRegistry(sources: Iterable<McpServerSource>): McpServerRegistry;
193
+ //#endregion
194
+ //#region src/skill/schema.d.ts
195
+ /**
196
+ * A Skill is reusable instruction text for a coding agent. It is deliberately
197
+ * provider-independent: nothing here says how or where a provider installs it.
198
+ */
199
+ declare const skillDefinitionSchema: z.ZodObject<{
200
+ name: z.ZodString;
201
+ description: z.ZodString;
202
+ content: z.ZodString;
203
+ }, z.core.$strict>;
204
+ /** A validated skill definition. */
205
+ type SkillDefinition = z.infer<typeof skillDefinitionSchema>;
206
+ /** The shape accepted when authoring a skill definition. */
207
+ type SkillDefinitionInput = z.input<typeof skillDefinitionSchema>;
208
+ //#endregion
209
+ //#region src/skill/registry.d.ts
210
+ /**
211
+ * Where a single skill comes from. The name is known up front so that listing
212
+ * and existence checks stay cheap, and `load` is only called when something
213
+ * actually needs the instructions — a design that keeps `resolve` working on
214
+ * identifiers alone.
215
+ *
216
+ * This is also the seam an external or remote registry would plug into later.
217
+ */
218
+ interface SkillSource {
219
+ readonly name: string;
220
+ /** Produces the definition. Called at most once per registry. */
221
+ load(): SkillDefinitionInput;
222
+ }
223
+ /** A name lookup over skills, independent of where the definitions live. */
224
+ interface SkillRegistry {
225
+ /** Registered names in registration order. Never reads a skill body. */
226
+ readonly names: readonly string[];
227
+ has(name: string): boolean;
228
+ /**
229
+ * Loads, validates and caches a skill.
230
+ *
231
+ * @throws {UnknownSkillError} when the name is not registered.
232
+ * @throws {InvalidSkillError} when the source yields an invalid definition.
233
+ */
234
+ get(name: string): SkillDefinition;
235
+ }
236
+ /**
237
+ * Indexes skill sources by name.
238
+ *
239
+ * Names and duplicates are validated here; the definitions themselves are
240
+ * validated the first time each skill is loaded.
241
+ *
242
+ * @throws {DuplicateSkillError} when two sources share a name.
243
+ * @throws {InvalidSkillError} when a source name is not a valid skill name.
244
+ */
245
+ declare function createSkillRegistry(sources: Iterable<SkillSource>): SkillRegistry;
246
+ //#endregion
247
+ //#region src/stack/schema.d.ts
248
+ /**
249
+ * A stack describes a development environment that can build on other stacks
250
+ * and contribute provider-agnostic capabilities to them.
251
+ */
252
+ declare const stackDefinitionSchema: z.ZodObject<{
253
+ name: z.ZodString;
254
+ description: z.ZodOptional<z.ZodString>;
255
+ extends: z.ZodDefault<z.ZodArray<z.ZodString>>;
256
+ skills: z.ZodDefault<z.ZodArray<z.ZodString>>;
257
+ mcpServers: z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
258
+ name: z.ZodString;
259
+ level: z.ZodDefault<z.ZodEnum<{
260
+ optional: "optional";
261
+ essential: "essential";
262
+ recommended: "recommended";
263
+ }>>;
264
+ }, z.core.$strict>]>, z.ZodTransform<{
265
+ name: string;
266
+ level: "optional" | "essential" | "recommended";
267
+ }, string | {
268
+ name: string;
269
+ level: "optional" | "essential" | "recommended";
270
+ }>>, z.ZodObject<{
271
+ name: z.ZodString;
272
+ level: z.ZodEnum<{
273
+ optional: "optional";
274
+ essential: "essential";
275
+ recommended: "recommended";
276
+ }>;
277
+ }, z.core.$strict>>>>;
278
+ }, z.core.$strict>;
279
+ /** A validated stack definition, with defaults always present. */
280
+ type StackDefinition = z.infer<typeof stackDefinitionSchema>;
281
+ /** The shape accepted when authoring a stack definition. */
282
+ type StackDefinitionInput = z.input<typeof stackDefinitionSchema>;
283
+ //#endregion
284
+ //#region src/stack/registry.d.ts
285
+ /**
286
+ * A registry is a name lookup over stack definitions. Keeping it a plain map
287
+ * means the resolver stays independent of where definitions come from, so
288
+ * external registries can be added later without touching resolution.
289
+ */
290
+ type StackRegistry = ReadonlyMap<string, StackDefinition>;
291
+ /** Validates definitions and indexes them by name. */
292
+ declare function createStackRegistry(definitions: Iterable<StackDefinitionInput>): StackRegistry;
293
+ /**
294
+ * The stacks Agentyx ships with, expressed as data. Relationships live here, not
295
+ * in the resolver.
296
+ */
297
+ declare const builtInStacks: readonly StackDefinitionInput[];
298
+ /** The registry used by default when no explicit registry is supplied. */
299
+ declare const builtInStackRegistry: StackRegistry;
300
+ //#endregion
301
+ //#region src/config/resolver.d.ts
302
+ /** A project configuration with its stack inheritance expanded. */
303
+ interface ResolvedAgentyxConfig {
304
+ /** The stacks the project asked for, in configuration order. */
305
+ readonly requestedStacks: readonly string[];
306
+ /** The full inheritance chain, dependency-first and de-duplicated. */
307
+ readonly resolvedStacks: readonly string[];
308
+ /**
309
+ * Skill identifiers contributed by the resolved stacks, in resolution order.
310
+ * Identifiers only — reading the instructions is a separate, explicit step.
311
+ */
312
+ readonly skills: readonly string[];
313
+ readonly declaredMcpServers: readonly McpServerReference[];
314
+ readonly mcpServers: readonly string[];
315
+ readonly profile: AgentyxProfile;
316
+ readonly targets: readonly string[];
317
+ }
318
+ /**
319
+ * Combines a validated project configuration with stack and skill resolution.
320
+ * The input is never mutated.
321
+ *
322
+ * @throws {UnknownStackError} when a configured stack is missing.
323
+ * @throws {CircularStackDependencyError} when inheritance forms a cycle.
324
+ * @throws {UnknownSkillError} when a stack references an unknown skill.
325
+ */
326
+ declare function resolveAgentyxConfig(config: AgentyxConfig, registry?: StackRegistry, skillRegistry?: SkillRegistry, mcpRegistry?: McpServerRegistry): ResolvedAgentyxConfig;
327
+ //#endregion
328
+ //#region src/mcp/built-in.d.ts
329
+ declare const builtInMcpServerRegistry: McpServerRegistry;
330
+ declare const builtInMcpServerNames: readonly string[];
331
+ //#endregion
332
+ //#region src/mcp/errors.d.ts
333
+ declare class UnknownMcpServerError extends AgentyxError {
334
+ readonly serverName: string;
335
+ readonly requiredBy: string | undefined;
336
+ readonly knownServers: readonly string[];
337
+ constructor(serverName: string, requiredBy: string | undefined, knownServers: readonly string[]);
338
+ }
339
+ declare class DuplicateMcpServerError extends AgentyxError {
340
+ readonly serverName: string;
341
+ constructor(serverName: string);
342
+ }
343
+ declare class InvalidMcpServerError extends AgentyxError {
344
+ readonly origin: string;
345
+ readonly reason: string;
346
+ constructor(origin: string, reason: string | ZodError, options?: ErrorOptions);
347
+ }
348
+ //#endregion
349
+ //#region src/mcp/resolver.d.ts
350
+ declare function collectStackMcpServerReferences(resolvedStacks: readonly string[], stackRegistry: StackRegistry, mcpRegistry: McpServerRegistry): McpServerReference[];
351
+ declare function filterEffectiveMcpServers(servers: readonly McpServerReference[], profile: AgentyxProfile): string[];
352
+ declare function collectStackMcpServers(resolvedStacks: readonly string[], stackRegistry: StackRegistry, mcpRegistry: McpServerRegistry, profile?: AgentyxProfile): string[];
353
+ declare function resolveStackMcpServerReferences(requestedStacks: readonly string[], stackRegistry?: StackRegistry, mcpRegistry?: McpServerRegistry): McpServerReference[];
354
+ declare function resolveStackMcpServers(requestedStacks: readonly string[], stackRegistry?: StackRegistry, mcpRegistry?: McpServerRegistry, profile?: AgentyxProfile): string[];
355
+ //#endregion
356
+ //#region src/meta.d.ts
357
+ declare const agentyxCoreName = "agentyx-core";
358
+ declare function getCoreStatus(): string;
359
+ //#endregion
360
+ //#region src/optimization/profile.d.ts
361
+ interface OptimizationProfileDefinition {
362
+ readonly name: AgentyxProfile;
363
+ readonly goal: string;
364
+ readonly mcpLevels: readonly McpCapabilityLevel[];
365
+ readonly notes: readonly string[];
366
+ }
367
+ declare const optimizationProfiles: readonly OptimizationProfileDefinition[];
368
+ declare const optimizationProfileNames: readonly AgentyxProfile[];
369
+ declare function getOptimizationProfile(name: AgentyxProfile): OptimizationProfileDefinition;
370
+ declare function isMcpLevelEnabled(profile: AgentyxProfile, level: McpCapabilityLevel): boolean;
371
+ //#endregion
372
+ //#region src/project/detector.d.ts
373
+ declare const PACKAGE_MANAGERS: readonly ["pnpm", "npm", "yarn", "bun"];
374
+ type PackageManagerName = (typeof PACKAGE_MANAGERS)[number];
375
+ interface PackageManagerDetection {
376
+ readonly name: PackageManagerName | undefined;
377
+ readonly source: "lockfile" | "package-json" | undefined;
378
+ readonly lockfiles: readonly string[];
379
+ readonly ambiguous: boolean;
380
+ }
381
+ interface ProjectPackageJsonDetection {
382
+ readonly present: boolean;
383
+ readonly valid: boolean;
384
+ readonly path: string;
385
+ readonly name: string | undefined;
386
+ readonly packageManager: string | undefined;
387
+ readonly error: string | undefined;
388
+ }
389
+ interface ProjectDetection {
390
+ readonly projectDir: string;
391
+ readonly packageJson: ProjectPackageJsonDetection;
392
+ readonly packageManager: PackageManagerDetection;
393
+ readonly detectedStacks: readonly string[];
394
+ readonly recommendedStack: string | undefined;
395
+ }
396
+ declare function detectProject(projectDir: string): Promise<ProjectDetection>;
397
+ declare function buildAgentyxConfig(input: {
398
+ readonly stack: string;
399
+ readonly profile: AgentyxProfile;
400
+ readonly targets: readonly string[];
401
+ }): AgentyxConfigInput;
402
+ declare function formatAgentyxConfig(config: AgentyxConfigInput): string;
403
+ //#endregion
404
+ //#region src/skill/built-in.d.ts
405
+ /**
406
+ * The skills Agentyx ships with. The names are the directory names under
407
+ * `packages/core/skills`, and knowing them without touching the filesystem is
408
+ * what lets stack resolution validate references without reading any body.
409
+ */
410
+ declare const builtInSkillNames: readonly ["planning", "systematic-debugging", "verification", "typescript-modern", "angular-modern"];
411
+ /** The registry used by default when no explicit registry is supplied. */
412
+ declare const builtInSkillRegistry: SkillRegistry;
413
+ //#endregion
414
+ //#region src/skill/errors.d.ts
415
+ /**
416
+ * Raised when a stack references a skill the registry does not know.
417
+ *
418
+ * The offending name is exposed as `skillName`; `stack` stays the JS stack
419
+ * trace inherited from `Error`.
420
+ */
421
+ declare class UnknownSkillError extends AgentyxError {
422
+ readonly skillName: string;
423
+ /** The stack that declared the skill, when the failure came from resolution. */
424
+ readonly requiredBy: string | undefined;
425
+ readonly knownSkills: readonly string[];
426
+ constructor(skillName: string, requiredBy: string | undefined, knownSkills: readonly string[]);
427
+ }
428
+ /** Raised when a registry is built from sources that reuse a skill name. */
429
+ declare class DuplicateSkillError extends AgentyxError {
430
+ readonly skillName: string;
431
+ constructor(skillName: string);
432
+ }
433
+ /**
434
+ * Raised when a skill exists but cannot be turned into a valid definition —
435
+ * malformed `SKILL.md` frontmatter, a missing field, an unreadable file.
436
+ *
437
+ * Built-in skills ship with Agentyx, so this is a programmer error rather than
438
+ * something a user can fix in their project.
439
+ */
440
+ declare class InvalidSkillError extends AgentyxError {
441
+ /** Where the skill came from: a file path, or a label for an in-memory source. */
442
+ readonly origin: string;
443
+ readonly reason: string;
444
+ constructor(origin: string, reason: string | ZodError, options?: ErrorOptions);
445
+ }
446
+ //#endregion
447
+ //#region src/skill/markdown.d.ts
448
+ /**
449
+ * A `SKILL.md` file is a frontmatter block followed by the Markdown body:
450
+ *
451
+ * ```md
452
+ * ---
453
+ * name: planning
454
+ * description: Plan non-trivial work before editing.
455
+ * ---
456
+ *
457
+ * Instructions...
458
+ * ```
459
+ *
460
+ * The frontmatter is a deliberately small YAML subset — a flat block of
461
+ * `key: value` pairs, values optionally quoted — so that core keeps depending
462
+ * on Zod alone. Anything richer is rejected rather than guessed at.
463
+ *
464
+ * The body is preserved as written apart from trimming the blank lines around
465
+ * it, and `origin` is only used to make errors readable.
466
+ *
467
+ * @throws {InvalidSkillError} when the frontmatter or the resulting skill is invalid.
468
+ */
469
+ declare function parseSkillMarkdown(markdown: string, origin: string): SkillDefinition;
470
+ /**
471
+ * Renders a skill as canonical `SKILL.md` text — the inverse of
472
+ * `parseSkillMarkdown`, and the single representation every consumer installs.
473
+ *
474
+ * Keeping this in core is what stops a provider from owning a copy of a skill
475
+ * body: an adapter decides *where* a skill goes, never what it says.
476
+ *
477
+ * The output is deterministic. Frontmatter is always `name` then `description`,
478
+ * the body is the trimmed content, and the file ends with exactly one newline,
479
+ * so re-rendering an unchanged skill produces a byte-identical file and an
480
+ * installer can compare content instead of guessing.
481
+ *
482
+ * @throws {InvalidSkillError} when the definition is invalid, or when the
483
+ * description cannot be represented in the flat frontmatter subset the parser
484
+ * accepts.
485
+ */
486
+ declare function formatSkillMarkdown(skill: SkillDefinitionInput): string;
487
+ //#endregion
488
+ //#region src/skill/resolver.d.ts
489
+ /**
490
+ * Expands the requested stacks and returns the skills they contribute.
491
+ *
492
+ * The result follows the resolved stack order, then each stack's declaration
493
+ * order, and is de-duplicated by first occurrence. Skills do not extend other
494
+ * skills, so there is nothing further to expand.
495
+ *
496
+ * @throws {UnknownStackError} when a requested or inherited stack is missing.
497
+ * @throws {CircularStackDependencyError} when stack inheritance forms a cycle.
498
+ * @throws {UnknownSkillError} when a stack references a skill the registry lacks.
499
+ */
500
+ declare function resolveStackSkills(requestedStacks: readonly string[], stackRegistry?: StackRegistry, skillRegistry?: SkillRegistry): string[];
501
+ //#endregion
502
+ //#region src/stack/errors.d.ts
503
+ /**
504
+ * Raised when a requested or inherited stack is not present in the registry.
505
+ *
506
+ * The offending name is exposed as `stackName`; `stack` stays the JS stack
507
+ * trace inherited from `Error`.
508
+ */
509
+ declare class UnknownStackError extends AgentyxError {
510
+ readonly stackName: string;
511
+ readonly requiredBy: string | undefined;
512
+ readonly knownStacks: readonly string[];
513
+ constructor(stackName: string, requiredBy: string | undefined, knownStacks: readonly string[]);
514
+ }
515
+ /** Raised when stack inheritance forms a cycle. */
516
+ declare class CircularStackDependencyError extends AgentyxError {
517
+ /** The cycle path, starting and ending with the same stack. */
518
+ readonly cycle: readonly string[];
519
+ constructor(cycle: readonly string[]);
520
+ }
521
+ /** Raised when a registry is built from definitions that reuse a stack name. */
522
+ declare class DuplicateStackError extends AgentyxError {
523
+ readonly stackName: string;
524
+ constructor(stackName: string);
525
+ }
526
+ //#endregion
527
+ //#region src/stack/resolver.d.ts
528
+ /**
529
+ * Expands the requested stacks into the full inheritance chain.
530
+ *
531
+ * The result is dependency-first, de-duplicated and deterministic: stacks are
532
+ * visited in the order they are requested, and each stack's parents are visited
533
+ * in declaration order before the stack itself.
534
+ *
535
+ * @throws {UnknownStackError} when a requested or inherited stack is missing.
536
+ * @throws {CircularStackDependencyError} when inheritance forms a cycle.
537
+ */
538
+ declare function resolveStacks(requestedStacks: readonly string[], registry?: StackRegistry): string[];
539
+ //#endregion
540
+ export { AGENTYX_CONFIG_FILENAME, AGENTYX_CONFIG_SCHEMA_ID, AGENTYX_PROFILES, type AgentyxConfig, type AgentyxConfigInput, type AgentyxConfigIssue, AgentyxConfigNotFoundError, AgentyxConfigParseError, AgentyxConfigValidationError, AgentyxError, type AgentyxProfile, CircularStackDependencyError, DEFAULT_AGENTYX_PROFILE, DuplicateMcpServerError, DuplicateSkillError, DuplicateStackError, InvalidMcpServerError, InvalidSkillError, MCP_CAPABILITY_LEVELS, MCP_CONTEXT_COSTS, type McpCapabilityLevel, type McpContextCost, type McpEnvReference, type McpServerDefinition, type McpServerDefinitionInput, type McpServerMetadata, type McpServerReference, type McpServerReferenceInput, type McpServerRegistry, type McpServerSource, type OptimizationProfileDefinition, PACKAGE_MANAGERS, type PackageManagerDetection, type PackageManagerName, type ProjectDetection, type ProjectPackageJsonDetection, type ResolvedAgentyxConfig, type SkillDefinition, type SkillDefinitionInput, type SkillRegistry, type SkillSource, type StackDefinition, type StackDefinitionInput, type StackRegistry, UnknownMcpServerError, UnknownSkillError, UnknownStackError, agentyxConfigPath, agentyxConfigSchema, agentyxCoreName, agentyxProfileSchema, buildAgentyxConfig, buildAgentyxConfigJsonSchema, builtInMcpServerNames, builtInMcpServerRegistry, builtInSkillNames, builtInSkillRegistry, builtInStackRegistry, builtInStacks, collectStackMcpServerReferences, collectStackMcpServers, createMcpServerRegistry, createSkillRegistry, createStackRegistry, detectProject, filterEffectiveMcpServers, formatAgentyxConfig, formatSkillMarkdown, getCoreStatus, getOptimizationProfile, isMcpLevelEnabled, loadAgentyxConfig, mcpCapabilityLevelSchema, mcpContextCostSchema, mcpEnvReferenceSchema, mcpServerDefinitionSchema, mcpServerReferenceSchema, optimizationProfileNames, optimizationProfiles, parseAgentyxConfig, parseSkillMarkdown, resolveAgentyxConfig, resolveStackMcpServerReferences, resolveStackMcpServers, resolveStackSkills, resolveStacks, skillDefinitionSchema, stackDefinitionSchema };
541
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/errors.ts","../src/config/errors.ts","../src/config/json-schema.ts","../src/config/schema.ts","../src/config/loader.ts","../src/mcp/schema.ts","../src/mcp/registry.ts","../src/skill/schema.ts","../src/skill/registry.ts","../src/stack/schema.ts","../src/stack/registry.ts","../src/config/resolver.ts","../src/mcp/built-in.ts","../src/mcp/errors.ts","../src/mcp/resolver.ts","../src/meta.ts","../src/optimization/profile.ts","../src/project/detector.ts","../src/skill/built-in.ts","../src/skill/errors.ts","../src/skill/markdown.ts","../src/skill/resolver.ts","../src/stack/errors.ts","../src/stack/resolver.ts"],"mappings":";;;;;;;;;cAOa,qBAAqB;WACvB;EAEG,YAAA,cAAc,iBAAiB,UAAU;;;;;UCNtC;;WAEN;WACA;;;cAIE,mCAAmC;WACrC;EAEG,YAAA,kBAAkB,UAAU;;;cAQ7B,gCAAgC;WAClC;EAEG,YAAA,kBAAkB,gBAAgB,UAAU;;;cAQ7C,qCAAqC;WACvC,iBAAiB;;WAEjB;EAEG,YAAA,OAAO,UAAU;;;;;cClClB;;;;;;;;;iBAUG,gCAAgC;;;;cCVnC;cAEA,sBAAoB,EAAA;;;;;KAIrB,iBAAiB,EAAE,aAAa;;cAG/B,yBAAyB;;cASzB,qBAAmB,EAAA;;;;;;;;;GAc9B,EAAA,KAAA;;KAGU,gBAAgB,EAAE,aAAa;;KAG/B,qBAAqB,EAAE,aAAa;;;cCjCnC;;iBAGG,kBAAkB;;;;;;iBASlB,mBAAmB,gBAAgB,oBAAoB;;;;;;;;;;;iBAoBjD,kBACpB,uBACC,QAAQ;;;cCzCE;cAEA,0BAAwB,EAAA;;;;;cAExB;cAEA,sBAAoB,EAAA;;;;;cAUpB,uBAAqB,EAAA;;GAMhC,EAAA,KAAA;cAkBW,0BAAwB,EAAA,QAAA,EAAA,QAAA,EAAA,mBAAA,EAAA,WAAA,EAAA;;;;;;;;;;;;;;;;;;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