@cloudflare/ai-chat 0.10.0 → 0.10.1

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/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { MessageType } from "./types.js";
2
2
  import { autoTransformMessages } from "./ai-chat-v5-migration.js";
3
- import { Agent, __DO_NOT_USE_WILL_BREAK__agentContext, isDurableObjectMemoryLimitReset } from "agents";
3
+ import { Agent, __DO_NOT_USE_WILL_BREAK__agentContext, __DO_NOT_USE_WILL_BREAK__withInvocationScope, isDurableObjectMemoryLimitReset } from "agents";
4
4
  import { AbortRegistry, AgentToolProgressEmitter, AgentToolStreamProgressThrottle, AutoContinuationController, ChatRecoveryEngine, ChatStreamStalledError, ContinuationState, MAX_BOUND_PARAMS, PreStreamTurns, ResumableStream, ResumeHandshake, STREAM_CLEANUP_DELAY_SECONDS, StreamProgressCreditThrottle, SubmitConcurrencyController, TIMED_OUT, TurnQueue, aiSdkRecoveryCodec, applyChunkToParts, awaitWithDeadline, buildChatRecoveringFrame, buildInClauseStrings, bumpChatRecoveryProgress, chatRecoverySchedulePolicy, classifyAgentToolChildRecovery, cleanupStreamBuffers, clearChatTerminal, clientResolvableToolNames, createChatFiberSnapshot, createToolsFromClientSchemas, drainInteractionApplies, enforceRowSizeLimit, hasIncompleteToolBatch, interceptAgentToolBroadcast, isReplayChunk, iterateWithStallWatchdog, listActiveChatRecoveryIncidents, parseProtocolMessage, partAwaitsClientInteraction, pendingChatTerminal, persistReconstructedOrphan, readChatRecoveryProgress, reconcileMessages, reconcileOrphanPartial, recordChatTerminal, repairInterruptedToolParts, resolveChatRecoveryConfig, resolveToolMergeId, runChatRecoveryExhaustion, sanitizeMessage, sendIfOpen, setChatRecovering, shouldCreditStreamProgress, sweepStaleChatRecoveryIncidents, toolApprovalUpdate, unwrapChatFiberSnapshot, wrapChatFiberSnapshot } from "agents/chat";
5
5
  import { nanoid } from "nanoid";
6
6
  //#region src/index.ts
@@ -1223,12 +1223,12 @@ var AIChatAgent = class AIChatAgent extends Agent {
1223
1223
  const generation = options?.epoch;
1224
1224
  let result;
1225
1225
  try {
1226
- result = await this._turnQueue.enqueue(requestId, () => withAgentSpan(this, "chat_turn", "turn", {
1226
+ result = await this._turnQueue.enqueue(requestId, () => __DO_NOT_USE_WILL_BREAK__withInvocationScope(() => withAgentSpan(this, "chat_turn", "turn", {
1227
1227
  "cloudflare.agents.component": "ai_chat",
1228
1228
  "cloudflare.agents.turn.request_id": requestId,
1229
1229
  "cloudflare.agents.turn.admission": "queue",
1230
1230
  "cloudflare.agents.turn.generation": generation
1231
- }, fn), { generation });
1231
+ }, fn), { detached: true }), { generation });
1232
1232
  } finally {
1233
1233
  const gen = generation ?? this._turnQueue.generation;
1234
1234
  if (this._turnQueue.queuedCount(gen) === 0) this._mergeQueuedUserStartIndexByEpoch.delete(gen);