@cloudflare/think 0.20.0 → 0.20.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-DwPAhQRQ.d.ts → index-CmhSKa6U.d.ts} +19 -1
- package/dist/messengers/index.d.ts +1 -1
- package/dist/messengers/telegram.d.ts +1 -1
- package/dist/think.d.ts +1 -1
- package/dist/think.js +26 -3
- package/dist/think.js.map +1 -1
- package/dist/workflows.d.ts +1 -1
- package/package.json +5 -3
|
@@ -4747,6 +4747,24 @@ declare class Think<
|
|
|
4747
4747
|
* @returns Whether the failure was reported.
|
|
4748
4748
|
*/
|
|
4749
4749
|
private _reportContinuationFailure;
|
|
4750
|
+
/**
|
|
4751
|
+
* Settle the continuation state when an auto-continuation turn ends (#2443).
|
|
4752
|
+
*
|
|
4753
|
+
* A turn only owns `pending` until its stream starts: `_streamResult` moves
|
|
4754
|
+
* that pending to the active slot, freeing `pending` for the NEXT
|
|
4755
|
+
* continuation. A client tool result that lands while this turn is still
|
|
4756
|
+
* streaming (a fast client tool chained across steps) creates that next
|
|
4757
|
+
* pending, and the stream-finalize re-arm fires it. So `pending` is cleared
|
|
4758
|
+
* here only while it still holds this turn's request — a turn that never
|
|
4759
|
+
* streamed (failed, aborted, or produced nothing before its stream started).
|
|
4760
|
+
* Clearing unconditionally would drop the newer pending and stall the chat.
|
|
4761
|
+
*
|
|
4762
|
+
* A newer pending that has not started also covers any `deferred` follow-up:
|
|
4763
|
+
* that result arrived before this turn's stream and the newer continuation
|
|
4764
|
+
* runs after it, so firing the deferred too would run a redundant turn that
|
|
4765
|
+
* replays a transcript ending in assistant text.
|
|
4766
|
+
*/
|
|
4767
|
+
private _settleContinuationTurn;
|
|
4750
4768
|
private _activateDeferredContinuation;
|
|
4751
4769
|
/**
|
|
4752
4770
|
* Queue a continuation turn that does NOT require a live client connection.
|
|
@@ -5730,4 +5748,4 @@ export {
|
|
|
5730
5748
|
Workspace$1 as zn,
|
|
5731
5749
|
MessageConcurrency$1 as zt
|
|
5732
5750
|
};
|
|
5733
|
-
//# sourceMappingURL=index-
|
|
5751
|
+
//# sourceMappingURL=index-CmhSKa6U.d.ts.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
R as TextStreamCallback,
|
|
3
3
|
c as MessengerDefinition,
|
|
4
4
|
n as ChatSdkMessengerOptions
|
|
5
|
-
} from "../index-
|
|
5
|
+
} from "../index-CmhSKa6U.js";
|
|
6
6
|
import { TelegramAdapterConfig } from "@chat-adapter/telegram";
|
|
7
7
|
|
|
8
8
|
//#region src/messengers/telegram.d.ts
|
package/dist/think.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $n as messengerChannel, $t as RunTurnWait, An as TurnConfig, At as ChunkContext, Bn as action, Bt as MessageMetadataCallback, Cn as ThinkSubmissionInspection, Ct as ChatRecoveryConfig, D as DeliveryKind, Dn as ToolCallContext, Dt as ChatRecoveryProgressContext, En as ThinkWallClockSchedule, Et as ChatRecoveryOptions, Fn as TurnTrigger, Ft as ExtensionConfig, Gn as ChannelContext, Gt as PrepareStepResult, Hn as isAction, Ht as PendingApproval, In as TypedToolCall, It as FiberContext, Jn as ChannelDeliverySurface, Jt as ResolvedChatRecoveryConfig, Kn as ChannelDefinition, Kt as RejectExecutionOptions, Ln as TypedToolResult, Lt as FiberRecoveryContext, Mn as TurnInput, Mt as ContextOverflowConfig, Nn as TurnInputMessages, Nt as DeleteSubmissionsOptions, O as DeliveryTag, On as ToolCallDecision, Ot as ChatResponseResult, Pn as TurnResult, Pt as DeliverNoticeOptions, Qn as ThinkChannels, Qt as RunTurnSubmit, Rn as WaitForSubmissionOptions, Rt as ListSubmissionsOptions, Sn as ThinkScheduledTasks, St as ChatOptions, Tn as ThinkTime, Tt as ChatRecoveryExhaustedContext, Un as skills, Ut as PrepareStepContext, Vn as defaultContextOverflowClassifier, Vt as OnStartDegradation, Wn as ChannelCapabilities, Wt as PrepareStepFunction, Xn as ChannelKind, Xt as RunTurnOptions, Yn as ChannelIngress, Yt as RunTurnBase, Zn as NormalizedChannelDefinition, Zt as RunTurnStream, _n as ThinkModel, _t as AddMessagesOptions, an as SkillWorkspaceSeedOptions, bn as ThinkScheduledTaskContext, bt as ChatErrorContext, cn as StepResult, ct as ActionApprovalPolicy, dn as StreamableResult, dt as ActionConfig, en as SaveMessagesOptions, er as MediaEvictionConfig, fn as SubmitMessagesOptions, ft as ActionContext, gn as ThinkIntervalSchedule, gt as ActiveTurn, hn as Think, ht as ActionPermissionSpec, in as SkillSource, ir as ThinkSession, jn as TurnContext, jt as ChunkPart, kn as ToolCallResultContext, kt as ChatStartEvent, ln as StopCondition, lt as ActionAuthorizationContext, mn as TextStreamPart, mt as ActionKind, nn as SessionMessage, nr as CompactionErrorHandler, on as StepConfig, ot as Action, pn as SubmitMessagesResult, pt as ActionIdempotencyKey, qn as ChannelDeliveryPolicy, qt as ReplyAttachment, rn as SkillRunContext, rr as SessionContextOptions, sn as StepContext, st as ActionApprovalDescriptor, tn as SaveMessagesResult, tr as CompactAfterOptions, un as StreamCallback, ut as ActionAuthorizationDecision, vn as ThinkModelId, vt as CancelSubmissionResult, wn as ThinkSubmissionStatus, wt as ChatRecoveryContext, xn as ThinkScheduledTaskSchedule, xt as ChatInterruptedInfo, yn as ThinkScheduledTask, yt as ChatErrorClassification, zn as Workspace, zt as MessageConcurrency } from "./index-
|
|
1
|
+
import { $n as messengerChannel, $t as RunTurnWait, An as TurnConfig, At as ChunkContext, Bn as action, Bt as MessageMetadataCallback, Cn as ThinkSubmissionInspection, Ct as ChatRecoveryConfig, D as DeliveryKind, Dn as ToolCallContext, Dt as ChatRecoveryProgressContext, En as ThinkWallClockSchedule, Et as ChatRecoveryOptions, Fn as TurnTrigger, Ft as ExtensionConfig, Gn as ChannelContext, Gt as PrepareStepResult, Hn as isAction, Ht as PendingApproval, In as TypedToolCall, It as FiberContext, Jn as ChannelDeliverySurface, Jt as ResolvedChatRecoveryConfig, Kn as ChannelDefinition, Kt as RejectExecutionOptions, Ln as TypedToolResult, Lt as FiberRecoveryContext, Mn as TurnInput, Mt as ContextOverflowConfig, Nn as TurnInputMessages, Nt as DeleteSubmissionsOptions, O as DeliveryTag, On as ToolCallDecision, Ot as ChatResponseResult, Pn as TurnResult, Pt as DeliverNoticeOptions, Qn as ThinkChannels, Qt as RunTurnSubmit, Rn as WaitForSubmissionOptions, Rt as ListSubmissionsOptions, Sn as ThinkScheduledTasks, St as ChatOptions, Tn as ThinkTime, Tt as ChatRecoveryExhaustedContext, Un as skills, Ut as PrepareStepContext, Vn as defaultContextOverflowClassifier, Vt as OnStartDegradation, Wn as ChannelCapabilities, Wt as PrepareStepFunction, Xn as ChannelKind, Xt as RunTurnOptions, Yn as ChannelIngress, Yt as RunTurnBase, Zn as NormalizedChannelDefinition, Zt as RunTurnStream, _n as ThinkModel, _t as AddMessagesOptions, an as SkillWorkspaceSeedOptions, bn as ThinkScheduledTaskContext, bt as ChatErrorContext, cn as StepResult, ct as ActionApprovalPolicy, dn as StreamableResult, dt as ActionConfig, en as SaveMessagesOptions, er as MediaEvictionConfig, fn as SubmitMessagesOptions, ft as ActionContext, gn as ThinkIntervalSchedule, gt as ActiveTurn, hn as Think, ht as ActionPermissionSpec, in as SkillSource, ir as ThinkSession, jn as TurnContext, jt as ChunkPart, kn as ToolCallResultContext, kt as ChatStartEvent, ln as StopCondition, lt as ActionAuthorizationContext, mn as TextStreamPart, mt as ActionKind, nn as SessionMessage, nr as CompactionErrorHandler, on as StepConfig, ot as Action, pn as SubmitMessagesResult, pt as ActionIdempotencyKey, qn as ChannelDeliveryPolicy, qt as ReplyAttachment, rn as SkillRunContext, rr as SessionContextOptions, sn as StepContext, st as ActionApprovalDescriptor, tn as SaveMessagesResult, tr as CompactAfterOptions, un as StreamCallback, ut as ActionAuthorizationDecision, vn as ThinkModelId, vt as CancelSubmissionResult, wn as ThinkSubmissionStatus, wt as ChatRecoveryContext, xn as ThinkScheduledTaskSchedule, xt as ChatInterruptedInfo, yn as ThinkScheduledTask, yt as ChatErrorClassification, zn as Workspace, zt as MessageConcurrency } from "./index-CmhSKa6U.js";
|
|
2
2
|
import { h as WorkspaceLike } from "./workspace-CNeXc2vl.js";
|
|
3
3
|
import { a as FetchResponseMode, i as FetchRedirectPolicy, n as FetchBindingTarget, o as FetchResult, r as FetchErrorCode, s as FetchToolEvent, t as CreateFetchToolsOptions } from "./fetch-By3eIQ-a.js";
|
|
4
4
|
export { Action, ActionApprovalDescriptor, ActionApprovalPolicy, ActionAuthorizationContext, ActionAuthorizationDecision, ActionConfig, ActionContext, ActionIdempotencyKey, ActionKind, ActionPermissionSpec, ActiveTurn, AddMessagesOptions, CancelSubmissionResult, type ChannelCapabilities, type ChannelContext, type ChannelDefinition, type ChannelDeliveryPolicy, type ChannelDeliverySurface, type ChannelIngress, type ChannelKind, ChatErrorClassification, ChatErrorContext, ChatInterruptedInfo, ChatOptions, type ChatRecoveryConfig, type ChatRecoveryContext, type ChatRecoveryExhaustedContext, type ChatRecoveryOptions, type ChatRecoveryProgressContext, type ChatResponseResult, ChatStartEvent, ChunkContext, ChunkPart, type CompactAfterOptions, type CompactionErrorHandler, ContextOverflowConfig, type CreateFetchToolsOptions, DeleteSubmissionsOptions, DeliverNoticeOptions, type DeliveryKind, type DeliveryTag, ExtensionConfig, type FetchBindingTarget, type FetchErrorCode, type FetchRedirectPolicy, type FetchResponseMode, type FetchResult, type FetchToolEvent, type FiberContext, type FiberRecoveryContext, ListSubmissionsOptions, type MediaEvictionConfig, type MessageConcurrency, MessageMetadataCallback, type NormalizedChannelDefinition, OnStartDegradation, PendingApproval, PrepareStepContext, type PrepareStepFunction, type PrepareStepResult, RejectExecutionOptions, ReplyAttachment, type ResolvedChatRecoveryConfig, RunTurnBase, RunTurnOptions, RunTurnStream, RunTurnSubmit, RunTurnWait, type SaveMessagesOptions, type SaveMessagesResult, ThinkSession as Session, ThinkSession, type SessionContextOptions, type SessionMessage, type SkillRunContext, type SkillSource, type SkillWorkspaceSeedOptions, StepConfig, StepContext, type StepResult, type StopCondition, StreamCallback, StreamableResult, SubmitMessagesOptions, SubmitMessagesResult, type TextStreamPart, Think, type ThinkChannels, ThinkIntervalSchedule, ThinkModel, ThinkModelId, ThinkScheduledTask, ThinkScheduledTaskContext, ThinkScheduledTaskSchedule, ThinkScheduledTasks, ThinkSubmissionInspection, ThinkSubmissionStatus, ThinkTime, ThinkWallClockSchedule, ToolCallContext, ToolCallDecision, ToolCallResultContext, TurnConfig, TurnContext, TurnInput, TurnInputMessages, TurnResult, TurnTrigger, type TypedToolCall, type TypedToolResult, WaitForSubmissionOptions, Workspace, type WorkspaceLike, action, defaultContextOverflowClassifier, isAction, messengerChannel, skills };
|
package/dist/think.js
CHANGED
|
@@ -10637,9 +10637,7 @@ var Think = class Think extends Agent {
|
|
|
10637
10637
|
throw error;
|
|
10638
10638
|
} finally {
|
|
10639
10639
|
this._aborts.remove(requestId);
|
|
10640
|
-
|
|
10641
|
-
this._continuation.clearPending();
|
|
10642
|
-
this._activateDeferredContinuation();
|
|
10640
|
+
this._settleContinuationTurn(requestId, streamed);
|
|
10643
10641
|
}
|
|
10644
10642
|
}
|
|
10645
10643
|
}).catch((error) => {
|
|
@@ -10692,6 +10690,31 @@ var Think = class Think extends Agent {
|
|
|
10692
10690
|
});
|
|
10693
10691
|
return true;
|
|
10694
10692
|
}
|
|
10693
|
+
/**
|
|
10694
|
+
* Settle the continuation state when an auto-continuation turn ends (#2443).
|
|
10695
|
+
*
|
|
10696
|
+
* A turn only owns `pending` until its stream starts: `_streamResult` moves
|
|
10697
|
+
* that pending to the active slot, freeing `pending` for the NEXT
|
|
10698
|
+
* continuation. A client tool result that lands while this turn is still
|
|
10699
|
+
* streaming (a fast client tool chained across steps) creates that next
|
|
10700
|
+
* pending, and the stream-finalize re-arm fires it. So `pending` is cleared
|
|
10701
|
+
* here only while it still holds this turn's request — a turn that never
|
|
10702
|
+
* streamed (failed, aborted, or produced nothing before its stream started).
|
|
10703
|
+
* Clearing unconditionally would drop the newer pending and stall the chat.
|
|
10704
|
+
*
|
|
10705
|
+
* A newer pending that has not started also covers any `deferred` follow-up:
|
|
10706
|
+
* that result arrived before this turn's stream and the newer continuation
|
|
10707
|
+
* runs after it, so firing the deferred too would run a redundant turn that
|
|
10708
|
+
* replays a transcript ending in assistant text.
|
|
10709
|
+
*/
|
|
10710
|
+
_settleContinuationTurn(requestId, streamed) {
|
|
10711
|
+
const pending = this._continuation.pending;
|
|
10712
|
+
if (pending?.requestId === requestId) {
|
|
10713
|
+
if (!streamed) this._continuation.sendResumeNone();
|
|
10714
|
+
this._continuation.clearPending();
|
|
10715
|
+
} else if (pending && !pending.pastCoalesce) this._continuation.clearDeferred();
|
|
10716
|
+
this._activateDeferredContinuation();
|
|
10717
|
+
}
|
|
10695
10718
|
_activateDeferredContinuation() {
|
|
10696
10719
|
this._autoContinuation.activateDeferredAndReschedule();
|
|
10697
10720
|
}
|