@percena/weft 0.4.0-next.2 → 0.4.0-next.4

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 (50) hide show
  1. package/dist/action-bridge.cjs +180 -3
  2. package/dist/action-bridge.d.cts +112 -23
  3. package/dist/action-bridge.d.ts +112 -23
  4. package/dist/action-bridge.js +169 -2
  5. package/dist/chat.cjs +982 -3
  6. package/dist/chat.d.cts +30 -1
  7. package/dist/chat.d.ts +30 -1
  8. package/dist/chat.js +981 -2
  9. package/dist/index.cjs +341 -1616
  10. package/dist/index.d.cts +4 -274
  11. package/dist/index.d.ts +4 -274
  12. package/dist/index.js +174 -1408
  13. package/dist/styles/index.css +2 -212
  14. package/package.json +28 -55
  15. package/dist/auth.cjs +0 -241
  16. package/dist/auth.d.cts +0 -1
  17. package/dist/auth.d.ts +0 -1
  18. package/dist/auth.js +0 -208
  19. package/dist/automations.cjs +0 -3044
  20. package/dist/automations.d.cts +0 -4774
  21. package/dist/automations.d.ts +0 -4774
  22. package/dist/automations.js +0 -2965
  23. package/dist/factory.cjs +0 -5057
  24. package/dist/factory.d.cts +0 -7909
  25. package/dist/factory.d.ts +0 -7909
  26. package/dist/factory.js +0 -5008
  27. package/dist/local-runtime.cjs +0 -1387
  28. package/dist/local-runtime.d.cts +0 -3314
  29. package/dist/local-runtime.d.ts +0 -3314
  30. package/dist/local-runtime.js +0 -1345
  31. package/dist/providers.cjs +0 -6154
  32. package/dist/providers.d.cts +0 -6024
  33. package/dist/providers.d.ts +0 -6024
  34. package/dist/providers.js +0 -6110
  35. package/dist/server.cjs +0 -9137
  36. package/dist/server.d.cts +0 -9868
  37. package/dist/server.d.ts +0 -9868
  38. package/dist/server.js +0 -9118
  39. package/dist/skills-browser.cjs +0 -118
  40. package/dist/skills-browser.d.cts +0 -105
  41. package/dist/skills-browser.d.ts +0 -105
  42. package/dist/skills-browser.js +0 -88
  43. package/dist/skills.cjs +0 -505
  44. package/dist/skills.d.cts +0 -218
  45. package/dist/skills.d.ts +0 -218
  46. package/dist/skills.js +0 -458
  47. package/dist/sources.cjs +0 -1710
  48. package/dist/sources.d.cts +0 -3978
  49. package/dist/sources.d.ts +0 -3978
  50. 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
- };