oricore 1.5.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@ import {
2
2
  History,
3
3
  Usage,
4
4
  randomUUID
5
- } from "./chunk-4QYFQSAC.js";
5
+ } from "./chunk-MZNH54NB.js";
6
6
 
7
7
  // src/session/session.ts
8
8
  import fs2 from "fs";
@@ -317,4 +317,4 @@ export {
317
317
  filterMessages,
318
318
  loadSessionMessages
319
319
  };
320
- //# sourceMappingURL=chunk-OYWDQD3F.js.map
320
+ //# sourceMappingURL=chunk-XBRIUBK5.js.map
@@ -0,0 +1,8 @@
1
+ import {
2
+ History
3
+ } from "./chunk-MZNH54NB.js";
4
+ import "./chunk-D5X6YFSK.js";
5
+ export {
6
+ History
7
+ };
8
+ //# sourceMappingURL=history-FS6CASR6.js.map
package/dist/index.cjs CHANGED
@@ -32813,80 +32813,6 @@ var init_read = __esm({
32813
32813
  }
32814
32814
  });
32815
32815
 
32816
- // src/tools/tools/skill.ts
32817
- function renderAvailableSkills(skills) {
32818
- return skills.map(
32819
- (skill) => `<skill>
32820
- <name>${skill.name}</name>
32821
- <description>${skill.description}</description>
32822
- </skill>`
32823
- ).join("\n");
32824
- }
32825
- function generateDescription(skillManager) {
32826
- const skills = skillManager.getSkills();
32827
- return `Execute a skill within the main conversation
32828
- <skills_instructions>
32829
- When users ask you to perform tasks, check if any of the available skills below match the task. If a skill matches, use this tool to invoke it. Skills provide specialized knowledge and procedures for specific tasks.
32830
- </skills_instructions>
32831
- <available_skills>
32832
- ${renderAvailableSkills(skills)}
32833
- </available_skills>`;
32834
- }
32835
- function createSkillTool(opts) {
32836
- return createTool({
32837
- name: "skill",
32838
- description: generateDescription(opts.skillManager),
32839
- parameters: import_zod9.z.object({
32840
- skill: import_zod9.z.string().describe("The skill name to execute")
32841
- }),
32842
- getDescription: ({ params }) => {
32843
- return params.skill;
32844
- },
32845
- async execute({ skill }) {
32846
- const trimmed = skill.trim();
32847
- const skillName = trimmed.startsWith("/") ? trimmed.substring(1) : trimmed;
32848
- const foundSkill = opts.skillManager.getSkill(skillName);
32849
- if (!foundSkill) {
32850
- return {
32851
- isError: true,
32852
- llmContent: `Skill "${skillName}" not found`
32853
- };
32854
- }
32855
- const body = await opts.skillManager.readSkillBody(foundSkill);
32856
- const baseDir = import_pathe13.default.dirname(foundSkill.path);
32857
- const messages = [
32858
- {
32859
- type: "text",
32860
- text: `<command-message>${skillName} is running\u2026</command-message>
32861
- <command-name>${skillName}</command-name>`
32862
- },
32863
- {
32864
- type: "text",
32865
- text: `Base directory for this skill: ${baseDir}
32866
-
32867
- ${body}`,
32868
- isMeta: true
32869
- }
32870
- ];
32871
- return {
32872
- llmContent: safeStringify(messages),
32873
- returnDisplay: `Loaded skill: ${foundSkill.name}`
32874
- };
32875
- },
32876
- approval: { category: "read" }
32877
- });
32878
- }
32879
- var import_pathe13, import_zod9;
32880
- var init_skill = __esm({
32881
- "src/tools/tools/skill.ts"() {
32882
- "use strict";
32883
- import_pathe13 = __toESM(require("pathe"), 1);
32884
- import_zod9 = require("zod");
32885
- init_tool();
32886
- init_safeStringify();
32887
- }
32888
- });
32889
-
32890
32816
  // src/tools/tools/task.ts
32891
32817
  function createTaskTool(opts) {
32892
32818
  const { signal, sessionId } = opts;
@@ -32953,11 +32879,11 @@ Since the user is greeting, use the greeting-responder agent to respond with a f
32953
32879
  assistant: "I'm going to use the ${"task" /* TASK */} tool to launch the with the greeting-responder agent"
32954
32880
  </example>
32955
32881
  `,
32956
- parameters: import_zod10.z.object({
32957
- description: import_zod10.z.string().describe("A short (3-5 word) description of task"),
32958
- prompt: import_zod10.z.string().describe("The task for the agent to perform"),
32959
- subagent_type: import_zod10.z.string().describe("The type of specialized agent to use for this task"),
32960
- resume: import_zod10.z.string().optional().describe(
32882
+ parameters: import_zod9.z.object({
32883
+ description: import_zod9.z.string().describe("A short (3-5 word) description of task"),
32884
+ prompt: import_zod9.z.string().describe("The task for the agent to perform"),
32885
+ subagent_type: import_zod9.z.string().describe("The type of specialized agent to use for this task"),
32886
+ resume: import_zod9.z.string().optional().describe(
32961
32887
  "Optional agent ID to resume from. If provided, the agent will continue from the previous execution transcript."
32962
32888
  )
32963
32889
  }),
@@ -33128,17 +33054,135 @@ Agent ID: ${result.agentId}`,
33128
33054
  approval: { category: "read" }
33129
33055
  });
33130
33056
  }
33131
- var import_zod10;
33057
+ var import_zod9;
33132
33058
  var init_task = __esm({
33133
33059
  "src/tools/tools/task.ts"() {
33134
33060
  "use strict";
33135
- import_zod10 = require("zod");
33061
+ import_zod9 = require("zod");
33136
33062
  init_constants();
33137
33063
  init_tool();
33138
33064
  init_randomUUID();
33139
33065
  }
33140
33066
  });
33141
33067
 
33068
+ // src/tools/tools/skill.ts
33069
+ function renderAvailableSkills(skills) {
33070
+ return skills.filter((skill) => skill.modelInvocable !== false).map(
33071
+ (skill) => `<skill>
33072
+ <name>${skill.name}</name>
33073
+ <description>${skill.description}</description>
33074
+ </skill>`
33075
+ ).join("\n");
33076
+ }
33077
+ function generateDescription(skillManager) {
33078
+ const skills = skillManager.getSkills({ modelInvocable: true });
33079
+ return `Execute a skill within the main conversation
33080
+ <skills_instructions>
33081
+ When users ask you to perform tasks, check if any of the available skills below match the task. If a skill matches, use this tool to invoke it. Skills provide specialized knowledge and procedures for specific tasks.
33082
+ </skills_instructions>
33083
+ <available_skills>
33084
+ ${renderAvailableSkills(skills)}
33085
+ </available_skills>`;
33086
+ }
33087
+ function createSkillTool(opts) {
33088
+ const { skillManager, context, tools, sessionId, signal } = opts;
33089
+ return createTool({
33090
+ name: "skill",
33091
+ description: generateDescription(skillManager),
33092
+ parameters: import_zod10.z.object({
33093
+ skill: import_zod10.z.string().describe("The skill name to execute"),
33094
+ args: import_zod10.z.string().optional().describe("Optional arguments to pass to the skill")
33095
+ }),
33096
+ getDescription: ({ params }) => {
33097
+ return params.args ? `${params.skill} ${params.args}` : params.skill;
33098
+ },
33099
+ async execute({ skill, args }) {
33100
+ const trimmed = skill.trim();
33101
+ const skillName = trimmed.startsWith("/") ? trimmed.substring(1) : trimmed;
33102
+ const foundSkill = skillManager.getSkill(skillName);
33103
+ if (!foundSkill) {
33104
+ return {
33105
+ isError: true,
33106
+ llmContent: `Skill "${skillName}" not found`
33107
+ };
33108
+ }
33109
+ if (foundSkill.modelInvocable === false) {
33110
+ return {
33111
+ isError: true,
33112
+ llmContent: `Skill "${skillName}" cannot be invoked by the model`
33113
+ };
33114
+ }
33115
+ const skillArgs = args || "";
33116
+ const body = await skillManager.readSkillBody(foundSkill, skillArgs);
33117
+ const baseDir = import_pathe13.default.dirname(foundSkill.path);
33118
+ if (foundSkill.context === "fork") {
33119
+ if (!context.agentManager) {
33120
+ return {
33121
+ isError: true,
33122
+ llmContent: `Skill "${skillName}" requires fork execution but agent manager is not available`
33123
+ };
33124
+ }
33125
+ const allowedTools = foundSkill.allowedTools;
33126
+ const filteredTools = allowedTools ? tools.filter(
33127
+ (t) => t.name !== "skill" && allowedTools.some(
33128
+ (allowed) => allowed.toLowerCase() === t.name.toLowerCase()
33129
+ )
33130
+ ) : tools.filter((t) => t.name !== "skill");
33131
+ const taskTool = createTaskTool({
33132
+ context,
33133
+ tools: filteredTools,
33134
+ sessionId,
33135
+ signal
33136
+ });
33137
+ const agentType = foundSkill.agent || "general-purpose";
33138
+ const prompt = `Base directory for this skill: ${baseDir}
33139
+
33140
+ ${body}`;
33141
+ const toolCallId = `skill-${skillName}-${randomUUID()}`;
33142
+ return taskTool.execute(
33143
+ {
33144
+ description: `Execute skill: ${skillName}`,
33145
+ prompt,
33146
+ subagent_type: agentType
33147
+ },
33148
+ toolCallId
33149
+ );
33150
+ }
33151
+ const messages = [
33152
+ {
33153
+ type: "text",
33154
+ text: `<command-message>${skillName} is running\u2026</command-message>
33155
+ <command-name>${skillName}</command-name>`
33156
+ },
33157
+ {
33158
+ type: "text",
33159
+ text: `Base directory for this skill: ${baseDir}
33160
+
33161
+ ${body}`,
33162
+ isMeta: true
33163
+ }
33164
+ ];
33165
+ return {
33166
+ llmContent: safeStringify(messages),
33167
+ returnDisplay: `Loaded skill: ${foundSkill.name}`
33168
+ };
33169
+ },
33170
+ approval: { category: "read" }
33171
+ });
33172
+ }
33173
+ var import_pathe13, import_zod10;
33174
+ var init_skill = __esm({
33175
+ "src/tools/tools/skill.ts"() {
33176
+ "use strict";
33177
+ import_pathe13 = __toESM(require("pathe"), 1);
33178
+ import_zod10 = require("zod");
33179
+ init_tool();
33180
+ init_safeStringify();
33181
+ init_task();
33182
+ init_randomUUID();
33183
+ }
33184
+ });
33185
+
33142
33186
  // src/tools/tools/todo.ts
33143
33187
  async function loadTodosFromFile(filePath) {
33144
33188
  if (!import_fs13.default.existsSync(filePath)) return [];
@@ -33481,8 +33525,7 @@ async function resolveTools(opts) {
33481
33525
  createLSTool({ cwd }),
33482
33526
  createGlobTool({ cwd }),
33483
33527
  createGrepTool({ cwd }),
33484
- createFetchTool({ model, fetch: opts.context.fetch }),
33485
- ...hasSkills ? [createSkillTool({ skillManager: opts.context.skillManager })] : []
33528
+ createFetchTool({ model, fetch: opts.context.fetch })
33486
33529
  ];
33487
33530
  const askUserQuestionTools = opts.askUserQuestion ? [createAskUserQuestionTool()] : [];
33488
33531
  const writeTools = opts.write ? [
@@ -33510,7 +33553,7 @@ async function resolveTools(opts) {
33510
33553
  })
33511
33554
  ] : [];
33512
33555
  const mcpTools = await getMcpTools(opts.context);
33513
- const allTools = [
33556
+ let allTools = [
33514
33557
  ...readonlyTools,
33515
33558
  ...askUserQuestionTools,
33516
33559
  ...writeTools,
@@ -33518,6 +33561,16 @@ async function resolveTools(opts) {
33518
33561
  ...backgroundTools,
33519
33562
  ...mcpTools
33520
33563
  ];
33564
+ if (hasSkills) {
33565
+ const skillTool = createSkillTool({
33566
+ skillManager: opts.context.skillManager,
33567
+ context: opts.context,
33568
+ tools: allTools,
33569
+ sessionId: opts.sessionId,
33570
+ signal: opts.signal
33571
+ });
33572
+ allTools = [...allTools, skillTool];
33573
+ }
33521
33574
  let availableTools = allTools;
33522
33575
  try {
33523
33576
  availableTools = await opts.context.apply({
@@ -34047,6 +34100,9 @@ __export(index_exports, {
34047
34100
  Usage: () => Usage,
34048
34101
  brainstormMode: () => brainstormMode,
34049
34102
  builtinModes: () => builtinModes,
34103
+ bundledSkillRegistry: () => bundledSkillRegistry,
34104
+ bundledSkillToMetadata: () => bundledSkillToMetadata,
34105
+ createBundledSkill: () => createBundledSkill,
34050
34106
  createEngine: () => createEngine,
34051
34107
  debugMode: () => debugMode,
34052
34108
  defaultMode: () => defaultMode,
@@ -34058,6 +34114,7 @@ __export(index_exports, {
34058
34114
  planMode: () => planMode,
34059
34115
  randomUUID: () => randomUUID,
34060
34116
  registerBuiltinModes: () => registerBuiltinModes,
34117
+ registerBundledSkill: () => registerBundledSkill,
34061
34118
  reviewMode: () => reviewMode
34062
34119
  });
34063
34120
  module.exports = __toCommonJS(index_exports);
@@ -36520,6 +36577,116 @@ var import_fs23 = __toESM(require("fs"), 1);
36520
36577
  var import_os9 = __toESM(require("os"), 1);
36521
36578
  var import_pathe26 = __toESM(require("pathe"), 1);
36522
36579
  init_plugin();
36580
+
36581
+ // src/skill/bundled.ts
36582
+ var BundledSkillRegistry = class {
36583
+ skills = /* @__PURE__ */ new Map();
36584
+ aliases = /* @__PURE__ */ new Map();
36585
+ /**
36586
+ * Register a bundled skill.
36587
+ * @param definition The skill definition
36588
+ */
36589
+ register(definition) {
36590
+ if (!definition.name) {
36591
+ throw new Error("Bundled skill must have a name");
36592
+ }
36593
+ if (!definition.description) {
36594
+ throw new Error("Bundled skill must have a description");
36595
+ }
36596
+ if (!definition.getPrompt) {
36597
+ throw new Error("Bundled skill must have a getPrompt function");
36598
+ }
36599
+ this.skills.set(definition.name, definition);
36600
+ if (definition.aliases) {
36601
+ for (const alias of definition.aliases) {
36602
+ this.aliases.set(alias, definition.name);
36603
+ }
36604
+ }
36605
+ }
36606
+ /**
36607
+ * Get a bundled skill by name or alias.
36608
+ * @param name Skill name or alias
36609
+ * @returns The skill definition or undefined if not found
36610
+ */
36611
+ get(name) {
36612
+ const skill = this.skills.get(name);
36613
+ if (skill) return skill;
36614
+ const aliasedName = this.aliases.get(name);
36615
+ if (aliasedName) {
36616
+ return this.skills.get(aliasedName);
36617
+ }
36618
+ return void 0;
36619
+ }
36620
+ /**
36621
+ * Get all registered bundled skills.
36622
+ * @param context Optional context to filter by isEnabled
36623
+ * @returns Array of skill definitions
36624
+ */
36625
+ getAll(context) {
36626
+ return Array.from(this.skills.values()).filter((skill) => {
36627
+ if (skill.isEnabled === void 0) return true;
36628
+ if (typeof skill.isEnabled === "boolean") return skill.isEnabled;
36629
+ if (typeof skill.isEnabled === "function" && context) {
36630
+ return skill.isEnabled(context);
36631
+ }
36632
+ return true;
36633
+ });
36634
+ }
36635
+ /**
36636
+ * Check if a skill is registered.
36637
+ * @param name Skill name or alias
36638
+ */
36639
+ has(name) {
36640
+ return this.skills.has(name) || this.aliases.has(name);
36641
+ }
36642
+ /**
36643
+ * Unregister a skill.
36644
+ * @param name Skill name
36645
+ */
36646
+ unregister(name) {
36647
+ const skill = this.skills.get(name);
36648
+ if (skill && skill.aliases) {
36649
+ for (const alias of skill.aliases) {
36650
+ this.aliases.delete(alias);
36651
+ }
36652
+ }
36653
+ this.skills.delete(name);
36654
+ }
36655
+ /**
36656
+ * Clear all registered skills.
36657
+ */
36658
+ clear() {
36659
+ this.skills.clear();
36660
+ this.aliases.clear();
36661
+ }
36662
+ };
36663
+ var bundledSkillRegistry = new BundledSkillRegistry();
36664
+ function bundledSkillToMetadata(definition, source = "builtin") {
36665
+ return {
36666
+ name: definition.name,
36667
+ description: definition.description,
36668
+ path: `bundled://${definition.name}`,
36669
+ source,
36670
+ allowedTools: definition.allowedTools,
36671
+ context: definition.context,
36672
+ agent: definition.agent,
36673
+ userInvocable: definition.userInvocable ?? true,
36674
+ modelInvocable: definition.modelInvocable ?? true
36675
+ // Note: bundled skills don't support 'paths' conditional activation
36676
+ };
36677
+ }
36678
+ function createBundledSkill(config) {
36679
+ return {
36680
+ ...config,
36681
+ getPrompt: typeof config.prompt === "string" ? () => config.prompt : config.prompt
36682
+ };
36683
+ }
36684
+ function registerBundledSkill(config) {
36685
+ const skill = createBundledSkill(config);
36686
+ bundledSkillRegistry.register(skill);
36687
+ }
36688
+
36689
+ // src/skill/skill.ts
36523
36690
  function isDirOrSymlinkToDir(parentDir, entry) {
36524
36691
  if (entry.isDirectory()) return true;
36525
36692
  if (entry.isSymbolicLink()) {
@@ -36536,6 +36703,7 @@ var SkillSource = /* @__PURE__ */ ((SkillSource2) => {
36536
36703
  SkillSource2["Global"] = "global";
36537
36704
  SkillSource2["ProjectClaude"] = "project-claude";
36538
36705
  SkillSource2["Project"] = "project";
36706
+ SkillSource2["Builtin"] = "builtin";
36539
36707
  return SkillSource2;
36540
36708
  })(SkillSource || {});
36541
36709
  var MAX_NAME_LENGTH2 = 64;
@@ -36545,21 +36713,119 @@ var SkillManager = class {
36545
36713
  errors = [];
36546
36714
  paths;
36547
36715
  context;
36716
+ /**
36717
+ * Tracks which skills are currently "active" based on file operations.
36718
+ * Skills with `paths` frontmatter are activated when matching files are accessed.
36719
+ */
36720
+ activeSkillNames = /* @__PURE__ */ new Set();
36721
+ /**
36722
+ * Maps alias names to original skill names for bundled skills.
36723
+ */
36724
+ aliasMap = /* @__PURE__ */ new Map();
36548
36725
  constructor(opts) {
36549
36726
  this.context = opts.context;
36550
36727
  this.paths = opts.context.paths;
36551
36728
  }
36552
- getSkills() {
36553
- return Array.from(this.skillsMap.values());
36729
+ /**
36730
+ * Get all loaded skills.
36731
+ * @param options Filter options
36732
+ * @returns Array of skill metadata
36733
+ */
36734
+ getSkills(options) {
36735
+ let skills = Array.from(this.skillsMap.values());
36736
+ if (options?.userInvocable !== void 0) {
36737
+ skills = skills.filter(
36738
+ (s) => (s.userInvocable ?? true) === options.userInvocable
36739
+ );
36740
+ }
36741
+ if (options?.modelInvocable !== void 0) {
36742
+ skills = skills.filter(
36743
+ (s) => (s.modelInvocable ?? true) === options.modelInvocable
36744
+ );
36745
+ }
36746
+ if (options?.activeOnly) {
36747
+ skills = skills.filter((s) => this.activeSkillNames.has(s.name));
36748
+ }
36749
+ return skills;
36554
36750
  }
36751
+ /**
36752
+ * Get a specific skill by name.
36753
+ * Automatically resolves aliases to the original skill.
36754
+ * @param name Skill name or alias
36755
+ * @returns Skill metadata or undefined if not found
36756
+ */
36555
36757
  getSkill(name) {
36556
- return this.skillsMap.get(name);
36758
+ const skill = this.skillsMap.get(name);
36759
+ if (skill) return skill;
36760
+ const originalName = this.aliasMap.get(name);
36761
+ if (originalName) {
36762
+ return this.skillsMap.get(originalName);
36763
+ }
36764
+ return void 0;
36765
+ }
36766
+ /**
36767
+ * Check if a skill is active (has matching paths for current context).
36768
+ * @param name Skill name
36769
+ */
36770
+ isSkillActive(name) {
36771
+ return this.activeSkillNames.has(name);
36772
+ }
36773
+ /**
36774
+ * Activate skills based on file paths.
36775
+ * Skills with `paths` frontmatter that match the given paths will be activated.
36776
+ * @param filePaths Array of file paths to check
36777
+ * @returns Array of newly activated skill names
36778
+ */
36779
+ activateSkillsForPaths(filePaths) {
36780
+ const newlyActivated = [];
36781
+ const minimatch = require("minimatch");
36782
+ for (const [name, skill] of this.skillsMap) {
36783
+ if (skill.paths && skill.paths.length > 0) {
36784
+ const isMatch = skill.paths.some(
36785
+ (pattern) => filePaths.some((filePath) => minimatch(filePath, pattern))
36786
+ );
36787
+ if (isMatch && !this.activeSkillNames.has(name)) {
36788
+ this.activeSkillNames.add(name);
36789
+ newlyActivated.push(name);
36790
+ }
36791
+ }
36792
+ }
36793
+ return newlyActivated;
36794
+ }
36795
+ /**
36796
+ * Clear all active skill activations.
36797
+ * Useful when switching contexts or projects.
36798
+ */
36799
+ clearActiveSkills() {
36800
+ this.activeSkillNames.clear();
36801
+ }
36802
+ /**
36803
+ * Get all skills that have path-based conditional activation.
36804
+ * @returns Array of skills with paths defined
36805
+ */
36806
+ getConditionalSkills() {
36807
+ return Array.from(this.skillsMap.values()).filter(
36808
+ (s) => s.paths && s.paths.length > 0
36809
+ );
36557
36810
  }
36558
36811
  getErrors() {
36559
36812
  return this.errors;
36560
36813
  }
36561
- async readSkillBody(skill) {
36814
+ /**
36815
+ * Read the body content of a skill.
36816
+ * For file-based skills, reads from disk.
36817
+ * For bundled skills, generates content via getPrompt.
36818
+ */
36819
+ async readSkillBody(skill, args = "") {
36562
36820
  try {
36821
+ if (skill.path.startsWith("bundled://")) {
36822
+ const bundledName = skill.path.replace("bundled://", "");
36823
+ const bundledSkill = bundledSkillRegistry.get(bundledName);
36824
+ if (!bundledSkill) {
36825
+ throw new Error(`Bundled skill "${bundledName}" not found in registry`);
36826
+ }
36827
+ return await bundledSkill.getPrompt(args, this.context);
36828
+ }
36563
36829
  const content = import_fs23.default.readFileSync(skill.path, "utf-8");
36564
36830
  const { body } = safeFrontMatter(content, skill.path);
36565
36831
  return body;
@@ -36568,9 +36834,26 @@ var SkillManager = class {
36568
36834
  throw new Error(`Failed to read skill ${skill.name}: ${message}`);
36569
36835
  }
36570
36836
  }
36837
+ /**
36838
+ * Get a bundled skill definition by name.
36839
+ * @param name Bundled skill name
36840
+ * @returns Bundled skill definition or undefined if not found
36841
+ */
36842
+ getBundledSkill(name) {
36843
+ return bundledSkillRegistry.get(name);
36844
+ }
36845
+ /**
36846
+ * Register a bundled skill programmatically.
36847
+ * @param definition Bundled skill definition
36848
+ */
36849
+ registerBundledSkill(definition) {
36850
+ bundledSkillRegistry.register(definition);
36851
+ this.loadBuiltinSkills();
36852
+ }
36571
36853
  async loadSkills() {
36572
36854
  this.skillsMap.clear();
36573
36855
  this.errors = [];
36856
+ this.loadBuiltinSkills();
36574
36857
  const pluginSkills = await this.context.apply({
36575
36858
  hook: "skill",
36576
36859
  args: [],
@@ -36613,6 +36896,22 @@ var SkillManager = class {
36613
36896
  const projectDir = import_pathe26.default.join(this.paths.projectConfigDir, "skills");
36614
36897
  this.loadSkillsFromDirectory(projectDir, "project" /* Project */);
36615
36898
  }
36899
+ /**
36900
+ * Load builtin/bundled skills from the registry.
36901
+ */
36902
+ loadBuiltinSkills() {
36903
+ this.aliasMap.clear();
36904
+ const bundledSkills = bundledSkillRegistry.getAll(this.context);
36905
+ for (const skill of bundledSkills) {
36906
+ const metadata = bundledSkillToMetadata(skill, "builtin" /* Builtin */);
36907
+ this.skillsMap.set(skill.name, metadata);
36908
+ if (skill.aliases) {
36909
+ for (const alias of skill.aliases) {
36910
+ this.aliasMap.set(alias, skill.name);
36911
+ }
36912
+ }
36913
+ }
36914
+ }
36616
36915
  loadSkillsFromDirectory(skillsDir, source) {
36617
36916
  if (!import_fs23.default.existsSync(skillsDir)) {
36618
36917
  return;
@@ -36688,10 +36987,19 @@ var SkillManager = class {
36688
36987
  });
36689
36988
  return null;
36690
36989
  }
36990
+ const allowedTools = this.parseStringArrayField(attributes.allowedTools);
36991
+ const context = attributes.context === "inline" || attributes.context === "fork" ? attributes.context : void 0;
36992
+ const paths = this.parseStringArrayField(attributes.paths);
36691
36993
  return {
36692
36994
  name: attributes.name,
36693
36995
  description: attributes.description,
36694
- path: skillPath
36996
+ path: skillPath,
36997
+ allowedTools,
36998
+ context,
36999
+ agent: attributes.agent,
37000
+ paths,
37001
+ userInvocable: attributes.userInvocable ?? true,
37002
+ modelInvocable: attributes.modelInvocable ?? true
36695
37003
  };
36696
37004
  } catch (error) {
36697
37005
  this.errors.push({
@@ -36701,6 +37009,21 @@ var SkillManager = class {
36701
37009
  return null;
36702
37010
  }
36703
37011
  }
37012
+ /**
37013
+ * Parse a field that can be either a comma-separated string or an array of strings.
37014
+ * @param value The value to parse
37015
+ * @returns Array of strings or undefined if empty
37016
+ */
37017
+ parseStringArrayField(value) {
37018
+ if (!value) return void 0;
37019
+ if (Array.isArray(value)) {
37020
+ return value.map((item) => item.trim()).filter((item) => item.length > 0);
37021
+ }
37022
+ if (typeof value === "string") {
37023
+ return value.split(",").map((item) => item.trim()).filter((item) => item.length > 0);
37024
+ }
37025
+ return void 0;
37026
+ }
36704
37027
  async addSkill(source, options = {}) {
36705
37028
  const {
36706
37029
  global: isGlobal = false,
@@ -38313,6 +38636,9 @@ var ENGINE_VERSION = "1.0.0";
38313
38636
  Usage,
38314
38637
  brainstormMode,
38315
38638
  builtinModes,
38639
+ bundledSkillRegistry,
38640
+ bundledSkillToMetadata,
38641
+ createBundledSkill,
38316
38642
  createEngine,
38317
38643
  debugMode,
38318
38644
  defaultMode,
@@ -38324,6 +38650,7 @@ var ENGINE_VERSION = "1.0.0";
38324
38650
  planMode,
38325
38651
  randomUUID,
38326
38652
  registerBuiltinModes,
38653
+ registerBundledSkill,
38327
38654
  reviewMode
38328
38655
  });
38329
38656
  /*! Bundled license information: