@percena/weft 0.4.0-next.0 → 0.4.0-next.10

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.
Files changed (114) hide show
  1. package/dist/action-bridge.cjs +323 -0
  2. package/dist/action-bridge.d.cts +8 -0
  3. package/dist/action-bridge.d.ts +8 -0
  4. package/dist/action-bridge.js +291 -0
  5. package/dist/chat.cjs +3851 -36
  6. package/dist/chat.d.cts +1 -874
  7. package/dist/chat.d.ts +1 -874
  8. package/dist/chat.js +3870 -36
  9. package/dist/index.cjs +12085 -1488
  10. package/dist/index.d.cts +553 -240
  11. package/dist/index.d.ts +553 -240
  12. package/dist/index.js +12118 -1447
  13. package/dist/providers-flitro.cjs +50 -307
  14. package/dist/providers-flitro.d.cts +75 -52
  15. package/dist/providers-flitro.d.ts +75 -52
  16. package/dist/providers-flitro.js +45 -287
  17. package/dist/styles/fonts/KaTeX_AMS-Regular.ttf +0 -0
  18. package/dist/styles/fonts/KaTeX_AMS-Regular.woff +0 -0
  19. package/dist/styles/fonts/KaTeX_AMS-Regular.woff2 +0 -0
  20. package/dist/styles/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
  21. package/dist/styles/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
  22. package/dist/styles/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
  23. package/dist/styles/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
  24. package/dist/styles/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
  25. package/dist/styles/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
  26. package/dist/styles/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
  27. package/dist/styles/fonts/KaTeX_Fraktur-Bold.woff +0 -0
  28. package/dist/styles/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
  29. package/dist/styles/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
  30. package/dist/styles/fonts/KaTeX_Fraktur-Regular.woff +0 -0
  31. package/dist/styles/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
  32. package/dist/styles/fonts/KaTeX_Main-Bold.ttf +0 -0
  33. package/dist/styles/fonts/KaTeX_Main-Bold.woff +0 -0
  34. package/dist/styles/fonts/KaTeX_Main-Bold.woff2 +0 -0
  35. package/dist/styles/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
  36. package/dist/styles/fonts/KaTeX_Main-BoldItalic.woff +0 -0
  37. package/dist/styles/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
  38. package/dist/styles/fonts/KaTeX_Main-Italic.ttf +0 -0
  39. package/dist/styles/fonts/KaTeX_Main-Italic.woff +0 -0
  40. package/dist/styles/fonts/KaTeX_Main-Italic.woff2 +0 -0
  41. package/dist/styles/fonts/KaTeX_Main-Regular.ttf +0 -0
  42. package/dist/styles/fonts/KaTeX_Main-Regular.woff +0 -0
  43. package/dist/styles/fonts/KaTeX_Main-Regular.woff2 +0 -0
  44. package/dist/styles/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
  45. package/dist/styles/fonts/KaTeX_Math-BoldItalic.woff +0 -0
  46. package/dist/styles/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
  47. package/dist/styles/fonts/KaTeX_Math-Italic.ttf +0 -0
  48. package/dist/styles/fonts/KaTeX_Math-Italic.woff +0 -0
  49. package/dist/styles/fonts/KaTeX_Math-Italic.woff2 +0 -0
  50. package/dist/styles/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
  51. package/dist/styles/fonts/KaTeX_SansSerif-Bold.woff +0 -0
  52. package/dist/styles/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
  53. package/dist/styles/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
  54. package/dist/styles/fonts/KaTeX_SansSerif-Italic.woff +0 -0
  55. package/dist/styles/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
  56. package/dist/styles/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
  57. package/dist/styles/fonts/KaTeX_SansSerif-Regular.woff +0 -0
  58. package/dist/styles/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
  59. package/dist/styles/fonts/KaTeX_Script-Regular.ttf +0 -0
  60. package/dist/styles/fonts/KaTeX_Script-Regular.woff +0 -0
  61. package/dist/styles/fonts/KaTeX_Script-Regular.woff2 +0 -0
  62. package/dist/styles/fonts/KaTeX_Size1-Regular.ttf +0 -0
  63. package/dist/styles/fonts/KaTeX_Size1-Regular.woff +0 -0
  64. package/dist/styles/fonts/KaTeX_Size1-Regular.woff2 +0 -0
  65. package/dist/styles/fonts/KaTeX_Size2-Regular.ttf +0 -0
  66. package/dist/styles/fonts/KaTeX_Size2-Regular.woff +0 -0
  67. package/dist/styles/fonts/KaTeX_Size2-Regular.woff2 +0 -0
  68. package/dist/styles/fonts/KaTeX_Size3-Regular.ttf +0 -0
  69. package/dist/styles/fonts/KaTeX_Size3-Regular.woff +0 -0
  70. package/dist/styles/fonts/KaTeX_Size3-Regular.woff2 +0 -0
  71. package/dist/styles/fonts/KaTeX_Size4-Regular.ttf +0 -0
  72. package/dist/styles/fonts/KaTeX_Size4-Regular.woff +0 -0
  73. package/dist/styles/fonts/KaTeX_Size4-Regular.woff2 +0 -0
  74. package/dist/styles/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
  75. package/dist/styles/fonts/KaTeX_Typewriter-Regular.woff +0 -0
  76. package/dist/styles/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
  77. package/dist/styles/index.css +2 -212
  78. package/package.json +23 -49
  79. package/dist/auth.cjs +0 -241
  80. package/dist/auth.d.cts +0 -21
  81. package/dist/auth.d.ts +0 -21
  82. package/dist/auth.js +0 -208
  83. package/dist/automations.cjs +0 -3044
  84. package/dist/automations.d.cts +0 -4774
  85. package/dist/automations.d.ts +0 -4774
  86. package/dist/automations.js +0 -2965
  87. package/dist/factory.cjs +0 -5057
  88. package/dist/factory.d.cts +0 -7909
  89. package/dist/factory.d.ts +0 -7909
  90. package/dist/factory.js +0 -5008
  91. package/dist/local-runtime.cjs +0 -1387
  92. package/dist/local-runtime.d.cts +0 -3314
  93. package/dist/local-runtime.d.ts +0 -3314
  94. package/dist/local-runtime.js +0 -1345
  95. package/dist/providers.cjs +0 -6154
  96. package/dist/providers.d.cts +0 -6024
  97. package/dist/providers.d.ts +0 -6024
  98. package/dist/providers.js +0 -6110
  99. package/dist/server.cjs +0 -9137
  100. package/dist/server.d.cts +0 -9868
  101. package/dist/server.d.ts +0 -9868
  102. package/dist/server.js +0 -9118
  103. package/dist/skills-browser.cjs +0 -118
  104. package/dist/skills-browser.d.cts +0 -105
  105. package/dist/skills-browser.d.ts +0 -105
  106. package/dist/skills-browser.js +0 -88
  107. package/dist/skills.cjs +0 -505
  108. package/dist/skills.d.cts +0 -218
  109. package/dist/skills.d.ts +0 -218
  110. package/dist/skills.js +0 -458
  111. package/dist/sources.cjs +0 -1710
  112. package/dist/sources.d.cts +0 -3978
  113. package/dist/sources.d.ts +0 -3978
  114. package/dist/sources.js +0 -1675
@@ -1,118 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/skills-browser.ts
21
- var skills_browser_exports = {};
22
- __export(skills_browser_exports, {
23
- AGENTS_PLUGIN_NAME: () => AGENTS_PLUGIN_NAME,
24
- createSkillActivationPlan: () => createSkillActivationPlan,
25
- formatSkillDirective: () => formatSkillDirective,
26
- prependSkillDirective: () => prependSkillDirective
27
- });
28
- module.exports = __toCommonJS(skills_browser_exports);
29
-
30
- // ../packages/skills/dist/chunk-IAAI7RH5.js
31
- var AGENTS_PLUGIN_NAME = ".agents";
32
- function createSkillActivationPlan(options) {
33
- const enabledSources = new Set(options.enabledSourceSlugs ?? []);
34
- const selected = new Set(options.selectedSkillSlugs ?? []);
35
- const promptMentions = parseSkillMentions(options.prompt ?? "");
36
- const filePaths = options.filePaths ?? [];
37
- const activations = [];
38
- const seen = /* @__PURE__ */ new Set();
39
- for (const skill of options.skills) {
40
- const reason = activationReason(skill, {
41
- selected,
42
- promptMentions,
43
- filePaths
44
- });
45
- if (!reason || seen.has(skill.slug)) continue;
46
- seen.add(skill.slug);
47
- activations.push({ skill, reason });
48
- }
49
- const requiredSourceSlugs = unique(activations.flatMap(
50
- (activation) => activation.skill.metadata.requiredSources ?? []
51
- ));
52
- const missingRequiredSourceSlugs = requiredSourceSlugs.filter((source) => !enabledSources.has(source));
53
- const policyExtensions = activations.flatMap(({ skill }) => (skill.metadata.alwaysAllow ?? []).map((toolName) => ({
54
- toolName,
55
- scope: { type: "skill", skillSlug: skill.slug }
56
- })));
57
- const prerequisiteFiles = activations.map(({ skill }) => `${skill.path}/SKILL.md`).filter((path) => options.prerequisiteFileExists?.(path) ?? true);
58
- return {
59
- activeSkillSlugs: activations.map((activation) => activation.skill.slug),
60
- activations,
61
- requiredSourceSlugs,
62
- missingRequiredSourceSlugs,
63
- policyExtensions,
64
- providerInstructions: buildProviderInstructions(activations),
65
- prerequisiteFiles
66
- };
67
- }
68
- function activationReason(skill, context) {
69
- if (context.promptMentions.has(skill.slug)) return "prompt-mention";
70
- if (context.selected.has(skill.slug)) return "host-selection";
71
- if (matchesAnyGlob(skill.metadata.globs ?? [], context.filePaths)) return "file-glob";
72
- return void 0;
73
- }
74
- function parseSkillMentions(prompt) {
75
- const mentions = /* @__PURE__ */ new Set();
76
- for (const match of prompt.matchAll(/@([A-Za-z0-9_-]+)/g)) {
77
- mentions.add(match[1]);
78
- }
79
- return mentions;
80
- }
81
- function matchesAnyGlob(globs, filePaths) {
82
- return globs.some((glob) => filePaths.some((filePath) => globMatches(glob, filePath)));
83
- }
84
- function buildProviderInstructions(activations) {
85
- return activations.map(({ skill }) => `# ${skill.metadata.name}
86
-
87
- ${skill.content}`).join("\n\n");
88
- }
89
- function unique(values) {
90
- return [...new Set(values)];
91
- }
92
- function globMatches(pattern, value) {
93
- const escaped = pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*\*/g, "__DOUBLE_STAR__").replace(/\*/g, "[^/]*").replace(/__DOUBLE_STAR__/g, ".*");
94
- return new RegExp(`^${escaped}$`).test(value);
95
- }
96
- function formatSkillDirective(prerequisiteFiles) {
97
- if (prerequisiteFiles.length === 0) return void 0;
98
- const fileList = prerequisiteFiles.map((f) => `- ${f}`).join("\n");
99
- return [
100
- "Before proceeding with the user's request, you MUST read the following skill instruction files:",
101
- fileList,
102
- "Do not take any other action until you have read these files."
103
- ].join("\n");
104
- }
105
- function prependSkillDirective(message, prerequisiteFiles) {
106
- const directive = formatSkillDirective(prerequisiteFiles);
107
- if (!directive) return message;
108
- return `${directive}
109
-
110
- ${message}`;
111
- }
112
- // Annotate the CommonJS export names for ESM import in node:
113
- 0 && (module.exports = {
114
- AGENTS_PLUGIN_NAME,
115
- createSkillActivationPlan,
116
- formatSkillDirective,
117
- prependSkillDirective
118
- });
@@ -1,105 +0,0 @@
1
-
2
-
3
- // ── inlined from @weft/skills/browser ──
4
- // -- @weft/skills/browser/browser.d.ts --
5
- /**
6
- * Skills Types
7
- *
8
- * Type definitions for workspace skills.
9
- * Skills are specialized instructions that extend Claude's capabilities.
10
- */
11
- /**
12
- * Skill metadata from SKILL.md YAML frontmatter
13
- */
14
- interface SkillMetadata {
15
- /** Display name for the skill */
16
- name: string;
17
- /** Brief description shown in skill list */
18
- description: string;
19
- /** Optional file patterns that trigger this skill */
20
- globs?: string[];
21
- /** Optional tools to always allow when skill is active */
22
- alwaysAllow?: string[];
23
- /**
24
- * Optional icon - emoji or URL only.
25
- * - Emoji: rendered directly in UI (e.g., "🔧")
26
- * - URL: auto-downloaded to icon.{ext} file
27
- * Note: Relative paths and inline SVG are NOT supported.
28
- */
29
- icon?: string;
30
- /** Optional source slugs to auto-enable when this skill is invoked */
31
- requiredSources?: string[];
32
- }
33
- /** Source of a loaded skill */
34
- type SkillSource = 'global' | 'workspace' | 'project';
35
- /**
36
- * Plugin name for project-level and global skills.
37
- *
38
- * The SDK derives plugin names from `path.basename()` of the registered plugin
39
- * directory. Both `{project}/.agents/` and `~/.agents/` share the basename
40
- * `.agents`, so skills from either tier resolve to `.agents:skillSlug`.
41
- */
42
- declare const AGENTS_PLUGIN_NAME = ".agents";
43
- /**
44
- * A loaded skill with parsed content
45
- */
46
- interface LoadedSkill {
47
- /** Directory name (slug) */
48
- slug: string;
49
- /** Parsed metadata from YAML frontmatter */
50
- metadata: SkillMetadata;
51
- /** Full SKILL.md content (without frontmatter) */
52
- content: string;
53
- /** Absolute path to icon file if exists */
54
- iconPath?: string;
55
- /** Absolute path to skill directory */
56
- path: string;
57
- /** Where this skill was loaded from */
58
- source: SkillSource;
59
- }
60
-
61
- type SkillActivationReason = 'prompt-mention' | 'file-glob' | 'host-selection';
62
- interface SkillActivation {
63
- skill: LoadedSkill;
64
- reason: SkillActivationReason;
65
- }
66
- interface CreateSkillActivationPlanOptions {
67
- skills: LoadedSkill[];
68
- prompt?: string;
69
- filePaths?: string[];
70
- selectedSkillSlugs?: string[];
71
- enabledSourceSlugs?: string[];
72
- prerequisiteFileExists?: (path: string) => boolean;
73
- }
74
- interface SkillPolicyExtension {
75
- toolName: string;
76
- scope: {
77
- type: 'skill';
78
- skillSlug: string;
79
- };
80
- }
81
- interface SkillActivationPlan {
82
- activeSkillSlugs: string[];
83
- activations: SkillActivation[];
84
- requiredSourceSlugs: string[];
85
- missingRequiredSourceSlugs: string[];
86
- policyExtensions: SkillPolicyExtension[];
87
- providerInstructions: string;
88
- prerequisiteFiles: string[];
89
- }
90
- declare function createSkillActivationPlan(options: CreateSkillActivationPlanOptions): SkillActivationPlan;
91
-
92
- /**
93
- * Format a skill prerequisite directive that instructs the agent to read
94
- * SKILL.md files before taking any other action.
95
- *
96
- * Returns undefined if no prerequisite files are specified.
97
- */
98
- declare function formatSkillDirective(prerequisiteFiles: string[]): string | undefined;
99
- /**
100
- * Prepend a skill directive to a user message if prerequisite files exist.
101
- * Returns the original message if no prerequisites.
102
- */
103
- declare function prependSkillDirective(message: string, prerequisiteFiles: string[]): string;
104
-
105
- export { AGENTS_PLUGIN_NAME, type CreateSkillActivationPlanOptions, type LoadedSkill, type SkillActivation, type SkillActivationPlan, type SkillActivationReason, type SkillMetadata, type SkillPolicyExtension, type SkillSource, createSkillActivationPlan, formatSkillDirective, prependSkillDirective };
@@ -1,105 +0,0 @@
1
-
2
-
3
- // ── inlined from @weft/skills/browser ──
4
- // -- @weft/skills/browser/browser.d.ts --
5
- /**
6
- * Skills Types
7
- *
8
- * Type definitions for workspace skills.
9
- * Skills are specialized instructions that extend Claude's capabilities.
10
- */
11
- /**
12
- * Skill metadata from SKILL.md YAML frontmatter
13
- */
14
- interface SkillMetadata {
15
- /** Display name for the skill */
16
- name: string;
17
- /** Brief description shown in skill list */
18
- description: string;
19
- /** Optional file patterns that trigger this skill */
20
- globs?: string[];
21
- /** Optional tools to always allow when skill is active */
22
- alwaysAllow?: string[];
23
- /**
24
- * Optional icon - emoji or URL only.
25
- * - Emoji: rendered directly in UI (e.g., "🔧")
26
- * - URL: auto-downloaded to icon.{ext} file
27
- * Note: Relative paths and inline SVG are NOT supported.
28
- */
29
- icon?: string;
30
- /** Optional source slugs to auto-enable when this skill is invoked */
31
- requiredSources?: string[];
32
- }
33
- /** Source of a loaded skill */
34
- type SkillSource = 'global' | 'workspace' | 'project';
35
- /**
36
- * Plugin name for project-level and global skills.
37
- *
38
- * The SDK derives plugin names from `path.basename()` of the registered plugin
39
- * directory. Both `{project}/.agents/` and `~/.agents/` share the basename
40
- * `.agents`, so skills from either tier resolve to `.agents:skillSlug`.
41
- */
42
- declare const AGENTS_PLUGIN_NAME = ".agents";
43
- /**
44
- * A loaded skill with parsed content
45
- */
46
- interface LoadedSkill {
47
- /** Directory name (slug) */
48
- slug: string;
49
- /** Parsed metadata from YAML frontmatter */
50
- metadata: SkillMetadata;
51
- /** Full SKILL.md content (without frontmatter) */
52
- content: string;
53
- /** Absolute path to icon file if exists */
54
- iconPath?: string;
55
- /** Absolute path to skill directory */
56
- path: string;
57
- /** Where this skill was loaded from */
58
- source: SkillSource;
59
- }
60
-
61
- type SkillActivationReason = 'prompt-mention' | 'file-glob' | 'host-selection';
62
- interface SkillActivation {
63
- skill: LoadedSkill;
64
- reason: SkillActivationReason;
65
- }
66
- interface CreateSkillActivationPlanOptions {
67
- skills: LoadedSkill[];
68
- prompt?: string;
69
- filePaths?: string[];
70
- selectedSkillSlugs?: string[];
71
- enabledSourceSlugs?: string[];
72
- prerequisiteFileExists?: (path: string) => boolean;
73
- }
74
- interface SkillPolicyExtension {
75
- toolName: string;
76
- scope: {
77
- type: 'skill';
78
- skillSlug: string;
79
- };
80
- }
81
- interface SkillActivationPlan {
82
- activeSkillSlugs: string[];
83
- activations: SkillActivation[];
84
- requiredSourceSlugs: string[];
85
- missingRequiredSourceSlugs: string[];
86
- policyExtensions: SkillPolicyExtension[];
87
- providerInstructions: string;
88
- prerequisiteFiles: string[];
89
- }
90
- declare function createSkillActivationPlan(options: CreateSkillActivationPlanOptions): SkillActivationPlan;
91
-
92
- /**
93
- * Format a skill prerequisite directive that instructs the agent to read
94
- * SKILL.md files before taking any other action.
95
- *
96
- * Returns undefined if no prerequisite files are specified.
97
- */
98
- declare function formatSkillDirective(prerequisiteFiles: string[]): string | undefined;
99
- /**
100
- * Prepend a skill directive to a user message if prerequisite files exist.
101
- * Returns the original message if no prerequisites.
102
- */
103
- declare function prependSkillDirective(message: string, prerequisiteFiles: string[]): string;
104
-
105
- export { AGENTS_PLUGIN_NAME, type CreateSkillActivationPlanOptions, type LoadedSkill, type SkillActivation, type SkillActivationPlan, type SkillActivationReason, type SkillMetadata, type SkillPolicyExtension, type SkillSource, createSkillActivationPlan, formatSkillDirective, prependSkillDirective };
@@ -1,88 +0,0 @@
1
- // ../packages/skills/dist/chunk-IAAI7RH5.js
2
- var AGENTS_PLUGIN_NAME = ".agents";
3
- function createSkillActivationPlan(options) {
4
- const enabledSources = new Set(options.enabledSourceSlugs ?? []);
5
- const selected = new Set(options.selectedSkillSlugs ?? []);
6
- const promptMentions = parseSkillMentions(options.prompt ?? "");
7
- const filePaths = options.filePaths ?? [];
8
- const activations = [];
9
- const seen = /* @__PURE__ */ new Set();
10
- for (const skill of options.skills) {
11
- const reason = activationReason(skill, {
12
- selected,
13
- promptMentions,
14
- filePaths
15
- });
16
- if (!reason || seen.has(skill.slug)) continue;
17
- seen.add(skill.slug);
18
- activations.push({ skill, reason });
19
- }
20
- const requiredSourceSlugs = unique(activations.flatMap(
21
- (activation) => activation.skill.metadata.requiredSources ?? []
22
- ));
23
- const missingRequiredSourceSlugs = requiredSourceSlugs.filter((source) => !enabledSources.has(source));
24
- const policyExtensions = activations.flatMap(({ skill }) => (skill.metadata.alwaysAllow ?? []).map((toolName) => ({
25
- toolName,
26
- scope: { type: "skill", skillSlug: skill.slug }
27
- })));
28
- const prerequisiteFiles = activations.map(({ skill }) => `${skill.path}/SKILL.md`).filter((path) => options.prerequisiteFileExists?.(path) ?? true);
29
- return {
30
- activeSkillSlugs: activations.map((activation) => activation.skill.slug),
31
- activations,
32
- requiredSourceSlugs,
33
- missingRequiredSourceSlugs,
34
- policyExtensions,
35
- providerInstructions: buildProviderInstructions(activations),
36
- prerequisiteFiles
37
- };
38
- }
39
- function activationReason(skill, context) {
40
- if (context.promptMentions.has(skill.slug)) return "prompt-mention";
41
- if (context.selected.has(skill.slug)) return "host-selection";
42
- if (matchesAnyGlob(skill.metadata.globs ?? [], context.filePaths)) return "file-glob";
43
- return void 0;
44
- }
45
- function parseSkillMentions(prompt) {
46
- const mentions = /* @__PURE__ */ new Set();
47
- for (const match of prompt.matchAll(/@([A-Za-z0-9_-]+)/g)) {
48
- mentions.add(match[1]);
49
- }
50
- return mentions;
51
- }
52
- function matchesAnyGlob(globs, filePaths) {
53
- return globs.some((glob) => filePaths.some((filePath) => globMatches(glob, filePath)));
54
- }
55
- function buildProviderInstructions(activations) {
56
- return activations.map(({ skill }) => `# ${skill.metadata.name}
57
-
58
- ${skill.content}`).join("\n\n");
59
- }
60
- function unique(values) {
61
- return [...new Set(values)];
62
- }
63
- function globMatches(pattern, value) {
64
- const escaped = pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*\*/g, "__DOUBLE_STAR__").replace(/\*/g, "[^/]*").replace(/__DOUBLE_STAR__/g, ".*");
65
- return new RegExp(`^${escaped}$`).test(value);
66
- }
67
- function formatSkillDirective(prerequisiteFiles) {
68
- if (prerequisiteFiles.length === 0) return void 0;
69
- const fileList = prerequisiteFiles.map((f) => `- ${f}`).join("\n");
70
- return [
71
- "Before proceeding with the user's request, you MUST read the following skill instruction files:",
72
- fileList,
73
- "Do not take any other action until you have read these files."
74
- ].join("\n");
75
- }
76
- function prependSkillDirective(message, prerequisiteFiles) {
77
- const directive = formatSkillDirective(prerequisiteFiles);
78
- if (!directive) return message;
79
- return `${directive}
80
-
81
- ${message}`;
82
- }
83
- export {
84
- AGENTS_PLUGIN_NAME,
85
- createSkillActivationPlan,
86
- formatSkillDirective,
87
- prependSkillDirective
88
- };