page-agent-sdk 2.29.0 → 2.31.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.29.0",
3
+ "version": "2.31.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
@@ -163,6 +163,7 @@ export interface SubagentConfig {
163
163
  skills?: SkillSpec[];
164
164
  temperature?: number;
165
165
  maxTokens?: number;
166
+ /** 子 agent 工具调用轮次上限(默认 10);大 JSON 子任务可调大 */
166
167
  maxToolRounds?: number;
167
168
  /** 子 agent 可写路径前缀白名单(给子 agent 写权限;写工具包 path guard,越界 PATH_OUT_OF_SCOPE;整体 set 禁)。subagent-writable Phase 2 */
168
169
  writablePaths?: string[];
@@ -476,6 +477,8 @@ export interface SessionSnapshot {
476
477
  mission?: Mission;
477
478
  /** 跨压缩工作记忆 path/hash 备忘(context-persist-resilience:刷新后少重复 read;capabilities.workingMemory 开启时写入) */
478
479
  workingMemory?: WorkingMemory;
480
+ /** 上下文聚焦焦点(focus-auto-switch:刷新/切会话后聚焦状态保留;capabilities.focus 开启时写入;null=清除标记) */
481
+ focus?: Focus | null;
479
482
  }
480
483
  export type StorageEvent =
481
484
  | { type: 'degraded'; reason: string }
@@ -588,6 +591,7 @@ export interface ChatSdkOptions {
588
591
  /** 内存中保留的对话轮数上限(默认 50);超限把最旧轮次压缩为摘要 system 消息(防 OOM);0 关闭 */
589
592
  maxMemoryRounds?: number;
590
593
  debug?: boolean;
594
+ /** agent 工具调用轮次上限(默认 10);大 JSON 分块构建(draft_write×N + draft_commit + read 确认)是多轮场景,可能触顶被截断,建议调大到 20-30 */
591
595
  maxToolRounds?: number;
592
596
  /** 规划阶段总轮次预算(默认 5);planning 状态下超限 → write_todos/update_todo 回灌,防"光规划不执行"死循环。与 maxIterations 正交 */
593
597
  maxPlanRevisions?: number;
@@ -1158,6 +1162,9 @@ export interface ContextManagerOptions { [k: string]: any }
1158
1162
  export interface CompressionStats { [k: string]: any }
1159
1163
 
1160
1164
  // 模型能力 / token 估算 / offload 阈值
1165
+ export declare const MIN_CONTEXT_WINDOW: number;
1166
+ /** 判定错误是否为上下文超限(模型输入超 contextWindow);复用 langchain ContextOverflowError + 兜底正则。harden-context-resilience */
1167
+ export declare function isContextLengthError(err: unknown): boolean;
1161
1168
  export declare function resolveModelCaps(model: string): any;
1162
1169
  export declare function estimateTokens(text: string): number;
1163
1170
  export declare function offloadThresholdChars(contextWindow: number): number;