@yeaft/webchat-agent 1.0.514 → 1.0.516

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.514",
3
+ "version": "1.0.516",
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
@@ -1250,8 +1250,8 @@ export class Engine {
1250
1250
  }
1251
1251
 
1252
1252
  /**
1253
- * Build the system prompt with the AMS-rendered Memory block, the
1254
- * Active Scope block, and skill content. The legacy multi-path
1253
+ * Build the system prompt with the AMS-rendered Memory block, routing
1254
+ * metadata, and skill content. The legacy multi-path
1255
1255
  * Memory injection (FTS-formatted + AMS snapshot + Layer-A summaries +
1256
1256
  * userProfile + coreMemory) was retired in DESIGN-PROMPT v1; callers
1257
1257
  * now thread a single `memoryInjection` string composed upstream from
@@ -1260,8 +1260,7 @@ export class Engine {
1260
1260
  * Routes through `buildWorkerPrompt`, which:
1261
1261
  * - Lays in the persona-as-identity block (or Yeaft identity fallback)
1262
1262
  * - Adds the Memory section (passed in as `memoryInjection`)
1263
- * - Adds the structured Active Scope block (`activeScope`)
1264
- * - Forwards optional `taskCtx` for the legacy task-context sub-block
1263
+ * - Adds multi-VP routing metadata from `activeScope` when applicable
1265
1264
  *
1266
1265
  * @param {object} args
1267
1266
  * @param {string} args.prompt — user prompt (for skill relevance matching)
@@ -1273,11 +1272,10 @@ export class Engine {
1273
1272
  * @param {string} [args.projectLabel] — current Project name and id for prompt attribution
1274
1273
  * @param {string} [args.workCenterInstructions] — frozen Agent-level Work Center policy
1275
1274
  * @param {string} [args.projectDoc] — resolved CLAUDE.md / AGENTS.md text (already truncated)
1276
- * @param {object} [args.taskCtx] — legacy task-context sub-block (optional)
1277
1275
  * @param {string} [args.explicitSkillName] — leading /skill:<name> command, if present
1278
1276
  * @returns {string}
1279
1277
  */
1280
- #buildSystemPrompt({ prompt, memoryInjection, vpPersona, activeScope, sessionAnnouncement, projectInstruction, projectLabel, workCenterInstructions, projectDoc, taskCtx, activeTasks, collabToolPolicy = null, activeToolNames = null, promptNotices = [], explicitSkillName, resolvedSkillContent = null } = {}) {
1278
+ #buildSystemPrompt({ prompt, memoryInjection, vpPersona, activeScope, sessionAnnouncement, projectInstruction, projectLabel, workCenterInstructions, projectDoc, promptNotices = [], explicitSkillName, resolvedSkillContent = null } = {}) {
1281
1279
  // #runQuery resolves Skill selection at each provider-request boundary so
1282
1280
  // a live Plugin policy change cannot leave stale content in the next prompt.
1283
1281
  // Keep the local fallback for internal callers that do not need selection
@@ -1292,21 +1290,8 @@ export class Engine {
1292
1290
  }
1293
1291
  }
1294
1292
 
1295
- // Prompt guidance must describe the same canonical capability
1296
- // intersection that reaches provider schemas and execution.
1297
- const registeredToolNames = this.#toolRegistry
1298
- ? this.#toolRegistry.getToolNames({
1299
- plugins: this.#config?.plugins,
1300
- collabToolPolicy,
1301
- })
1302
- : Array.from(this.#tools.keys());
1303
- const toolNames = activeToolNames instanceof Set
1304
- ? registeredToolNames.filter(name => activeToolNames.has(name))
1305
- : registeredToolNames;
1306
-
1307
1293
  return buildWorkerPrompt({
1308
1294
  language: this.#config.language || 'en',
1309
- toolNames,
1310
1295
  memoryInjection,
1311
1296
  skillContent,
1312
1297
  vpPersona,
@@ -1317,8 +1302,6 @@ export class Engine {
1317
1302
  workCenterInstructions,
1318
1303
  projectDoc,
1319
1304
  runtimePlatform: getRuntimePlatformInfo(),
1320
- taskCtx,
1321
- activeTasks,
1322
1305
  promptNotices,
1323
1306
  // Worker-shape harness is descriptive metadata for human inspection;
1324
1307
  // production prompts skip it to save tokens. Re-enable via env when
@@ -1453,19 +1436,14 @@ export class Engine {
1453
1436
  // VP-aware tool). Undefined when running in non-group / no-VP flows.
1454
1437
  router: vpCtx?.router,
1455
1438
  senderVpId: vpCtx?.senderVpId,
1456
- // Active VP persona — surfaced so tools like `StartPlan` can read
1457
- // the optional `planInstruction` override without re-reading
1458
- // role.md. Mirrors the symmetry already present in
1459
- // `parentEngineDeps.parentVpPersona` below — sub-agents inherit it
1460
- // through the parent deps; tools at this level read it directly.
1439
+ // Active VP persona for VP-aware tools and inherited sub-agent context.
1461
1440
  // Null in non-VP / test contexts.
1462
1441
  vpPersona: vpCtx?.vpPersona || null,
1463
1442
  inboundEnvelope: vpCtx?.inboundEnvelope,
1464
1443
  taskId: vpCtx?.taskId,
1465
1444
  taskMembers: vpCtx?.taskMembers,
1466
- // TodoWrite per-VP cache hooks. Threaded from web-bridge so each
1467
- // VP keeps its own todo list (see todo-write.js, web-bridge.js).
1468
- // Null in non-VP / test contexts — tools tolerate missing slots.
1445
+ // Legacy todo cache hooks retained for embedding callers and replay.
1446
+ // Native checklist tools are no longer registered.
1469
1447
  getCurrentTodos: vpCtx?.getCurrentTodos || null,
1470
1448
  setCurrentTodos: vpCtx?.setCurrentTodos || null,
1471
1449
  askUser: typeof vpCtx?.askUser === 'function'
@@ -2306,18 +2284,13 @@ export class Engine {
2306
2284
  }))
2307
2285
  : [];
2308
2286
 
2309
- // ─── Active Scope (DESIGN-PROMPT §3 ④) ──────────────────────
2310
- // Structured per-turn scope summary: session + vp + members + envelope routing
2311
- // info. Long-form scope content lives in AMS — this block carries
2312
- // only IDs + tiny labels. (Feature scope retired 2026-05-13.)
2313
- const activeSessionTopics = topicScopesForResident
2314
- .map(scope => scope.replace(/^sessions\/[^/]+\/topic\//, ''));
2287
+ // ─── Multi-VP routing scope ──────────────────────────────────
2288
+ // Only identity and peer membership affect the routing contract rendered in
2289
+ // the system prompt. Session bookkeeping and inferred topics remain in their
2290
+ // owning runtime/memory paths instead of being mirrored into prompt metadata.
2315
2291
  const activeScope = {
2316
- sessionId: sessionId || '',
2317
- sessionMember: ownVpIdForAms || '',
2292
+ vpId: ownVpIdForAms || '',
2318
2293
  sessionMembers: Array.isArray(sessionMembers) ? sessionMembers : [],
2319
- sessionTopics: activeSessionTopics,
2320
- envelope: inboundEnvelope || null,
2321
2294
  };
2322
2295
 
2323
2296
  let projectDocSource = this.#getProjectDocBlock(workDir);
@@ -2332,11 +2305,6 @@ export class Engine {
2332
2305
  && typeof this.#taskManager.listActiveTasks === 'function'
2333
2306
  ? this.#taskManager.listActiveTasks(runtimeSessionId)
2334
2307
  : [];
2335
- let activeTasks = this.#taskManager
2336
- ? this.#taskManager.renderActiveTasksForPrompt(runtimeSessionId, {
2337
- language: this.#config.language || 'en',
2338
- })
2339
- : '';
2340
2308
  const registeredToolNames = this.#toolRegistry
2341
2309
  ? this.#toolRegistry.getToolNames({
2342
2310
  collabToolPolicy: effectiveCollabToolPolicy,
@@ -2407,9 +2375,6 @@ export class Engine {
2407
2375
  projectLabel,
2408
2376
  workCenterInstructions,
2409
2377
  projectDoc: projectDocContext.text,
2410
- activeTasks,
2411
- collabToolPolicy: effectiveCollabToolPolicy,
2412
- activeToolNames,
2413
2378
  promptNotices,
2414
2379
  explicitSkillName,
2415
2380
  resolvedSkillContent,
@@ -2603,12 +2568,6 @@ export class Engine {
2603
2568
  // control to other VPs cleanly. Reset to null at the top of every
2604
2569
  // outer-loop iteration so the flag never carries across turns.
2605
2570
  let endTurnRequested = null;
2606
- // StartPlan is a control tool. If the model emits only the checklist after
2607
- // it, there is no new workspace fact to interpret: persist the plan and
2608
- // close the turn instead of spending another provider request on a
2609
- // TodoWrite-only control round. A later user turn can continue the first
2610
- // pending step; a batch that includes a real work tool always continues.
2611
- let planBootstrapPending = false;
2612
2571
 
2613
2572
  // LLM retry bookkeeping (rate-limit / 5xx / transient network errors).
2614
2573
  // Counts CONSECUTIVE retryable failures on the same turn — reset to 0
@@ -2825,11 +2784,6 @@ export class Engine {
2825
2784
  && typeof this.#taskManager.listActiveTasks === 'function'
2826
2785
  ? this.#taskManager.listActiveTasks(runtimeSessionId)
2827
2786
  : [];
2828
- activeTasks = this.#taskManager
2829
- ? this.#taskManager.renderActiveTasksForPrompt(runtimeSessionId, {
2830
- language: this.#config.language || 'en',
2831
- })
2832
- : '';
2833
2787
  activeToolNames = resolveCurrentActiveToolNames();
2834
2788
  for (const name of [...discoveredToolNames]) {
2835
2789
  if (this.#toolRegistry?.has(name)) activeToolNames?.add(name);
@@ -4686,9 +4640,6 @@ export class Engine {
4686
4640
  reusedCallId: reusedReadOnlyCallId,
4687
4641
  });
4688
4642
 
4689
- if (!skipped && !duplicateCallSuppressed && !reusedReadOnlyResult && tc.name === 'StartPlan') {
4690
- planBootstrapPending = true;
4691
- }
4692
4643
  if (!skipped && !duplicateCallSuppressed && !reusedReadOnlyResult
4693
4644
  && !readOnlyToolReuseDisabled && cacheableTool) {
4694
4645
  readOnlyToolResults.set(duplicateKey, {
@@ -4783,36 +4734,6 @@ export class Engine {
4783
4734
  break;
4784
4735
  }
4785
4736
 
4786
- // A plan bootstrap that produced only a TodoWrite has no executable work
4787
- // to feed back to the provider. Close it here. This is intentionally
4788
- // narrow: StartPlan + TodoWrite is a valid planning result, but a batch
4789
- // containing any other tool must continue so the model can inspect its
4790
- // result before deciding what to do next.
4791
- const onlyPlanControls = planBootstrapPending
4792
- && toolCalls.length > 0
4793
- && toolCalls.every(call => call.name === 'StartPlan' || call.name === 'TodoWrite')
4794
- && toolCalls.some(call => call.name === 'TodoWrite')
4795
- && !toolBatchBarrier
4796
- && !endTurnRequested
4797
- && !abortedDuringTools
4798
- && !signal?.aborted;
4799
- if (onlyPlanControls) {
4800
- const hasPendingStep = toolCalls
4801
- .filter(call => call.name === 'TodoWrite')
4802
- .some(call => Array.isArray(call.input?.todos)
4803
- && call.input.todos.some(todo => todo?.status === 'pending' || todo?.status === 'in_progress'));
4804
- yield {
4805
- type: 'turn_end',
4806
- turnNumber,
4807
- stopReason: 'plan_recorded',
4808
- detail: { nextStep: hasPendingStep ? 'pending_work_tools' : 'none', toolCount: toolCalls.length },
4809
- threadId,
4810
- terminal: true,
4811
- };
4812
- break;
4813
- }
4814
- planBootstrapPending = false;
4815
-
4816
4737
  // A batch barrier deliberately returns control to the provider. Any
4817
4738
  // handoff requested by an earlier call belongs to the invalidated plan
4818
4739
  // and must not leak into a later provider-generated batch.