page-agent-sdk 2.20.1 → 2.22.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": "2.20.1",
3
+ "version": "2.22.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",
package/types/index.d.ts CHANGED
@@ -489,7 +489,7 @@ export interface ChatSdkOptions {
489
489
  /** 自动乐观锁(默认 true):写入时若 LLM 未传 expectedHash,自动用其最后 get 读到的 hash 比对;设 false 回退「不传 = 不校验」 */
490
490
  autoLock?: boolean;
491
491
  /** 数据操作审计回调:每次 set/edit/delete/restore 经此回调外发结构化事件(独立于 debug,无需 debug:true);集成方做合规审计/操作追溯 */
492
- onAudit?: (entry: { op: string; jsonPath?: string; opDetail?: string; timestamp: number; success: boolean; error?: string }) => void;
492
+ onAudit?: (entry: { op: string; value?: unknown; detail?: string; timestamp: number }) => void;
493
493
  /** 工具呈现模式:simple(默认,主推 read/write 但保留 query/search/eval/snapshot)| advanced(全暴露)| minimal(只 read/write) */
494
494
  toolMode?: 'simple' | 'advanced' | 'minimal';
495
495
  /** 读写拦截器:read/write 透传给数据工具(脱敏/转换/审计/拒绝 LLM 读写);input/output 在 agent IO 入口/出口预处理 */
@@ -826,6 +826,13 @@ export interface ConflictManager {
826
826
  }
827
827
  export declare function createConflictManager(getEmit?: () => (((e: any) => void) | undefined)): ConflictManager;
828
828
  // ============ 配置解析 + 事件系统(optionsResolver/events,refactor-module-extraction 期三)============
829
+ // capabilities 能力开关注册表 + 单一解析(p2-refactor 子项 4:消除 11/17 开关 ===true/!==false 混)
830
+ export interface Capability { name: string; defaultOn: boolean; requires?: readonly string[] }
831
+ export type CapabilityFlags = Partial<Record<string, boolean>>;
832
+ export type ResolvedCapabilities = Record<string, boolean>;
833
+ export declare const CAPABILITIES: readonly Capability[];
834
+ /** 单一解析:集成方原始 caps(Partial)→ 全量 boolean(opt-out 默认开 !==false / opt-in 默认关 ===true;requires 依赖未满足强制关)。参数宽松 Record<string,unknown>(兼容含 subagents 等非 boolean 字段的 caps 对象;只读已知 capability 的 boolean) */
835
+ export declare function resolveCapabilities(caps?: Record<string, unknown>): ResolvedCapabilities;
829
836
  export declare function resolveStorage(storage: any): any | null;
830
837
  export declare function resolveDialogConfig(opts: any): any;
831
838
  export interface SdkEvents {