@dp-bohrium/widget-sdk 0.8.0 → 0.9.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/CHANGELOG.md +19 -0
- package/assets/schemas/widget-runtime-contracts.schema.json +906 -0
- package/assets/toolchain.json +8 -8
- package/conformance/development-diagnostics.json +128 -0
- package/dist/cli.mjs +184 -14
- package/dist/compatibility/testing.js +1 -1
- package/dist/contracts.js +3 -2
- package/dist/development-guards-COvBR0G1.js +136 -0
- package/dist/{dsh-BlpXm2Bv.mjs → dsh-BL6cMLrg.mjs} +1151 -3
- package/dist/index.js +53 -7
- package/dist/protocol/development-guards.d.ts +9 -0
- package/dist/protocol/generated-development-policy.d.ts +22 -0
- package/dist/protocol/generated-runtime-contracts.d.ts +241 -0
- package/dist/protocol/index.d.ts +5 -0
- package/dist/protocol/widget-recovery.d.ts +19 -0
- package/dist/{protocol-endpoint-CDz-YDGT.js → protocol-endpoint-DbT0OJNu.js} +5 -0
- package/dist/runtime/bootstrap.d.ts +3 -1
- package/dist/runtime/client.d.ts +5 -1
- package/dist/runtime/index.js +2 -2
- package/dist/runtime/protocol-endpoint.d.ts +5 -5
- package/dist/runtime/transport.d.ts +9 -9
- package/dist/{runtime-D2xmZVSb.js → runtime-9g5MfsgK.js} +39 -5
- package/dist/widget-recovery-BF_sSUZX.js +472 -0
- package/llms.txt +13 -1
- package/package.json +1 -1
- package/schemas/widget-runtime-contracts.schema.json +906 -0
- package/dist/widget-events-gsKJbjqg.js +0 -65
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
//#region src/protocol/plugin-manifest.ts
|
|
2
|
-
/**
|
|
3
|
-
* Widget Host 公开的固定激活事件。数组同时作为清单编辑器文档和 Host
|
|
4
|
-
* 运行时校验的单一事实源;带工具名的事件使用下方的动态形式。
|
|
5
|
-
*/
|
|
6
|
-
const WIDGET_ACTIVATION_EVENTS = [
|
|
7
|
-
"session.start",
|
|
8
|
-
"turn-start",
|
|
9
|
-
"turn-end",
|
|
10
|
-
"step-start",
|
|
11
|
-
"step-end",
|
|
12
|
-
"tool-call-generating",
|
|
13
|
-
"tool-call-waiting",
|
|
14
|
-
"tool-call-running",
|
|
15
|
-
"tool-call-result",
|
|
16
|
-
"tool-call-error",
|
|
17
|
-
"workspace-file-changed",
|
|
18
|
-
"workspace-tree-refresh",
|
|
19
|
-
"workspace-file-opened",
|
|
20
|
-
"ui-tool-opened",
|
|
21
|
-
"ui-panel-focused",
|
|
22
|
-
"host-surface-changed"
|
|
23
|
-
];
|
|
24
|
-
const TOOL_EVENT_PATTERN = /^(?:tool-call-(?:generating|waiting|running|result|error)):[A-Za-z0-9_.:-]+$/u;
|
|
25
|
-
/**
|
|
26
|
-
* 判断一个字符串是否为合法激活事件(固定事件或带工具名的动态形式)。
|
|
27
|
-
* @param value 待检查的字符串。
|
|
28
|
-
* @returns 若命中固定目录或工具事件模式则收窄为 `WidgetActivationEvent`。
|
|
29
|
-
*/
|
|
30
|
-
function isWidgetActivationEvent(value) {
|
|
31
|
-
return typeof value === "string" && (WIDGET_ACTIVATION_EVENTS.includes(value) || TOOL_EVENT_PATTERN.test(value));
|
|
32
|
-
}
|
|
33
|
-
//#endregion
|
|
34
|
-
//#region src/protocol/widget-events.ts
|
|
35
|
-
/**
|
|
36
|
-
* Host 主动推送给已激活 Widget 的实时事件。`session.start` 只用于激活索引,
|
|
37
|
-
* 不属于这组运行期事件;激活后首个可用快照通过 `context.render` 交付。
|
|
38
|
-
*/
|
|
39
|
-
const WIDGET_EVENT_NAMES = [
|
|
40
|
-
"turn-start",
|
|
41
|
-
"turn-end",
|
|
42
|
-
"step-start",
|
|
43
|
-
"step-end",
|
|
44
|
-
"tool-call-generating",
|
|
45
|
-
"tool-call-waiting",
|
|
46
|
-
"tool-call-running",
|
|
47
|
-
"tool-call-result",
|
|
48
|
-
"tool-call-error",
|
|
49
|
-
"workspace-file-changed",
|
|
50
|
-
"workspace-tree-refresh",
|
|
51
|
-
"workspace-file-opened",
|
|
52
|
-
"ui-tool-opened",
|
|
53
|
-
"ui-panel-focused",
|
|
54
|
-
"host-surface-changed"
|
|
55
|
-
];
|
|
56
|
-
/**
|
|
57
|
-
* 判断一个字符串是否为合法的实时事件名。
|
|
58
|
-
* @param value 待检查的字符串。
|
|
59
|
-
* @returns 若 `value` 命中 `WIDGET_EVENT_NAMES` 则收窄为 `WidgetEventName`。
|
|
60
|
-
*/
|
|
61
|
-
function isWidgetEventName(value) {
|
|
62
|
-
return typeof value === "string" && WIDGET_EVENT_NAMES.includes(value);
|
|
63
|
-
}
|
|
64
|
-
//#endregion
|
|
65
|
-
export { isWidgetActivationEvent as i, isWidgetEventName as n, WIDGET_ACTIVATION_EVENTS as r, WIDGET_EVENT_NAMES as t };
|