page-agent-sdk 1.3.7 → 1.3.8
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 +3 -2
- package/types/index.d.ts +45 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "page-agent-sdk",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "框架无关的页面内 Agent JS SDK —— 以对话框形态挂载到任意网页,通过自定义 tool 读写宿主 window 属性(GET 抓文档),具备 planning/skills/虚拟工作区/快照回退/context 管理能力。Vue 打包进库,使用者无需安装 Vue。",
|
|
6
6
|
"main": "./dist/page-agent-sdk.umd.cjs",
|
|
@@ -34,7 +34,8 @@
|
|
|
34
34
|
"build:iife": "vite build --config vite.iife.config.ts",
|
|
35
35
|
"preview": "vite preview",
|
|
36
36
|
"test": "tsx src/core/__tests__/selftest.ts",
|
|
37
|
-
"test:e2e": "node tests/e2e-integration.mjs"
|
|
37
|
+
"test:e2e": "node tests/e2e-integration.mjs",
|
|
38
|
+
"test:exports": "node tests/exports-consistency.mjs"
|
|
38
39
|
},
|
|
39
40
|
"keywords": [
|
|
40
41
|
"ai",
|
package/types/index.d.ts
CHANGED
|
@@ -488,3 +488,48 @@ export declare function zodError(path: string, issues: unknown[]): string;
|
|
|
488
488
|
export declare function jsonParseError(path: string | undefined, raw: string, err: unknown): string;
|
|
489
489
|
/** 提取 zod issues 为结构化 details(每条 path/expected/received/message) */
|
|
490
490
|
export declare function formatZodIssues(issues: unknown[]): unknown[];
|
|
491
|
+
|
|
492
|
+
// === 与 src/core/index.ts 导出对齐(消费者类型完整;复杂内部类型用宽松声明,消费者主要消费工厂返回值) ===
|
|
493
|
+
// 上下文压缩预设
|
|
494
|
+
export declare function resolveContextOptions(options: any, modelContextWindow: number): any;
|
|
495
|
+
export type ContextPreset = 'auto' | 'conservative' | 'aggressive';
|
|
496
|
+
export declare const CONTEXT_PRESETS: Record<string, any>;
|
|
497
|
+
|
|
498
|
+
// MCP
|
|
499
|
+
export declare function connectMcp(config: any): Promise<any>;
|
|
500
|
+
export declare function extractText(result: any): string;
|
|
501
|
+
export type McpTransport = 'http' | 'sse' | 'websocket';
|
|
502
|
+
export interface McpConnection { [k: string]: any }
|
|
503
|
+
|
|
504
|
+
// harness / 中间件
|
|
505
|
+
export interface CreateAgentOptions { [k: string]: any }
|
|
506
|
+
export interface Middleware { name: string; [k: string]: any }
|
|
507
|
+
export interface ModelRequest { [k: string]: any }
|
|
508
|
+
export interface ModelResponse { [k: string]: any }
|
|
509
|
+
export interface ToolCallContext { [k: string]: any }
|
|
510
|
+
export interface StateUpdate { [k: string]: any }
|
|
511
|
+
|
|
512
|
+
// 子 agent
|
|
513
|
+
export declare function createSubagentsMiddleware(opts: any): any;
|
|
514
|
+
export interface SubagentOptions { [k: string]: any }
|
|
515
|
+
export interface SubagentLlmConfig { [k: string]: any }
|
|
516
|
+
|
|
517
|
+
// checkpoint / windowOps / permissions
|
|
518
|
+
export interface CheckpointDeps { [k: string]: any }
|
|
519
|
+
export interface WindowAuditEntry { [k: string]: any }
|
|
520
|
+
export interface WindowSnapshotEntry { [k: string]: any }
|
|
521
|
+
export type PermissionOp = string;
|
|
522
|
+
|
|
523
|
+
// vfs
|
|
524
|
+
export declare function createVfs(opts?: any): any;
|
|
525
|
+
|
|
526
|
+
// 上下文管理
|
|
527
|
+
export interface ContextManagerOptions { [k: string]: any }
|
|
528
|
+
export interface CompressionStats { [k: string]: any }
|
|
529
|
+
|
|
530
|
+
// 模型能力 / token 估算 / offload 阈值
|
|
531
|
+
export declare function resolveModelCaps(model: string): any;
|
|
532
|
+
export declare function estimateTokens(text: string): number;
|
|
533
|
+
export declare function offloadThresholdChars(contextWindow: number): number;
|
|
534
|
+
export declare function offloadPassThroughChars(contextWindow: number): number;
|
|
535
|
+
export interface ModelCaps { [k: string]: any }
|