page-agent-sdk 1.3.7 → 1.3.9

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.
Files changed (2) hide show
  1. package/package.json +5 -2
  2. package/types/index.d.ts +45 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "page-agent-sdk",
3
- "version": "1.3.7",
3
+ "version": "1.3.9",
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,10 @@
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",
39
+ "test:types": "tsc --noEmit -p tsconfig.test.json",
40
+ "test:size": "node tests/size-check.mjs"
38
41
  },
39
42
  "keywords": [
40
43
  "ai",
package/types/index.d.ts CHANGED
@@ -122,7 +122,6 @@ export interface AgentInfo {
122
122
  /** 会话级 checkpoint 装载状态(未开启 → undefined) */
123
123
  checkpoints?: { enabled: boolean; auto: boolean; list: CheckpointMeta[] };
124
124
  }
125
- }
126
125
  export interface McpServerConfig { transport: 'http' | 'sse' | 'websocket'; url: string; name?: string; requestInit?: any; }
127
126
 
128
127
  export declare const ChatDialog: DefineComponent<ChatDialogProps>;
@@ -488,3 +487,48 @@ export declare function zodError(path: string, issues: unknown[]): string;
488
487
  export declare function jsonParseError(path: string | undefined, raw: string, err: unknown): string;
489
488
  /** 提取 zod issues 为结构化 details(每条 path/expected/received/message) */
490
489
  export declare function formatZodIssues(issues: unknown[]): unknown[];
490
+
491
+ // === 与 src/core/index.ts 导出对齐(消费者类型完整;复杂内部类型用宽松声明,消费者主要消费工厂返回值) ===
492
+ // 上下文压缩预设
493
+ export declare function resolveContextOptions(options: any, modelContextWindow: number): any;
494
+ export type ContextPreset = 'auto' | 'conservative' | 'aggressive';
495
+ export declare const CONTEXT_PRESETS: Record<string, any>;
496
+
497
+ // MCP
498
+ export declare function connectMcp(config: any): Promise<any>;
499
+ export declare function extractText(result: any): string;
500
+ export type McpTransport = 'http' | 'sse' | 'websocket';
501
+ export interface McpConnection { [k: string]: any }
502
+
503
+ // harness / 中间件
504
+ export interface CreateAgentOptions { [k: string]: any }
505
+ export interface Middleware { name: string; [k: string]: any }
506
+ export interface ModelRequest { [k: string]: any }
507
+ export interface ModelResponse { [k: string]: any }
508
+ export interface ToolCallContext { [k: string]: any }
509
+ export interface StateUpdate { [k: string]: any }
510
+
511
+ // 子 agent
512
+ export declare function createSubagentsMiddleware(opts: any): any;
513
+ export interface SubagentOptions { [k: string]: any }
514
+ export interface SubagentLlmConfig { [k: string]: any }
515
+
516
+ // checkpoint / windowOps / permissions
517
+ export interface CheckpointDeps { [k: string]: any }
518
+ export interface WindowAuditEntry { [k: string]: any }
519
+ export interface WindowSnapshotEntry { [k: string]: any }
520
+ export type PermissionOp = string;
521
+
522
+ // vfs
523
+ export declare function createVfs(opts?: any): any;
524
+
525
+ // 上下文管理
526
+ export interface ContextManagerOptions { [k: string]: any }
527
+ export interface CompressionStats { [k: string]: any }
528
+
529
+ // 模型能力 / token 估算 / offload 阈值
530
+ export declare function resolveModelCaps(model: string): any;
531
+ export declare function estimateTokens(text: string): number;
532
+ export declare function offloadThresholdChars(contextWindow: number): number;
533
+ export declare function offloadPassThroughChars(contextWindow: number): number;
534
+ export interface ModelCaps { [k: string]: any }