@tansr/sdk 0.2.0 → 0.4.0
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 +389 -121
- package/dist/index.js +1563 -460
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -5644,8 +5644,9 @@ declare const TansrConfigSchema: z.ZodObject<{
|
|
|
5644
5644
|
* TANSR_CLASSIFIER_TIGHTEN_OUTSIDE_AUTO / TANSR_CLASSIFIER_BUDGET 保留为
|
|
5645
5645
|
* 最高优先覆盖(逐键接管)。仅 user/managed 层被尊重(T-K0:分类器属
|
|
5646
5646
|
* 用户/企业的信任与成本决策,项目层声明整段忽略+示警)。
|
|
5647
|
-
*
|
|
5648
|
-
* break-glass
|
|
5647
|
+
* 史注:TANSR_CLASSIFIER_ALLOW_UNQUALIFIED(资格越过)曾刻意不进配置
|
|
5648
|
+
* (break-glass 性质恒 env-only),已随 UAA P4-C2 整体退役(2026-08-30,
|
|
5649
|
+
* 任命即授照后无「未达资格」可越)。
|
|
5649
5650
|
*/
|
|
5650
5651
|
classifier: z.ZodOptional<z.ZodObject<{
|
|
5651
5652
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -7021,15 +7022,6 @@ interface PermissionClassifierConfig {
|
|
|
7021
7022
|
classifier: PermissionClassifier;
|
|
7022
7023
|
/** 咨询超时(毫秒),缺省 DEFAULT_CLASSIFIER_TIMEOUT_MS;超时维持 ask */
|
|
7023
7024
|
timeoutMs?: number;
|
|
7024
|
-
/**
|
|
7025
|
-
* safe→allow 裁决人资格位(T-K12 止血,05 §10.2/INV-5)。
|
|
7026
|
-
*
|
|
7027
|
-
* @deprecated T-K23c 起由 resolveQualificationTier 三级档位解析闭包取代
|
|
7028
|
-
* (16 §4.5);仅供过渡期测试。解析闭包缺席时按 `true→'high'` /
|
|
7029
|
-
* `false|缺省→'none'` 派生;闭包在场时本位被忽略。W1 收口卡
|
|
7030
|
-
* (T-K23g)将其移出生产装配路径。
|
|
7031
|
-
*/
|
|
7032
|
-
qualifiedForAllow?: boolean;
|
|
7033
7025
|
/**
|
|
7034
7026
|
* 三级资格档动态解析闭包(T-K23c,16 §4.5):返回当前生效档
|
|
7035
7027
|
* (= min(授格档, 天花板, 会话覆盖),合成在装配层)。引擎**每次咨询
|
|
@@ -10591,9 +10583,9 @@ declare class PermissionEngine {
|
|
|
10591
10583
|
/**
|
|
10592
10584
|
* 生效资格档解析(T-K23c,16 §4.5):解析闭包在场即**现算**(装配层合成
|
|
10593
10585
|
* min(entry, ceiling, override);闭包抛错 → 'none',词表外脏值由
|
|
10594
|
-
* softenRadiusAllows 安全查表兜底——T-INV-B 一切异常朝严)
|
|
10595
|
-
*
|
|
10596
|
-
*
|
|
10586
|
+
* softenRadiusAllows 安全查表兜底——T-INV-B 一切异常朝严);闭包缺席
|
|
10587
|
+
* 恒 'none'(无任命即无软化面;@deprecated 布尔位 qualifiedForAllow
|
|
10588
|
+
* 已随 P4-C3 拆除,2026-08-30)。
|
|
10597
10589
|
*/
|
|
10598
10590
|
private resolveClassifierTier;
|
|
10599
10591
|
/**
|
|
@@ -10928,6 +10920,41 @@ declare class UnavailableChannel implements PromptChannel {
|
|
|
10928
10920
|
ask(_questions: readonly Question[], _signal: AbortSignal): Promise<Answer[]>;
|
|
10929
10921
|
}
|
|
10930
10922
|
|
|
10923
|
+
/**
|
|
10924
|
+
* T-D4 — Web 搜索后端接口(可插拔)。
|
|
10925
|
+
*
|
|
10926
|
+
* 命名为 WebSearchProvider(而非任务卡字面的 SearchProvider)以避开
|
|
10927
|
+
* 《09》§8 前置项 4 预留给代码检索(T-D2 语义索引)的 SearchProvider
|
|
10928
|
+
* 名字空间——kernel 顶层出口是 `export *`,同名必撞。偏差已记入任务报告。
|
|
10929
|
+
*/
|
|
10930
|
+
/** 单条搜索结果(结构化;渲染归表面层) */
|
|
10931
|
+
interface WebSearchResultItem {
|
|
10932
|
+
title: string;
|
|
10933
|
+
url: string;
|
|
10934
|
+
snippet: string;
|
|
10935
|
+
}
|
|
10936
|
+
/** provider 收到的查询(maxResults 已被工具层夹紧到上限) */
|
|
10937
|
+
interface WebSearchQuery {
|
|
10938
|
+
query: string;
|
|
10939
|
+
maxResults: number;
|
|
10940
|
+
}
|
|
10941
|
+
interface WebSearchProviderContext {
|
|
10942
|
+
/** 工具层合成的取消信号(ctx.signal + 工具内部超时) */
|
|
10943
|
+
signal: AbortSignal;
|
|
10944
|
+
}
|
|
10945
|
+
/**
|
|
10946
|
+
* 搜索后端契约:
|
|
10947
|
+
* - 返回结构化结果数组(可多于 maxResults,工具层会截断);
|
|
10948
|
+
* - 失败以 throw 表达(工具层捕获并转结构化错误);错误消息中**不得**
|
|
10949
|
+
* 出现密钥原文(实现方自行脱敏,内置 HTTP provider 见 http-search-provider.ts);
|
|
10950
|
+
* - 必须尊重 signal(至少把它传给底层 I/O)。
|
|
10951
|
+
*/
|
|
10952
|
+
interface WebSearchProvider {
|
|
10953
|
+
/** 后端名(进 ToolResult.data 供渲染与审计;如 "http") */
|
|
10954
|
+
readonly name: string;
|
|
10955
|
+
search(query: WebSearchQuery, context: WebSearchProviderContext): Promise<WebSearchResultItem[]>;
|
|
10956
|
+
}
|
|
10957
|
+
|
|
10931
10958
|
/** 单条解析结果(node:dns lookup all:true 的消费子集) */
|
|
10932
10959
|
interface ResolvedHostAddress {
|
|
10933
10960
|
address: string;
|
|
@@ -15489,22 +15516,155 @@ type AppCapabilities = z.infer<typeof AppCapabilitiesSchema>;
|
|
|
15489
15516
|
/** 平台缺省档(保守值;终值⏸候拍板⑥,doc/83 §八) */
|
|
15490
15517
|
declare const DEFAULT_APP_CAPABILITIES: AppCapabilities;
|
|
15491
15518
|
|
|
15519
|
+
/** bundle 内单模型条目(SDK 消费子集) */
|
|
15520
|
+
interface AppBundleModel {
|
|
15521
|
+
handle: string;
|
|
15522
|
+
modelId: string;
|
|
15523
|
+
displayName: string;
|
|
15524
|
+
/**
|
|
15525
|
+
* 原始厂商(模型呈现面二波,用户拍板 2026-08-30 ④;api bundle 加法键,
|
|
15526
|
+
* 法人/品牌如 'Anthropic')。集成方模型切换器「厂商 → 系列」分组呈现的
|
|
15527
|
+
* 一级维;旧 bundle 缺键/api 未校准 = null(呈现面回落平铺,恒不猜)。
|
|
15528
|
+
*/
|
|
15529
|
+
manufacturer: string | null;
|
|
15530
|
+
/** 模型族 = 系列维(api T-A13 列;两级分组二级维;缺键 = null) */
|
|
15531
|
+
family: string | null;
|
|
15532
|
+
/** 上游协议标识(信息位;消费恒走 twp,方言转换收敛在网关) */
|
|
15533
|
+
protocol: string;
|
|
15534
|
+
capabilities: Record<string, unknown>;
|
|
15535
|
+
contextWindow: number | null;
|
|
15536
|
+
}
|
|
15537
|
+
/**
|
|
15538
|
+
* 图像模型受理约束(bundle platformModels.imageGen 行 constraints 加法键,
|
|
15539
|
+
* 2026-09-01;网关侧单源 = /t1 运行时校验档同一 classify 词表)。工具描述
|
|
15540
|
+
* 逐模型拼注——智能体首发即中,不再靠拒收错误试错(用户实测连环拒收后追加)。
|
|
15541
|
+
*/
|
|
15542
|
+
interface ImageModelConstraints {
|
|
15543
|
+
/** false = 模型定档分辨率,size 在场即拒。 */
|
|
15544
|
+
size: boolean;
|
|
15545
|
+
seed: boolean;
|
|
15546
|
+
negativePrompt: boolean;
|
|
15547
|
+
/** 单请求张数帽(n 超帽由网关钳)。 */
|
|
15548
|
+
maxImages: number;
|
|
15549
|
+
/** 富输入 imageUrls 受理域(null = 纯文生行,在场即拒)。 */
|
|
15550
|
+
imageInput: {
|
|
15551
|
+
min: number;
|
|
15552
|
+
max: number;
|
|
15553
|
+
urlOk: boolean;
|
|
15554
|
+
b64Ok: boolean;
|
|
15555
|
+
} | null;
|
|
15556
|
+
/** false = 动词行(引用既有任务),prompt 在场即拒。 */
|
|
15557
|
+
promptRequired: boolean;
|
|
15558
|
+
/** 动词行必携 action{taskId,actionId}。 */
|
|
15559
|
+
actionRequired?: boolean;
|
|
15560
|
+
}
|
|
15561
|
+
/** 视频模型受理约束(同上镜像;时长域/首帧受理/比例域是实测三大拒收源)。 */
|
|
15562
|
+
interface VideoModelConstraints {
|
|
15563
|
+
durations: {
|
|
15564
|
+
kind: 'set';
|
|
15565
|
+
values: number[];
|
|
15566
|
+
defaultSec: number;
|
|
15567
|
+
} | {
|
|
15568
|
+
kind: 'range';
|
|
15569
|
+
min: number;
|
|
15570
|
+
max: number;
|
|
15571
|
+
defaultSec: number;
|
|
15572
|
+
};
|
|
15573
|
+
/** 比例词形域(null = ratio 在场即拒;键缺席 = 透传上游,域未实录)。 */
|
|
15574
|
+
ratio?: string[] | null;
|
|
15575
|
+
negativePrompt: boolean;
|
|
15576
|
+
seed: boolean;
|
|
15577
|
+
/** 首帧图受理域(required = i2v 专用行必携 imageUrls;null = 纯文生行在场即拒)。 */
|
|
15578
|
+
imageInput: {
|
|
15579
|
+
required: boolean;
|
|
15580
|
+
max: number;
|
|
15581
|
+
urlOk: boolean;
|
|
15582
|
+
b64Ok: boolean;
|
|
15583
|
+
} | null;
|
|
15584
|
+
audioInput: boolean;
|
|
15585
|
+
}
|
|
15586
|
+
/**
|
|
15587
|
+
* 授权媒体模型条目(S-G1 媒体池化顺位取用,用户拍板 2026-08-30):`model` =
|
|
15588
|
+
* canonical handle(/t1/imagegen、/t1/videogen 的 model 位可直用)。网关契约
|
|
15589
|
+
* 恒不下发价格/成本/供应商内部信息。constraints 加法键(2026-09-01)按 kind
|
|
15590
|
+
* 特化(下方两型);条目级容错:缺席/坏形状 = undefined(旧 api 回落通用
|
|
15591
|
+
* 描述,恒不臆造受理面)。
|
|
15592
|
+
*/
|
|
15593
|
+
interface AppBundleMediaModel {
|
|
15594
|
+
model: string;
|
|
15595
|
+
displayName: string;
|
|
15596
|
+
}
|
|
15597
|
+
interface AppBundleImageModel extends AppBundleMediaModel {
|
|
15598
|
+
constraints?: ImageModelConstraints;
|
|
15599
|
+
}
|
|
15600
|
+
interface AppBundleVideoModel extends AppBundleMediaModel {
|
|
15601
|
+
constraints?: VideoModelConstraints;
|
|
15602
|
+
}
|
|
15603
|
+
/**
|
|
15604
|
+
* 授权媒体模型集(bundle platformModels 段):序 = 平台收敛稳定序,**顺位第一
|
|
15605
|
+
* 即工具/网关 model 缺省时的生效模型**;空数组 = 平台未配置(如实,恒不猜名)。
|
|
15606
|
+
*/
|
|
15607
|
+
interface AppBundlePlatformModels {
|
|
15608
|
+
imageGen: AppBundleImageModel[];
|
|
15609
|
+
videoGen: AppBundleVideoModel[];
|
|
15610
|
+
}
|
|
15611
|
+
/** bundle-for-app 的 SDK 消费子集 */
|
|
15612
|
+
interface AppBundle {
|
|
15613
|
+
models: AppBundleModel[];
|
|
15614
|
+
aliases: Record<string, string>;
|
|
15615
|
+
/** App 能力位(doc/89 契约 2;段缺席/坏形状 = 平台缺省档) */
|
|
15616
|
+
capabilities: AppCapabilities;
|
|
15617
|
+
/**
|
|
15618
|
+
* 授权媒体模型集(S-G1):工具描述/装配 system 段的自取数据源——集成方
|
|
15619
|
+
* 恒不手配模型名。旧 bundle 无段 = 双空集如实(段级容错同 capabilities
|
|
15620
|
+
* 方向:缺席恒不臆造)。
|
|
15621
|
+
*/
|
|
15622
|
+
platformModels: AppBundlePlatformModels;
|
|
15623
|
+
}
|
|
15624
|
+
/** 平台 provider 档名(与 cli TANSR_PROVIDER_ID 同值;registry 键与别名前缀) */
|
|
15625
|
+
declare const TANSR_PROVIDER_ID = "tansr";
|
|
15626
|
+
/**
|
|
15627
|
+
* 令牌档 registry 的 ApiKey 占位环境变量(readApiKey 非空校验的哑值通道;
|
|
15628
|
+
* 真实鉴权头由 createAppTokenFetch 包装覆写,令牌恒不进 registry env)。
|
|
15629
|
+
*/
|
|
15630
|
+
declare const APP_TOKEN_PLACEHOLDER_ENV = "TANSR_SDK_APP_TOKEN_TIER";
|
|
15631
|
+
/**
|
|
15632
|
+
* bundle 载荷 → SDK 消费子集。顶层形状非法返回 null(调用方结构化报错);
|
|
15633
|
+
* 条目级损坏逐条跳过。capabilities 段严格校验,失败回落平台缺省档
|
|
15634
|
+
* (fail-closed 方向:缺省档保守)。platformModels 段(S-G1)加法解析:
|
|
15635
|
+
* 段缺席(旧 api)/坏形状 = 双空集如实——媒体工具据此如实注明未配置,
|
|
15636
|
+
* 恒不猜模型名;**序恒保持下发序**(顺位第一即缺省)。
|
|
15637
|
+
*/
|
|
15638
|
+
declare function parseAppBundle(raw: unknown): AppBundle | null;
|
|
15639
|
+
/**
|
|
15640
|
+
* bundle → 令牌档 RegistryConfig:单一 tansr 档(twp/1,占位鉴权变量)+
|
|
15641
|
+
* 别名表(目录裸名自动别名最低层,显式 aliases 压过)。恒零本地配置 IO。
|
|
15642
|
+
*/
|
|
15643
|
+
declare function appBundleRegistryConfig(bundle: AppBundle, baseUrl: string): RegistryConfig;
|
|
15644
|
+
|
|
15492
15645
|
/** 环2 内置工具词表(与 AppCapabilities.tools 的工具位同名,doc/84 §4.1) */
|
|
15493
15646
|
type BuiltinToolName = 'read' | 'write' | 'edit' | 'glob' | 'grep' | 'list' | 'shell' | 'webFetch' | 'webSearch' | 'http' | 'todoWrite' | 'askUser';
|
|
15494
|
-
/**
|
|
15495
|
-
|
|
15647
|
+
/**
|
|
15648
|
+
* 环3 平台能力词表(与 AppCapabilities.platform 同名;webSearch 自 S-WS2 收编
|
|
15649
|
+
* 进环2 builtin——位 platform.webSearch 仍在能力契约,但装配入口移位)。
|
|
15650
|
+
*/
|
|
15651
|
+
type PlatformCapabilityName = 'imageGen' | 'videoGen';
|
|
15496
15652
|
/** 三环工具入口(CreateSessionOptions.tools / ManagedQueryOptions.tools) */
|
|
15497
15653
|
interface SdkToolsOptions {
|
|
15498
15654
|
/**
|
|
15499
15655
|
* 环2 内置工具选择(词表:read/write/edit/glob/grep/list/shell/webFetch/
|
|
15500
15656
|
* webSearch/http/todoWrite/askUser)。缺席 = 装配能力位放行的全部内置
|
|
15501
15657
|
* 工具;空数组 = 零内置(纯自定义工具场景)。显式列出位关工具报可读错。
|
|
15658
|
+
* webSearch 双门(S-WS2):除工具位外还需令牌档材料 + platform.webSearch 位
|
|
15659
|
+
* (后端恒平台通道,SDK 恒不 BYO)——缺席选择时通道不备静默不装,显式选择
|
|
15660
|
+
* 即 fail-fast 分因可读错。
|
|
15502
15661
|
*/
|
|
15503
15662
|
builtin?: readonly string[];
|
|
15504
15663
|
/**
|
|
15505
|
-
* 环3 平台能力选择(词表:imageGen/videoGen
|
|
15506
|
-
*
|
|
15507
|
-
*
|
|
15664
|
+
* 环3 平台能力选择(词表:imageGen/videoGen)。位关恒 fail-fast;位开即
|
|
15665
|
+
* 装配平台工具客户端(ImageGen/VideoGen,材料 = 令牌档 platformContext,
|
|
15666
|
+
* 托管/注入档选择即可读错)。webSearch 已收编进 tools.builtin(S-WS2),
|
|
15667
|
+
* 此处显式列出报迁移指引。
|
|
15508
15668
|
*/
|
|
15509
15669
|
platform?: readonly string[];
|
|
15510
15670
|
/** 环1 自定义工具(defineTool 产物;kernel Tool 形态直给亦可) */
|
|
@@ -15520,6 +15680,13 @@ interface PlatformToolContext {
|
|
|
15520
15680
|
token: string;
|
|
15521
15681
|
/** fetch 注入缝(测试桩网关;缺省全局 fetch) */
|
|
15522
15682
|
fetchImpl?: typeof fetch;
|
|
15683
|
+
/**
|
|
15684
|
+
* bundle 授权媒体模型集(S-G1 媒体池化顺位取用):令牌档装配自
|
|
15685
|
+
* assemblePlatformModel 随取随注——ImageGen/VideoGen 工具描述自列授权集
|
|
15686
|
+
* (顺位第一 = model 缺省生效模型),集成方零手配。缺席(注入档测试直构
|
|
15687
|
+
* 等)= 工具描述按未知集处理(仍可显式点名)。
|
|
15688
|
+
*/
|
|
15689
|
+
platformModels?: AppBundlePlatformModels;
|
|
15523
15690
|
}
|
|
15524
15691
|
interface BuildSdkToolSetOptions {
|
|
15525
15692
|
/** 三环工具入口;缺席 = 只装能力位放行的内置工具 */
|
|
@@ -15782,6 +15949,85 @@ declare function accumulateUsage(total: IRUsage | undefined, next: IRUsage): IRU
|
|
|
15782
15949
|
*/
|
|
15783
15950
|
declare function query(options: QueryOptions): AsyncGenerator<KernelEvent, QueryResult, undefined>;
|
|
15784
15951
|
|
|
15952
|
+
/**
|
|
15953
|
+
* doc/91 会话管理实施批 — SessionStore 可注入存储接口(拍板③/⑦)。
|
|
15954
|
+
*
|
|
15955
|
+
* 定位:SDK 会话存储的**唯一承诺面**(拍板⑦:kernel journal 原语恒不经
|
|
15956
|
+
* SDK 出口导出,FileSessionStore 只作内部消费)。「存哪」被本接口抽象掉——
|
|
15957
|
+
* 本地文件(createFileSessionStore)、开发者自建 DB、平台托管(二期
|
|
15958
|
+
* createPlatformSessionStore,候独立拍板)三态同形,createSession 的
|
|
15959
|
+
* resume/store 双字段(拍板③)恒不随存储后端变化。
|
|
15960
|
+
*
|
|
15961
|
+
* 概念收敛(doc/91 §3.1):对外「会话」= AgentSession 逻辑会话,一个
|
|
15962
|
+
* sessionId 一段历史;存储内部的卷/纪元轮换是实现细节,list 面恒按逻辑
|
|
15963
|
+
* 会话呈现。
|
|
15964
|
+
*/
|
|
15965
|
+
|
|
15966
|
+
/** 会话存储登记行(元数据半边;内容经 get 另取,list 恒不携内容) */
|
|
15967
|
+
interface SessionRecordMeta {
|
|
15968
|
+
/** 逻辑会话 id(= AgentSession.sessionId;缺省 UUID 形制,可显式供给) */
|
|
15969
|
+
sessionId: string;
|
|
15970
|
+
/** ISO-8601 创建时间 */
|
|
15971
|
+
createdAt: string;
|
|
15972
|
+
/** ISO-8601 最近提交时间(list 排序锚) */
|
|
15973
|
+
updatedAt: string;
|
|
15974
|
+
/** 会话标题(缺省 = 首条用户输入截断;可显式供给) */
|
|
15975
|
+
title?: string;
|
|
15976
|
+
/**
|
|
15977
|
+
* 平台会话 id(ULID 26 位 Crockford;doc/91 拍板⑤):令牌档 createSession
|
|
15978
|
+
* per-AgentSession 铸造并经 twp meta.sessionId 出线,ULID↔内核 UUID 映射
|
|
15979
|
+
* 落在此键——平台侧会话行(归因/续租/亲和)与本地记录互认的桥。
|
|
15980
|
+
*/
|
|
15981
|
+
platformSessionId?: string;
|
|
15982
|
+
/** 开发者自留元数据域(SDK 恒不消费其内容) */
|
|
15983
|
+
meta?: Record<string, unknown>;
|
|
15984
|
+
}
|
|
15985
|
+
/** create 登记参数(sessionId 缺省由 store 铸造 UUID) */
|
|
15986
|
+
interface SessionStoreCreateInit {
|
|
15987
|
+
sessionId?: string;
|
|
15988
|
+
title?: string;
|
|
15989
|
+
/** 平台会话 ULID(令牌档装配注入;重复登记时以新值对账更新) */
|
|
15990
|
+
platformSessionId?: string;
|
|
15991
|
+
meta?: Record<string, unknown>;
|
|
15992
|
+
}
|
|
15993
|
+
/** commit 附带信息(与 CreateSessionOptions.onHistoryCommit 的 meta 同形) */
|
|
15994
|
+
interface SessionStoreCommitMeta {
|
|
15995
|
+
/**
|
|
15996
|
+
* true = 历史前缀被就地改写(session.compacted 压缩折叠 /
|
|
15997
|
+
* session.microcompacted 存根化),已存内容不再与之对齐——实现方不得按
|
|
15998
|
+
* 长度增量追加,须整卷轮换(demo persistence 先例,doc/91 §3.3)。
|
|
15999
|
+
*/
|
|
16000
|
+
readonly rewritten: boolean;
|
|
16001
|
+
}
|
|
16002
|
+
/** get 终值(meta + 完整历史;resume 径另过配对治理,见 session.ts) */
|
|
16003
|
+
interface SessionRecord {
|
|
16004
|
+
meta: SessionRecordMeta;
|
|
16005
|
+
messages: IRMessage[];
|
|
16006
|
+
}
|
|
16007
|
+
/**
|
|
16008
|
+
* 会话存储接口(拍板③冻结形态)。实现纪律:
|
|
16009
|
+
* - commit 的 rewritten=true 须整卷轮换(语义见 SessionStoreCommitMeta);
|
|
16010
|
+
* - 存储损坏恒结构化报错(throw),恒不静默返回残缺历史(doc/88 对抗式
|
|
16011
|
+
* 验收:改坏存储文件须报错不静默);
|
|
16012
|
+
* - list 恒不携消息内容(枚举是元数据面);
|
|
16013
|
+
* - create 幂等(同 sessionId 重复登记返回既有记录,platformSessionId
|
|
16014
|
+
* 以新值对账更新——resume 后的新 AgentSession 铸新平台 ULID 经此落位)。
|
|
16015
|
+
*/
|
|
16016
|
+
interface SessionStore {
|
|
16017
|
+
/** 建会话(登记 meta;id 由 store 铸造或调用方供给;幂等) */
|
|
16018
|
+
create(init: SessionStoreCreateInit): Promise<SessionRecordMeta>;
|
|
16019
|
+
/** 取单会话(meta + 完整历史;不存在返回 null;损坏结构化 throw) */
|
|
16020
|
+
get(sessionId: string): Promise<SessionRecord | null>;
|
|
16021
|
+
/** 列会话(按 updatedAt 倒序;恒无内容) */
|
|
16022
|
+
list(filter?: {
|
|
16023
|
+
limit?: number;
|
|
16024
|
+
}): Promise<SessionRecordMeta[]>;
|
|
16025
|
+
/** 轮末提交(对接 onHistoryCommit;rewritten=true 须整卷轮换) */
|
|
16026
|
+
commit(sessionId: string, history: readonly IRMessage[], meta: SessionStoreCommitMeta): Promise<void>;
|
|
16027
|
+
/** 删除/归档(FileSessionStore = 目录删除;平台实现 = 归档语义) */
|
|
16028
|
+
delete(sessionId: string): Promise<void>;
|
|
16029
|
+
}
|
|
16030
|
+
|
|
15785
16031
|
interface CreateSessionOptions {
|
|
15786
16032
|
/**
|
|
15787
16033
|
* 模型档(三档判定):
|
|
@@ -15867,6 +16113,26 @@ interface CreateSessionOptions {
|
|
|
15867
16113
|
* console.warn(错误不静默消失)。
|
|
15868
16114
|
*/
|
|
15869
16115
|
onHistoryCommit?: (history: readonly IRMessage[], meta: HistoryCommitMeta) => void | Promise<void>;
|
|
16116
|
+
/**
|
|
16117
|
+
* 一等恢复:自 store 取回历史与 meta 预载(与 initialMessages 互斥;
|
|
16118
|
+
* sessionId 同给时必须与 resume.sessionId 一致)。resume 径内置配对治理
|
|
16119
|
+
* (sessions/pairing.ts,拍板④):断尾 tool_call 补 isError 占位、孤儿
|
|
16120
|
+
* tool_result 截断到干净边界——kernel 对 initialMessages 原样收不校验,
|
|
16121
|
+
* 治理保证 wire 恒不 400。目标不存在抛 TansrSdkError('session_not_found');
|
|
16122
|
+
* 存储损坏由 store.get 结构化上抛(恒不静默)。
|
|
16123
|
+
*/
|
|
16124
|
+
resume?: {
|
|
16125
|
+
sessionId: string;
|
|
16126
|
+
store: SessionStore;
|
|
16127
|
+
};
|
|
16128
|
+
/**
|
|
16129
|
+
* 在场时自动接管会话登记(store.create,幂等;令牌档的平台会话 ULID
|
|
16130
|
+
* 映射随登记落 SessionRecordMeta,拍板⑤)与每轮落卷(store.commit;
|
|
16131
|
+
* store 先行、onHistoryCommit 回调后行,失败面同 sdk.persistence 吞错
|
|
16132
|
+
* 纪律)。与 resume 正交:续存一个恢复的会话把同一 store 同时传两处。
|
|
16133
|
+
* 缺席 = 纯内存零变化(SDK 恒不引入任何隐式落盘)。
|
|
16134
|
+
*/
|
|
16135
|
+
store?: SessionStore;
|
|
15870
16136
|
}
|
|
15871
16137
|
/** onHistoryCommit 附带信息(落盘方决定增量追加还是整卷轮换) */
|
|
15872
16138
|
interface HistoryCommitMeta {
|
|
@@ -15958,6 +16224,16 @@ declare class AgentSession {
|
|
|
15958
16224
|
*/
|
|
15959
16225
|
declare function createSession(options?: CreateSessionOptions): Promise<AgentSession>;
|
|
15960
16226
|
|
|
16227
|
+
interface CreateFileSessionStoreOptions {
|
|
16228
|
+
/** 存储根目录(显式传入,恒不隐式扫用户目录;Electron 场景传 userData) */
|
|
16229
|
+
dir: string;
|
|
16230
|
+
}
|
|
16231
|
+
/**
|
|
16232
|
+
* 缺省文件实现工厂。目录布局(kernel journal 原语同款):
|
|
16233
|
+
* <dir>/sessions/<sessionId>/{journal.jsonl, meta.json, lock, attachments/}
|
|
16234
|
+
*/
|
|
16235
|
+
declare function createFileSessionStore(options: CreateFileSessionStoreOptions): SessionStore;
|
|
16236
|
+
|
|
15961
16237
|
/**
|
|
15962
16238
|
* T-E8 — SDK 结构化错误。
|
|
15963
16239
|
*
|
|
@@ -15975,7 +16251,11 @@ type SdkErrorCode =
|
|
|
15975
16251
|
/** App 能力位关闭而被显式选择(S-B3;消息含控制台修复指引) */
|
|
15976
16252
|
| 'capability_disabled'
|
|
15977
16253
|
/** 会话已关闭后仍调用会改变状态的方法 */
|
|
15978
|
-
| 'session_closed'
|
|
16254
|
+
| 'session_closed'
|
|
16255
|
+
/** resume 目标会话在 store 中不存在(doc/91 拍板③) */
|
|
16256
|
+
| 'session_not_found'
|
|
16257
|
+
/** 会话存储损坏(中段损坏/哈希链断裂/坏 payload;doc/88 对抗锚:恒不静默) */
|
|
16258
|
+
| 'session_store_corrupted';
|
|
15979
16259
|
declare class TansrSdkError extends Error {
|
|
15980
16260
|
readonly code: SdkErrorCode;
|
|
15981
16261
|
constructor(code: SdkErrorCode, message: string, options?: {
|
|
@@ -16155,6 +16435,25 @@ declare function appendUserMessage(state: SessionViewReducerState, text: string)
|
|
|
16155
16435
|
*/
|
|
16156
16436
|
declare function markSourceFailure(state: SessionViewReducerState, error: unknown): SessionViewReducerState;
|
|
16157
16437
|
|
|
16438
|
+
/**
|
|
16439
|
+
* viewStateFromHistory — L2/L3 重建入口(doc/98 §五恢复链步骤④;doc/97
|
|
16440
|
+
* 卡 A3-1 的 TS 半边,与 tansr-android :core 同名 Kotlin 实现逐语义对齐,
|
|
16441
|
+
* 双端金样卷(test/view-golden)锁一致性,重录恒双仓同笔)。
|
|
16442
|
+
*
|
|
16443
|
+
* 语义:治理后历史快照(IRMessage[],pairing 已保证配对完整)→ 定稿消息
|
|
16444
|
+
* 投影(无流式簿记):
|
|
16445
|
+
* - text/thinking 空文本不建 part(与 reducer「空块定稿即删」同律);
|
|
16446
|
+
* - tool_call 与 tool_result 按 callId 全卷配对(后写者胜):有回执按
|
|
16447
|
+
* isError 落 completed/failed,resultText = 回执 text 项拼接(空则缺席);
|
|
16448
|
+
* 无回执(断尾)落 aborted;
|
|
16449
|
+
* - 纯 tool_result 消息不落 user 气泡(回执是协议载体不是用户话语);
|
|
16450
|
+
* tool_result/opaque/image 与未知块型恒不建 part,空消息整条跳过;
|
|
16451
|
+
* - 消息 id 单调续接(msg-1…),internal.nextMessageSeq 随之推进——重建后
|
|
16452
|
+
* 新增消息恒不撞 id;其余内部簿记与视图字段取初始态(status='idle')。
|
|
16453
|
+
*/
|
|
16454
|
+
|
|
16455
|
+
declare function viewStateFromHistory(messages: readonly IRMessage[]): SessionViewReducerState;
|
|
16456
|
+
|
|
16158
16457
|
/**
|
|
16159
16458
|
* S-B7 — 事件泵(view 内部共享;session-view 与 narrator 同用)。
|
|
16160
16459
|
*
|
|
@@ -16233,6 +16532,13 @@ interface AssemblePlatformModelOptions {
|
|
|
16233
16532
|
fetchImpl?: typeof fetch;
|
|
16234
16533
|
/** fallback 链最终命中通报(session 装配合成 cost.provider.switched) */
|
|
16235
16534
|
onProviderSelected?: (selection: FallbackSelection) => void;
|
|
16535
|
+
/**
|
|
16536
|
+
* doc/91 拍板⑤ — twp meta.sessionId 动态供给(平台会话 id,ULID 形制;
|
|
16537
|
+
* 经 ProviderRegistry twp 选项缝透传,providers 零改动)。createSession
|
|
16538
|
+
* 令牌档 per-AgentSession 铸造一枚注入;缺席 = meta.sessionId 如实不携带
|
|
16539
|
+
* (归账兜底在认证头,批ι 前语义),query 单轮档现维持缺席。
|
|
16540
|
+
*/
|
|
16541
|
+
sessionId?: () => string | undefined;
|
|
16236
16542
|
}
|
|
16237
16543
|
interface AssembledPlatformModel {
|
|
16238
16544
|
client: ModelClient;
|
|
@@ -16243,6 +16549,11 @@ interface AssembledPlatformModel {
|
|
|
16243
16549
|
registry: ProviderRegistry;
|
|
16244
16550
|
/** bundle capabilities 段(S-B3 裁剪的事实源;缺席时为平台缺省档) */
|
|
16245
16551
|
capabilities: AppCapabilities;
|
|
16552
|
+
/**
|
|
16553
|
+
* bundle 授权媒体模型集(S-G1;初始化即取,媒体工具装配自取的数据源——
|
|
16554
|
+
* 集成方零手配)。旧 api 无段 = 双空集如实。
|
|
16555
|
+
*/
|
|
16556
|
+
platformModels: AppBundlePlatformModels;
|
|
16246
16557
|
}
|
|
16247
16558
|
/**
|
|
16248
16559
|
* 令牌头注入 fetch 包装:剥 AK/SK 双头与签名三头(值只是占位哑值,但
|
|
@@ -16278,26 +16589,29 @@ declare function assemblePlatformModel(options: AssemblePlatformModelOptions): P
|
|
|
16278
16589
|
/** 生成张数 wire 帽(与网关 TwpImagegenRequestSchema 同值;超模型帽由网关再钳)。 */
|
|
16279
16590
|
declare const IMAGEGEN_TOOL_MAX_N = 4;
|
|
16280
16591
|
declare const ImageGenArgsSchema: z.ZodObject<{
|
|
16281
|
-
model: z.ZodString
|
|
16592
|
+
model: z.ZodOptional<z.ZodString>;
|
|
16282
16593
|
prompt: z.ZodEffects<z.ZodString, string, string>;
|
|
16283
16594
|
negativePrompt: z.ZodOptional<z.ZodString>;
|
|
16284
16595
|
size: z.ZodOptional<z.ZodString>;
|
|
16285
16596
|
n: z.ZodOptional<z.ZodNumber>;
|
|
16286
16597
|
seed: z.ZodOptional<z.ZodNumber>;
|
|
16598
|
+
imageUrls: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
16287
16599
|
}, "strip", z.ZodTypeAny, {
|
|
16288
|
-
model: string;
|
|
16289
16600
|
prompt: string;
|
|
16601
|
+
model?: string | undefined;
|
|
16290
16602
|
size?: string | undefined;
|
|
16291
16603
|
n?: number | undefined;
|
|
16292
|
-
negativePrompt?: string | undefined;
|
|
16293
16604
|
seed?: number | undefined;
|
|
16605
|
+
negativePrompt?: string | undefined;
|
|
16606
|
+
imageUrls?: string[] | undefined;
|
|
16294
16607
|
}, {
|
|
16295
|
-
model: string;
|
|
16296
16608
|
prompt: string;
|
|
16609
|
+
model?: string | undefined;
|
|
16297
16610
|
size?: string | undefined;
|
|
16298
16611
|
n?: number | undefined;
|
|
16299
|
-
negativePrompt?: string | undefined;
|
|
16300
16612
|
seed?: number | undefined;
|
|
16613
|
+
negativePrompt?: string | undefined;
|
|
16614
|
+
imageUrls?: string[] | undefined;
|
|
16301
16615
|
}>;
|
|
16302
16616
|
type ImageGenArgs = z.infer<typeof ImageGenArgsSchema>;
|
|
16303
16617
|
/** 表面层渲染用结构化数据(ToolResult.data;错误时携错误码)。 */
|
|
@@ -16317,6 +16631,14 @@ interface CreateImageGenToolOptions {
|
|
|
16317
16631
|
token: string;
|
|
16318
16632
|
/** fetch 注入缝(测试桩网关;缺省全局 fetch)。 */
|
|
16319
16633
|
fetchImpl?: typeof fetch;
|
|
16634
|
+
/**
|
|
16635
|
+
* 授权图像模型集(S-G1;bundle platformModels.imageGen,装配循环自取):
|
|
16636
|
+
* 工具描述自列(顺位第一 = model 缺省生效模型),constraints 在场时逐模型
|
|
16637
|
+
* 拼受理约束注记(2026-09-01——size/富输入/动词行,智能体首发即中);
|
|
16638
|
+
* 空数组 = 平台未配置(描述如实注明,恒不猜名);缺席 = 集未知(注入档
|
|
16639
|
+
* 直构/旧径),描述回落通用指引。
|
|
16640
|
+
*/
|
|
16641
|
+
models?: readonly AppBundleImageModel[];
|
|
16320
16642
|
}
|
|
16321
16643
|
/**
|
|
16322
16644
|
* 环3 平台图像生成工具(kernel Tool 形态;name 'ImageGen' 沿 kernel PascalCase
|
|
@@ -16346,26 +16668,29 @@ declare function createImageGenTool(options: CreateImageGenToolOptions): Tool<Im
|
|
|
16346
16668
|
/** 时长 wire 帽(秒;与网关 TwpVideogenRequestSchema 同值;超模型帽由网关再钳)。 */
|
|
16347
16669
|
declare const VIDEOGEN_TOOL_MAX_DURATION = 30;
|
|
16348
16670
|
declare const VideoGenArgsSchema: z.ZodObject<{
|
|
16349
|
-
model: z.ZodString
|
|
16671
|
+
model: z.ZodOptional<z.ZodString>;
|
|
16350
16672
|
prompt: z.ZodEffects<z.ZodString, string, string>;
|
|
16351
16673
|
negativePrompt: z.ZodOptional<z.ZodString>;
|
|
16352
16674
|
duration: z.ZodOptional<z.ZodNumber>;
|
|
16353
16675
|
ratio: z.ZodOptional<z.ZodString>;
|
|
16354
16676
|
seed: z.ZodOptional<z.ZodNumber>;
|
|
16677
|
+
imageUrls: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
16355
16678
|
}, "strip", z.ZodTypeAny, {
|
|
16356
|
-
model: string;
|
|
16357
16679
|
prompt: string;
|
|
16680
|
+
model?: string | undefined;
|
|
16358
16681
|
duration?: number | undefined;
|
|
16359
|
-
negativePrompt?: string | undefined;
|
|
16360
16682
|
seed?: number | undefined;
|
|
16683
|
+
negativePrompt?: string | undefined;
|
|
16361
16684
|
ratio?: string | undefined;
|
|
16685
|
+
imageUrls?: string[] | undefined;
|
|
16362
16686
|
}, {
|
|
16363
|
-
model: string;
|
|
16364
16687
|
prompt: string;
|
|
16688
|
+
model?: string | undefined;
|
|
16365
16689
|
duration?: number | undefined;
|
|
16366
|
-
negativePrompt?: string | undefined;
|
|
16367
16690
|
seed?: number | undefined;
|
|
16691
|
+
negativePrompt?: string | undefined;
|
|
16368
16692
|
ratio?: string | undefined;
|
|
16693
|
+
imageUrls?: string[] | undefined;
|
|
16369
16694
|
}>;
|
|
16370
16695
|
type VideoGenArgs = z.infer<typeof VideoGenArgsSchema>;
|
|
16371
16696
|
/** 表面层渲染用结构化数据(ToolResult.data;错误时携错误码)。 */
|
|
@@ -16387,6 +16712,14 @@ interface CreateVideoGenToolOptions {
|
|
|
16387
16712
|
token: string;
|
|
16388
16713
|
/** fetch 注入缝(测试桩网关;缺省全局 fetch)。 */
|
|
16389
16714
|
fetchImpl?: typeof fetch;
|
|
16715
|
+
/**
|
|
16716
|
+
* 授权视频模型集(S-G1;bundle platformModels.videoGen,装配循环自取):
|
|
16717
|
+
* 工具描述自列(顺位第一 = model 缺省生效模型),constraints 在场时逐模型
|
|
16718
|
+
* 拼受理约束注记(2026-09-01——时长域/i2v 首帧/比例域,实测三大拒收源
|
|
16719
|
+
* 前置进描述);空数组 = 平台未配置(如实注明恒不猜名);缺席 = 集未知
|
|
16720
|
+
* (注入档直构/旧径),描述回落通用指引。
|
|
16721
|
+
*/
|
|
16722
|
+
models?: readonly AppBundleVideoModel[];
|
|
16390
16723
|
}
|
|
16391
16724
|
/**
|
|
16392
16725
|
* 环3 平台视频生成工具(kernel Tool 形态;name 'VideoGen' 沿 kernel PascalCase
|
|
@@ -16396,60 +16729,30 @@ interface CreateVideoGenToolOptions {
|
|
|
16396
16729
|
declare function createVideoGenTool(options: CreateVideoGenToolOptions): Tool<VideoGenArgs>;
|
|
16397
16730
|
|
|
16398
16731
|
/**
|
|
16399
|
-
* S-
|
|
16400
|
-
*
|
|
16401
|
-
*
|
|
16402
|
-
* 环3 语义:执行不在终端本地——工具 execute 经令牌档 fetch 打平台网关
|
|
16403
|
-
* POST {baseUrl}/t1/websearch(鉴权头 x-tansr-app-token),平台代调搜索
|
|
16404
|
-
* 供应商池(加权选池 + 一次故障转移),**按次计量计费归 App**(pricePerCall;
|
|
16405
|
-
* 开发者对终端如何转售自主,计量计费分离)。
|
|
16406
|
-
*
|
|
16407
|
-
* wire 契约(api 仓 TwpWebsearchRequest/Response,doc/36 §3.2):请求
|
|
16408
|
-
* {query, max_results?} 为 snake_case——与 CLI 内核 HTTP 搜索后端字节同构的
|
|
16409
|
-
* 既有特例(imagegen/videogen 的 camelCase 系 twp 核心纪律,本面迁就既有
|
|
16410
|
-
* 字节);响应 {results:[{title,url,snippet}]}(供应商方言已在网关归一)。
|
|
16732
|
+
* S-WS2 — 平台联网搜索后端(kernel WebSearchProvider 实现;用户拍板 2026-08-31
|
|
16733
|
+
* 「SDK 恒不暴露 BYO 档,移除相关逻辑,内核态 WebSearch 直接走平台」)。
|
|
16411
16734
|
*
|
|
16412
|
-
*
|
|
16413
|
-
*
|
|
16414
|
-
*
|
|
16735
|
+
* 形态注记(取代 S-WS 的环3 独立工具 'PlatformWebSearch'):SDK 里联网搜索恒
|
|
16736
|
+
* 一件工具 = kernel 环2 'WebSearch',后端恒为本 provider(平台通道)。BYO
|
|
16737
|
+
* (TANSR_WEBSEARCH_ENDPOINT/KEY 环境变量后端)在 SDK 装配面恒不存在——终端
|
|
16738
|
+
* 持搜索商密钥即 appkey 防盗模型要消灭的反模式;可解释可审计面恒在平台
|
|
16739
|
+
* (逐笔 usage_events、预扣结算闭环、endUserId 归因、失败零计费)。
|
|
16415
16740
|
*
|
|
16416
|
-
*
|
|
16417
|
-
*
|
|
16418
|
-
*
|
|
16741
|
+
* wire 契约(api TwpWebsearchRequest/Response,doc/36 §3.2):POST /t1/websearch
|
|
16742
|
+
* {query, max_results} snake_case;响应 {results:[{title,url,snippet}]}
|
|
16743
|
+
* (供应商方言已在网关归一;供应商身份恒匿名,doc/50 采购红线)。按次计量
|
|
16744
|
+
* 计费归 App(pricePerCall;开发者对终端如何转售自主,计量计费分离)。
|
|
16419
16745
|
*
|
|
16420
|
-
*
|
|
16421
|
-
*
|
|
16422
|
-
* (INV-10
|
|
16423
|
-
*
|
|
16746
|
+
* 错误纪律:WebSearchProvider 契约以 throw 表达失败——kernel search-tool 捕获
|
|
16747
|
+
* 转 provider_error 结构化错误(不炸查询环),错误消息携网关错误码与修复指引;
|
|
16748
|
+
* 令牌只活在闭包(INV-10),查询文本平台侧恒不落日志不落库(网关红线),SDK
|
|
16749
|
+
* 侧同样恒不打印。
|
|
16424
16750
|
*/
|
|
16425
16751
|
|
|
16426
|
-
/**
|
|
16427
|
-
declare const
|
|
16428
|
-
|
|
16429
|
-
|
|
16430
|
-
max_results: z.ZodOptional<z.ZodNumber>;
|
|
16431
|
-
}, "strip", z.ZodTypeAny, {
|
|
16432
|
-
query: string;
|
|
16433
|
-
max_results?: number | undefined;
|
|
16434
|
-
}, {
|
|
16435
|
-
query: string;
|
|
16436
|
-
max_results?: number | undefined;
|
|
16437
|
-
}>;
|
|
16438
|
-
type WebSearchArgs = z.infer<typeof WebSearchArgsSchema>;
|
|
16439
|
-
/** 表面层渲染用结构化数据(ToolResult.data;错误时携错误码)。 */
|
|
16440
|
-
interface WebSearchData {
|
|
16441
|
-
query: string;
|
|
16442
|
-
results: Array<{
|
|
16443
|
-
title: string;
|
|
16444
|
-
url: string;
|
|
16445
|
-
snippet: string;
|
|
16446
|
-
}>;
|
|
16447
|
-
resultCount: number;
|
|
16448
|
-
/** 网关错误码(如 forbidden/websearch_not_configured/websearch_quota_exceeded;成功缺席)。 */
|
|
16449
|
-
errorCode?: string;
|
|
16450
|
-
}
|
|
16451
|
-
interface CreateWebSearchToolOptions {
|
|
16452
|
-
/** 平台 API 基址(令牌档会话档;/t1 前缀由本工具追加)。 */
|
|
16752
|
+
/** 后端名(进 kernel WebSearch 的 ToolResult.data.provider,供渲染与审计)。 */
|
|
16753
|
+
declare const PLATFORM_SEARCH_PROVIDER_NAME = "tansr-platform";
|
|
16754
|
+
interface CreatePlatformSearchProviderOptions {
|
|
16755
|
+
/** 平台 API 基址(令牌档会话档;/t1 前缀由本 provider 追加)。 */
|
|
16453
16756
|
baseUrl: string;
|
|
16454
16757
|
/** app_user 短期令牌(只活在本闭包,恒不进工具定义/日志)。 */
|
|
16455
16758
|
token: string;
|
|
@@ -16457,47 +16760,12 @@ interface CreateWebSearchToolOptions {
|
|
|
16457
16760
|
fetchImpl?: typeof fetch;
|
|
16458
16761
|
}
|
|
16459
16762
|
/**
|
|
16460
|
-
*
|
|
16461
|
-
*
|
|
16462
|
-
* (
|
|
16763
|
+
* 平台联网搜索 provider(kernel WebSearchProvider 契约):经令牌档 fetch 打
|
|
16764
|
+
* 平台网关,平台代调搜索供应商池(加权选池 + 故障转移),按次计费归 App。
|
|
16765
|
+
* 结果条目做最小映射(title/url 非字符串剔除,snippet 缺席补空串);上限
|
|
16766
|
+
* 截断、URL 卫生、去重恒由 kernel search-tool 层收口(不信任 provider 同律)。
|
|
16463
16767
|
*/
|
|
16464
|
-
declare function
|
|
16465
|
-
|
|
16466
|
-
/** bundle 内单模型条目(SDK 消费子集) */
|
|
16467
|
-
interface AppBundleModel {
|
|
16468
|
-
handle: string;
|
|
16469
|
-
modelId: string;
|
|
16470
|
-
displayName: string;
|
|
16471
|
-
/** 上游协议标识(信息位;消费恒走 twp,方言转换收敛在网关) */
|
|
16472
|
-
protocol: string;
|
|
16473
|
-
capabilities: Record<string, unknown>;
|
|
16474
|
-
contextWindow: number | null;
|
|
16475
|
-
}
|
|
16476
|
-
/** bundle-for-app 的 SDK 消费子集 */
|
|
16477
|
-
interface AppBundle {
|
|
16478
|
-
models: AppBundleModel[];
|
|
16479
|
-
aliases: Record<string, string>;
|
|
16480
|
-
/** App 能力位(doc/89 契约 2;段缺席/坏形状 = 平台缺省档) */
|
|
16481
|
-
capabilities: AppCapabilities;
|
|
16482
|
-
}
|
|
16483
|
-
/** 平台 provider 档名(与 cli TANSR_PROVIDER_ID 同值;registry 键与别名前缀) */
|
|
16484
|
-
declare const TANSR_PROVIDER_ID = "tansr";
|
|
16485
|
-
/**
|
|
16486
|
-
* 令牌档 registry 的 ApiKey 占位环境变量(readApiKey 非空校验的哑值通道;
|
|
16487
|
-
* 真实鉴权头由 createAppTokenFetch 包装覆写,令牌恒不进 registry env)。
|
|
16488
|
-
*/
|
|
16489
|
-
declare const APP_TOKEN_PLACEHOLDER_ENV = "TANSR_SDK_APP_TOKEN_TIER";
|
|
16490
|
-
/**
|
|
16491
|
-
* bundle 载荷 → SDK 消费子集。顶层形状非法返回 null(调用方结构化报错);
|
|
16492
|
-
* 条目级损坏逐条跳过。capabilities 段严格校验,失败回落平台缺省档
|
|
16493
|
-
* (fail-closed 方向:缺省档保守)。
|
|
16494
|
-
*/
|
|
16495
|
-
declare function parseAppBundle(raw: unknown): AppBundle | null;
|
|
16496
|
-
/**
|
|
16497
|
-
* bundle → 令牌档 RegistryConfig:单一 tansr 档(twp/1,占位鉴权变量)+
|
|
16498
|
-
* 别名表(目录裸名自动别名最低层,显式 aliases 压过)。恒零本地配置 IO。
|
|
16499
|
-
*/
|
|
16500
|
-
declare function appBundleRegistryConfig(bundle: AppBundle, baseUrl: string): RegistryConfig;
|
|
16768
|
+
declare function createPlatformSearchProvider(options: CreatePlatformSearchProviderOptions): WebSearchProvider;
|
|
16501
16769
|
|
|
16502
16770
|
interface CreateSdkPermissionGateOptions {
|
|
16503
16771
|
/** 权限规则的路径锚定目录;必须与 executor 的 cwd 一致 */
|
|
@@ -16527,5 +16795,5 @@ declare function attachSdkTaskTool(toolset: SdkToolsetRef, config: AttachSdkTask
|
|
|
16527
16795
|
*/
|
|
16528
16796
|
declare function subagentModelResolverOf(registry: ProviderRegistry | null): SubagentModelResolver | undefined;
|
|
16529
16797
|
|
|
16530
|
-
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, QueueChannel, SequentialToolExecutor, TANSR_PROVIDER_ID, TOOL_GUIDE_LABEL, TansrSdkError, UnavailableChannel, VIDEOGEN_TOOL_MAX_DURATION, VideoGenArgsSchema,
|
|
16531
|
-
export type { ActiveToolStatus, Answer, AppBundle, AppBundleModel, AppCapabilities, AppTokenRequest, AppTokenResponse, AskUserCallback, AssembleManagedModelOptions, AssemblePlatformModelOptions, AssembleToolingOptions, AssembledManagedModel, AssembledPlatformModel, AssembledSkills, AssembledTooling, AttachSdkTaskToolConfig, BuildSdkToolSetOptions, BuiltinToolName, Capability, CompactNowOptions, CompactNowResult, ConfigDiagnostic, CreateImageGenToolOptions, CreateSdkPermissionGateOptions, CreateSessionOptions, CreateVideoGenToolOptions,
|
|
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 };
|
|
16799
|
+
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 };
|