page-agent-sdk 4.7.0 → 4.8.1
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 +2 -2
- package/README.zh-CN.md +2 -2
- package/dist/page-agent-sdk.headless.js +2971 -2888
- package/dist/page-agent-sdk.iife.js +159 -159
- package/dist/page-agent-sdk.js +5616 -5533
- package/dist/page-agent-sdk.legacy.js +14954 -14863
- package/dist/page-agent-sdk.umd.cjs +117 -117
- package/package.json +1 -1
- package/types/headless.d.ts +10 -2
- package/types/index.d.ts +10 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "page-agent-sdk",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.8.1",
|
|
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/headless.d.ts
CHANGED
|
@@ -283,7 +283,7 @@ export interface SubagentInfo {
|
|
|
283
283
|
enabled: boolean;
|
|
284
284
|
maxDepth: number;
|
|
285
285
|
maxParallel: number;
|
|
286
|
-
/** 单次委派总时长毫秒(flow-robustness P1#4 反射:undefined → 默认
|
|
286
|
+
/** 单次委派总时长毫秒(flow-robustness P1#4 反射:undefined → 默认 1800000(30min,2026-08-28 抬升对齐流总时长);0 = 关) */
|
|
287
287
|
timeoutMs: number;
|
|
288
288
|
allowedTools: string[];
|
|
289
289
|
/** 预声明子 agent 列表(动态:反映 setSubagents/addSubagent/removeSubagent 后的最新) */
|
|
@@ -874,7 +874,7 @@ export interface ChatSdkOptions {
|
|
|
874
874
|
maxOutputTokens?: number;
|
|
875
875
|
/** 子 agent 委派(默认开启;{ enabled: false } 关闭) */
|
|
876
876
|
capabilities?: { dataOps?: boolean; fetch?: boolean; planning?: boolean; missionAnchor?: boolean; skills?: boolean; vfs?: boolean; summarization?: boolean; memory?: boolean; subagent?: boolean; verify?: boolean; domInspect?: boolean; inspectEnv?: boolean; draftWrite?: boolean; automation?: boolean; workingMemory?: boolean; focus?: boolean; contextInspector?: boolean; agentCompression?: boolean };/** tracing/skillHostScript/preferences/bulkGuard 已于 4.1.0 移除;残键静默忽略 */
|
|
877
|
-
subagent?: { enabled?: boolean; allowedTools?: string[]; systemPrompt?: string; temperature?: number; maxTokens?: number; skills?: SkillSpec[]; llm?: LLMConfig | ChatModelLike; maxDepth?: number; maxParallel?: number; /** 单次委派总时长毫秒(默认
|
|
877
|
+
subagent?: { enabled?: boolean; allowedTools?: string[]; systemPrompt?: string; temperature?: number; maxTokens?: number; skills?: SkillSpec[]; llm?: LLMConfig | ChatModelLike; maxDepth?: number; maxParallel?: number; /** 单次委派总时长毫秒(默认 1800000=30min,2026-08-28 抬升;超时 abort 子流 + recoverable 回灌;0 = 不限制) */ timeoutMs?: number; thinkingMode?: 'simple' | 'deep' };
|
|
878
878
|
/** 预声明子 agent 列表:每个用同主配置方式声明,自动生成 use_<id> 委派工具(与 spawn_agent 共存) */
|
|
879
879
|
subagents?: SubagentConfig[];
|
|
880
880
|
/** 自检:agent 返回前跑 check,不通过则 feedback 回灌自纠(默认关闭;需 capabilities.verify:true)。check 省略时默认 createWriteBackCheck 写后读回验证 */
|
|
@@ -1632,6 +1632,8 @@ export interface HtmlFormatCheckOptions {
|
|
|
1632
1632
|
}
|
|
1633
1633
|
/** HTML 格式 verify check(beforeReturn 门禁):扫 state.files 代码文件,不通过回灌 feedback 自纠 */
|
|
1634
1634
|
export declare function createHtmlFormatCheck(opts?: HtmlFormatCheckOptions): VerifyCheck;
|
|
1635
|
+
/** 工匠笔记末行守卫(note-gate):craftNotes 开启时子 agent 收口回复无 [note] 行 → beforeReturn 回灌补写一次 */
|
|
1636
|
+
export declare function createCraftNoteCheck(): VerifyCheck;
|
|
1635
1637
|
/** 沙箱采集到的原始渲染信号(console.error / js-error / unhandledrejection / 资源失败 / CSP 违规 / console.warn) */
|
|
1636
1638
|
export interface RenderSignal {
|
|
1637
1639
|
type: 'console-error' | 'console-warn' | 'js-error' | 'unhandledrejection' | 'resource-error' | 'csp-violation';
|
|
@@ -1743,6 +1745,12 @@ export declare function decorateModelUnavailable(err: unknown): boolean;
|
|
|
1743
1745
|
/** 模型不可用引导文案 */
|
|
1744
1746
|
export declare const MODEL_UNAVAILABLE_GUIDANCE: string;
|
|
1745
1747
|
export declare function resolveModelCaps(model: string): any;
|
|
1748
|
+
/** 表内该模型的输出上限(LLMConfig.maxTokens 未设时作请求 max_tokens 缺省;仅表命中模型返回值,未知模型 undefined 不兜防超发 400) */
|
|
1749
|
+
export declare function tableMaxOutputTokens(model?: string): number | undefined;
|
|
1750
|
+
/** 低能力提示基线:上下文 200K / 请求输出上限 32K */
|
|
1751
|
+
export declare const LOW_CAPS_HINT_BASELINE: { readonly contextWindow: 200000; readonly requestMaxTokens: 32768 };
|
|
1752
|
+
/** 低能力提示文案:上下文 <200K 或请求输出上限 <32K → 提示串;均达基线返回 null(主 agent 装配 warn / 子 agent debugLogs 留痕由调用面分流) */
|
|
1753
|
+
export declare function lowCapsHint(model: string | undefined, caps: { contextWindow: number; maxOutputTokens: number }, requestMaxTokens?: number): string | null;
|
|
1746
1754
|
export declare function estimateTokens(text: string): number;
|
|
1747
1755
|
export declare function offloadThresholdChars(contextWindow: number): number;
|
|
1748
1756
|
export declare function offloadPassThroughChars(contextWindow: number): number;
|
package/types/index.d.ts
CHANGED
|
@@ -613,7 +613,7 @@ export interface SubagentInfo {
|
|
|
613
613
|
enabled: boolean;
|
|
614
614
|
maxDepth: number;
|
|
615
615
|
maxParallel: number;
|
|
616
|
-
/** 单次委派总时长毫秒(flow-robustness P1#4 反射:undefined → 默认
|
|
616
|
+
/** 单次委派总时长毫秒(flow-robustness P1#4 反射:undefined → 默认 1800000(30min,2026-08-28 抬升对齐流总时长);0 = 关) */
|
|
617
617
|
timeoutMs: number;
|
|
618
618
|
allowedTools: string[];
|
|
619
619
|
/** 预声明子 agent 列表(动态:反映 setSubagents/addSubagent/removeSubagent 后的最新) */
|
|
@@ -1240,7 +1240,7 @@ export interface ChatSdkOptions {
|
|
|
1240
1240
|
images?: ImagesConfig;
|
|
1241
1241
|
/** 子 agent 委派(默认开启;{ enabled: false } 关闭) */
|
|
1242
1242
|
capabilities?: { dataOps?: boolean; fetch?: boolean; planning?: boolean; missionAnchor?: boolean; skills?: boolean; vfs?: boolean; summarization?: boolean; memory?: boolean; subagent?: boolean; verify?: boolean; domInspect?: boolean; inspectEnv?: boolean; draftWrite?: boolean; automation?: boolean; workingMemory?: boolean; focus?: boolean; contextInspector?: boolean; agentCompression?: boolean };/** tracing/skillHostScript/preferences/bulkGuard 已于 4.1.0 移除;残键静默忽略 */
|
|
1243
|
-
subagent?: { enabled?: boolean; allowedTools?: string[]; systemPrompt?: string; temperature?: number; maxTokens?: number; skills?: SkillSpec[]; llm?: LLMConfig | ChatModelLike; maxDepth?: number; maxParallel?: number; /** 单次委派总时长毫秒(默认
|
|
1243
|
+
subagent?: { enabled?: boolean; allowedTools?: string[]; systemPrompt?: string; temperature?: number; maxTokens?: number; skills?: SkillSpec[]; llm?: LLMConfig | ChatModelLike; maxDepth?: number; maxParallel?: number; /** 单次委派总时长毫秒(默认 1800000=30min,2026-08-28 抬升;超时 abort 子流 + recoverable 回灌;0 = 不限制) */ timeoutMs?: number; thinkingMode?: 'simple' | 'deep' };
|
|
1244
1244
|
/** 预声明子 agent 列表:每个用同主配置方式声明,自动生成 use_<id> 委派工具(与 spawn_agent 共存) */
|
|
1245
1245
|
subagents?: SubagentConfig[];
|
|
1246
1246
|
/** 自检:agent 返回前跑 check,不通过则 feedback 回灌自纠(默认关闭)。传 check/maxAttempts/adversarial 任一即自动开启(无需再配 capabilities.verify:true;显式 false 或 enabled:false 可关)。check 省略时默认 createWriteBackCheck 写后读回验证 */
|
|
@@ -2053,6 +2053,8 @@ export interface HtmlFormatCheckOptions {
|
|
|
2053
2053
|
}
|
|
2054
2054
|
/** HTML 格式 verify check(beforeReturn 门禁):扫 state.files 代码文件,不通过回灌 feedback 自纠 */
|
|
2055
2055
|
export declare function createHtmlFormatCheck(opts?: HtmlFormatCheckOptions): VerifyCheck;
|
|
2056
|
+
/** 工匠笔记末行守卫(note-gate):craftNotes 开启时子 agent 收口回复无 [note] 行 → beforeReturn 回灌补写一次(2026-08-28 真 LLM 复验驱动;createHtmlSubagent 默认挂进 verify 链尾,独立导出供自定义校验链复用) */
|
|
2057
|
+
export declare function createCraftNoteCheck(): VerifyCheck;
|
|
2056
2058
|
/** 沙箱采集到的原始渲染信号(console.error / js-error / unhandledrejection / 资源失败 / CSP 违规 / console.warn) */
|
|
2057
2059
|
export interface RenderSignal {
|
|
2058
2060
|
type: 'console-error' | 'console-warn' | 'js-error' | 'unhandledrejection' | 'resource-error' | 'csp-violation';
|
|
@@ -2168,6 +2170,12 @@ export declare function decorateModelUnavailable(err: unknown): boolean;
|
|
|
2168
2170
|
/** 模型不可用引导文案(换模型名 setLlm / 查网关模型面;不引导声明任何新配置) */
|
|
2169
2171
|
export declare const MODEL_UNAVAILABLE_GUIDANCE: string;
|
|
2170
2172
|
export declare function resolveModelCaps(model: string): any;
|
|
2173
|
+
/** 表内该模型的输出上限(LLMConfig.maxTokens 未设时作请求 max_tokens 缺省;仅表命中模型返回值,未知模型 undefined 不兜防超发 400) */
|
|
2174
|
+
export declare function tableMaxOutputTokens(model?: string): number | undefined;
|
|
2175
|
+
/** 低能力提示基线:上下文 200K / 请求输出上限 32K */
|
|
2176
|
+
export declare const LOW_CAPS_HINT_BASELINE: { readonly contextWindow: 200000; readonly requestMaxTokens: 32768 };
|
|
2177
|
+
/** 低能力提示文案:上下文 <200K 或请求输出上限 <32K → 提示串;均达基线返回 null(主 agent 装配 warn / 子 agent debugLogs 留痕由调用面分流) */
|
|
2178
|
+
export declare function lowCapsHint(model: string | undefined, caps: { contextWindow: number; maxOutputTokens: number }, requestMaxTokens?: number): string | null;
|
|
2171
2179
|
export declare function estimateTokens(text: string): number;
|
|
2172
2180
|
export declare function offloadThresholdChars(contextWindow: number): number;
|
|
2173
2181
|
export declare function offloadPassThroughChars(contextWindow: number): number;
|