@x-otto/interchange 0.1.0-alpha.4 → 0.1.0-alpha.5
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 +1 -0
- package/dist/index.d.ts +21 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -98,6 +98,7 @@ const entry: SigilEntry = { label: 'File', value: '/path/to/file', kind: 'file',
|
|
|
98
98
|
- `ChildProcessConfig` / `ProcessTracker` — child process management
|
|
99
99
|
- `PluginPerfMetricResult` — plugin performance metric contract
|
|
100
100
|
- `A2uiComponent` / `A2uiContent` — rich component types
|
|
101
|
+
- `ContextFragment` / `ContextFragmentId` / `boundFragment` / `contextFragmentBytes` — bounded context fragment shapes + truncation primitives (RFC-374 M3)
|
|
101
102
|
|
|
102
103
|
## Dependencies
|
|
103
104
|
|
package/dist/index.d.ts
CHANGED
|
@@ -480,7 +480,7 @@ declare function collectModelCapabilityFacts(model: Pick<Model, 'input'>): Model
|
|
|
480
480
|
* CODE-STYLE.md §6b)。片段内容被截断只损失尾部信息,不改变已注入部分的可读性。
|
|
481
481
|
*/
|
|
482
482
|
/** system prompt 注入片段的类型化 id(与 SYSTEM_PROMPT_SECTIONS 的字段一一对应)。 */
|
|
483
|
-
type ContextFragmentId = 'toolGuidance' | 'skillLoopGuidance' | 'environment' | 'memoryIndex' | 'skillCatalog' | 'lesson' | 'lessonRelevantHints' | 'memoryDelta' | 'todoReminder' | 'docSyncReminder';
|
|
483
|
+
type ContextFragmentId = 'toolGuidance' | 'skillLoopGuidance' | 'environment' | 'memoryIndex' | 'skillCatalog' | 'lesson' | 'lessonRelevantHints' | 'memoryDelta' | 'todoReminder' | 'docSyncReminder' | 'internalize';
|
|
484
484
|
/** 有界上下文片段:id + 内容。预算声明在 SYSTEM_PROMPT_SECTIONS(runtime 包)。 */
|
|
485
485
|
interface ContextFragment {
|
|
486
486
|
id: ContextFragmentId;
|
|
@@ -503,7 +503,7 @@ declare function boundFragment(fragment: ContextFragment, budgetBytes: number):
|
|
|
503
503
|
* 工具错误的类型化类别——在**产生处**定型,取代下游对错误文本的英文子串猜测
|
|
504
504
|
* (agent work-loop 旧 categoriseToolError)。未设时下游回退启发式匹配(向后兼容未迁移的工具)。
|
|
505
505
|
*/
|
|
506
|
-
type ToolErrorKind = 'validation' | 'permission' | 'not_found' | 'timeout' | 'network' | 'io' | 'runtime' | 'aborted' | 'unknown';
|
|
506
|
+
type ToolErrorKind = 'validation' | 'permission' | 'not_found' | 'timeout' | 'network' | 'io' | 'runtime' | 'aborted' | 'sandbox-denied' | 'unknown';
|
|
507
507
|
interface ToolResult {
|
|
508
508
|
content: (TextContent | ImageContent)[];
|
|
509
509
|
isError?: boolean;
|
|
@@ -554,6 +554,15 @@ interface AgentTool<Params = unknown> {
|
|
|
554
554
|
exposure?: 'direct' | 'deferred' | 'hidden';
|
|
555
555
|
/** 标记为只读工具,可与其他只读工具并发执行 */
|
|
556
556
|
readonly?: boolean;
|
|
557
|
+
/**
|
|
558
|
+
* RFC review D5:steering(用户新指令)到达时对**正在执行**的本工具的处置语义。
|
|
559
|
+
* - 'block'(缺省,= 改动前行为):工具跑完,steering 只拦未执行工具;
|
|
560
|
+
* - 'cancel':声明「可安全中止」——steering 到达即 abort 本工具(per-tool abort
|
|
561
|
+
* signal,执行方快速终止、结果 errorKind='aborted'),用户指令立刻接管。
|
|
562
|
+
* 约束:取消语义只对「副作用可安全中止」的工具声明(如搜索/分析类);写类工具
|
|
563
|
+
* (bash/edit)不得声明 cancel(其副作用不可回滚)。
|
|
564
|
+
*/
|
|
565
|
+
interruptBehavior?: 'cancel' | 'block';
|
|
557
566
|
/**
|
|
558
567
|
* RFC-093:本工具结果的上下文预算(chars)。超预算时结果落盘、上下文留 preview+路径占位符。
|
|
559
568
|
* 缺省用引擎全局 maxToolResultChars(100K)。声明更小值(如 30K)促使大输出工具更早落盘。
|
|
@@ -687,6 +696,7 @@ type AgentSessionEvent = {
|
|
|
687
696
|
model?: string;
|
|
688
697
|
thinkingLevel?: string;
|
|
689
698
|
stopReason?: PromptStopReason;
|
|
699
|
+
errorMessage?: string;
|
|
690
700
|
} /** RFC-094 D3:todo 闸门自动续跑的中间轮信号(一个用户 prompt 恰好一对 start/end,中间每次续跑发一次)。 */ | {
|
|
691
701
|
type: 'prompt.continued';
|
|
692
702
|
sessionId: string;
|
|
@@ -988,6 +998,15 @@ type AgentSessionEvent = {
|
|
|
988
998
|
arguments: Record<string, unknown>;
|
|
989
999
|
description: string; /** HITL 显示风险等级(权限层派生,仅显示提示;缺省下游回退 medium)。 */
|
|
990
1000
|
risk?: 'low' | 'medium' | 'high';
|
|
1001
|
+
/**
|
|
1002
|
+
* RFC-380 T4:LLM 语义审批层(opt-in)的自动裁决标记。仅宿主配置了 semanticReviewer
|
|
1003
|
+
* 且命中升级审批(description 含 [sandbox-escalation])时出现:
|
|
1004
|
+
* - 'allow':runtime 已自动放行(approvalGate 已 resolve true),宿主只需记命令 bypass、
|
|
1005
|
+
* 不得再弹窗/再 resolve(PendingGate.resolve 对已 settle 幂等返回 false,安全);
|
|
1006
|
+
* - 'deny':runtime 已自动拒绝(已 resolve false),宿主不得弹窗。
|
|
1007
|
+
* 缺省(未配置 reviewer / abstain)不出现 → 宿主走既有弹窗流程。
|
|
1008
|
+
*/
|
|
1009
|
+
semanticVerdict?: 'allow' | 'deny';
|
|
991
1010
|
} | {
|
|
992
1011
|
type: 'approval.resolved';
|
|
993
1012
|
sessionId: string;
|