page-agent-sdk 3.18.0 → 3.19.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 +208 -180
- package/dist/page-agent-sdk.iife.js +3 -3
- package/dist/page-agent-sdk.js +56 -28
- package/dist/page-agent-sdk.umd.cjs +3 -3
- package/package.json +2 -1
- package/types/index.d.ts +8 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "page-agent-sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.19.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",
|
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
"test:draft-real": "tsx tests/runtime/draft-real-llm.ts",
|
|
63
63
|
"test:trace-real": "tsx tests/runtime/trace-real-llm.ts",
|
|
64
64
|
"test:maliang-real": "tsx tests/runtime/maliang-real-llm.ts",
|
|
65
|
+
"test:real": "node tests/runtime/real-llm.mjs",
|
|
65
66
|
"test:uispec-real": "node tests/runtime/uispec-real-llm.mjs"
|
|
66
67
|
},
|
|
67
68
|
"keywords": [
|
package/types/index.d.ts
CHANGED
|
@@ -120,6 +120,10 @@ export interface TokenUsage {
|
|
|
120
120
|
prompt_tokens?: number;
|
|
121
121
|
completion_tokens?: number;
|
|
122
122
|
total_tokens?: number;
|
|
123
|
+
/** prompt caching 命中读取的 input tokens(Anthropic;0/缺省=未命中或端点不支持缓存) */
|
|
124
|
+
cache_read_input_tokens?: number;
|
|
125
|
+
/** prompt caching 本次写入的 input tokens(Anthropic;写价格 1.25x,5m/1h TTL 内复用) */
|
|
126
|
+
cache_creation_input_tokens?: number;
|
|
123
127
|
}
|
|
124
128
|
/** 批处理单任务结果(sdk.batch 返回;ok=true 含 reply,ok=false 含 error) */
|
|
125
129
|
export interface BatchResult {
|
|
@@ -491,6 +495,10 @@ export interface LLMConfig {
|
|
|
491
495
|
extraBody?: Record<string, any>;
|
|
492
496
|
/** 透传 ChatOpenAI configuration 的额外字段(如 headers/timeout/customFetch),与 baseUrl 合并 */
|
|
493
497
|
extraConfig?: Record<string, any>;
|
|
498
|
+
/** Anthropic prompt caching(仅 provider:'anthropic' 生效):`true` = ephemeral 5m / `'1h'` = 长 TTL。
|
|
499
|
+
* langchain 顶层 cache_control 自动在最后一个可缓存块打断点并随对话增长推进 —— ReAct 多轮前缀
|
|
500
|
+
* (system+tools+历史)命中缓存,input 价格降至 ~1/10;效果观测看 usage 事件的 cache_read_input_tokens */
|
|
501
|
+
cacheControl?: boolean | '5m' | '1h';
|
|
494
502
|
}
|
|
495
503
|
/** LangChain BaseChatModel 的结构形状(provider 抽离:llm 可传任意 provider 实例) */
|
|
496
504
|
export type ChatModelLike = {
|