page-agent-sdk 2.40.0 → 2.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/README.md +3 -3
- package/README.zh-CN.md +3 -3
- package/dist/page-agent-sdk.headless.js +1005 -995
- package/dist/page-agent-sdk.iife.js +142 -141
- package/dist/page-agent-sdk.js +3186 -3151
- package/dist/page-agent-sdk.umd.cjs +93 -92
- package/package.json +1 -1
- package/types/headless.d.ts +6 -0
- package/types/index.d.ts +12 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "page-agent-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.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",
|
package/types/headless.d.ts
CHANGED
|
@@ -869,6 +869,12 @@ export interface ChatSdk {
|
|
|
869
869
|
show(): void;
|
|
870
870
|
send(message: string, options?: { mission?: Partial<Mission>; interceptors?: { input?: (input: unknown) => unknown; output?: (json: unknown) => unknown }; maxAutoRetries?: number; /** 中断信号(fix-hang-and-feedback P1-4) */ signal?: AbortSignal }): Promise<string>;
|
|
871
871
|
switchSession(sessionId?: string): Promise<string>;
|
|
872
|
+
/**
|
|
873
|
+
* 新建/清空会话(同步;「清空对话」编程式入口):中止在途流 + 收口挂起冲突(keep_external)
|
|
874
|
+
* + 重置全部内存态(messages/vfs/todos/memory/mission/workingMemory/focus/checkpoint/debugLogs)+ 换新 sessionId + emit session_restored。
|
|
875
|
+
* storage 开启时同步新建持久会话;未开启时仅重置内存态(P1-8 修复后不再早退泄漏)。
|
|
876
|
+
*/
|
|
877
|
+
resetSession(): void;
|
|
872
878
|
/** 列出当前 agent 的所有历史会话(供「历史列表」UI;storage 未开启 → []) */
|
|
873
879
|
listSessions(): Promise<SessionMeta[]>;
|
|
874
880
|
/** 历史会话列表(响应式;switchSession/deleteSession/onClear/init 后自动 refresh;直接消费无需手动 listSessions/refresh/hook) */
|
package/types/index.d.ts
CHANGED
|
@@ -404,6 +404,12 @@ export declare const MessageContent: DefineComponent<any>;
|
|
|
404
404
|
export declare const CodePreview: DefineComponent<any>;
|
|
405
405
|
export declare const SkillPanel: DefineComponent<any>;
|
|
406
406
|
export declare function useChat(opts?: any): any;
|
|
407
|
+
/** 单代码块超过此字符数跳过 hljs 高亮(转义直出),防巨代码块单帧卡顿(P1-26 尺寸闸) */
|
|
408
|
+
export declare const HLJS_BLOCK_MAX_CHARS: number;
|
|
409
|
+
/** markdown → 未净化 HTML(marked + 代码块渲染,含 hljs 尺寸闸;**不含** DOMPurify;⚠️ 勿直接 v-html)。P1-26 抽离可单测 */
|
|
410
|
+
export declare function markedToHtml(text: string): string;
|
|
411
|
+
/** markdown → 净化 HTML(marked + 代码块渲染 + DOMPurify;含 hljs 尺寸闸;sanitize 恒走)。仅主包(headless 子路径不含) */
|
|
412
|
+
export declare function renderMarkdownHtml(text: string): string;
|
|
407
413
|
|
|
408
414
|
// ===== 框架无关 SDK(页面内 Agent)=====
|
|
409
415
|
export interface LLMConfig {
|
|
@@ -879,6 +885,12 @@ export interface ChatSdk {
|
|
|
879
885
|
show(): void;
|
|
880
886
|
send(message: string, options?: { mission?: Partial<Mission>; interceptors?: { input?: (input: unknown) => unknown; output?: (json: unknown) => unknown }; maxAutoRetries?: number; /** 中断信号(fix-hang-and-feedback P1-4) */ signal?: AbortSignal }): Promise<string>;
|
|
881
887
|
switchSession(sessionId?: string): Promise<string>;
|
|
888
|
+
/**
|
|
889
|
+
* 新建/清空会话(同步;「清空对话」编程式入口,与 UI ChatHeader 清空同语义):
|
|
890
|
+
* 中止在途流 + 收口挂起冲突(keep_external)+ 重置全部内存态(messages/vfs/todos/memory/mission/workingMemory/focus/checkpoint/debugLogs)
|
|
891
|
+
* + 换新 sessionId + emit session_restored。storage 开启时同步新建持久会话;未开启时仅重置内存态(P1-8 修复后不再早退泄漏)。
|
|
892
|
+
*/
|
|
893
|
+
resetSession(): void;
|
|
882
894
|
/** 列出当前 agent 的所有历史会话(供「历史列表」UI;storage 未开启 → []) */
|
|
883
895
|
listSessions(): Promise<SessionMeta[]>;
|
|
884
896
|
/** 历史会话列表(响应式;switchSession/deleteSession/onClear/init 后自动 refresh;直接消费无需手动 listSessions/refresh/hook) */
|