@yeaft/webchat-agent 1.0.86 → 1.0.88

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 (2) hide show
  1. package/package.json +1 -1
  2. package/yeaft/engine.js +22 -15
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeaft/webchat-agent",
3
- "version": "1.0.86",
3
+ "version": "1.0.88",
4
4
  "description": "Remote worker agent for Yeaft Web Code Agent — connects the native Yeaft engine, CLI providers, and workbench tools",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/yeaft/engine.js CHANGED
@@ -96,41 +96,48 @@ const RETRY_DEFAULTS = Object.freeze({
96
96
  jitterRatio: 0.25,
97
97
  });
98
98
 
99
- // Accept the Yeaft-native alias and the Claude Code plugin-style command.
100
- // Autocomplete prefers /yeaft-skills:<name>; /skill:<name> remains supported
101
- // for older clients and typed history.
102
- const EXPLICIT_SKILL_COMMAND_RE = /^\/(?:skill|yeaft-skills):([^\s]+)(\s+|$)/;
99
+ // Accept legacy namespaced commands and Claude Code-style bare skill commands.
100
+ // Project-tier skills are shown as /<skill-name>; /yeaft-skills:<name> and
101
+ // /skill:<name> stay supported for globals, older clients, and typed history.
102
+ const PREFIXED_SKILL_COMMAND_RE = /^\/(?:skill|yeaft-skills):([^\s]+)(\s+|$)/;
103
103
  const BARE_SKILL_COMMAND_RE = /^\/([A-Za-z0-9][A-Za-z0-9_.-]*)(\s+|$)/;
104
104
 
105
+ function skillManagerHasSkill(skillManager, name) {
106
+ if (!skillManager || !name) return false;
107
+ if (typeof skillManager.has === 'function') return !!skillManager.has(name);
108
+ return false;
109
+ }
110
+
105
111
  function parseExplicitSkillCommand(prompt, skillManager) {
106
112
  if (typeof prompt !== 'string') {
107
113
  return { skillName: null, cleanedPrompt: prompt };
108
114
  }
109
- const match = prompt.match(EXPLICIT_SKILL_COMMAND_RE);
110
- if (match) {
115
+ const prefixed = prompt.match(PREFIXED_SKILL_COMMAND_RE);
116
+ if (prefixed) {
111
117
  return {
112
- skillName: match[1],
113
- cleanedPrompt: prompt.slice(match[0].length),
118
+ skillName: prefixed[1],
119
+ cleanedPrompt: prompt.slice(prefixed[0].length),
114
120
  };
115
121
  }
116
- const bareMatch = prompt.match(BARE_SKILL_COMMAND_RE);
117
- if (bareMatch && typeof skillManager?.has === 'function' && skillManager.has(bareMatch[1])) {
122
+
123
+ const bare = prompt.match(BARE_SKILL_COMMAND_RE);
124
+ if (bare && skillManagerHasSkill(skillManager, bare[1])) {
118
125
  return {
119
- skillName: bareMatch[1],
120
- cleanedPrompt: prompt.slice(bareMatch[0].length),
126
+ skillName: bare[1],
127
+ cleanedPrompt: prompt.slice(bare[0].length),
121
128
  };
122
129
  }
123
130
  return { skillName: null, cleanedPrompt: prompt };
124
131
  }
125
132
 
126
- function stripLeadingSkillCommandFromPromptParts(promptParts) {
133
+ function stripLeadingSkillCommandFromPromptParts(promptParts, skillManager) {
127
134
  if (!Array.isArray(promptParts) || promptParts.length === 0) return promptParts;
128
135
  let stripped = false;
129
136
  return promptParts.map(part => {
130
137
  if (stripped || !part || part.type !== 'text' || typeof part.text !== 'string') {
131
138
  return part;
132
139
  }
133
- const parsed = parseExplicitSkillCommand(part.text);
140
+ const parsed = parseExplicitSkillCommand(part.text, skillManager);
134
141
  if (!parsed.skillName) return part;
135
142
  stripped = true;
136
143
  return { ...part, text: parsed.cleanedPrompt };
@@ -1652,7 +1659,7 @@ export class Engine {
1652
1659
  const parsedSkill = parseExplicitSkillCommand(parsed.cleanedPrompt, this.#skillManager);
1653
1660
  const effectivePrompt = parsedSkill.cleanedPrompt;
1654
1661
  const effectivePromptParts = parsedSkill.skillName
1655
- ? stripLeadingSkillCommandFromPromptParts(promptParts)
1662
+ ? stripLeadingSkillCommandFromPromptParts(promptParts, this.#skillManager)
1656
1663
  : promptParts;
1657
1664
  const configuredEffort = normalizeEffort(this.#config?.modelEffort);
1658
1665
  const effectiveUserEffort = normalizeEffort(userEffort) || parsed.effort || configuredEffort || null;