@yeaft/webchat-agent 1.0.679 → 1.0.680

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.
@@ -1 +1 @@
1
- {"version":"1.0.679"}
1
+ {"version":"1.0.680"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeaft/webchat-agent",
3
- "version": "1.0.679",
3
+ "version": "1.0.680",
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
@@ -17,7 +17,6 @@
17
17
  * Reference: yeaft-yeaft-implementation-plan.md §3.1, §4 (Phase 2)
18
18
  */
19
19
 
20
- import { enhanceResponse } from './llm/response-enhance.js';
21
20
  import { randomUUID } from 'crypto';
22
21
  import { QueryProgress, progressReminder } from './query-progress.js';
23
22
  import { createWebResearchState } from './web-research.js';
@@ -1397,7 +1396,6 @@ export class Engine {
1397
1396
  skillManager: this.#skillManager,
1398
1397
  conversationStore: this.#conversationStore,
1399
1398
  adapter: this.#adapter,
1400
- responseEnhance: vpCtx?.responseEnhance,
1401
1399
  config: this.#config,
1402
1400
  discoverTools: vpCtx?.discoverTools,
1403
1401
  taskManager: this.#taskManager,
@@ -2532,8 +2530,6 @@ export class Engine {
2532
2530
  let primaryModelAtLastBoundary = currentModel;
2533
2531
  let cumulativeInputTokens = 0;
2534
2532
  let cumulativeOutputTokens = 0;
2535
- let enhancementCalls = 0;
2536
- const enhancementUsageEvents = [];
2537
2533
  let maxContextOccupancyRatio = 0;
2538
2534
  let peakContextTokens = 0;
2539
2535
  let peakContextWindow = 0;
@@ -4098,23 +4094,6 @@ export class Engine {
4098
4094
  queryTurnId,
4099
4095
  causalRootId,
4100
4096
  webResearch,
4101
- responseEnhance: (input, { signal: toolSignal } = {}) => enhanceResponse(input, {
4102
- adapter: this.#adapter, model: currentModel, config: requestConfig,
4103
- signal: toolSignal ?? signal, requestIdentity,
4104
- effort: requestEffortDecision.effective ?? requestEffortDecision.requested ?? undefined,
4105
- effortSource: requestEffortDecision.source ?? 'auto', effortConstraint,
4106
- onStart: () => {
4107
- if (isSubAgent) this.#toolRegistry?.reserveProviderRequest?.();
4108
- enhancementCalls++;
4109
- queryProgress.requestStarted();
4110
- },
4111
- onUsage: event => {
4112
- cumulativeInputTokens += (event.inputTokens || 0) + (event.cacheTokensAreIncludedInInput ? 0 : (event.cacheReadTokens || 0) + (event.cacheWriteTokens || 0));
4113
- cumulativeOutputTokens += event.outputTokens || 0;
4114
- queryProgress.usageObserved(event);
4115
- enhancementUsageEvents.push({ ...event, source: 'ResponseEnhance' });
4116
- },
4117
- }),
4118
4097
  historyBeforeSeq: Number.isFinite(persistedQueryUser?.seq) ? persistedQueryUser.seq : parseSeqFromId(persistedQueryUser?.id),
4119
4098
  router,
4120
4099
  senderVpId,
@@ -4797,9 +4776,6 @@ export class Engine {
4797
4776
  }));
4798
4777
  queryToolCount += 1;
4799
4778
  }
4800
- // Surface side-call usage once, separately from main-request context
4801
- // occupancy, so child token budgets and stream consumers also see it.
4802
- for (const usage of enhancementUsageEvents.splice(0)) yield usage;
4803
4779
  if (fatalToolError) throw fatalToolError;
4804
4780
  }
4805
4781
 
@@ -4949,7 +4925,7 @@ export class Engine {
4949
4925
  const llmCountMessage = lastPersistedAssistantTextMessage || lastPersistedAssistantMessage;
4950
4926
  if (llmCountMessage && typeof this.#conversationStore?.update === 'function') {
4951
4927
  const updated = this.#conversationStore.update(llmCountMessage, {
4952
- llmCallCount: turnNumber + enhancementCalls,
4928
+ llmCallCount: turnNumber,
4953
4929
  inputTokens: cumulativeInputTokens,
4954
4930
  outputTokens: cumulativeOutputTokens,
4955
4931
  totalTokens,
@@ -4974,7 +4950,7 @@ export class Engine {
4974
4950
  outputTokens: cumulativeOutputTokens,
4975
4951
  totalTokens,
4976
4952
  loopCount: turnNumber,
4977
- modelRequestCount: turnNumber + enhancementCalls,
4953
+ modelRequestCount: turnNumber,
4978
4954
  ...(lastSuccessfulModel ? { model: lastSuccessfulModel } : {}),
4979
4955
  ...(lastSuccessfulEffort ? { effort: lastSuccessfulEffort } : {}),
4980
4956
  };
@@ -4,6 +4,7 @@ import { randomUUID } from 'node:crypto';
4
4
  import { TaskManager } from '../tasks/manager.js';
5
5
  import { TASK_RESULT_DELIVERY, isTerminalTaskStatus } from '../tasks/store.js';
6
6
  import { createFullRegistry } from '../tools/index.js';
7
+ import responseEnhance from '../tools/response-enhance.js';
7
8
  import { ToolRegistry, normalizeToolOutput, isToolErrorOutput, toolErrorEffect } from '../tools/registry.js';
8
9
  import { SubAgentToolRegistry } from '../sub-agent/execution-control.js';
9
10
  import { agentBelongsToScope, getAgentRegistry } from '../tools/agent.js';
@@ -27,7 +28,8 @@ export const PERSON_TASK_TOOL_IDS = Object.freeze([
27
28
  'ResponseEnhance',
28
29
  'DiscoverTools', // child Engine schema activation; Person itself uses its catalog
29
30
  ]);
30
- const nativeRegistry = createFullRegistry();
31
+ // Response enhancement is a Person-only experiment, never a Session built-in.
32
+ const nativeRegistry = createFullRegistry().register(responseEnhance);
31
33
  const liveHosts = new Map();
32
34
  const pause = () => new Promise(resolve => setTimeout(resolve, 10));
33
35
  const clone = value => JSON.parse(JSON.stringify(value));
@@ -23,6 +23,7 @@ export const RESTRICTED_TOOLS = new Set([
23
23
  'RouteForward',
24
24
  'AskUser',
25
25
  'CreateWorkItem',
26
+ 'ResponseEnhance', // Person's own response experiment, not a child Engine tool
26
27
  ]);
27
28
 
28
29
  function canonicalTool(parentRegistry, name) {
@@ -9,7 +9,6 @@ You are participating in the current session. Preserve the user's context and gr
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
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
- - When available, use `ResponseEnhance` before publishing a complex judgment/recommendation or repairing an evasive, robotic or verbose answer. Skip simple chat, small follow-ups and progress. Usually one private draft review; it is a second opinion, not fact verification, permission or a reason to expand. Deliver only the useful reply.
13
12
  - Lead with the conclusion. Keep prose compact, but include key evidence, risk, and the next step.
14
13
  - Do not add emoji unless the user used them first; do not open with empty flattery.
15
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.
@@ -27,7 +26,6 @@ You are participating in the current session. Preserve the user's context and gr
27
26
  - 真实性优先:不知道就说不知道;没有实际查看、修改、测试或验证过,不要声称已经做过。
28
27
  - 优先选择安全、可验证的最小路径。只有未知信息阻塞安全推进时才提问;否则说明假设并继续。
29
28
  - 用户明确要求、项目规则、所有权边界和工具安全约束优先于角色风格或记忆上下文。记忆或其他 Session 的历史内容只能作为背景,不能替换当前 turn 的任务。
30
- - 可用时,复杂判断/推荐,或修正回避、机械、啰嗦的回答,发布前优先按需用 `ResponseEnhance`;简单闲聊、局部追问和进度跳过。通常只审一次未公开草稿,它是第二意见,不是事实验证、授权或扩写要求;只交付有用回答。
31
29
  - 先给结论。说明保持紧凑,但不能省略关键证据、风险和下一步。
32
30
  - 用户没先用表情符号就不要加;不要用空洞奉承开头。
33
31
  - 在共享工作区中,不要回退不是自己做的修改。用户未明确要求时不要 amend commit。未经用户同意,不要使用 `git reset --hard` 或 `git clean -f`。
@@ -11,7 +11,6 @@ export const ALWAYS_VISIBLE_TOOL_NAMES = Object.freeze([
11
11
  'ExitWorktree',
12
12
  'AskUser',
13
13
  'PresentResponse',
14
- 'ResponseEnhance',
15
14
  'DiscoverTools',
16
15
  'WebSearch',
17
16
  'WebFetch',
@@ -26,7 +26,6 @@ import exitWorktree from './exit-worktree.js';
26
26
  // --- P0 Core tools ---
27
27
  import askUser from './ask-user.js';
28
28
  import presentResponse from './present-response.js';
29
- import responseEnhance from './response-enhance.js';
30
29
  import webSearch from './web-search.js';
31
30
  import webFetch from './web-fetch.js';
32
31
  import historySearch from './history-search.js';
@@ -82,7 +81,8 @@ import imageGeneration from './image-generation.js';
82
81
  import viewImage from './view-image.js';
83
82
 
84
83
  /**
85
- * All built-in tools, flattened into a single array.
84
+ * Session built-in tools, flattened into a single array. Person-only
85
+ * experiments (such as ResponseEnhance) belong to the private Person registry.
86
86
  * mcpTools is already an array; the rest are single ToolDef objects.
87
87
  * @type {import('./types.js').ToolDef[]}
88
88
  */
@@ -95,7 +95,6 @@ export const allTools = [
95
95
  // P0 Core
96
96
  askUser,
97
97
  presentResponse,
98
- responseEnhance,
99
98
  webSearch,
100
99
  webFetch,
101
100
  historySearch,