omp-fabric 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -60,14 +60,14 @@ import {
60
60
  expandSkillDirMarkersForRead,
61
61
  expandSkillDirMarkersInSkillBlock,
62
62
  filterPrewalkContinuationMessages,
63
- formatSkillsForPrompt,
63
+ formatSkillsSection,
64
64
  hasPrewalkArmedPrompt,
65
65
  prewalkArmedPrompt,
66
66
  repairFabricGuestCode,
67
67
  resolveFabricIdentity,
68
68
  settleInPlacePrewalk,
69
69
  streamedToolCallName
70
- } from "./chunks/chunk-DOKANNFC.js";
70
+ } from "./chunks/chunk-TLSJXU4F.js";
71
71
  import "./chunks/chunk-7VIQNUPS.js";
72
72
  import {
73
73
  AgentTranscriptReader
@@ -2175,23 +2175,35 @@ var fabricSchemaGuidance = (mode) => {
2175
2175
  };
2176
2176
 
2177
2177
  // src/core/skill-prompt.ts
2178
+ import { getActiveSkills, Settings } from "@oh-my-pi/pi-coding-agent";
2178
2179
  var OMP_SKILL_SECTION_MARKER = "<skills>";
2180
+ var OMP_SKILL_SECTION_HEADING = "# Skills & Rules\n";
2179
2181
  var OMP_SKILL_LOAD_INSTRUCTION = "Matching skill \u2192 MUST read `skill://<name>` first.";
2182
+ var OMP_CUSTOM_SKILL_LOAD_INSTRUCTION = "If a skill applies, you MUST read `skill://<name>` before proceeding.";
2180
2183
  var FABRIC_OMP_SKILL_LOAD_INSTRUCTION = "Matching skill \u2192 MUST read `skill://<name>` through `omp.read` inside `fabric_exec` first.";
2181
- var LEGACY_SKILL_LOAD_INSTRUCTION = "Use the read tool to load a skill's file when the task matches its description.";
2182
- var FABRIC_SKILL_LOAD_INSTRUCTION = "Use `omp.read` inside `fabric_exec` to load a skill's file when the task matches its description.";
2184
+ var FABRIC_CUSTOM_SKILL_LOAD_INSTRUCTION = "If a skill applies, you MUST read `skill://<name>` through `omp.read` inside `fabric_exec` before proceeding.";
2185
+ var activeSkills = () => getActiveSkills();
2186
+ var listableSkills = (skills) => {
2187
+ try {
2188
+ if (Settings.instance.get("skillful") === false) return [];
2189
+ } catch {
2190
+ return skills;
2191
+ }
2192
+ return skills;
2193
+ };
2183
2194
  var restoreSkillsForFullCodePrompt = (systemPrompt, skills) => {
2184
2195
  if (systemPrompt.includes(OMP_SKILL_SECTION_MARKER)) {
2185
- return systemPrompt.replace(
2186
- OMP_SKILL_LOAD_INSTRUCTION,
2187
- FABRIC_OMP_SKILL_LOAD_INSTRUCTION
2188
- );
2196
+ return systemPrompt.replace(OMP_SKILL_LOAD_INSTRUCTION, FABRIC_OMP_SKILL_LOAD_INSTRUCTION).replace(OMP_CUSTOM_SKILL_LOAD_INSTRUCTION, FABRIC_CUSTOM_SKILL_LOAD_INSTRUCTION);
2189
2197
  }
2190
- const section = formatSkillsForPrompt([...skills]).replace(
2191
- LEGACY_SKILL_LOAD_INSTRUCTION,
2192
- FABRIC_SKILL_LOAD_INSTRUCTION
2193
- );
2194
- return section ? `${systemPrompt}${section}` : systemPrompt;
2198
+ const section = formatSkillsSection(skills, FABRIC_OMP_SKILL_LOAD_INSTRUCTION);
2199
+ if (!section) return systemPrompt;
2200
+ const heading = systemPrompt.indexOf(OMP_SKILL_SECTION_HEADING);
2201
+ if (heading < 0) return `${systemPrompt}
2202
+
2203
+ ${section}`;
2204
+ const insertAt = heading + OMP_SKILL_SECTION_HEADING.length;
2205
+ return `${systemPrompt.slice(0, insertAt)}${section}
2206
+ ${systemPrompt.slice(insertAt)}`;
2195
2207
  };
2196
2208
 
2197
2209
  // src/core/proxy-contract.ts
@@ -2346,7 +2358,7 @@ var buildSkillReferenceGuidance = (prompt, skills) => {
2346
2358
  const body = prompt.slice(openingEnd + 2, closingTag);
2347
2359
  const invocationLines = body.split("\n").filter((line) => INVOCATION_VERB.test(line) && !NEGATED_INVOCATION.test(line));
2348
2360
  const referenced = skills.filter(
2349
- (skill) => skill.name !== active.name && skill.disableModelInvocation !== true && invocationLines.some((line) => referencesSkill(line, skill.name))
2361
+ (skill) => skill.name !== active.name && skill.hide !== true && invocationLines.some((line) => referencesSkill(line, skill.name))
2350
2362
  );
2351
2363
  if (referenced.length === 0) return void 0;
2352
2364
  const mappings = referenced.map((skill) => `- /${skill.name} -> ${JSON.stringify(skill.filePath)}`).join("\n");
@@ -5595,9 +5607,12 @@ async function ompFabric(omp) {
5595
5607
  reassertToolOwnership();
5596
5608
  const effectiveFullCodeMode = fullCodeMode || schemaMode === "enforce";
5597
5609
  if (!omp.getActiveTools().includes("fabric_exec")) return;
5598
- const skills = event.systemPromptOptions?.skills ?? [];
5610
+ const skills = activeSkills();
5599
5611
  const captureSnapshot = state.cwd ? capturePolicy() : void 0;
5600
- const systemPrompt = effectiveFullCodeMode ? restoreSkillsForFullCodePrompt(event.systemPrompt.join("\n"), skills) : event.systemPrompt.join("\n");
5612
+ const systemPrompt = effectiveFullCodeMode ? restoreSkillsForFullCodePrompt(
5613
+ event.systemPrompt.join("\n"),
5614
+ listableSkills(skills)
5615
+ ) : event.systemPrompt.join("\n");
5601
5616
  const skillReferenceGuidance = effectiveFullCodeMode ? buildSkillReferenceGuidance(event.prompt, skills) : void 0;
5602
5617
  const currentModel = context.model ? `${context.model.provider}/${context.model.id}` : void 0;
5603
5618
  const resolvedGuidance = resolveFabricModelGuidance(state.modelGuidance(), {