@dp-bohrium/widget-sdk 0.7.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.
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 DP Technology
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,65 +0,0 @@
1
- //#region ../contracts/src/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 ../contracts/src/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 };