@webskill/sdk 0.5.0 → 0.6.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/dist/agent.d.ts +2 -2
- package/dist/agent.js +57 -15
- package/dist/browser.d.ts +101 -5
- package/dist/browser.js +421 -11
- package/dist/{catalogComponents-DV7cPpUm-C77AEEx9.js → catalogComponents-Dr5dFMAb-Dacibl1e.js} +126 -44
- package/dist/{dist-bewtXYlO.js → dist-DnYG2-eY.js} +53 -14
- package/dist/{dist-6C03DShK.js → dist-DusANsrn.js} +981 -185
- package/dist/{env--jJB-TSX-04klhTYi.js → env-8cY40DXB-CGnEVZby.js} +7 -6
- package/dist/{env-BPUBZCwJ-4jat_SVG.d.ts → env-AK3cSMEA-Dli6QU5E.d.ts} +4 -3
- package/dist/governance.d.ts +3 -3
- package/dist/governance.js +1 -1
- package/dist/{index-Bsqg4ftU.d.ts → index-BMocOEi0.d.ts} +13 -7
- package/dist/{index-D_7ZZjkl.d.ts → index-BuTpBMzr.d.ts} +69 -6
- package/dist/{index-vBz_FC9w.d.ts → index-C-KFAZoF.d.ts} +298 -52
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/mcp.d.ts +39 -8
- package/dist/mcp.js +53 -19
- package/dist/{memoryArtifactStore-BtOeB_hm-tj3fC5ip.js → memoryArtifactStore-52Zn9npI-BMPYwvoy.js} +10 -2
- package/dist/node.d.ts +4 -4
- package/dist/node.js +9 -2
- package/dist/{openUiLibrary-W3Ce896k-ClFTRZFs.js → openUiLibrary-Bdrji9qK-DzAxRlTY.js} +3 -3
- package/dist/{skillVersionStore-BzLbzFOL-CxwIewHJ.d.ts → skillVersionStore-BzLbzFOL-CxdAFWO2.d.ts} +1 -1
- package/dist/{testing-DDCJWvgA.js → testing-CYTFqkDm.js} +1 -1
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +3 -3
- package/dist/{types-D_hoCri8-BnNPiZCi.d.ts → types-4pg-qp_I-Gq63X8Oa.d.ts} +33 -8
- package/dist/ui-react.d.ts +2 -2
- package/dist/ui-react.js +66 -23
- package/dist/ui-vue.d.ts +1 -1
- package/dist/ui-vue.js +13 -8
- package/dist/ui.d.ts +3 -3
- package/dist/ui.js +2 -2
- package/dist/{webskillLitCatalog-_mugzRHx-DiuJpCuf.js → webskillLitCatalog-_mugzRHx-B_54vxum.js} +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFileSync } from "node:fs";
|
|
2
2
|
|
|
3
|
-
//#region ../node/dist/env
|
|
3
|
+
//#region ../node/dist/env-8cY40DXB.js
|
|
4
4
|
/** 解析 .env(简单 KEY=VALUE 行解析,不引依赖);文件缺失返回 undefined */
|
|
5
5
|
function readEnvVars(dotenvPath) {
|
|
6
6
|
let raw;
|
|
@@ -23,15 +23,16 @@ function readEnvVars(dotenvPath) {
|
|
|
23
23
|
return vars;
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
|
-
* 读取 LLM_BASE_URL / LLM_API_KEY / LLM_MODEL
|
|
27
|
-
*
|
|
26
|
+
* 读取 LLM_BASE_URL / LLM_API_KEY / LLM_MODEL;缺项返回 undefined 供测试 skip 判断。
|
|
27
|
+
* 0.6.0 FR-13.2 移除了旧的 `VITE_` 前缀回退:该前缀是 Vite 向**客户端 bundle** 注入变量的开关,
|
|
28
|
+
* 把 API key 放在它名下等于告诉使用者“这个 key 会被打进前端产物”。
|
|
28
29
|
*/
|
|
29
30
|
function loadLlmConfigFromEnv(dotenvPath = ".env") {
|
|
30
31
|
const vars = readEnvVars(dotenvPath);
|
|
31
32
|
if (!vars) return void 0;
|
|
32
|
-
const baseUrl = vars.get("LLM_BASE_URL")
|
|
33
|
-
const apiKey = vars.get("LLM_API_KEY")
|
|
34
|
-
const model = vars.get("LLM_MODEL")
|
|
33
|
+
const baseUrl = vars.get("LLM_BASE_URL");
|
|
34
|
+
const apiKey = vars.get("LLM_API_KEY");
|
|
35
|
+
const model = vars.get("LLM_MODEL");
|
|
35
36
|
if (!baseUrl || !apiKey || !model) return void 0;
|
|
36
37
|
return {
|
|
37
38
|
baseUrl,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../node/dist/env-
|
|
1
|
+
//#region ../node/dist/env-AK3cSMEA.d.ts
|
|
2
2
|
//#region src/env.d.ts
|
|
3
3
|
interface LlmEnvConfig {
|
|
4
4
|
baseUrl: string;
|
|
@@ -12,8 +12,9 @@ interface ProviderEnvConfig {
|
|
|
12
12
|
baseUrl?: string;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
* 读取 LLM_BASE_URL / LLM_API_KEY / LLM_MODEL
|
|
16
|
-
*
|
|
15
|
+
* 读取 LLM_BASE_URL / LLM_API_KEY / LLM_MODEL;缺项返回 undefined 供测试 skip 判断。
|
|
16
|
+
* 0.6.0 FR-13.2 移除了旧的 `VITE_` 前缀回退:该前缀是 Vite 向**客户端 bundle** 注入变量的开关,
|
|
17
|
+
* 把 API key 放在它名下等于告诉使用者“这个 key 会被打进前端产物”。
|
|
17
18
|
*/
|
|
18
19
|
declare function loadLlmConfigFromEnv(dotenvPath?: string): LlmEnvConfig | undefined;
|
|
19
20
|
/** ANTHROPIC_API_KEY / ANTHROPIC_MODEL(可选 ANTHROPIC_BASE_URL);缺项返回 undefined */
|
package/dist/governance.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { B as PageQuery, P as FileSystemProvider, Q as SkillCatalogEntry, b as UiBridge, et as SkillDocument, f as LlmMessage, it as SkillManagerPort, l as LlmClient, z as Page } from "./types-
|
|
2
|
-
import {
|
|
3
|
-
import { _ as SkillVersion, a as AuditLog, c as CandidateFile, d as CandidateSource, f as CandidateStatus, g as SkillState, h as SKILL_VERSION_PAGE_SIZE, i as AuditEvent, l as CandidateRisk, m as CompositeApprovalPolicy, n as ApprovalDecision, o as AuditQueryFilter, p as CandidateStore, r as ApprovalPolicy, s as CANDIDATE_PAGE_SIZE, t as AlwaysHumanApprovalPolicy, u as CandidateSkill, v as SkillVersionStore, y as candidateToCatalogEntry } from "./skillVersionStore-BzLbzFOL-
|
|
1
|
+
import { B as PageQuery, P as FileSystemProvider, Q as SkillCatalogEntry, b as UiBridge, et as SkillDocument, f as LlmMessage, it as SkillManagerPort, l as LlmClient, z as Page } from "./types-4pg-qp_I-Gq63X8Oa.js";
|
|
2
|
+
import { It as SkillStateGuard, Mt as SkillOutcomeReporter, V as IntegrityVerdict, jt as SkillIntegrityGuard, on as WebSkillRuntime, vt as RuntimeRun } from "./index-C-KFAZoF.js";
|
|
3
|
+
import { _ as SkillVersion, a as AuditLog, c as CandidateFile, d as CandidateSource, f as CandidateStatus, g as SkillState, h as SKILL_VERSION_PAGE_SIZE, i as AuditEvent, l as CandidateRisk, m as CompositeApprovalPolicy, n as ApprovalDecision, o as AuditQueryFilter, p as CandidateStore, r as ApprovalPolicy, s as CANDIDATE_PAGE_SIZE, t as AlwaysHumanApprovalPolicy, u as CandidateSkill, v as SkillVersionStore, y as candidateToCatalogEntry } from "./skillVersionStore-BzLbzFOL-CxdAFWO2.js";
|
|
4
4
|
//#region ../governance/dist/index.d.ts
|
|
5
5
|
//#region src/candidate/candidateNormalizer.d.ts
|
|
6
6
|
/** 剥 markdown fence 与 <think> 块、截取首尾 {};非对象 → CANDIDATE_INVALID */
|
package/dist/governance.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { O as messageOf, T as isValidSkillName, g as assertSafePathSegment, m as WebSkillError } from "./dist-8oQRa8Xz.js";
|
|
2
|
-
import {
|
|
2
|
+
import { a as textParts, n as partsToText } from "./memoryArtifactStore-52Zn9npI-BMPYwvoy.js";
|
|
3
3
|
|
|
4
4
|
//#region ../governance/dist/index.js
|
|
5
5
|
const invalid = (message, details) => {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { I as JsonSchema, T as UiSpecSnapshot, b as UiBridge, c as InteractionResponse, mt as UiSpecNode, r as ChartSpec, s as InteractionRequest, v as RenderBlock, x as UiSpecActionCapability, y as RenderResultRequest } from "./types-
|
|
2
|
-
import {
|
|
1
|
+
import { I as JsonSchema, T as UiSpecSnapshot, b as UiBridge, c as InteractionResponse, mt as UiSpecNode, r as ChartSpec, s as InteractionRequest, v as RenderBlock, x as UiSpecActionCapability, y as RenderResultRequest } from "./types-4pg-qp_I-Gq63X8Oa.js";
|
|
2
|
+
import { O as ExternalToolSource } from "./index-C-KFAZoF.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { ComponentType, ReactNode } from "react";
|
|
5
5
|
//#region ../ui/dist/index.d.ts
|
|
6
6
|
//#region src/model/formModel.d.ts
|
|
7
7
|
interface FormModel {
|
|
8
|
-
kind: 'ask' | 'confirm' | 'form' | 'select' | 'authorize';
|
|
8
|
+
kind: 'ask' | 'confirm' | 'form' | 'select' | 'authorize' | 'file-pick';
|
|
9
9
|
title?: string;
|
|
10
10
|
message?: string;
|
|
11
11
|
controls: ControlModel[];
|
|
@@ -15,7 +15,7 @@ interface FormModel {
|
|
|
15
15
|
interface ControlModel {
|
|
16
16
|
name: string;
|
|
17
17
|
label: string;
|
|
18
|
-
control: 'text' | 'number' | 'boolean' | 'select' | 'textarea';
|
|
18
|
+
control: 'text' | 'number' | 'boolean' | 'select' | 'textarea' | 'file';
|
|
19
19
|
required?: boolean;
|
|
20
20
|
description?: string;
|
|
21
21
|
defaultValue?: unknown;
|
|
@@ -23,14 +23,17 @@ interface ControlModel {
|
|
|
23
23
|
label: string;
|
|
24
24
|
value: unknown;
|
|
25
25
|
}>;
|
|
26
|
+
/** 传给 `input.accept` 的类型列表(仅 file 控件) */
|
|
27
|
+
accept?: readonly string[];
|
|
28
|
+
multiple?: boolean;
|
|
26
29
|
/**
|
|
27
|
-
*
|
|
30
|
+
* 建议值(FR-19.4)。与 `defaultValue` 严格分开:渲染器只能把它展示为建议,
|
|
28
31
|
* 用户主动采纳后才能进控件。
|
|
29
32
|
* @experimental
|
|
30
33
|
*/
|
|
31
34
|
suggestion?: {
|
|
32
35
|
value: unknown;
|
|
33
|
-
|
|
36
|
+
reason?: string;
|
|
34
37
|
};
|
|
35
38
|
}
|
|
36
39
|
/** 提交值按请求类型归形(WebFormBridge 与框架组件库共享单一来源) */
|
|
@@ -67,7 +70,10 @@ declare function applySuggestion(control: ControlModel, container: ParentNode):
|
|
|
67
70
|
declare function renderMiniMarkdown(text: string, doc: Document): HTMLElement;
|
|
68
71
|
//#endregion
|
|
69
72
|
//#region src/chart/miniChart.d.ts
|
|
70
|
-
/**
|
|
73
|
+
/**
|
|
74
|
+
* 固定 8 色循环调色板。这是**数据编码**(区分序列),不是主题色;
|
|
75
|
+
* 图表的轴线与文字等“外壳”颜色走 currentColor,跟随宿主容器的主题。
|
|
76
|
+
*/
|
|
71
77
|
declare const CHART_PALETTE: readonly ["#4e79a7", "#f28e2b", "#e15759", "#76b7b2", "#59a14f", "#edc948", "#b07aa1", "#ff9da7"];
|
|
72
78
|
/**
|
|
73
79
|
* ChartSpec → SVG(bar 等宽柱 + 值标签;line 折线 + 点;pie 扇形 + 图例;空数据容错)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as InteractionOrigin, b as UiBridge } from "./types-
|
|
2
|
-
import {
|
|
1
|
+
import { a as InteractionOrigin, b as UiBridge } from "./types-4pg-qp_I-Gq63X8Oa.js";
|
|
2
|
+
import { O as ExternalToolSource } from "./index-C-KFAZoF.js";
|
|
3
3
|
//#region ../agent/dist/index.d.ts
|
|
4
4
|
//#region src/todo/types.d.ts
|
|
5
5
|
/** 待办条目状态:未开始 / 进行中 / 已完成(FR-3.1) */
|
|
@@ -165,6 +165,9 @@ declare function createSkillGenerationToolSource(options: SkillGenerationToolSou
|
|
|
165
165
|
/**
|
|
166
166
|
* 技能自动生成的系统提示词。默认不注册工具,因此这段提示词只在
|
|
167
167
|
* 宿主打开开关时才进入上下文(设计 02 §1.3)。
|
|
168
|
+
*
|
|
169
|
+
* 触发条件写成正面清单而不是「不要自发调用」(0.6.0 FR-18.5):实测中后者会连
|
|
170
|
+
* 「帮我写一份流程规范」这类明确的沉淀请求一起抑制掉,开关等于白开。
|
|
168
171
|
*/
|
|
169
172
|
declare const SKILL_GENERATION_SYSTEM_PROMPT: string;
|
|
170
173
|
//#endregion
|
|
@@ -312,8 +315,46 @@ interface PerceivedNode {
|
|
|
312
315
|
name?: string;
|
|
313
316
|
/** 仅非敏感控件的当前值 */
|
|
314
317
|
value?: string;
|
|
318
|
+
/** 关联的图像分片 id(FR-12.1);节点里只放 id 不放 base64,否则 JSON 树会被截断切碎 */
|
|
319
|
+
imageId?: string;
|
|
320
|
+
/** 取像失败的降级说明(英文);不得静默丢弃(FR-12.1) */
|
|
321
|
+
imageNote?: string;
|
|
315
322
|
children?: readonly PerceivedNode[];
|
|
316
323
|
}
|
|
324
|
+
/** 随感知一起下发的一张图像(FR-12.1) @experimental */
|
|
325
|
+
interface PerceivedImage {
|
|
326
|
+
/** 与 `PerceivedNode.imageId` 对应 */
|
|
327
|
+
id: string;
|
|
328
|
+
mimeType: string;
|
|
329
|
+
/** base64,不含 `data:` 前缀 */
|
|
330
|
+
data: string;
|
|
331
|
+
/** 取像级别:`src` 为原图字节,`canvas` 为画布/SVG 读回 */
|
|
332
|
+
level: 'src' | 'canvas';
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* 取像预算与开关(FR-12.3 / FR-12.5)。
|
|
336
|
+
* 它只能来自宿主配置与当前模型能力,**不包含任何范围字段**:
|
|
337
|
+
* “读哪里”仍只由构造时的 `scope` 决定(AC-10.8)。
|
|
338
|
+
* @experimental
|
|
339
|
+
*/
|
|
340
|
+
interface PerceptionCaptureOptions {
|
|
341
|
+
/** false 时 reader 不得进入任何取像分支(抓完再丢弃不可接受) */
|
|
342
|
+
images: boolean;
|
|
343
|
+
maxImageBytes: number;
|
|
344
|
+
maxImages: number;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* reader 的完整产物。只实现文本的 reader 可以继续返回节点数组。
|
|
348
|
+
* @experimental
|
|
349
|
+
*/
|
|
350
|
+
interface PerceptionResult {
|
|
351
|
+
nodes: readonly PerceivedNode[];
|
|
352
|
+
images?: readonly PerceivedImage[];
|
|
353
|
+
/** 超出 `maxImages` 而未下发的张数 */
|
|
354
|
+
imagesOmitted?: number;
|
|
355
|
+
/** 取像失败的张数;失败不影响整次感知的成功与否 */
|
|
356
|
+
imageFailures?: number;
|
|
357
|
+
}
|
|
317
358
|
/**
|
|
318
359
|
* 页面读取实现的注入口(浏览器侧 `createDomPerceptionReader`)。
|
|
319
360
|
*
|
|
@@ -322,7 +363,7 @@ interface PerceivedNode {
|
|
|
322
363
|
* @experimental
|
|
323
364
|
*/
|
|
324
365
|
interface PagePerceptionReader {
|
|
325
|
-
read(scope: PerceptionScope): Promise<readonly PerceivedNode[]> | readonly PerceivedNode[];
|
|
366
|
+
read(scope: PerceptionScope, capture?: PerceptionCaptureOptions): Promise<readonly PerceivedNode[] | PerceptionResult> | readonly PerceivedNode[] | PerceptionResult;
|
|
326
367
|
}
|
|
327
368
|
/** 一次感知的留痕(FR-10.5 的 UI 提示与 FR-10.6 的审计共用同一条记录) @experimental */
|
|
328
369
|
interface PerceptionRecord {
|
|
@@ -333,6 +374,14 @@ interface PerceptionRecord {
|
|
|
333
374
|
exclude: readonly string[];
|
|
334
375
|
/** 读到的顶层节点数;用于「它读的比我预期的多」这类判断 */
|
|
335
376
|
nodeCount: number;
|
|
377
|
+
/** 本次下发的图像张数,按取像级别分组(只在取像开启时存在) */
|
|
378
|
+
images?: {
|
|
379
|
+
src: number;
|
|
380
|
+
canvas: number;
|
|
381
|
+
};
|
|
382
|
+
imagesOmitted?: number;
|
|
383
|
+
/** 读取失败的张数;藏起来会让用户误以为模型看到了全部图片 */
|
|
384
|
+
imageFailures?: number;
|
|
336
385
|
}
|
|
337
386
|
/**
|
|
338
387
|
* 审计落盘端口。刻意只声明 `append` 的结构化子集,`FsAuditLog` 直接满足——
|
|
@@ -361,9 +410,10 @@ interface PagePerceptionPolicyOptions {
|
|
|
361
410
|
/**
|
|
362
411
|
* 页面只读感知策略(需求 10)。
|
|
363
412
|
*
|
|
364
|
-
* **`perceive()`
|
|
413
|
+
* **`perceive()` 不接受任何范围参数**——这是「白名单判定不受模型输出影响」
|
|
365
414
|
* (AC-10.8)的实现方式。不是先拿模型给的范围再去校验,而是模型压根没有
|
|
366
415
|
* 表达范围的入口:能被读的区域只由构造时的 `scope` 决定。
|
|
416
|
+
* 唯一的参数是取像预算(`PerceptionCaptureOptions`),它里面没有任何范围字段。
|
|
367
417
|
*
|
|
368
418
|
* 本类**没有**任何点击 / 输入 / 提交 / 导航 / 滚动方法(FR-10.7)。
|
|
369
419
|
* @experimental
|
|
@@ -378,8 +428,10 @@ declare class PagePerceptionPolicy {
|
|
|
378
428
|
get records(): readonly PerceptionRecord[];
|
|
379
429
|
/** FR-10.5:感知发生时通知 UI,chatbot 据此在消息流里标注一行 */
|
|
380
430
|
subscribe(listener: (record: PerceptionRecord) => void): () => void;
|
|
381
|
-
perceive(): Promise<{
|
|
431
|
+
perceive(capture?: PerceptionCaptureOptions): Promise<{
|
|
382
432
|
nodes: readonly PerceivedNode[];
|
|
433
|
+
images: readonly PerceivedImage[];
|
|
434
|
+
imagesOmitted: number;
|
|
383
435
|
record: PerceptionRecord;
|
|
384
436
|
}>;
|
|
385
437
|
}
|
|
@@ -388,6 +440,17 @@ declare class PagePerceptionPolicy {
|
|
|
388
440
|
declare const PERCEIVE_PAGE_TOOL = "perceive_page";
|
|
389
441
|
interface PagePerceptionToolSourceOptions {
|
|
390
442
|
policy: PagePerceptionPolicy;
|
|
443
|
+
/**
|
|
444
|
+
* 取像预算与开关(FR-12.5)。每次调用重取,设置或选中模型改完立刻生效;
|
|
445
|
+
* 缺省即不取像。判定在遍历 DOM **之前**完成一次,不是每个节点判一次。
|
|
446
|
+
*/
|
|
447
|
+
imageCapture?(): ImageCaptureBudget | Promise<ImageCaptureBudget>;
|
|
448
|
+
}
|
|
449
|
+
/** @experimental */
|
|
450
|
+
interface ImageCaptureBudget {
|
|
451
|
+
enabled: boolean;
|
|
452
|
+
maxImageBytes: number;
|
|
453
|
+
maxImages: number;
|
|
391
454
|
}
|
|
392
455
|
/**
|
|
393
456
|
* 把只读感知接到既有工具协议上。**本工具源不导出任何写入动作**(FR-10.7):
|
|
@@ -408,4 +471,4 @@ declare function createPagePerceptionToolSource(options: PagePerceptionToolSourc
|
|
|
408
471
|
*/
|
|
409
472
|
declare const PERCEPTION_SYSTEM_PROMPT: string;
|
|
410
473
|
//#endregion
|
|
411
|
-
export {
|
|
474
|
+
export { SkillGenerationPolicy as A, TodoListener as B, PerceptionCaptureOptions as C, SKILL_GENERATION_SYSTEM_PROMPT as D, PerceptionScope as E, SubAgentRunner as F, createPagePerceptionToolSource as G, TodoStore as H, TODO_SYSTEM_PROMPT as I, withDelegationOrigin as J, createSkillGenerationToolSource as K, TodoEvent as L, SkillGenerator as M, SkillGeneratorOptions as N, SkillCandidateSink as O, SubAgentRunInput as P, TodoItem as R, PerceptionAuditSink as S, PerceptionResult as T, TodoToolSourceOptions as U, TodoStatus as V, createDelegationToolSource as W, PagePerceptionReader as _, DelegationOrchestratorOptions as a, PerceivedImage as b, DelegationToolSourceOptions as c, ImageCaptureBudget as d, MANAGE_TODO_TOOL as f, PagePerceptionPolicyOptions as g, PagePerceptionPolicy as h, DelegationOrchestrator as i, SkillGenerationToolSourceOptions as j, SkillGenerationOutcome as k, GENERATE_SKILL_TOOL as l, PERCEPTION_SYSTEM_PROMPT as m, DELEGATION_SYSTEM_PROMPT as n, DelegationRequest as o, PERCEIVE_PAGE_TOOL as p, createTodoToolSource as q, DelegationBudget as r, DelegationResult as s, DELEGATE_TASK_TOOL as t, GeneratedSkillDraft as u, PagePerceptionToolSourceOptions as v, PerceptionRecord as w, PerceivedNode as x, ParentBudget as y, TodoList as z };
|