page-agent-sdk 3.40.3 → 3.41.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "page-agent-sdk",
3
- "version": "3.40.3",
3
+ "version": "3.41.0",
4
4
  "type": "module",
5
5
  "description": "AI agent SDK for web pages — embed a chat assistant that edits page data via schema-validated tools. A lighter, framework-agnostic alternative to CopilotKit/LangChain for in-page JSON-editing agents. Vue-bundled; works with DeepSeek, OpenAI, MCP.",
6
6
  "main": "./dist/page-agent-sdk.umd.cjs",
@@ -490,6 +490,11 @@ export interface DataConfig {
490
490
  * 配置后 read 受保护路径返占位符(精确值不入 LLM 消息流),写侧强制(freeze 拒/verbatim 展开校验)。
491
491
  * opt-in:未配(默认)全部行为零变化 */
492
492
  resources?: ResourceProtectSpec[];
493
+ /**
494
+ * 装配期工具白名单(main-surface-slim Phase 1):`'high'` 预设(全量减旧四件 get/set/edit/delete_data)/
495
+ * 具体名单(按名过滤,未装配名 warn 留痕)。不传 = 全量零回归;仅首次装配生效,运行时 setData 忽略。
496
+ */
497
+ tools?: string[] | 'high';
493
498
  }
494
499
  /** createDataOps 选项(审计回调 / 快照上限 / 乐观锁) */
495
500
  export interface DataOpsOptions {
@@ -499,6 +504,11 @@ export interface DataOpsOptions {
499
504
  onConflict?: (conflict: ConflictInfo) => Promise<ConflictResolution>;
500
505
  /** 冲突监听字段白名单(任意深度字段名):声明后仅这些字段的值变动触发自动冲突检测(位置不敏感);未声明 = 不开自动检测(仅显式 expectedHash 校验);['*'] = 全字段检测(旧 autoLock 行为) */
501
506
  conflictWatchFields?: string[];
507
+ /**
508
+ * 装配期工具白名单(main-surface-slim Phase 1):`'high'` 预设(全量减旧四件 get/set/edit/delete_data)/
509
+ * 具体名单(按名过滤,未装配名 warn 留痕)。不传 = 全量零回归。
510
+ */
511
+ tools?: string[] | 'high';
502
512
  }
503
513
 
504
514
  /** 数据操作控制器(运行时替换配置;createDataOps 返回的工具数组上以不可枚举属性 `controller` 挂载) */
@@ -804,7 +814,7 @@ export interface ChatSdkOptions {
804
814
  permissions?: PermissionRule[];
805
815
  /** 自定义中间件(注入到内置中间件之后;可拦截/观察模型调用、工具、prompt) */
806
816
  middleware?: any[];
807
- vfs?: { initialFiles?: Record<string, string>; maxBytes?: number };
817
+ vfs?: { initialFiles?: Record<string, string>; maxBytes?: number; poolBytes?: { largeResults?: number; drafts?: number; userFiles?: number }; mainTools?: boolean };
808
818
  /** 每个数据对象最多保留快照数(默认 20) */
809
819
  maxSnapshots?: number;
810
820
  /** 乐观锁冲突裁决策略(默认 'ask'):ask=挂起 pendingConflict 等人工 resolveConflict;overwrite=agent 强制覆盖(宿主与 agent 争同一份数据且 agent 优先时用,冲突自动收口不挂起,无人值守场景防永挂);keep_external=自动保留外部修改(agent 收到提示重新 read)。自动裁决仍外发 conflict 事件(conflict.autoResolved 标记) */
package/types/index.d.ts CHANGED
@@ -854,6 +854,11 @@ export interface DataConfig {
854
854
  * 配置后 read 受保护路径返占位符(精确值不入 LLM 消息流),写侧强制(freeze 拒/verbatim 展开校验)。
855
855
  * opt-in:未配(默认)全部行为零变化 */
856
856
  resources?: ResourceProtectSpec[];
857
+ /**
858
+ * 装配期工具白名单(main-surface-slim Phase 1):`'high'` 预设(全量减旧四件 get/set/edit/delete_data)/
859
+ * 具体名单(按名过滤,未装配名 warn 留痕)。不传 = 全量零回归;仅首次装配生效,运行时 setData 忽略。
860
+ */
861
+ tools?: string[] | 'high';
857
862
  }
858
863
  /** createDataOps 选项(审计回调 / 快照上限 / 乐观锁) */
859
864
  export interface DataOpsOptions {
@@ -863,6 +868,11 @@ export interface DataOpsOptions {
863
868
  onConflict?: (conflict: ConflictInfo) => Promise<ConflictResolution>;
864
869
  /** 冲突监听字段白名单(任意深度字段名):声明后仅这些字段的值变动触发自动冲突检测(位置不敏感);未声明 = 不开自动检测(仅显式 expectedHash 校验);['*'] = 全字段检测(旧 autoLock 行为) */
865
870
  conflictWatchFields?: string[];
871
+ /**
872
+ * 装配期工具白名单(main-surface-slim Phase 1):`'high'` 预设(全量减旧四件 get/set/edit/delete_data)/
873
+ * 具体名单(按名过滤,未装配名 warn 留痕)。不传 = 全量零回归。
874
+ */
875
+ tools?: string[] | 'high';
866
876
  }
867
877
 
868
878
  /** 数据操作控制器(运行时替换配置;createDataOps 返回的工具数组上以不可枚举属性 `controller` 挂载) */
@@ -1193,7 +1203,7 @@ export interface ChatSdkOptions {
1193
1203
  permissions?: PermissionRule[];
1194
1204
  /** 自定义中间件(注入到内置中间件之后;可拦截/观察模型调用、工具、prompt) */
1195
1205
  middleware?: any[];
1196
- vfs?: { initialFiles?: Record<string, string>; maxBytes?: number };
1206
+ vfs?: { initialFiles?: Record<string, string>; maxBytes?: number; poolBytes?: { largeResults?: number; drafts?: number; userFiles?: number }; mainTools?: boolean };
1197
1207
  /** 每个数据对象最多保留快照数(默认 20) */
1198
1208
  maxSnapshots?: number;
1199
1209
  /** 乐观锁冲突裁决策略(默认 'ask'):ask=挂起 pendingConflict 等人工 resolveConflict;overwrite=agent 强制覆盖(宿主与 agent 争同一份数据且 agent 优先时用,冲突自动收口不挂起,无人值守场景防永挂);keep_external=自动保留外部修改(agent 收到提示重新 read)。自动裁决仍外发 conflict 事件(conflict.autoResolved 标记) */