page-agent-sdk 2.20.0 → 2.21.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.0",
3
+ "version": "2.21.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",
@@ -54,7 +54,8 @@
54
54
  "test:browser": "playwright test",
55
55
  "test:browser:ui": "playwright test --ui",
56
56
  "test:draft-real": "tsx tests/runtime/draft-real-llm.ts",
57
- "test:trace-real": "tsx tests/runtime/trace-real-llm.ts"
57
+ "test:trace-real": "tsx tests/runtime/trace-real-llm.ts",
58
+ "test:maliang-real": "tsx tests/runtime/maliang-real-llm.ts"
58
59
  },
59
60
  "keywords": [
60
61
  "ai",
package/types/index.d.ts CHANGED
@@ -147,6 +147,8 @@ export interface SubagentConfig {
147
147
  temperature?: number;
148
148
  maxTokens?: number;
149
149
  maxToolRounds?: number;
150
+ /** 子 agent 可写路径前缀白名单(给子 agent 写权限;写工具包 path guard,越界 PATH_OUT_OF_SCOPE;整体 set 禁)。subagent-writable Phase 2 */
151
+ writablePaths?: string[];
150
152
  }
151
153
  export interface AgentInfo {
152
154
  id: string;
@@ -487,7 +489,7 @@ export interface ChatSdkOptions {
487
489
  /** 自动乐观锁(默认 true):写入时若 LLM 未传 expectedHash,自动用其最后 get 读到的 hash 比对;设 false 回退「不传 = 不校验」 */
488
490
  autoLock?: boolean;
489
491
  /** 数据操作审计回调:每次 set/edit/delete/restore 经此回调外发结构化事件(独立于 debug,无需 debug:true);集成方做合规审计/操作追溯 */
490
- 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;
491
493
  /** 工具呈现模式:simple(默认,主推 read/write 但保留 query/search/eval/snapshot)| advanced(全暴露)| minimal(只 read/write) */
492
494
  toolMode?: 'simple' | 'advanced' | 'minimal';
493
495
  /** 读写拦截器:read/write 透传给数据工具(脱敏/转换/审计/拒绝 LLM 读写);input/output 在 agent IO 入口/出口预处理 */
@@ -996,7 +998,15 @@ export interface SubagentsController {
996
998
  remove(id: string): boolean;
997
999
  get(): SubagentConfig[];
998
1000
  }
999
- export interface SubagentOptions { [k: string]: any }
1001
+ /** spawn_agent / spawn_agents 运行时选项(role/tools/writablePaths 等可运行时覆盖) */
1002
+ export interface SubagentOptions {
1003
+ role?: string;
1004
+ tools?: string[];
1005
+ /** 子 agent 可写路径前缀白名单(运行时覆盖;写工具包 path guard,越界 PATH_OUT_OF_SCOPE)。subagent-writable Phase 2 */
1006
+ writablePaths?: string[];
1007
+ model?: string;
1008
+ [k: string]: any;
1009
+ }
1000
1010
  export interface SubagentLlmConfig { [k: string]: any }
1001
1011
 
1002
1012
  // checkpoint / dataOps / permissions