@agentyx/core 0.7.0 → 0.9.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/README.md +5 -1
- package/dist/index.d.mts +272 -135
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +322 -28
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -3
- package/schema/agentyx.schema.json +187 -0
- package/skills/cargo-project-verification/SKILL.md +48 -0
- package/skills/rust-filesystem-safety/SKILL.md +46 -0
- package/skills/rust-idiomatic-development/SKILL.md +46 -0
- package/skills/rust-testing-portability/SKILL.md +41 -0
- package/templates/project-context.md +9 -0
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/errors.ts","../src/issues.ts","../src/config/errors.ts","../src/config/json-schema.ts","../src/config/schema.ts","../src/config/loader.ts","../src/pack/schema.ts","../src/pack/registry.ts","../src/skill/schema.ts","../src/skill/registry.ts","../src/config/project.ts","../src/hook/schema.ts","../src/hook/registry.ts","../src/mcp/schema.ts","../src/mcp/registry.ts","../src/tool/schema.ts","../src/tool/registry.ts","../src/config/resolver.ts","../src/hook/built-in.ts","../src/hook/errors.ts","../src/hook/resolver.ts","../src/manifest/errors.ts","../src/manifest/schema.ts","../src/manifest/io.ts","../src/mcp/built-in.ts","../src/mcp/errors.ts","../src/mcp/resolver.ts","../src/meta.ts","../src/pack/errors.ts","../src/pack/resolver.ts","../src/project/signals.ts","../src/project/detector.ts","../src/project/executable.ts","../src/project/recommend.ts","../src/skill/built-in.ts","../src/skill/errors.ts","../src/skill/markdown.ts","../src/skill/resolver.ts","../src/source/errors.ts","../src/source/schema.ts","../src/source/inspection.ts","../src/source/registry.ts","../src/tool/built-in.ts","../src/tool/errors.ts","../src/tool/resolver.ts"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":["_$___project_graph_js0.ProjectGraph","_$__registry_js0.HookRegistry","_$__registry_js0.McpServerRegistry","_$__registry_js0.ToolRegistry"],"sources":["../src/errors.ts","../src/issues.ts","../src/config/errors.ts","../src/config/json-schema.ts","../src/config/schema.ts","../src/config/loader.ts","../src/project-graph.ts","../src/pack/schema.ts","../src/pack/registry.ts","../src/skill/schema.ts","../src/skill/registry.ts","../src/config/project.ts","../src/hook/schema.ts","../src/hook/registry.ts","../src/mcp/schema.ts","../src/mcp/registry.ts","../src/tool/schema.ts","../src/tool/registry.ts","../src/config/resolver.ts","../src/hook/built-in.ts","../src/hook/errors.ts","../src/hook/resolver.ts","../src/manifest/errors.ts","../src/manifest/schema.ts","../src/manifest/io.ts","../src/mcp/built-in.ts","../src/mcp/errors.ts","../src/mcp/resolver.ts","../src/meta.ts","../src/pack/errors.ts","../src/pack/resolver.ts","../src/project/signals.ts","../src/project/detector.ts","../src/project/executable.ts","../src/project/recommend.ts","../src/skill/built-in.ts","../src/skill/errors.ts","../src/skill/markdown.ts","../src/skill/resolver.ts","../src/source/errors.ts","../src/source/schema.ts","../src/source/inspection.ts","../src/source/registry.ts","../src/tool/built-in.ts","../src/tool/errors.ts","../src/tool/resolver.ts"],"mappings":";;;;;;;;;qBAOa,qBAAqB;WACvB;EAEG,YAAA,cAAc,iBAAiB,UAAU;;;;;UCPtC;;WAEN;WACA;;;;;KCDC,qBAAqB;;qBAGpB,mCAAmC;WACrC;EAEG,YAAA,kBAAkB,UAAU;;;qBAQ7B,gCAAgC;WAClC;EAEG,YAAA,kBAAkB,gBAAgB,UAAU;;;qBAQ7C,qCAAqC;WACvC,iBAAiB;;WAEjB;EAEG,YAAA,OAAO,UAAU;;qBAYlB,sCAAsC;WACxC;WACA;EAEG,YAAA,wBAAwB;;;qBAczB,iCAAiC;WACnC;EAEG,YAAA,mBAAmB,gBAAgB,UAAU;;;qBAY9C,gCAAgC;WAClC;EAEG,YAAA,cAAc,gBAAgB,UAAU;;;;;qBC/EzC;;;;;;;;;wBAWG,gCAAgC;;;;;;;qBCPnC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AwB,oBAAoB;qBAE3C,8BAA8B;qBAgB9B,4BAA4B;wBAGzB,4BACd,aAAa,SAAS,2BACrB;wBAgBa,2BACd,iBAAiB,wBACjB,WAAU,wBACT;;;qBChCU,qBAAAC;qBAEA;;;qBCjBA,yBAAyB;WAC3B;WACA;WACA;EAEG,YAAA,kBAAkB,gCAAgC;;qBAYnD,2BAA2B;WAC7B;EAEG,YAAA;;qBAOD,yBAAyB;EACxB,YAAA,gBAAgB,iBAAiB,UAAU;;;;wBCvBzC,0BACd,kCACA,cAAc,cACd,cAAc,eACb;wBAsBa,qBACd,gBAAgB,iBAChB;wBASc,0BACd,mCACA,eAAc,cACd,eAAc,eACb;wBAQa,iBACd,mCACA,eAAc,cACd,eAAc,cACd"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { access, readFile, readdir, realpath } from "node:fs/promises";
|
|
2
|
+
import { access, readFile, readdir, realpath, stat } from "node:fs/promises";
|
|
3
3
|
import { delimiter, dirname, extname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
4
4
|
import { constants, readFileSync } from "node:fs";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
@@ -96,6 +96,15 @@ var LocalSkillDirectoryError = class extends AgentyxError {
|
|
|
96
96
|
this.directory = directory;
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
|
+
/** Raised when a configured project-context path is missing or escapes the project. */
|
|
100
|
+
var ProjectContextPathError = class extends AgentyxError {
|
|
101
|
+
path;
|
|
102
|
+
constructor(path, reason, options) {
|
|
103
|
+
super("project_context_path_error", `Invalid project context path "${path}": ${reason}.`, options);
|
|
104
|
+
this.name = "ProjectContextPathError";
|
|
105
|
+
this.path = path;
|
|
106
|
+
}
|
|
107
|
+
};
|
|
99
108
|
//#endregion
|
|
100
109
|
//#region src/hook/schema.ts
|
|
101
110
|
const HOOK_ACTIVATION_LEVELS = ["default", "optional"];
|
|
@@ -280,6 +289,53 @@ const enabledCapabilityNameSchema = z.string().min(1, "Enabled capability names
|
|
|
280
289
|
* every supported platform.
|
|
281
290
|
*/
|
|
282
291
|
const skillDirectorySchema = z.string().min(1, "Skill directories must be non-empty strings.").regex(/^(?!\/)(?![A-Za-z]:)(?!.*(?:^|\/)\.\.(?:\/|$))[^\\\0]+$/, "Skill directories must be portable project-relative paths without parent traversal.");
|
|
292
|
+
const projectIdSchema = z.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, "Project ids must be lowercase kebab-case identifiers.");
|
|
293
|
+
const projectTextSchema = z.string().min(1, "Must not be blank.").refine((value) => value.trim().length > 0, "Must not be blank.").refine((value) => Array.from(value).every((character) => {
|
|
294
|
+
const codePoint = character.codePointAt(0) ?? 0;
|
|
295
|
+
return codePoint > 31 && (codePoint < 127 || codePoint > 159);
|
|
296
|
+
}), "Must be single-line text without control characters.");
|
|
297
|
+
const projectUrlSchema = z.string().url("Must be a valid URL.");
|
|
298
|
+
const projectResourceNames = z.array(projectTextSchema).refine((items) => new Set(items).size === items.length, "Entries must be unique.");
|
|
299
|
+
const projectDocsSchema = z.array(projectUrlSchema).refine((items) => new Set(items).size === items.length, "Documentation URLs must be unique.");
|
|
300
|
+
const projectOwnsSchema = z.array(projectIdSchema).refine((items) => new Set(items).size === items.length, "Ownership entries must be unique.");
|
|
301
|
+
const projectMetadataSchema = z.strictObject({
|
|
302
|
+
id: projectIdSchema.describe("Stable, human-authored project identifier in kebab-case."),
|
|
303
|
+
name: projectTextSchema.describe("Human-readable project name."),
|
|
304
|
+
description: projectTextSchema.optional().describe("Short description of this project."),
|
|
305
|
+
repository: projectUrlSchema.optional().describe("Repository URL; descriptive and never fetched."),
|
|
306
|
+
docs: projectDocsSchema.default([]).describe("Documentation URLs; descriptive only."),
|
|
307
|
+
mcp: projectResourceNames.default([]).describe("MCP server identifiers available to consult."),
|
|
308
|
+
owns: projectOwnsSchema.default([]).describe("Architectural capabilities owned by this project.")
|
|
309
|
+
});
|
|
310
|
+
const projectRelationTypeSchema = z.enum([
|
|
311
|
+
"uses",
|
|
312
|
+
"integrates",
|
|
313
|
+
"consumes",
|
|
314
|
+
"extends"
|
|
315
|
+
]);
|
|
316
|
+
const projectRelationSchema = z.strictObject({
|
|
317
|
+
id: projectIdSchema.describe("Stable identifier for the related project."),
|
|
318
|
+
name: projectTextSchema.describe("Human-readable related project name."),
|
|
319
|
+
type: projectRelationTypeSchema.describe("How the current project relates to this project."),
|
|
320
|
+
role: projectIdSchema.describe("Architectural role of the related project."),
|
|
321
|
+
repository: projectUrlSchema.optional().describe("Repository URL; descriptive and never fetched."),
|
|
322
|
+
docs: projectDocsSchema.default([]).describe("Documentation URLs; descriptive only."),
|
|
323
|
+
mcp: projectResourceNames.default([]).describe("MCP server identifiers available to consult."),
|
|
324
|
+
owns: projectOwnsSchema.default([]).describe("Architectural capabilities owned by this project."),
|
|
325
|
+
guidance: z.array(projectTextSchema).default([]).describe("Human-authored guidance for agents.")
|
|
326
|
+
});
|
|
327
|
+
const projectCommandSchema = z.strictObject({
|
|
328
|
+
command: projectTextSchema.describe("Suggested command; Agentyx never executes it."),
|
|
329
|
+
cwd: z.string().min(1).default(".").describe("Project-relative working directory.")
|
|
330
|
+
});
|
|
331
|
+
const projectContextSchema = z.strictObject({
|
|
332
|
+
commands: z.record(z.string().min(1).refine((name) => name.trim().length > 0, "Command names must not be blank."), projectCommandSchema).default({}),
|
|
333
|
+
areas: z.array(z.strictObject({
|
|
334
|
+
path: z.string().min(1),
|
|
335
|
+
purpose: projectTextSchema
|
|
336
|
+
})).default([]),
|
|
337
|
+
constraints: z.array(projectTextSchema).default([])
|
|
338
|
+
}).describe("Explicit repository-local facts for the generated project context Skill.");
|
|
283
339
|
/** The `.agentyx.json` project configuration. */
|
|
284
340
|
const agentyxConfigSchema = z.strictObject({
|
|
285
341
|
$schema: z.string().min(1, "$schema must be a non-empty string.").describe("Optional path or URL to the Agentyx JSON Schema.").optional(),
|
|
@@ -288,7 +344,45 @@ const agentyxConfigSchema = z.strictObject({
|
|
|
288
344
|
targets: z.array(agentyxTargetSchema).describe("Coding-agent providers this project targets.").default([]),
|
|
289
345
|
skillDirectories: z.array(skillDirectorySchema).describe("Project-relative roots containing local Agent Skills.").optional(),
|
|
290
346
|
localPacks: z.array(packDefinitionSchema).describe("Project-owned packs that can reference built-in or local Skills.").optional(),
|
|
291
|
-
trustedSources: z.array(trustedSourceReferenceSchema).describe("Pinned local checkouts of known external skill/plugin sources.").optional()
|
|
347
|
+
trustedSources: z.array(trustedSourceReferenceSchema).describe("Pinned local checkouts of known external skill/plugin sources.").optional(),
|
|
348
|
+
project: projectMetadataSchema.optional().describe("Identity and ownership for this project."),
|
|
349
|
+
relations: z.array(projectRelationSchema).optional().describe("Direct architectural relationships."),
|
|
350
|
+
context: projectContextSchema.optional()
|
|
351
|
+
}).superRefine((config, context) => {
|
|
352
|
+
const relations = config.relations ?? [];
|
|
353
|
+
if (relations.length > 0 && config.project === void 0) context.addIssue({
|
|
354
|
+
code: "custom",
|
|
355
|
+
path: ["project"],
|
|
356
|
+
message: "Project metadata is required when relations are configured."
|
|
357
|
+
});
|
|
358
|
+
const ids = /* @__PURE__ */ new Set();
|
|
359
|
+
for (const [index, relation] of relations.entries()) {
|
|
360
|
+
if (config.project?.id === relation.id) context.addIssue({
|
|
361
|
+
code: "custom",
|
|
362
|
+
path: [
|
|
363
|
+
"relations",
|
|
364
|
+
index,
|
|
365
|
+
"id"
|
|
366
|
+
],
|
|
367
|
+
message: "A project cannot relate to itself."
|
|
368
|
+
});
|
|
369
|
+
if (ids.has(relation.id)) context.addIssue({
|
|
370
|
+
code: "custom",
|
|
371
|
+
path: [
|
|
372
|
+
"relations",
|
|
373
|
+
index,
|
|
374
|
+
"id"
|
|
375
|
+
],
|
|
376
|
+
message: "Related project ids must be unique."
|
|
377
|
+
});
|
|
378
|
+
ids.add(relation.id);
|
|
379
|
+
}
|
|
380
|
+
const areaPaths = config.context?.areas.map((area) => area.path) ?? [];
|
|
381
|
+
if (new Set(areaPaths).size !== areaPaths.length) context.addIssue({
|
|
382
|
+
code: "custom",
|
|
383
|
+
path: ["context", "areas"],
|
|
384
|
+
message: "Area paths must be unique."
|
|
385
|
+
});
|
|
292
386
|
});
|
|
293
387
|
//#endregion
|
|
294
388
|
//#region src/config/json-schema.ts
|
|
@@ -359,6 +453,23 @@ function isFileNotFound(cause) {
|
|
|
359
453
|
return cause instanceof Error && cause.code === "ENOENT";
|
|
360
454
|
}
|
|
361
455
|
//#endregion
|
|
456
|
+
//#region src/assets.ts
|
|
457
|
+
/**
|
|
458
|
+
* Location of the non-code assets that ship with `@agentyx/core`.
|
|
459
|
+
*
|
|
460
|
+
* **This module must stay directly under `src/`.** The path is derived from
|
|
461
|
+
* `import.meta.url` rather than the working directory, and `src/assets.ts` and
|
|
462
|
+
* the bundled `dist/index.mjs` sit at the same depth below the package root, so
|
|
463
|
+
* one relative path is correct both in development and in the published
|
|
464
|
+
* package. Moving this file into a subdirectory breaks built-in skill loading;
|
|
465
|
+
* `packages/core/test/built-in-skills.test.ts` guards against that.
|
|
466
|
+
*
|
|
467
|
+
* `skills/` is listed in the package's `files`, so it is published alongside
|
|
468
|
+
* `dist/`.
|
|
469
|
+
*/
|
|
470
|
+
const BUILT_IN_SKILLS_PATH = fileURLToPath(new URL("../skills", import.meta.url));
|
|
471
|
+
const PROJECT_CONTEXT_TEMPLATE_PATH = fileURLToPath(new URL("../templates/project-context.md", import.meta.url));
|
|
472
|
+
//#endregion
|
|
362
473
|
//#region src/pack/errors.ts
|
|
363
474
|
/** Raised when a requested pack is not present in the registry. */
|
|
364
475
|
var UnknownPackError = class extends AgentyxError {
|
|
@@ -432,6 +543,17 @@ const builtInPacks = [
|
|
|
432
543
|
"typescript-modern"
|
|
433
544
|
]
|
|
434
545
|
},
|
|
546
|
+
{
|
|
547
|
+
name: "rust",
|
|
548
|
+
category: "language",
|
|
549
|
+
description: "Modern, idiomatic Rust development with safe ownership, Cargo verification, portability, and filesystem-aware engineering.",
|
|
550
|
+
skills: [
|
|
551
|
+
"rust-idiomatic-development",
|
|
552
|
+
"rust-filesystem-safety",
|
|
553
|
+
"rust-testing-portability",
|
|
554
|
+
"cargo-project-verification"
|
|
555
|
+
]
|
|
556
|
+
},
|
|
435
557
|
{
|
|
436
558
|
name: "angular",
|
|
437
559
|
category: "framework",
|
|
@@ -613,22 +735,6 @@ const builtInPacks = [
|
|
|
613
735
|
/** The registry used by default when no explicit registry is supplied. */
|
|
614
736
|
const builtInPackRegistry = createPackRegistry(builtInPacks);
|
|
615
737
|
//#endregion
|
|
616
|
-
//#region src/assets.ts
|
|
617
|
-
/**
|
|
618
|
-
* Location of the non-code assets that ship with `@agentyx/core`.
|
|
619
|
-
*
|
|
620
|
-
* **This module must stay directly under `src/`.** The path is derived from
|
|
621
|
-
* `import.meta.url` rather than the working directory, and `src/assets.ts` and
|
|
622
|
-
* the bundled `dist/index.mjs` sit at the same depth below the package root, so
|
|
623
|
-
* one relative path is correct both in development and in the published
|
|
624
|
-
* package. Moving this file into a subdirectory breaks built-in skill loading;
|
|
625
|
-
* `packages/core/test/built-in-skills.test.ts` guards against that.
|
|
626
|
-
*
|
|
627
|
-
* `skills/` is listed in the package's `files`, so it is published alongside
|
|
628
|
-
* `dist/`.
|
|
629
|
-
*/
|
|
630
|
-
const BUILT_IN_SKILLS_PATH = fileURLToPath(new URL("../skills", import.meta.url));
|
|
631
|
-
//#endregion
|
|
632
738
|
//#region src/skill/errors.ts
|
|
633
739
|
/**
|
|
634
740
|
* Raised when a pack references a skill the registry does not know.
|
|
@@ -828,6 +934,10 @@ const builtInSkillNames = [
|
|
|
828
934
|
"typescript-strict",
|
|
829
935
|
"typescript-modeling",
|
|
830
936
|
"typescript-modern",
|
|
937
|
+
"rust-idiomatic-development",
|
|
938
|
+
"rust-filesystem-safety",
|
|
939
|
+
"rust-testing-portability",
|
|
940
|
+
"cargo-project-verification",
|
|
831
941
|
"angular-modern",
|
|
832
942
|
"angular-signals",
|
|
833
943
|
"angular-architecture",
|
|
@@ -967,18 +1077,70 @@ function getTrustedSourceDefinition(source, registry = knownTrustedSourceRegistr
|
|
|
967
1077
|
async function loadAgentyxProject(projectPath = process.cwd()) {
|
|
968
1078
|
const projectDir = resolve(projectPath);
|
|
969
1079
|
const config = await loadAgentyxConfig(projectDir);
|
|
1080
|
+
await validateContextPaths(projectDir, config.context);
|
|
970
1081
|
for (const source of config.trustedSources ?? []) getTrustedSourceDefinition(source);
|
|
971
1082
|
const localSources = await loadLocalSkillSources(projectDir, config.skillDirectories ?? []);
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
1083
|
+
if (localSources.some((source) => source.name === "agentyx-project-context")) throw new DuplicateSkillError("agentyx-project-context");
|
|
1084
|
+
const generatedSources = config.project !== void 0 || config.context !== void 0 && hasContext(config.context) ? [createProjectContextSkill(config.project, config.relations ?? [], config.context)] : [];
|
|
1085
|
+
const skillRegistry = createSkillRegistry([
|
|
1086
|
+
...builtInSkillRegistry.names.map((name) => ({
|
|
1087
|
+
name,
|
|
1088
|
+
load: () => builtInSkillRegistry.get(name)
|
|
1089
|
+
})),
|
|
1090
|
+
...localSources,
|
|
1091
|
+
...generatedSources
|
|
1092
|
+
]);
|
|
976
1093
|
return {
|
|
977
1094
|
config,
|
|
978
1095
|
packRegistry: config.localPacks === void 0 ? builtInPackRegistry : createPackRegistry([...builtInPacks, ...config.localPacks]),
|
|
979
|
-
skillRegistry
|
|
1096
|
+
skillRegistry,
|
|
1097
|
+
graph: config.project === void 0 ? void 0 : {
|
|
1098
|
+
project: config.project,
|
|
1099
|
+
relations: config.relations ?? []
|
|
1100
|
+
}
|
|
1101
|
+
};
|
|
1102
|
+
}
|
|
1103
|
+
function createProjectContextSkill(project, relations, context) {
|
|
1104
|
+
return {
|
|
1105
|
+
name: "agentyx-project-context",
|
|
1106
|
+
load: () => {
|
|
1107
|
+
const template = readFileSync(PROJECT_CONTEXT_TEMPLATE_PATH, "utf8").trim();
|
|
1108
|
+
const data = JSON.stringify({
|
|
1109
|
+
project,
|
|
1110
|
+
relations,
|
|
1111
|
+
context
|
|
1112
|
+
}, null, 2);
|
|
1113
|
+
const longestFence = Math.max(0, ...Array.from(data.matchAll(/`+/g), (match) => match[0].length));
|
|
1114
|
+
const fence = "`".repeat(Math.max(3, longestFence + 1));
|
|
1115
|
+
return {
|
|
1116
|
+
name: "agentyx-project-context",
|
|
1117
|
+
description: "Repository facts and direct architectural relationships.",
|
|
1118
|
+
content: template.replace("{{PROJECT_FACTS}}", `${fence}json\n${data}\n${fence}`)
|
|
1119
|
+
};
|
|
1120
|
+
}
|
|
980
1121
|
};
|
|
981
1122
|
}
|
|
1123
|
+
function hasContext(context) {
|
|
1124
|
+
return Object.keys(context.commands).length > 0 || context.areas.length > 0 || context.constraints.length > 0;
|
|
1125
|
+
}
|
|
1126
|
+
async function validateContextPaths(projectDir, context) {
|
|
1127
|
+
if (context === void 0) return;
|
|
1128
|
+
const paths = [...Object.values(context.commands).map(({ cwd }) => cwd), ...context.areas.map(({ path }) => path)];
|
|
1129
|
+
const projectRealPath = await realpath(projectDir);
|
|
1130
|
+
for (const path of paths) {
|
|
1131
|
+
if (/^(?:\/|[A-Za-z]:)|\\|(?:^|\/)\.\.(?:\/|$)/.test(path)) throw new ProjectContextPathError(path, "it must be project-relative and cannot traverse parents");
|
|
1132
|
+
const resolvedPath = resolve(projectDir, path);
|
|
1133
|
+
let resolvedRealPath;
|
|
1134
|
+
try {
|
|
1135
|
+
resolvedRealPath = await realpath(resolvedPath);
|
|
1136
|
+
if (!(await stat(resolvedRealPath)).isDirectory()) throw new ProjectContextPathError(path, "it must name a directory");
|
|
1137
|
+
} catch (cause) {
|
|
1138
|
+
if (cause instanceof ProjectContextPathError) throw cause;
|
|
1139
|
+
throw new ProjectContextPathError(path, "it does not exist or cannot be read", cause instanceof Error ? { cause } : void 0);
|
|
1140
|
+
}
|
|
1141
|
+
if (!isInside$1(resolvedRealPath, projectRealPath)) throw new ProjectContextPathError(path, "it resolves outside the project");
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
982
1144
|
async function loadLocalSkillSources(projectDir, directories) {
|
|
983
1145
|
const projectRealPath = await realpath(projectDir);
|
|
984
1146
|
const sources = [];
|
|
@@ -1530,7 +1692,7 @@ function resolveAgentyxConfig(config, registry = builtInPackRegistry, skillRegis
|
|
|
1530
1692
|
return {
|
|
1531
1693
|
requestedPacks,
|
|
1532
1694
|
resolvedPacks,
|
|
1533
|
-
skills: collectPackSkills(resolvedPacks, registry, skillRegistry),
|
|
1695
|
+
skills: unique([...collectPackSkills(resolvedPacks, registry, skillRegistry), ...config.project !== void 0 || (config.relations?.length ?? 0) > 0 || hasProjectContext(config.context) ? ["agentyx-project-context"] : []]),
|
|
1534
1696
|
declaredMcpServers,
|
|
1535
1697
|
mcpServers: filterEffectiveMcpServers(declaredMcpServers, config.enable),
|
|
1536
1698
|
declaredTools,
|
|
@@ -1541,6 +1703,12 @@ function resolveAgentyxConfig(config, registry = builtInPackRegistry, skillRegis
|
|
|
1541
1703
|
targets: [...config.targets]
|
|
1542
1704
|
};
|
|
1543
1705
|
}
|
|
1706
|
+
function hasProjectContext(context) {
|
|
1707
|
+
return context !== void 0 && (Object.keys(context.commands).length > 0 || context.areas.length > 0 || context.constraints.length > 0);
|
|
1708
|
+
}
|
|
1709
|
+
function unique(values) {
|
|
1710
|
+
return [...new Set(values)];
|
|
1711
|
+
}
|
|
1544
1712
|
//#endregion
|
|
1545
1713
|
//#region src/manifest/errors.ts
|
|
1546
1714
|
/** Raised when `.agentyx.lock.json` is not valid JSON. */
|
|
@@ -1849,14 +2017,15 @@ async function collectProjectSignals(projectDir) {
|
|
|
1849
2017
|
const packageJsonPath = join(projectDir, "package.json");
|
|
1850
2018
|
const packageJsonResult = await readPackageJson(packageJsonPath);
|
|
1851
2019
|
const packageJson = packageJsonResult.data;
|
|
1852
|
-
const [packageManager, containers, ci, monorepo, repositorySize, tsconfig, rtkAvailable] = await Promise.all([
|
|
2020
|
+
const [packageManager, containers, ci, monorepo, repositorySize, tsconfig, rtkAvailable, rust] = await Promise.all([
|
|
1853
2021
|
detectPackageManager(projectDir, packageJson),
|
|
1854
2022
|
detectContainerFiles(projectDir),
|
|
1855
2023
|
detectCiFiles(projectDir),
|
|
1856
2024
|
detectMonorepo(projectDir, packageJson),
|
|
1857
2025
|
scanRepositorySize(projectDir),
|
|
1858
2026
|
exists(join(projectDir, "tsconfig.json")),
|
|
1859
|
-
isExecutableOnPath(builtInToolRegistry.get("rtk").command)
|
|
2027
|
+
isExecutableOnPath(builtInToolRegistry.get("rtk").command),
|
|
2028
|
+
detectRust(projectDir)
|
|
1860
2029
|
]);
|
|
1861
2030
|
return {
|
|
1862
2031
|
projectDir,
|
|
@@ -1866,6 +2035,7 @@ async function collectProjectSignals(projectDir) {
|
|
|
1866
2035
|
path: packageJsonPath,
|
|
1867
2036
|
name: getString(packageJson?.name),
|
|
1868
2037
|
packageManager: getString(packageJson?.packageManager),
|
|
2038
|
+
scripts: getStringRecord(packageJson?.scripts),
|
|
1869
2039
|
error: packageJsonResult.error
|
|
1870
2040
|
},
|
|
1871
2041
|
packageManager,
|
|
@@ -1874,6 +2044,7 @@ async function collectProjectSignals(projectDir) {
|
|
|
1874
2044
|
tsconfig
|
|
1875
2045
|
},
|
|
1876
2046
|
angular: findDependency(packageJson, "@angular/core"),
|
|
2047
|
+
rust,
|
|
1877
2048
|
testFrameworks: findAnyDependency(packageJson, TEST_FRAMEWORK_PATTERNS),
|
|
1878
2049
|
browserTesting: findAnyDependency(packageJson, BROWSER_TESTING_PATTERNS),
|
|
1879
2050
|
observability: findAnyDependency(packageJson, OBSERVABILITY_PATTERNS),
|
|
@@ -1954,6 +2125,37 @@ function findAnyDependency(packageJson, patterns) {
|
|
|
1954
2125
|
}
|
|
1955
2126
|
return matches;
|
|
1956
2127
|
}
|
|
2128
|
+
async function detectRust(projectDir) {
|
|
2129
|
+
let manifest;
|
|
2130
|
+
try {
|
|
2131
|
+
manifest = await readFile(join(projectDir, "Cargo.toml"), "utf8");
|
|
2132
|
+
} catch (cause) {
|
|
2133
|
+
if (isNotFound(cause) || isNotReadableAsFile(cause)) return {
|
|
2134
|
+
detected: false,
|
|
2135
|
+
workspace: false,
|
|
2136
|
+
cargoLock: false,
|
|
2137
|
+
toolchainFile: void 0
|
|
2138
|
+
};
|
|
2139
|
+
throw cause;
|
|
2140
|
+
}
|
|
2141
|
+
const workspace = /^\s*\[workspace\]/m.test(manifest);
|
|
2142
|
+
const detected = workspace || /^\s*\[package\]/m.test(manifest);
|
|
2143
|
+
const [cargoLock, toolchainToml, toolchain] = await Promise.all([
|
|
2144
|
+
exists(join(projectDir, "Cargo.lock")),
|
|
2145
|
+
exists(join(projectDir, "rust-toolchain.toml")),
|
|
2146
|
+
exists(join(projectDir, "rust-toolchain"))
|
|
2147
|
+
]);
|
|
2148
|
+
return {
|
|
2149
|
+
detected,
|
|
2150
|
+
workspace,
|
|
2151
|
+
cargoLock,
|
|
2152
|
+
toolchainFile: toolchainToml ? "rust-toolchain.toml" : toolchain ? "rust-toolchain" : void 0
|
|
2153
|
+
};
|
|
2154
|
+
}
|
|
2155
|
+
function isNotReadableAsFile(cause) {
|
|
2156
|
+
const code = cause instanceof Error ? cause.code : void 0;
|
|
2157
|
+
return code === "EISDIR" || code === "ENOTDIR";
|
|
2158
|
+
}
|
|
1957
2159
|
async function detectContainerFiles(projectDir) {
|
|
1958
2160
|
const [dockerfile, dockerCompose, compose] = await Promise.all([
|
|
1959
2161
|
exists(join(projectDir, "Dockerfile")),
|
|
@@ -2048,6 +2250,10 @@ function parsePackageManagerName(value) {
|
|
|
2048
2250
|
function getString(value) {
|
|
2049
2251
|
return typeof value === "string" ? value : void 0;
|
|
2050
2252
|
}
|
|
2253
|
+
function getStringRecord(value) {
|
|
2254
|
+
if (!isRecord(value)) return {};
|
|
2255
|
+
return Object.fromEntries(Object.entries(value).filter((entry) => typeof entry[1] === "string"));
|
|
2256
|
+
}
|
|
2051
2257
|
function isRecord(value) {
|
|
2052
2258
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2053
2259
|
}
|
|
@@ -2117,9 +2323,11 @@ function recommendCapabilities(signals, options = {}) {
|
|
|
2117
2323
|
}
|
|
2118
2324
|
function recommendPacks(signals) {
|
|
2119
2325
|
const packs = [];
|
|
2120
|
-
|
|
2326
|
+
const softwareReasons = [...signals.packageJson.present ? ["package.json"] : [], ...signals.rust.detected ? ["Cargo.toml"] : []];
|
|
2327
|
+
if (softwareReasons.length > 0) packs.push(packRecommendation("technical", "high", [`${softwareReasons.join(" and ")} detected — baseline engineering practices apply to any software project.`]));
|
|
2121
2328
|
const typescriptReasons = [...signals.typescript.dependency !== void 0 ? [dependencyReason("TypeScript", signals.typescript.dependency)] : [], ...signals.typescript.tsconfig ? ["tsconfig.json detected."] : []];
|
|
2122
2329
|
if (typescriptReasons.length > 0) packs.push(packRecommendation("typescript", "high", typescriptReasons));
|
|
2330
|
+
if (signals.rust.detected) packs.push(packRecommendation("rust", "high", rustReasons(signals)));
|
|
2123
2331
|
if (signals.angular !== void 0) packs.push(packRecommendation("angular", "high", [dependencyReason("@angular/core", signals.angular)]));
|
|
2124
2332
|
const testingMatches = dedupeMatches([...signals.testFrameworks, ...signals.browserTesting]);
|
|
2125
2333
|
if (testingMatches.length > 0) packs.push(packRecommendation("testing", "high", testingMatches.map((match) => dependencyReason(match.dependency, match))));
|
|
@@ -2134,6 +2342,15 @@ function recommendPacks(signals) {
|
|
|
2134
2342
|
if (signals.accessibilityTooling.length > 0) packs.push(packRecommendation("accessibility", "high", signals.accessibilityTooling.map((match) => dependencyReason(match.dependency, match))));
|
|
2135
2343
|
return packs;
|
|
2136
2344
|
}
|
|
2345
|
+
function rustReasons(signals) {
|
|
2346
|
+
const { workspace, cargoLock, toolchainFile } = signals.rust;
|
|
2347
|
+
return [
|
|
2348
|
+
"Cargo.toml detected.",
|
|
2349
|
+
...workspace ? ["Cargo workspace (workspace Cargo.toml)."] : [],
|
|
2350
|
+
...cargoLock ? ["Cargo.lock detected."] : [],
|
|
2351
|
+
...toolchainFile !== void 0 ? [`${toolchainFile} detected.`] : []
|
|
2352
|
+
];
|
|
2353
|
+
}
|
|
2137
2354
|
function recommendOptionalCapabilities(signals, activePacks, configuredPacks) {
|
|
2138
2355
|
const capabilities = [];
|
|
2139
2356
|
const playwrightMatch = signals.browserTesting.find((match) => match.dependency === "@playwright/test");
|
|
@@ -2186,6 +2403,83 @@ function dedupeMatches(matches) {
|
|
|
2186
2403
|
return result;
|
|
2187
2404
|
}
|
|
2188
2405
|
//#endregion
|
|
2406
|
+
//#region src/project-graph.ts
|
|
2407
|
+
var ProjectGraphNotConfiguredError = class extends AgentyxError {
|
|
2408
|
+
constructor() {
|
|
2409
|
+
super("project_graph_not_configured", "Project Graph requires a project object in .agentyx.json.");
|
|
2410
|
+
this.name = "ProjectGraphNotConfiguredError";
|
|
2411
|
+
}
|
|
2412
|
+
};
|
|
2413
|
+
function createProjectGraph(project, relations) {
|
|
2414
|
+
return {
|
|
2415
|
+
project,
|
|
2416
|
+
relations: [...relations]
|
|
2417
|
+
};
|
|
2418
|
+
}
|
|
2419
|
+
function renderProjectGraphText(graph) {
|
|
2420
|
+
const rows = graph.relations.map((relation, index) => {
|
|
2421
|
+
return `${index === graph.relations.length - 1 ? "└──" : "├──"} ${relation.type} [${relation.role}] → ${relation.name}`;
|
|
2422
|
+
});
|
|
2423
|
+
return [graph.project.name, ...rows].join("\n");
|
|
2424
|
+
}
|
|
2425
|
+
function renderProjectGraphJson(graph) {
|
|
2426
|
+
return `${JSON.stringify(graph, null, 2)}\n`;
|
|
2427
|
+
}
|
|
2428
|
+
function renderProjectGraphMermaid(graph) {
|
|
2429
|
+
const current = mermaidId(graph.project.id);
|
|
2430
|
+
return ["graph LR", ...graph.relations.map((relation) => ` ${current}["${mermaidText(graph.project.name)}"] -->|${mermaidText(`${relation.type}: ${relation.role}`)}| ${mermaidId(relation.id)}["${mermaidText(relation.name)}"]`)].join("\n");
|
|
2431
|
+
}
|
|
2432
|
+
function renderProjectGraphSvg(graph) {
|
|
2433
|
+
const width = 720;
|
|
2434
|
+
const rowHeight = 92;
|
|
2435
|
+
const height = Math.max(180, 100 + graph.relations.length * rowHeight);
|
|
2436
|
+
const centerX = 360;
|
|
2437
|
+
const centerY = height / 2;
|
|
2438
|
+
const svg = [
|
|
2439
|
+
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${width} ${height}" role="img" aria-labelledby="title desc">`,
|
|
2440
|
+
`<title id="title">${xml(graph.project.name)} project graph</title>`,
|
|
2441
|
+
`<desc id="desc">Direct architectural relationships from ${xml(graph.project.name)}.</desc>`,
|
|
2442
|
+
"<defs><marker id=\"arrow\" markerWidth=\"10\" markerHeight=\"8\" refX=\"9\" refY=\"4\" orient=\"auto\"><path d=\"M0,0 L10,4 L0,8 z\" fill=\"#526579\"/></marker></defs>"
|
|
2443
|
+
];
|
|
2444
|
+
graph.relations.forEach((relation, index) => {
|
|
2445
|
+
const y = 54 + index * rowHeight;
|
|
2446
|
+
const right = index % 2 === 0;
|
|
2447
|
+
const x = right ? 500 : 0;
|
|
2448
|
+
const edgeStart = right ? 488 : 232;
|
|
2449
|
+
const edgeEnd = right ? x : x + 220;
|
|
2450
|
+
svg.push(`<line x1="${edgeStart}" y1="${centerY}" x2="${edgeEnd}" y2="${y + 24}" stroke="#526579" stroke-width="2" marker-end="url(#arrow)"/>`);
|
|
2451
|
+
svg.push(`<text x="${right ? 494 : 226}" y="${Math.round((centerY + y + 24) / 2) - 7}" class="edge">${xml(truncate(`${relation.type} · ${relation.role}`, 34))}</text>`);
|
|
2452
|
+
svg.push(`<rect x="${x}" y="${y}" width="220" height="48" rx="10" class="node"/>`);
|
|
2453
|
+
svg.push(`<text x="${x + 110}" y="${y + 30}" class="label">${xml(truncate(relation.name, 22))}</text>`);
|
|
2454
|
+
});
|
|
2455
|
+
svg.push(`<rect x="232" y="${centerY - 34}" width="256" height="68" rx="14" class="current"/>`);
|
|
2456
|
+
svg.push(`<text x="${centerX}" y="${centerY + 6}" class="label">${xml(truncate(graph.project.name, 30))}</text>`);
|
|
2457
|
+
svg.push("<style>text{font-family:system-ui,sans-serif}.node{fill:#fff;stroke:#8da0b3;stroke-width:2}.current{fill:#e8f2ff;stroke:#2563a5;stroke-width:3}.label{text-anchor:middle;font-size:16px;font-weight:600;fill:#172536}.edge{text-anchor:middle;font-size:12px;fill:#34495e;paint-order:stroke;stroke:#fff;stroke-width:5px;stroke-linejoin:round}</style>");
|
|
2458
|
+
svg.push("</svg>");
|
|
2459
|
+
return `${svg.join("\n")}\n`;
|
|
2460
|
+
}
|
|
2461
|
+
function findProjectCapabilityOwners(graph, capability) {
|
|
2462
|
+
const owners = graph.relations.filter((relation) => relation.owns.includes(capability));
|
|
2463
|
+
return {
|
|
2464
|
+
capability,
|
|
2465
|
+
currentProject: graph.project.owns.includes(capability) ? graph.project : void 0,
|
|
2466
|
+
relatedProjects: owners
|
|
2467
|
+
};
|
|
2468
|
+
}
|
|
2469
|
+
function xml(value) {
|
|
2470
|
+
return value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll("\"", """).replaceAll("'", "'");
|
|
2471
|
+
}
|
|
2472
|
+
function mermaidText(value) {
|
|
2473
|
+
return value.replaceAll("&", "&").replaceAll("|", "|").replaceAll("[", "[").replaceAll("]", "]").replaceAll("\"", """).replaceAll("<", "<").replaceAll(">", ">");
|
|
2474
|
+
}
|
|
2475
|
+
function mermaidId(value) {
|
|
2476
|
+
return `node_${Array.from(value).map((char) => char.codePointAt(0)?.toString(16) ?? "0").join("")}`;
|
|
2477
|
+
}
|
|
2478
|
+
function truncate(value, limit) {
|
|
2479
|
+
const characters = Array.from(value);
|
|
2480
|
+
return characters.length > limit ? `${characters.slice(0, limit - 1).join("")}…` : value;
|
|
2481
|
+
}
|
|
2482
|
+
//#endregion
|
|
2189
2483
|
//#region src/source/inspection.ts
|
|
2190
2484
|
async function inspectTrustedSource(projectPath, reference) {
|
|
2191
2485
|
const definition = getTrustedSourceDefinition(reference);
|
|
@@ -2274,6 +2568,6 @@ function trustedSourceLoadError(sourceName, reason, cause) {
|
|
|
2274
2568
|
return new TrustedSourceLoadError(sourceName, reason, cause instanceof Error ? { cause } : void 0);
|
|
2275
2569
|
}
|
|
2276
2570
|
//#endregion
|
|
2277
|
-
export { AGENTYX_CONFIG_FILENAME, AGENTYX_CONFIG_SCHEMA_ID, AGENTYX_MANIFEST_FILENAME, AgentyxConfigNotFoundError, AgentyxConfigParseError, AgentyxConfigValidationError, AgentyxError, AgentyxManifestParseError, AgentyxManifestValidationError, CODEBASE_MEMORY_FILE_THRESHOLD, CODEBASE_MEMORY_MONOREPO_FILE_THRESHOLD, CircularPackDependencyError, DuplicateHookError, DuplicateMcpServerError, DuplicatePackError, DuplicateSkillError, DuplicateToolError, DuplicateTrustedSourceError, HOOK_ACTIVATION_LEVELS, HOOK_EVENTS, INSTALL_MANIFEST_VERSION, InvalidHookError, InvalidMcpServerError, InvalidSkillError, InvalidToolError, LocalSkillDirectoryError, MCP_CAPABILITY_LEVELS, MCP_CONTEXT_COSTS, PACKAGE_MANAGERS, PACK_CATEGORIES, RECOMMENDATION_CONFIDENCES, REPOSITORY_SCAN_ENTRY_LIMIT, TOOL_ACTIVATION_LEVELS, TrustedSourceLoadError, UnknownEnabledCapabilityError, UnknownHookError, UnknownMcpServerError, UnknownPackError, UnknownSkillError, UnknownToolError, UnknownTrustedSourceError, agentyxConfigPath, agentyxConfigSchema, agentyxCoreName, agentyxManifestPath, agentyxTargetSchema, buildAgentyxConfig, buildAgentyxConfigJsonSchema, builtInHookNames, builtInHookRegistry, builtInMcpServerNames, builtInMcpServerRegistry, builtInPackRegistry, builtInPacks, builtInSkillNames, builtInSkillRegistry, builtInToolNames, builtInToolRegistry, codexPluginManifestSchema, collectPackHookReferences, collectPackHooks, collectPackMcpServerReferences, collectPackMcpServers, collectPackToolReferences, collectProjectSignals, createHookRegistry, createMcpServerRegistry, createPackRegistry, createSkillRegistry, createToolRegistry, createTrustedSourceRegistry, detectProject, emptyInstallManifest, enabledCapabilityNameSchema, filterEffectiveHooks, filterEffectiveMcpServers, filterEffectiveTools, formatAgentyxConfig, formatInstallManifest, formatSkillMarkdown, getCoreStatus, getTrustedSourceDefinition, hashContent, hookActivationLevelSchema, hookDefinitionSchema, hookEventSchema, hookManifestEntrySchema, hookNameSchema, hookReferenceSchema, inspectTrustedSource, installManifestEntrySchema, installManifestSchema, isExecutableOnPath, knownTrustedSourceRegistry, knownTrustedSources, loadAgentyxConfig, loadAgentyxProject, loadInstallManifest, manifestEntriesByPath, mcpCapabilityLevelSchema, mcpContextCostSchema, mcpEnvReferenceSchema, mcpManifestEntrySchema, mcpServerDefinitionSchema, mcpServerReferenceSchema, packCategorySchema, packDefinitionSchema, packNameSchema, parseAgentyxConfig, parseInstallManifest, parseSkillMarkdown, recommendCapabilities, resolveAgentyxConfig, resolvePackHookReferences, resolvePackHooks, resolvePackMcpServerReferences, resolvePackMcpServers, resolvePackSkills, resolvePackToolReferences, resolvePackTools, resolvePacks, scanRepositorySize, skillDefinitionSchema, skillDirectorySchema, skillManifestEntrySchema, toolActivationLevelSchema, toolDefinitionSchema, toolNameSchema, toolReferenceSchema, trustedSourceDefinitionSchema, trustedSourceNameSchema, trustedSourcePathSchema, trustedSourceReferenceSchema, trustedSourceSkillSummarySchema };
|
|
2571
|
+
export { AGENTYX_CONFIG_FILENAME, AGENTYX_CONFIG_SCHEMA_ID, AGENTYX_MANIFEST_FILENAME, AgentyxConfigNotFoundError, AgentyxConfigParseError, AgentyxConfigValidationError, AgentyxError, AgentyxManifestParseError, AgentyxManifestValidationError, CODEBASE_MEMORY_FILE_THRESHOLD, CODEBASE_MEMORY_MONOREPO_FILE_THRESHOLD, CircularPackDependencyError, DuplicateHookError, DuplicateMcpServerError, DuplicatePackError, DuplicateSkillError, DuplicateToolError, DuplicateTrustedSourceError, HOOK_ACTIVATION_LEVELS, HOOK_EVENTS, INSTALL_MANIFEST_VERSION, InvalidHookError, InvalidMcpServerError, InvalidSkillError, InvalidToolError, LocalSkillDirectoryError, MCP_CAPABILITY_LEVELS, MCP_CONTEXT_COSTS, PACKAGE_MANAGERS, PACK_CATEGORIES, ProjectContextPathError, ProjectGraphNotConfiguredError, RECOMMENDATION_CONFIDENCES, REPOSITORY_SCAN_ENTRY_LIMIT, TOOL_ACTIVATION_LEVELS, TrustedSourceLoadError, UnknownEnabledCapabilityError, UnknownHookError, UnknownMcpServerError, UnknownPackError, UnknownSkillError, UnknownToolError, UnknownTrustedSourceError, agentyxConfigPath, agentyxConfigSchema, agentyxCoreName, agentyxManifestPath, agentyxTargetSchema, buildAgentyxConfig, buildAgentyxConfigJsonSchema, builtInHookNames, builtInHookRegistry, builtInMcpServerNames, builtInMcpServerRegistry, builtInPackRegistry, builtInPacks, builtInSkillNames, builtInSkillRegistry, builtInToolNames, builtInToolRegistry, codexPluginManifestSchema, collectPackHookReferences, collectPackHooks, collectPackMcpServerReferences, collectPackMcpServers, collectPackToolReferences, collectProjectSignals, createHookRegistry, createMcpServerRegistry, createPackRegistry, createProjectGraph, createSkillRegistry, createToolRegistry, createTrustedSourceRegistry, detectProject, emptyInstallManifest, enabledCapabilityNameSchema, filterEffectiveHooks, filterEffectiveMcpServers, filterEffectiveTools, findProjectCapabilityOwners, formatAgentyxConfig, formatInstallManifest, formatSkillMarkdown, getCoreStatus, getTrustedSourceDefinition, hashContent, hookActivationLevelSchema, hookDefinitionSchema, hookEventSchema, hookManifestEntrySchema, hookNameSchema, hookReferenceSchema, inspectTrustedSource, installManifestEntrySchema, installManifestSchema, isExecutableOnPath, knownTrustedSourceRegistry, knownTrustedSources, loadAgentyxConfig, loadAgentyxProject, loadInstallManifest, manifestEntriesByPath, mcpCapabilityLevelSchema, mcpContextCostSchema, mcpEnvReferenceSchema, mcpManifestEntrySchema, mcpServerDefinitionSchema, mcpServerReferenceSchema, packCategorySchema, packDefinitionSchema, packNameSchema, parseAgentyxConfig, parseInstallManifest, parseSkillMarkdown, projectContextSchema, projectMetadataSchema, projectRelationSchema, projectRelationTypeSchema, recommendCapabilities, renderProjectGraphJson, renderProjectGraphMermaid, renderProjectGraphSvg, renderProjectGraphText, resolveAgentyxConfig, resolvePackHookReferences, resolvePackHooks, resolvePackMcpServerReferences, resolvePackMcpServers, resolvePackSkills, resolvePackToolReferences, resolvePackTools, resolvePacks, scanRepositorySize, skillDefinitionSchema, skillDirectorySchema, skillManifestEntrySchema, toolActivationLevelSchema, toolDefinitionSchema, toolNameSchema, toolReferenceSchema, trustedSourceDefinitionSchema, trustedSourceNameSchema, trustedSourcePathSchema, trustedSourceReferenceSchema, trustedSourceSkillSummarySchema };
|
|
2278
2572
|
|
|
2279
2573
|
//# sourceMappingURL=index.mjs.map
|