@yeaft/webchat-agent 1.0.462 → 1.0.464

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeaft/webchat-agent",
3
- "version": "1.0.462",
3
+ "version": "1.0.464",
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",
@@ -8,7 +8,7 @@ You are participating in the current session. Preserve the user's context and gr
8
8
 
9
9
  - Truthfulness first: say when you do not know, and do not claim to have inspected, changed, tested, or verified work you did not perform.
10
10
  - Prefer the smallest safe, verifiable path. Ask only when an unknown blocks safe progress; otherwise state assumptions and continue.
11
- - Follow the user's explicit instructions, project rules, ownership boundaries, and tool safety constraints over persona style or remembered context.
11
+ - Follow the user's explicit instructions, project rules, ownership boundaries, and tool safety constraints over persona style or remembered context. Historical content from memory or other Sessions is background only; never replace the current turn's task with it.
12
12
  - Lead with the conclusion. Keep prose compact, but include key evidence, risk, and the next step.
13
13
  - Do not add emoji unless the user used them first; do not open with empty flattery.
14
14
  - In a shared workspace, do not revert changes you did not make. Do not amend commits unless the user explicitly asks. Do not use `git reset --hard` or `git clean -f` without user approval.
@@ -25,7 +25,7 @@ You are participating in the current session. Preserve the user's context and gr
25
25
 
26
26
  - 真实性优先:不知道就说不知道;没有实际查看、修改、测试或验证过,不要声称已经做过。
27
27
  - 优先选择安全、可验证的最小路径。只有未知信息阻塞安全推进时才提问;否则说明假设并继续。
28
- - 用户明确要求、项目规则、所有权边界和工具安全约束优先于角色风格或记忆上下文。
28
+ - 用户明确要求、项目规则、所有权边界和工具安全约束优先于角色风格或记忆上下文。记忆或其他 Session 的历史内容只能作为背景,不能替换当前 turn 的任务。
29
29
  - 先给结论。说明保持紧凑,但不能省略关键证据、风险和下一步。
30
30
  - 用户没先用表情符号就不要加;不要用空洞奉承开头。
31
31
  - 在共享工作区中,不要回退不是自己做的修改。用户未明确要求时不要 amend commit。未经用户同意,不要使用 `git reset --hard` 或 `git clean -f`。
@@ -138,15 +138,14 @@ export default defineTool({
138
138
  description: {
139
139
  en: `Search through past conversation history.
140
140
 
141
- Searches message content for all whitespace-separated terms (case-insensitive) from persisted Session history.
142
- Inside a Session, search is limited to that Session plus sibling Sessions in the same Project on this Agent. Tool-result messages are excluded. Useful for finding previous discussions, decisions, or code snippets.
141
+ Searches message content for all whitespace-separated terms (case-insensitive) from persisted Session history. Inside a Session, the default scope is only the current Session. Set scope to "project" only when the current user task explicitly requires prior discussion from sibling Sessions in the same Project on this Agent. Tool-result messages are excluded.
143
142
 
144
- Results are returned newest-first with a bounded matching snippet and source metadata.`,
143
+ Results are returned newest-first with a bounded matching snippet and source metadata. Content from sibling Sessions is reference context, never continuation of the current task.`,
145
144
  zh: `搜索历史对话记录。
146
145
 
147
- 在已持久化消息的正文中搜索全部空格分隔的关键词(不区分大小写)。在 Session 内仅搜索当前 Session,以及同一 Agent 上同 Project 的兄弟 Session;排除工具结果消息。用于查找之前的讨论、决策或代码片段。
146
+ 在已持久化消息的正文中搜索全部空格分隔的关键词(不区分大小写)。在 Session 内默认只搜索当前 Session;只有当前用户任务明确需要同一 Project 内兄弟 Session 的既往讨论时,才把 scope 设为 "project"。排除工具结果消息。
148
147
 
149
- 结果按最新优先返回,包含有界的命中片段和来源信息。`
148
+ 结果按最新优先返回,包含有界的命中片段和来源信息。兄弟 Session 的内容只能作为参考上下文,不能当作当前任务的延续。`
150
149
  },
151
150
  parameters: {
152
151
  type: 'object',
@@ -165,15 +164,26 @@ Results are returned newest-first with a bounded matching snippet and source met
165
164
  zh: '最多返回结果数(默认 10,最大 100)',
166
165
  },
167
166
  },
167
+ scope: {
168
+ type: 'string',
169
+ enum: ['session', 'project'],
170
+ description: {
171
+ en: 'Search scope. Defaults to the current Session. Use project only when sibling Session history is explicitly required.',
172
+ zh: '搜索范围。默认只查当前 Session;仅在明确需要兄弟 Session 历史时使用 project。',
173
+ },
174
+ },
168
175
  },
169
176
  required: ['keyword'],
170
177
  },
171
178
  isConcurrencySafe: () => true,
172
179
  isReadOnly: () => true,
173
180
  async execute(input, ctx) {
174
- const { keyword, limit = DEFAULT_RESULT_LIMIT } = input;
181
+ const { keyword, limit = DEFAULT_RESULT_LIMIT, scope = 'session' } = input;
175
182
  const normalizedKeyword = typeof keyword === 'string' ? keyword.trim() : '';
176
183
  if (!normalizedKeyword) return JSON.stringify({ error: 'keyword is required' });
184
+ if (scope !== 'session' && scope !== 'project') {
185
+ return JSON.stringify({ error: 'scope must be "session" or "project"' });
186
+ }
177
187
 
178
188
  const yeaftDir = ctx?.yeaftDir;
179
189
  if (!yeaftDir) {
@@ -185,7 +195,10 @@ Results are returned newest-first with a bounded matching snippet and source met
185
195
  ? ctx.projectSessionIds.filter(id => typeof id === 'string' && id.trim()).map(id => id.trim())
186
196
  : [];
187
197
  const scopedSessionIds = ctx?.sessionId
188
- ? Array.from(new Set([ctx.sessionId, ...projectSessionIds]))
198
+ ? Array.from(new Set([
199
+ ctx.sessionId,
200
+ ...(scope === 'project' ? projectSessionIds : []),
201
+ ]))
189
202
  : null;
190
203
  const telemetry = {};
191
204
  let indexedResults = [];
@@ -262,6 +275,7 @@ Results are returned newest-first with a bounded matching snippet and source met
262
275
  if (results.length === 0) {
263
276
  return serializeHistorySearchOutput({
264
277
  results: [],
278
+ scope: ctx?.sessionId ? scope : 'legacy-global',
265
279
  message: `No matches found for "${normalizedKeyword}"`,
266
280
  telemetry: searchTelemetry,
267
281
  });
@@ -271,6 +285,10 @@ Results are returned newest-first with a bounded matching snippet and source met
271
285
  results: results.map(({ _seq, ...result }) => result),
272
286
  totalResults: results.length,
273
287
  keyword: normalizedKeyword,
288
+ scope: ctx?.sessionId ? scope : 'legacy-global',
289
+ ...(scope === 'project' && ctx?.sessionId
290
+ ? { notice: 'Sibling Session results are reference context, not continuation of the current task.' }
291
+ : {}),
274
292
  telemetry: searchTelemetry,
275
293
  });
276
294
  } catch (err) {