@yeaft/webchat-agent 0.1.1063 → 0.1.1065

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": "0.1.1063",
3
+ "version": "0.1.1065",
4
4
  "description": "Remote agent for Yeaft WebChat — connects worker machines to the central server",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -343,7 +343,7 @@ use it as the default workflow or call it repeatedly in a loop.`,
343
343
  async execute(input, ctx) {
344
344
  // NB: every envelope below puts `next_steps` (or `error_next_steps`) at
345
345
  // the FIRST position because `agent/yeaft/tools/registry.js` caps tool
346
- // output at 1 KiB by chopping the tail. Tail-positioned nudges get
346
+ // output by chopping the tail at its model-context cap. Tail-positioned nudges get
347
347
  // truncated when the rest of the envelope is large.
348
348
  const ERROR_NEXT_STEPS =
349
349
  'That call failed — see `error`. Either correct the arguments and ' +
@@ -39,13 +39,13 @@ export const FORWARD_TOOL_NAMES = Object.freeze(['RouteForward']);
39
39
  * read, a paginated web fetch). If we forward that verbatim into the next LLM
40
40
  * request, it bloats context and makes every replay expensive. Keep the
41
41
  * boundary small and deterministic for LLM message history: one tool result
42
- * gets at most 1 KiB before a visible truncation marker is appended.
42
+ * gets a bounded slice before a visible truncation marker is appended.
43
43
  *
44
44
  * Do NOT apply this at tool execution time. Debug events, exec logs, and
45
45
  * persisted transcripts need the raw result. The engine/history replay path
46
46
  * applies this only when building messages for the model.
47
47
  */
48
- export const TOOL_RESULT_MAX_BYTES = 1024;
48
+ export const TOOL_RESULT_MAX_BYTES = 10 * 1024;
49
49
 
50
50
  function normalizeLanguage(language) {
51
51
  return String(language || '').toLowerCase().startsWith('zh') ? 'zh' : 'en';
@@ -217,8 +217,8 @@ export function truncateToolResultIfNeeded(output, { toolName, language } = {})
217
217
  }
218
218
  const head = chunks.join('');
219
219
  const marker = normalizeLanguage(language) === 'zh'
220
- ? `\n\n[已截断:${toolName} 返回 ${formatSize(originalBytes)},上限为 ${formatSize(TOOL_RESULT_MAX_BYTES)};原因:单个 tool result 超过 1KB,模型消息历史不会看到剩余内容]`
221
- : `\n\n[truncated: ${toolName} returned ${formatSize(originalBytes)}, capped at ${formatSize(TOOL_RESULT_MAX_BYTES)}; reason: single tool result exceeded 1KB, the model message history will not see the rest]`;
220
+ ? `\n\n[已截断:${toolName} 返回 ${formatSize(originalBytes)},上限为 ${formatSize(TOOL_RESULT_MAX_BYTES)};原因:单个 tool result 超过 ${formatSize(TOOL_RESULT_MAX_BYTES)},模型消息历史不会看到剩余内容]`
221
+ : `\n\n[truncated: ${toolName} returned ${formatSize(originalBytes)}, capped at ${formatSize(TOOL_RESULT_MAX_BYTES)}; reason: single tool result exceeded ${formatSize(TOOL_RESULT_MAX_BYTES)}, the model message history will not see the rest]`;
222
222
  return head + marker;
223
223
  }
224
224
 
@@ -62,8 +62,8 @@ SpawnAgent -> (PromptAgent <-> WaitAgent)+ -> CloseAgent -> 最终回复给用
62
62
  isConcurrencySafe: () => false,
63
63
  isReadOnly: () => false,
64
64
  async execute(input, ctx) {
65
- // NB: next_steps is the FIRST envelope field — the registry's 1 KiB
66
- // tail-truncation would eat it if it lived at the end.
65
+ // NB: next_steps is the FIRST envelope field — the registry's
66
+ // model-context tail truncation would eat it if it lived at the end.
67
67
  const ERROR_NEXT_STEPS =
68
68
  'That call failed — see `error`. Either correct the arguments and ' +
69
69
  'retry, or tell the user what went wrong. Do NOT end your turn ' +
@@ -39,8 +39,8 @@ import { consumeNotificationForAgent } from '../sub-agent/notifications.js';
39
39
  /**
40
40
  * Build the status-specific next-step guidance the LLM reads after a wait.
41
41
  * Imperative + names actual tools. Always appears as the FIRST field on
42
- * the envelope (the registry's 1 KiB tail-truncation would otherwise eat
43
- * tail-positioned nudges when `result` is long).
42
+ * the envelope (the registry's model-context tail truncation would
43
+ * otherwise eat tail-positioned nudges when `result` is long).
44
44
  *
45
45
  * @param {string} status
46
46
  * @param {{ timedOut?: boolean, runningInBackground?: boolean, budgetExceeded?: boolean, stale?: boolean }} [opts]