page-agent-sdk 2.22.0 → 2.23.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 +10 -10
- package/README.zh-CN.md +6 -6
- package/dist/page-agent-sdk.iife.js +121 -121
- package/dist/page-agent-sdk.js +744 -696
- package/dist/page-agent-sdk.umd.cjs +72 -72
- package/package.json +1 -1
- package/skills/page-agent-sdk-integrate/SKILL.md +1 -1
- package/skills/page-agent-sdk-integrate/references/advanced.md +1 -1
- package/skills/page-agent-sdk-integrate/references/api.md +2 -2
- package/skills/page-agent-sdk-integrate/references/integration-prompt.md +1 -1
- package/skills/page-agent-sdk-integrate/references/quickstart.md +4 -4
- package/skills/page-agent-sdk-integrate/references/use-cases.md +1 -1
- package/types/index.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "page-agent-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.23.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",
|
|
@@ -37,7 +37,7 @@ const app = { title: 'Demo', theme: 'light', items: [] } // plain object (or re
|
|
|
37
37
|
|
|
38
38
|
createChatSdk({
|
|
39
39
|
container: '#root',
|
|
40
|
-
llm: { apiKey, baseUrl: 'https://api.deepseek.com/v1', model: 'deepseek-
|
|
40
|
+
llm: { apiKey, baseUrl: 'https://api.deepseek.com/v1', model: 'deepseek-v4-flash' },
|
|
41
41
|
systemPrompt: 'You are a JSON operation assistant; read/write the main data via tools.',
|
|
42
42
|
data: {
|
|
43
43
|
schema: z.object({
|
|
@@ -317,4 +317,4 @@ sdk.removeSubagent('translator') // → boolean
|
|
|
317
317
|
sdk.setSubagents([{ id: 'a', description: 'A' }, { id: 'b', description: 'B' }]) // replace all
|
|
318
318
|
```
|
|
319
319
|
|
|
320
|
-
> **Note**: `setSystemPrompt` / `setMiddleware` (runtime middleware-array swap) are not yet implemented — they touch the harness core and are deferred. Use `setData` / `setSkills` / `augmentSystem` hook to cover most dynamic system-prompt scenarios. See `doc/roadmap.md` #5.
|
|
320
|
+
> **Note**: `setSystemPrompt` / `setMiddleware` (runtime middleware-array swap) are not yet implemented — they touch the harness core and are deferred. Use `setData` / `setSkills` / `augmentSystem` hook to cover most dynamic system-prompt scenarios. See `doc/archive/roadmap.md` #5.
|
|
@@ -231,7 +231,7 @@ createChatSdk({
|
|
|
231
231
|
mode: 'proxy',
|
|
232
232
|
baseUrl: '/api/llm', // your proxy (same-origin avoids CORS)
|
|
233
233
|
userToken: getUserToken(), // session token (server validates)
|
|
234
|
-
model: 'deepseek-
|
|
234
|
+
model: 'deepseek-v4-flash',
|
|
235
235
|
refreshToken?: async () => ..., // optional: refresh on 401
|
|
236
236
|
headers?: { 'X-Tenant': 'acme' }, // optional: extra headers
|
|
237
237
|
}),
|
|
@@ -244,7 +244,7 @@ createChatSdk({
|
|
|
244
244
|
mode: 'direct',
|
|
245
245
|
apiKey: 'sk-xxx',
|
|
246
246
|
baseUrl: 'https://api.deepseek.com/v1',
|
|
247
|
-
model: 'deepseek-
|
|
247
|
+
model: 'deepseek-v4-flash',
|
|
248
248
|
}),
|
|
249
249
|
...
|
|
250
250
|
})
|
|
@@ -78,7 +78,7 @@ const sdk = createChatSdk({
|
|
|
78
78
|
llm: {
|
|
79
79
|
apiKey: import.meta.env.VITE_AI_API_KEY || 'YOUR_API_KEY',
|
|
80
80
|
baseUrl: 'https://api.deepseek.com/v1', // OpenAI-compatible protocol; DeepSeek by default
|
|
81
|
-
model: 'deepseek-
|
|
81
|
+
model: 'deepseek-v4-flash',
|
|
82
82
|
temperature: 0.3, // low temp recommended for large JSON ops
|
|
83
83
|
},
|
|
84
84
|
// [UI form: built-in dialog (default) / drawer mode (dialog.drawer:true) / headless (ui:false)]
|
|
@@ -18,7 +18,7 @@ Drop into any HTML page. The built-in dialog mounts itself. (`systemPrompt` is o
|
|
|
18
18
|
const app = { title: 'Hello', theme: 'light' } // plain object (no window needed)
|
|
19
19
|
ChatSdk.createChatSdk({
|
|
20
20
|
container: '#root',
|
|
21
|
-
llm: { apiKey: 'sk-...', baseUrl: 'https://api.deepseek.com/v1', model: 'deepseek-
|
|
21
|
+
llm: { apiKey: 'sk-...', baseUrl: 'https://api.deepseek.com/v1', model: 'deepseek-v4-flash' },
|
|
22
22
|
systemPrompt: 'You are a JSON operation assistant. Read/write the main data via tools.',
|
|
23
23
|
data: {
|
|
24
24
|
schema: ChatSdk.z.object({
|
|
@@ -47,7 +47,7 @@ const app = { title: 'Hello', theme: 'light', items: [] }
|
|
|
47
47
|
|
|
48
48
|
const sdk = createChatSdk({
|
|
49
49
|
container: '#root',
|
|
50
|
-
llm: { apiKey: import.meta.env.VITE_AI_API_KEY, baseUrl: 'https://api.deepseek.com/v1', model: 'deepseek-
|
|
50
|
+
llm: { apiKey: import.meta.env.VITE_AI_API_KEY, baseUrl: 'https://api.deepseek.com/v1', model: 'deepseek-v4-flash' },
|
|
51
51
|
systemPrompt: 'You are a JSON operation assistant. Read/write the main data via tools.',
|
|
52
52
|
data: {
|
|
53
53
|
schema: z.object({
|
|
@@ -161,7 +161,7 @@ const sdk = createChatSdk({
|
|
|
161
161
|
mode: 'proxy',
|
|
162
162
|
baseUrl: '/api/llm', // your proxy (same-origin avoids CORS)
|
|
163
163
|
userToken: getUserToken(), // session token (server validates, swaps in real key)
|
|
164
|
-
model: 'deepseek-
|
|
164
|
+
model: 'deepseek-v4-flash',
|
|
165
165
|
refreshToken: async () => (await (await fetch('/api/refresh')).json()).token, // auto-refresh on 401
|
|
166
166
|
headers: { 'X-Tenant': 'acme' }, // optional custom headers
|
|
167
167
|
}),
|
|
@@ -173,7 +173,7 @@ const sdkDev = createChatSdk({
|
|
|
173
173
|
container: '#root',
|
|
174
174
|
llm: createProxyLlm({
|
|
175
175
|
mode: 'direct',
|
|
176
|
-
apiKey: 'sk-...', baseUrl: 'https://api.deepseek.com/v1', model: 'deepseek-
|
|
176
|
+
apiKey: 'sk-...', baseUrl: 'https://api.deepseek.com/v1', model: 'deepseek-v4-flash',
|
|
177
177
|
}),
|
|
178
178
|
// ...data, systemPrompt...
|
|
179
179
|
}).mount()
|
|
@@ -16,7 +16,7 @@ const page = {
|
|
|
16
16
|
|
|
17
17
|
createChatSdk({
|
|
18
18
|
container: '#chat',
|
|
19
|
-
llm: { apiKey, baseUrl: 'https://api.deepseek.com/v1', model: 'deepseek-
|
|
19
|
+
llm: { apiKey, baseUrl: 'https://api.deepseek.com/v1', model: 'deepseek-v4-flash', temperature: 0.3 },
|
|
20
20
|
systemPrompt: '你是页面搭建助手。用 write 的 patch 按 jsonPath 增量改 components,不要重传整树。',
|
|
21
21
|
data: {
|
|
22
22
|
schema: z.object({
|
package/types/index.d.ts
CHANGED
|
@@ -980,7 +980,7 @@ export declare function agentError(severity: ErrorSeverity, message: string, cod
|
|
|
980
980
|
// === 与 src/core/index.ts 导出对齐(消费者类型完整;复杂内部类型用宽松声明,消费者主要消费工厂返回值) ===
|
|
981
981
|
// 上下文压缩预设
|
|
982
982
|
export declare function resolveContextOptions(options: any, modelContextWindow: number): any;
|
|
983
|
-
export type ContextPreset = 'auto' | 'conservative' | 'aggressive';
|
|
983
|
+
export type ContextPreset = 'auto' | 'conservative' | 'aggressive' | 'complex';
|
|
984
984
|
export declare const CONTEXT_PRESETS: Record<string, any>;
|
|
985
985
|
|
|
986
986
|
// MCP
|