@tansr/sdk 0.4.0 → 0.4.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.d.ts +76 -45
- package/dist/index.js +15 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -10087,6 +10087,50 @@ interface Tool<Args = unknown> {
|
|
|
10087
10087
|
execute(args: Args, ctx: ToolContext): Promise<ToolResult>;
|
|
10088
10088
|
}
|
|
10089
10089
|
|
|
10090
|
+
/**
|
|
10091
|
+
* T-D6 — 会话待办台账(内存态,不做持久化)。
|
|
10092
|
+
*
|
|
10093
|
+
* 设计要点:
|
|
10094
|
+
* - `TodoItem` 形状与 protocol `plan.todo.updated` 事件的 items 对齐
|
|
10095
|
+
* (id/content/status 三字段;status 在事件侧是宽松 string,本侧收窄为枚举);
|
|
10096
|
+
* - 依赖注入:`onChange` 由工厂(内核会话装配处)注入,store 本身不发事件、
|
|
10097
|
+
* 不落盘——外部在回调里接线 `plan.todo.updated` 事件与(未来的)持久化;
|
|
10098
|
+
* - 所有对外暴露的数组/对象均为副本,防止调用方或回调持引用后污染内部状态。
|
|
10099
|
+
*/
|
|
10100
|
+
/** 待办状态全集(as const 元组,供 zod enum 与类型共用一份事实源) */
|
|
10101
|
+
declare const TODO_STATUSES: readonly ["pending", "in_progress", "completed", "cancelled"];
|
|
10102
|
+
type TodoStatus = (typeof TODO_STATUSES)[number];
|
|
10103
|
+
interface TodoItem {
|
|
10104
|
+
id: string;
|
|
10105
|
+
content: string;
|
|
10106
|
+
status: TodoStatus;
|
|
10107
|
+
}
|
|
10108
|
+
/**
|
|
10109
|
+
* merge 输入:按 id 定位,已知 id 只覆盖给定字段(未给字段保留原值);
|
|
10110
|
+
* 未知 id 追加为新项,此时 content 与 status 必须齐全(TodoWrite 工具
|
|
10111
|
+
* 的 schema 恒为全量,不会触发缺字段路径;此约束仅防御其他内部调用方)。
|
|
10112
|
+
*/
|
|
10113
|
+
type TodoPatch = {
|
|
10114
|
+
id: string;
|
|
10115
|
+
} & Partial<Omit<TodoItem, 'id'>>;
|
|
10116
|
+
interface TodoStoreOptions {
|
|
10117
|
+
/** 变更回调:replace/merge 每次调用后触发一次,载荷为变更后完整列表的独立副本 */
|
|
10118
|
+
onChange?: (items: TodoItem[]) => void;
|
|
10119
|
+
}
|
|
10120
|
+
declare class TodoStore {
|
|
10121
|
+
#private;
|
|
10122
|
+
constructor(options?: TodoStoreOptions);
|
|
10123
|
+
/** 当前列表(副本;修改返回值不影响内部状态) */
|
|
10124
|
+
list(): TodoItem[];
|
|
10125
|
+
/** 全量替换(含替换为空 = 清空台账),返回变更后快照 */
|
|
10126
|
+
replace(items: readonly TodoItem[]): TodoItem[];
|
|
10127
|
+
/**
|
|
10128
|
+
* 按 id 合并:已知 id 原位覆盖给定字段;未知 id 按提交顺序追加到尾部。
|
|
10129
|
+
* 返回变更后快照。未知 id 缺 content/status 视为调用方契约错误,抛 TypeError。
|
|
10130
|
+
*/
|
|
10131
|
+
merge(patches: readonly TodoPatch[]): TodoItem[];
|
|
10132
|
+
}
|
|
10133
|
+
|
|
10090
10134
|
/**
|
|
10091
10135
|
* T-C1 — 测试用顺序工具执行器(ToolExecutor 的最小实现)。
|
|
10092
10136
|
*
|
|
@@ -10820,50 +10864,6 @@ type OnToolDecision = (record: ToolDecisionRecord) => void;
|
|
|
10820
10864
|
*/
|
|
10821
10865
|
type CaptureFileCheckpoints = (paths: readonly string[]) => Promise<void> | void;
|
|
10822
10866
|
|
|
10823
|
-
/**
|
|
10824
|
-
* T-D6 — 会话待办台账(内存态,不做持久化)。
|
|
10825
|
-
*
|
|
10826
|
-
* 设计要点:
|
|
10827
|
-
* - `TodoItem` 形状与 protocol `plan.todo.updated` 事件的 items 对齐
|
|
10828
|
-
* (id/content/status 三字段;status 在事件侧是宽松 string,本侧收窄为枚举);
|
|
10829
|
-
* - 依赖注入:`onChange` 由工厂(内核会话装配处)注入,store 本身不发事件、
|
|
10830
|
-
* 不落盘——外部在回调里接线 `plan.todo.updated` 事件与(未来的)持久化;
|
|
10831
|
-
* - 所有对外暴露的数组/对象均为副本,防止调用方或回调持引用后污染内部状态。
|
|
10832
|
-
*/
|
|
10833
|
-
/** 待办状态全集(as const 元组,供 zod enum 与类型共用一份事实源) */
|
|
10834
|
-
declare const TODO_STATUSES: readonly ["pending", "in_progress", "completed", "cancelled"];
|
|
10835
|
-
type TodoStatus = (typeof TODO_STATUSES)[number];
|
|
10836
|
-
interface TodoItem {
|
|
10837
|
-
id: string;
|
|
10838
|
-
content: string;
|
|
10839
|
-
status: TodoStatus;
|
|
10840
|
-
}
|
|
10841
|
-
/**
|
|
10842
|
-
* merge 输入:按 id 定位,已知 id 只覆盖给定字段(未给字段保留原值);
|
|
10843
|
-
* 未知 id 追加为新项,此时 content 与 status 必须齐全(TodoWrite 工具
|
|
10844
|
-
* 的 schema 恒为全量,不会触发缺字段路径;此约束仅防御其他内部调用方)。
|
|
10845
|
-
*/
|
|
10846
|
-
type TodoPatch = {
|
|
10847
|
-
id: string;
|
|
10848
|
-
} & Partial<Omit<TodoItem, 'id'>>;
|
|
10849
|
-
interface TodoStoreOptions {
|
|
10850
|
-
/** 变更回调:replace/merge 每次调用后触发一次,载荷为变更后完整列表的独立副本 */
|
|
10851
|
-
onChange?: (items: TodoItem[]) => void;
|
|
10852
|
-
}
|
|
10853
|
-
declare class TodoStore {
|
|
10854
|
-
#private;
|
|
10855
|
-
constructor(options?: TodoStoreOptions);
|
|
10856
|
-
/** 当前列表(副本;修改返回值不影响内部状态) */
|
|
10857
|
-
list(): TodoItem[];
|
|
10858
|
-
/** 全量替换(含替换为空 = 清空台账),返回变更后快照 */
|
|
10859
|
-
replace(items: readonly TodoItem[]): TodoItem[];
|
|
10860
|
-
/**
|
|
10861
|
-
* 按 id 合并:已知 id 原位覆盖给定字段;未知 id 按提交顺序追加到尾部。
|
|
10862
|
-
* 返回变更后快照。未知 id 缺 content/status 视为调用方契约错误,抛 TypeError。
|
|
10863
|
-
*/
|
|
10864
|
-
merge(patches: readonly TodoPatch[]): TodoItem[];
|
|
10865
|
-
}
|
|
10866
|
-
|
|
10867
10867
|
/**
|
|
10868
10868
|
* T-D6 — 交互通道抽象:AskUser 工具与表面层之间的依赖注入缝。
|
|
10869
10869
|
*
|
|
@@ -16588,6 +16588,15 @@ declare function assemblePlatformModel(options: AssemblePlatformModelOptions): P
|
|
|
16588
16588
|
|
|
16589
16589
|
/** 生成张数 wire 帽(与网关 TwpImagegenRequestSchema 同值;超模型帽由网关再钳)。 */
|
|
16590
16590
|
declare const IMAGEGEN_TOOL_MAX_N = 4;
|
|
16591
|
+
/**
|
|
16592
|
+
* 客户端硬超时缺省(毫秒;kernel Tool.timeoutMs 位)= 服务端生成预算 120s
|
|
16593
|
+
* (tansr-api IMAGEGEN_DEFAULT_TIMEOUT_MS,解出层全模型恒用此值——含 classic
|
|
16594
|
+
* 万相异步任务与 mj_task midjourney 任务轮询长径)+ 60s 余量(videogen 同口径:
|
|
16595
|
+
* 请求上行/网关前置/响应回传)。kernel 统一档同为 120s、对服务端预算零余量——
|
|
16596
|
+
* 任务径跑满预算时客户端恒先掐(同 videogen 的有扣无产形态,窗口更短),故
|
|
16597
|
+
* 显式声明盖过。
|
|
16598
|
+
*/
|
|
16599
|
+
declare const IMAGEGEN_TOOL_TIMEOUT_MS = 180000;
|
|
16591
16600
|
declare const ImageGenArgsSchema: z.ZodObject<{
|
|
16592
16601
|
model: z.ZodOptional<z.ZodString>;
|
|
16593
16602
|
prompt: z.ZodEffects<z.ZodString, string, string>;
|
|
@@ -16639,6 +16648,12 @@ interface CreateImageGenToolOptions {
|
|
|
16639
16648
|
* 直构/旧径),描述回落通用指引。
|
|
16640
16649
|
*/
|
|
16641
16650
|
models?: readonly AppBundleImageModel[];
|
|
16651
|
+
/**
|
|
16652
|
+
* 客户端硬超时覆盖(毫秒;透传 kernel Tool.timeoutMs)。缺省
|
|
16653
|
+
* IMAGEGEN_TOOL_TIMEOUT_MS(服务端 120s 预算 + 60s 余量)——恒不回落
|
|
16654
|
+
* kernel 120s 统一档(与服务端预算零余量,任务轮询径必先掐)。
|
|
16655
|
+
*/
|
|
16656
|
+
timeoutMs?: number;
|
|
16642
16657
|
}
|
|
16643
16658
|
/**
|
|
16644
16659
|
* 环3 平台图像生成工具(kernel Tool 形态;name 'ImageGen' 沿 kernel PascalCase
|
|
@@ -16667,6 +16682,16 @@ declare function createImageGenTool(options: CreateImageGenToolOptions): Tool<Im
|
|
|
16667
16682
|
|
|
16668
16683
|
/** 时长 wire 帽(秒;与网关 TwpVideogenRequestSchema 同值;超模型帽由网关再钳)。 */
|
|
16669
16684
|
declare const VIDEOGEN_TOOL_MAX_DURATION = 30;
|
|
16685
|
+
/**
|
|
16686
|
+
* 客户端硬超时缺省(毫秒;kernel Tool.timeoutMs 位)= 服务端轮询预算 600s
|
|
16687
|
+
* (tansr-api VIDEOGEN_DEFAULT_TIMEOUT_MS,解出层全模型恒用此值)+ 60s 余量
|
|
16688
|
+
* (请求上行/网关前置[认证/限流/配额/预扣]/响应回传)。/t1/videogen 系服务端
|
|
16689
|
+
* 同步长等——客户端必须等到服务端先出结论(成功或 upstream_timeout 退款),
|
|
16690
|
+
* 恒不先掐:客户端先超时会复现「服务端成功结算而智能体无产出」的有扣无产
|
|
16691
|
+
* (2026-09-01 定谳:kling-v3 实测 122-185s,kernel 120s 缺省档下结构性必超时,
|
|
16692
|
+
* 三笔 ¥2.40 计 ¥7.20 有扣无产)。
|
|
16693
|
+
*/
|
|
16694
|
+
declare const VIDEOGEN_TOOL_TIMEOUT_MS = 660000;
|
|
16670
16695
|
declare const VideoGenArgsSchema: z.ZodObject<{
|
|
16671
16696
|
model: z.ZodOptional<z.ZodString>;
|
|
16672
16697
|
prompt: z.ZodEffects<z.ZodString, string, string>;
|
|
@@ -16720,6 +16745,12 @@ interface CreateVideoGenToolOptions {
|
|
|
16720
16745
|
* (注入档直构/旧径),描述回落通用指引。
|
|
16721
16746
|
*/
|
|
16722
16747
|
models?: readonly AppBundleVideoModel[];
|
|
16748
|
+
/**
|
|
16749
|
+
* 客户端硬超时覆盖(毫秒;透传 kernel Tool.timeoutMs)。缺省
|
|
16750
|
+
* VIDEOGEN_TOOL_TIMEOUT_MS(服务端 600s 预算 + 60s 余量)——恒不回落
|
|
16751
|
+
* kernel 120s 统一档(视频生成分钟级,120s 帽结构性必超时)。
|
|
16752
|
+
*/
|
|
16753
|
+
timeoutMs?: number;
|
|
16723
16754
|
}
|
|
16724
16755
|
/**
|
|
16725
16756
|
* 环3 平台视频生成工具(kernel Tool 形态;name 'VideoGen' 沿 kernel PascalCase
|
|
@@ -16795,5 +16826,5 @@ declare function attachSdkTaskTool(toolset: SdkToolsetRef, config: AttachSdkTask
|
|
|
16795
16826
|
*/
|
|
16796
16827
|
declare function subagentModelResolverOf(registry: ProviderRegistry | null): SubagentModelResolver | undefined;
|
|
16797
16828
|
|
|
16798
|
-
export { APP_SDK_CONTRACT_VERSION, APP_TOKEN_PLACEHOLDER_ENV, AgentSession, AppCapabilitiesSchema, AppTokenRequestSchema, AppTokenResponseSchema, DEFAULT_APP_CAPABILITIES, DEFAULT_MAX_TOKENS, DEFAULT_MAX_TURNS, EndUserIdSchema, HEADER_APP_TOKEN, IMAGEGEN_TOOL_MAX_N, ImageGenArgsSchema, McpHost, OUTPUT_TAIL_MAX_CHARS, PLATFORM_SEARCH_PROVIDER_NAME, QueueChannel, SequentialToolExecutor, TANSR_PROVIDER_ID, TOOL_GUIDE_LABEL, TansrSdkError, UnavailableChannel, VIDEOGEN_TOOL_MAX_DURATION, VideoGenArgsSchema, accumulateUsage, appBundleRegistryConfig, appendUserMessage, assembleManagedModel, assemblePlatformModel, assembleSdkSkills, assembleTooling, attachSdkMcp, attachSdkTaskTool, buildClientFromRegistry, buildSdkToolSet, buildToolGuideSegment, createAppTokenFetch, createFileSessionStore, createImageGenTool, createMcpHost, createNarrator, createPlatformSearchProvider, createSdkPermissionGate, createSession, createSessionView, createVideoGenTool, defineSkill, defineTool, initialSessionViewState, markSourceFailure, parseAppBundle, providerSwitchedBody, query, reduceSessionView, resolveBuiltinSelection, resolveInitialMessages, resolvePlatformSelection, runAgent, subagentModelResolverOf, toToolDef, viewStateFromHistory };
|
|
16829
|
+
export { APP_SDK_CONTRACT_VERSION, APP_TOKEN_PLACEHOLDER_ENV, AgentSession, AppCapabilitiesSchema, AppTokenRequestSchema, AppTokenResponseSchema, DEFAULT_APP_CAPABILITIES, DEFAULT_MAX_TOKENS, DEFAULT_MAX_TURNS, EndUserIdSchema, HEADER_APP_TOKEN, IMAGEGEN_TOOL_MAX_N, IMAGEGEN_TOOL_TIMEOUT_MS, ImageGenArgsSchema, McpHost, OUTPUT_TAIL_MAX_CHARS, PLATFORM_SEARCH_PROVIDER_NAME, QueueChannel, SequentialToolExecutor, TANSR_PROVIDER_ID, TOOL_GUIDE_LABEL, TansrSdkError, UnavailableChannel, VIDEOGEN_TOOL_MAX_DURATION, VIDEOGEN_TOOL_TIMEOUT_MS, VideoGenArgsSchema, accumulateUsage, appBundleRegistryConfig, appendUserMessage, assembleManagedModel, assemblePlatformModel, assembleSdkSkills, assembleTooling, attachSdkMcp, attachSdkTaskTool, buildClientFromRegistry, buildSdkToolSet, buildToolGuideSegment, createAppTokenFetch, createFileSessionStore, createImageGenTool, createMcpHost, createNarrator, createPlatformSearchProvider, createSdkPermissionGate, createSession, createSessionView, createVideoGenTool, defineSkill, defineTool, initialSessionViewState, markSourceFailure, parseAppBundle, providerSwitchedBody, query, reduceSessionView, resolveBuiltinSelection, resolveInitialMessages, resolvePlatformSelection, runAgent, subagentModelResolverOf, toToolDef, viewStateFromHistory };
|
|
16799
16830
|
export type { ActiveToolStatus, Answer, AppBundle, AppBundleImageModel, AppBundleMediaModel, AppBundleModel, AppBundlePlatformModels, AppBundleVideoModel, AppCapabilities, AppTokenRequest, AppTokenResponse, AskUserCallback, AssembleManagedModelOptions, AssemblePlatformModelOptions, AssembleToolingOptions, AssembledManagedModel, AssembledPlatformModel, AssembledSkills, AssembledTooling, AttachSdkTaskToolConfig, BuildSdkToolSetOptions, BuiltinToolName, Capability, CompactNowOptions, CompactNowResult, ConfigDiagnostic, CreateFileSessionStoreOptions, CreateImageGenToolOptions, CreatePlatformSearchProviderOptions, CreateSdkPermissionGateOptions, CreateSessionOptions, CreateVideoGenToolOptions, DecisionSource, DefineSkillOptions, DefineToolOptions, DefinedSkill, DefinedTool, ErrorView, EventBody, EventEnvelope, GateDecision, HistoryCommitMeta, HookOutcomeStatus, IRBlock, IRErrorKind, IRMessage, IRRequest, IRRole, IRStreamEvent, IRSystemSegment, IRToolContent, IRToolDef, IRToolResultBlock, IRUsage, ImageGenArgs, ImageGenData, ImageModelConstraints, Integrity, JournalKind, JournalRecord, KernelEvent, KernelState, LoadConfigOptions, LoadedConfig, ManagedQueryOptions, McpClientEvent, McpConnectFactory, McpConnection, McpEventObserver, McpHostOptions, McpServerConfig, McpSessionOption, ModelCallOptions, ModelClient, Narrator, NarratorOptions, NarratorVerbosity, PermissionDecision, PermissionGate, PermissionMode, PermissionOptions, PermissionRules, PlatformCapabilityName, PlatformToolContext, Pricing, PromptCachingMode, PromptChannel, ProposedToolCall, ProtocolKind, ProviderProfile, QueryCompactionOptions, QueryCounters, QueryHandle, QueryOptions, QueryResult, Question, QuestionOption, ResolvedModel, RunAgentOptions, SdkErrorCode, SdkSkillsOptions, SdkToolSet, SdkToolsOptions, SdkToolsetRef, SequentialToolHandler, SequentialToolResult, SessionEventSource, SessionRecord, SessionRecordMeta, SessionStore, SessionStoreCommitMeta, SessionStoreCreateInit, SessionView, SessionViewReducerState, SessionViewSource, SessionViewState, SessionViewStatus, SetModelBinding, SkillsFileSystem, TansrConfig, TerminalReason, TodoView, Tool, ToolCallPartStatus, ToolCallView, ToolContext, ToolErrorType, ToolExecutionContext, ToolExecutionOutcome, ToolExecutor, ToolExecutorYield, ToolParameterSpec, ToolResult, ToolResultContent, UIMessage, UIMessagePart, UITextPart, UIThinkingPart, UIToolCallPart, UsageView, VideoGenArgs, VideoGenData, VideoModelConstraints, Visibility };
|
package/dist/index.js
CHANGED
|
@@ -30851,6 +30851,7 @@ var AppQuotaSchema = z41.object({
|
|
|
30851
30851
|
// src/platform/imagegen-tool.ts
|
|
30852
30852
|
import { z as z42 } from "zod";
|
|
30853
30853
|
var IMAGEGEN_TOOL_MAX_N = 4;
|
|
30854
|
+
var IMAGEGEN_TOOL_TIMEOUT_MS = 18e4;
|
|
30854
30855
|
var ImageGenArgsSchema = z42.object({
|
|
30855
30856
|
// S-G1(媒体池化顺位取用):Optional——缺席即不发 model 位,网关按授权集顺位
|
|
30856
30857
|
// 第一生效(与 bundle platformModels.imageGen 首行恒同);点名限集内(工具描述自列)。
|
|
@@ -30925,11 +30926,14 @@ function createImageGenTool(options) {
|
|
|
30925
30926
|
const token = options.token;
|
|
30926
30927
|
return {
|
|
30927
30928
|
name: "ImageGen",
|
|
30928
|
-
description: "Generates images from a text prompt via the tansr platform (ring-3 hosted capability; the platform calls the image provider and bills the app per generated image). Returns image URLs that stay valid for roughly 24 hours — surface them to the user promptly. Requires the app to have the imageGen platform capability enabled." + authorizedModelsNote(options.models),
|
|
30929
|
+
description: "Generates images from a text prompt via the tansr platform (ring-3 hosted capability; the platform calls the image provider and bills the app per generated image). Some models run as polled tasks and can take a minute or two — client-side wait cap is ~3 minutes. Returns image URLs that stay valid for roughly 24 hours — surface them to the user promptly. Requires the app to have the imageGen platform capability enabled." + authorizedModelsNote(options.models),
|
|
30929
30930
|
shortDescription: "Generate images from a prompt via the tansr platform (billed per image). Args: model?, prompt, negativePrompt?, size?, n?, seed?, imageUrls?.",
|
|
30930
30931
|
inputSchema: ImageGenArgsSchema,
|
|
30931
30932
|
isReadOnly: false,
|
|
30932
30933
|
isConcurrencySafe: false,
|
|
30934
|
+
// 2026-09-01 定谳修(videogen 同批):服务端预算 120s 与 kernel 120s 缺省档
|
|
30935
|
+
// 零余量,classic/mj_task 任务轮询径跑满预算时客户端恒先掐——声明 180s 盖过。
|
|
30936
|
+
timeoutMs: options.timeoutMs ?? IMAGEGEN_TOOL_TIMEOUT_MS,
|
|
30933
30937
|
async execute(args, ctx) {
|
|
30934
30938
|
const modelRef = args.model ?? "(default)";
|
|
30935
30939
|
if (ctx.signal.aborted) {
|
|
@@ -30994,6 +30998,7 @@ function createImageGenTool(options) {
|
|
|
30994
30998
|
// src/platform/videogen-tool.ts
|
|
30995
30999
|
import { z as z43 } from "zod";
|
|
30996
31000
|
var VIDEOGEN_TOOL_MAX_DURATION = 30;
|
|
31001
|
+
var VIDEOGEN_TOOL_TIMEOUT_MS = 66e4;
|
|
30997
31002
|
var VideoGenArgsSchema = z43.object({
|
|
30998
31003
|
// S-G1(媒体池化顺位取用):Optional——缺席即不发 model 位,网关按授权集顺位
|
|
30999
31004
|
// 第一生效(与 bundle platformModels.videoGen 首行恒同);点名限集内(工具描述自列)。
|
|
@@ -31084,11 +31089,15 @@ function createVideoGenTool(options) {
|
|
|
31084
31089
|
const token = options.token;
|
|
31085
31090
|
return {
|
|
31086
31091
|
name: "VideoGen",
|
|
31087
|
-
description: "Generates a short video from a text prompt via the tansr platform (ring-3 hosted capability; the platform calls the video provider and bills the app per second of generated video). Generation is a long-running task (often minutes). Returns a video URL that stays valid for roughly 24 hours — surface it to the user promptly. Requires the app to have the videoGen platform capability enabled." + authorizedModelsNote2(options.models),
|
|
31092
|
+
description: "Generates a short video from a text prompt via the tansr platform (ring-3 hosted capability; the platform calls the video provider and bills the app per second of generated video). Generation is a long-running task (often minutes). This call waits for the result — client-side wait cap is ~11 minutes; do not abort or retry early. Returns a video URL that stays valid for roughly 24 hours — surface it to the user promptly. Requires the app to have the videoGen platform capability enabled." + authorizedModelsNote2(options.models),
|
|
31088
31093
|
shortDescription: "Generate a video from a prompt via the tansr platform (billed per second). Args: model?, prompt, negativePrompt?, duration?, ratio?, seed?, imageUrls?.",
|
|
31089
31094
|
inputSchema: VideoGenArgsSchema,
|
|
31090
31095
|
isReadOnly: false,
|
|
31091
31096
|
isConcurrencySafe: false,
|
|
31097
|
+
// 2026-09-01 定谳修:/t1/videogen 系服务端同步长等(600s 轮询预算),kernel
|
|
31098
|
+
// 120s 缺省档下分钟级任务结构性必超时且有扣无产——工具级声明盖过缺省档
|
|
31099
|
+
// (kernel 全局档恒不动;dispatching-tool-executor timeoutMs>0 即生效)。
|
|
31100
|
+
timeoutMs: options.timeoutMs ?? VIDEOGEN_TOOL_TIMEOUT_MS,
|
|
31092
31101
|
async execute(args, ctx) {
|
|
31093
31102
|
const modelRef = args.model ?? "(default)";
|
|
31094
31103
|
if (ctx.signal.aborted) {
|
|
@@ -32050,7 +32059,7 @@ function toolCallIds(message) {
|
|
|
32050
32059
|
function toolResultIds(message) {
|
|
32051
32060
|
return message.blocks.flatMap((b) => b.t === "tool_result" ? [b.callId] : []);
|
|
32052
32061
|
}
|
|
32053
|
-
function
|
|
32062
|
+
function repairHistoryPairing2(messages) {
|
|
32054
32063
|
const open4 = /* @__PURE__ */ new Set();
|
|
32055
32064
|
let cleanEnd = 0;
|
|
32056
32065
|
for (let i = 0; i < messages.length; i++) {
|
|
@@ -32409,7 +32418,7 @@ async function createSession(options = {}) {
|
|
|
32409
32418
|
`createSession: session "${options.resume.sessionId}" was not found in the given store; list() the store or create a fresh session instead.`
|
|
32410
32419
|
);
|
|
32411
32420
|
}
|
|
32412
|
-
initialMessages =
|
|
32421
|
+
initialMessages = repairHistoryPairing2(record.messages).messages;
|
|
32413
32422
|
}
|
|
32414
32423
|
const platformSessionId = tokenTier ? ulid() : void 0;
|
|
32415
32424
|
let sessionRef = null;
|
|
@@ -33699,6 +33708,7 @@ export {
|
|
|
33699
33708
|
EndUserIdSchema,
|
|
33700
33709
|
HEADER_APP_TOKEN,
|
|
33701
33710
|
IMAGEGEN_TOOL_MAX_N,
|
|
33711
|
+
IMAGEGEN_TOOL_TIMEOUT_MS,
|
|
33702
33712
|
ImageGenArgsSchema,
|
|
33703
33713
|
McpHost,
|
|
33704
33714
|
OUTPUT_TAIL_MAX_CHARS,
|
|
@@ -33710,6 +33720,7 @@ export {
|
|
|
33710
33720
|
TansrSdkError,
|
|
33711
33721
|
UnavailableChannel,
|
|
33712
33722
|
VIDEOGEN_TOOL_MAX_DURATION,
|
|
33723
|
+
VIDEOGEN_TOOL_TIMEOUT_MS,
|
|
33713
33724
|
VideoGenArgsSchema,
|
|
33714
33725
|
accumulateUsage,
|
|
33715
33726
|
appBundleRegistryConfig,
|
package/package.json
CHANGED