@yeaft/webchat-agent 1.0.633 → 1.0.635

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 (35) hide show
  1. package/local-runtime/version.json +1 -1
  2. package/local-runtime/web/app.bundle.js +145 -127
  3. package/local-runtime/web/app.bundle.js.gz +0 -0
  4. package/local-runtime/web/index.html +2 -2
  5. package/local-runtime/web/style.bundle.css +1 -1
  6. package/local-runtime/web/style.bundle.css.gz +0 -0
  7. package/package.json +1 -1
  8. package/yeaft/conversation/search.js +25 -9
  9. package/yeaft/engine.js +116 -14
  10. package/yeaft/person/autonomy.js +59 -0
  11. package/yeaft/person/behavior.js +30 -0
  12. package/yeaft/person/capabilities.js +4 -2
  13. package/yeaft/person/capability-experience.js +1 -1
  14. package/yeaft/person/contracts.js +25 -4
  15. package/yeaft/person/execution-goal.js +119 -0
  16. package/yeaft/person/execution-protocol.js +6 -3
  17. package/yeaft/person/inspection.js +1 -0
  18. package/yeaft/person/runtime.js +69 -12
  19. package/yeaft/person/service.js +25 -8
  20. package/yeaft/person/sqlite-repository.js +4 -1
  21. package/yeaft/person/sqlite-store.js +204 -21
  22. package/yeaft/person/task-host.js +25 -6
  23. package/yeaft/person/tool-arguments.js +3 -1
  24. package/yeaft/query-progress.js +201 -0
  25. package/yeaft/sub-agent/prompt-queue.js +3 -0
  26. package/yeaft/sub-agent/result-reference.js +13 -0
  27. package/yeaft/sub-agent/runner.js +11 -6
  28. package/yeaft/sub-agent/task-identity.js +46 -0
  29. package/yeaft/tools/agent.js +73 -2
  30. package/yeaft/tools/history-search.js +28 -8
  31. package/yeaft/tools/types.js +2 -0
  32. package/yeaft/tools/wait-agent.js +21 -1
  33. package/yeaft/tools/web-fetch.js +9 -0
  34. package/yeaft/web-bridge.js +25 -2
  35. package/yeaft/work-center/runner.js +1 -1
@@ -4153,6 +4153,27 @@ export function __testHandleEngineEvent(event, hctx) {
4153
4153
  }
4154
4154
 
4155
4155
  function handleEngineEvent(event, hctx) {
4156
+ // Observability is not provider activity: never touch watchdogs, text or history.
4157
+ if (event.type === 'query_progress') {
4158
+ const counters = ['revision', 'modelRequests', 'toolExecutions', 'reusedCalls', 'repeatedCalls', 'failedCalls', 'stagnantBatches'];
4159
+ if (hctx.queryProgressTerminal || hctx.signal?.aborted
4160
+ || event.turnId !== hctx.turnId || event.sessionId !== hctx.sessionId || event.vpId !== hctx.vpId
4161
+ || event.threadId !== (hctx.threadId || 'main')
4162
+ || ![event.turnId, event.sessionId, event.vpId].every(value => typeof value === 'string' && value.length > 0)
4163
+ || !counters.every(key => Number.isSafeInteger(event[key]) && event[key] >= 0)
4164
+ || event.revision <= (hctx.queryProgressRevision || 0)
4165
+ || !['running', 'warning', 'recovering', 'stopped'].includes(event.stage)
4166
+ || ![null, 'repeated_results', 'repeated_failure'].includes(event.reason)
4167
+ || !(event.lastEvidenceAt === null || (Number.isFinite(event.lastEvidenceAt) && event.lastEvidenceAt >= 0))) return;
4168
+ hctx.queryProgressRevision = event.revision;
4169
+ const { turnId, threadId, sessionId, vpId, revision, modelRequests, toolExecutions, reusedCalls,
4170
+ repeatedCalls, failedCalls, stage, reason, lastEvidenceAt, stagnantBatches } = event;
4171
+ sendToServer({ type: 'yeaft_output', conversationId: yeaftConversationId, sessionId, vpId, turnId, threadId,
4172
+ event: { type: 'query_progress', turnId, threadId, sessionId, vpId, revision, modelRequests,
4173
+ toolExecutions, reusedCalls, repeatedCalls, failedCalls, stage, reason, lastEvidenceAt, stagnantBatches } });
4174
+ return;
4175
+ }
4176
+ if (event.type === 'aborted' || (event.type === 'turn_end' && event.terminal === true)) hctx.queryProgressTerminal = true;
4156
4177
  // Hidden progress has no wire/history/status projection and must not flush
4157
4178
  // pending visible text or resume a paused/terminal provider watchdog.
4158
4179
  if (event.type === 'provider_activity') {
@@ -4437,7 +4458,7 @@ function handleEngineEvent(event, hctx) {
4437
4458
  }
4438
4459
  break;
4439
4460
  }
4440
- if (event.stopReason === 'error') {
4461
+ if (event.stopReason === 'error' || event.stopReason === 'no_progress') {
4441
4462
  if (typeof hctx.markEngineTerminal === 'function') {
4442
4463
  hctx.markEngineTerminal('error', hctx.lastEngineErrorDetail || event.detail || null);
4443
4464
  }
@@ -4694,7 +4715,7 @@ function handleEngineEvent(event, hctx) {
4694
4715
  // Move the broker out of its running-only `retrying` state here so
4695
4716
  // reconnect snapshots cannot resurrect a finished Session as active.
4696
4717
  maybeTransitionVpStatus(hctx, 'error');
4697
- const errMsg = event.error?.message || 'Unknown error';
4718
+ const errMsg = (typeof event.error === 'string' ? event.error : event.error?.message) || 'Unknown error';
4698
4719
  const retryAttempts = Number.isFinite(event.retryAttempts) ? event.retryAttempts : 0;
4699
4720
  const exhaustedIdle = event.reason === 'stream_idle_timeout' && event.retryExhausted;
4700
4721
  const contentPolicyDenied = event.reason === 'content_policy_denied'
@@ -4706,6 +4727,7 @@ function handleEngineEvent(event, hctx) {
4706
4727
  : errMsg;
4707
4728
  hctx.lastEngineErrorDetail = {
4708
4729
  message: visibleErrMsg,
4730
+ ...(event.code ? { code: event.code } : {}),
4709
4731
  ...(event.reason ? { reason: event.reason } : {}),
4710
4732
  ...(event.retryExhausted !== undefined ? { retryExhausted: !!event.retryExhausted } : {}),
4711
4733
  ...(Number.isFinite(event.retryAttempts) ? { retryAttempts: event.retryAttempts } : {}),
@@ -8028,6 +8050,7 @@ export const __testHooks = {
8028
8050
  projectVisibleHistoryChunkMessages,
8029
8051
  persistInboundMessageOnceByMsgId,
8030
8052
  buildPendingRescueEnvelope,
8053
+ runVpTurnForTest: runVpTurn,
8031
8054
  runYeaftSessionSendForTest(msg) {
8032
8055
  return runYeaftSessionSend(msg);
8033
8056
  },
@@ -1396,7 +1396,7 @@ export class WorkItemRunner {
1396
1396
  }
1397
1397
  // Provider activity is liveness-only; keep control handling above, but
1398
1398
  // never turn it into durable Run progress or a UI broadcast.
1399
- if (event?.type === 'provider_activity') continue;
1399
+ if (event?.type === 'provider_activity' || event?.type === 'query_progress') continue;
1400
1400
  if (event?.type === 'loop') {
1401
1401
  loopCount += 1;
1402
1402
  this.store.appendRunLoop?.(run.id, ownerBootId, run.leaseEpoch, {