@webskill/chatbot 0.22.0 → 0.23.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/config.d.ts +19 -1
- package/dist/config.js +56 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/config.d.ts
CHANGED
|
@@ -17,6 +17,24 @@ declare class WebSkillConfigError extends Error {
|
|
|
17
17
|
constructor(code: WebSkillConfigErrorCode, path: string, message: string);
|
|
18
18
|
}
|
|
19
19
|
//#endregion
|
|
20
|
+
//#region ../ui-kit/src/runtime-config/siteAccess.d.ts
|
|
21
|
+
/**
|
|
22
|
+
* 站点白名单的匹配规则(`RuntimeConfig.siteAccess.allowedHosts`)。
|
|
23
|
+
*
|
|
24
|
+
* 放在配置字段旁边而不是宿主里:规则一旦有第二份手抄,「配了却不生效」
|
|
25
|
+
* 和「以为拦住了其实没拦」就会同时存在,而后者是安全问题。
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* 地址是否落在白名单内。**空清单一律放行**——它表示「宿主没有设限」,
|
|
29
|
+
* 而不是「谁都不许」;把空当成全拒会让没配过的宿主整个瘫掉。
|
|
30
|
+
*
|
|
31
|
+
* 解析不出主机名的地址(`about:blank`、畸形串)在有清单时**拒绝**:
|
|
32
|
+
* 认不出来就不该当成自己人。
|
|
33
|
+
*
|
|
34
|
+
* @experimental
|
|
35
|
+
*/
|
|
36
|
+
declare function isAllowedSite(url: string | undefined, allowedHosts: readonly string[]): boolean;
|
|
37
|
+
//#endregion
|
|
20
38
|
//#region src/config/merge.d.ts
|
|
21
39
|
/**
|
|
22
40
|
* 三方合并:宿主缺省值 · 用户存储 · 上次应用过的缺省值快照。
|
|
@@ -104,4 +122,4 @@ interface ConfigDefaultsStoreOptions {
|
|
|
104
122
|
*/
|
|
105
123
|
declare function createConfigDefaultsStore(store: RuntimeConfigStore, options: ConfigDefaultsStoreOptions): RuntimeConfigStore;
|
|
106
124
|
//#endregion
|
|
107
|
-
export { type AppliedConfigDefaults, type ApplyConfigDefaultsInput, BAKED_KEY_SENTINEL, type BakedSecretLoader, CONFIGURED_RUNTIME_PATHS, CONFIG_FIELDS, CONFIG_TOP_LEVEL_SECTIONS, type ConfigDefaultsSnapshotStore, type ConfigDefaultsStoreOptions, type ConfigFieldSpec, type ConfigLeafKind, NON_CONFIGURABLE_RUNTIME_PATHS, type ParseWebSkillConfigOptions, type ParsedWebSkillConfig, type WebSkillConfigDefaults, WebSkillConfigError, type WebSkillConfigErrorCode, applyConfigDefaults, createConfigDefaultsStore, parseWebSkillConfig };
|
|
125
|
+
export { type AppliedConfigDefaults, type ApplyConfigDefaultsInput, BAKED_KEY_SENTINEL, type BakedSecretLoader, CONFIGURED_RUNTIME_PATHS, CONFIG_FIELDS, CONFIG_TOP_LEVEL_SECTIONS, type ConfigDefaultsSnapshotStore, type ConfigDefaultsStoreOptions, type ConfigFieldSpec, type ConfigLeafKind, NON_CONFIGURABLE_RUNTIME_PATHS, type ParseWebSkillConfigOptions, type ParsedWebSkillConfig, type WebSkillConfigDefaults, WebSkillConfigError, type WebSkillConfigErrorCode, applyConfigDefaults, createConfigDefaultsStore, isAllowedSite, parseWebSkillConfig };
|
package/dist/config.js
CHANGED
|
@@ -1,6 +1,61 @@
|
|
|
1
1
|
import { r as mergeRuntimeConfigDefaults } from "./types-DzBMgDa6.js";
|
|
2
2
|
import { a as NON_CONFIGURABLE_RUNTIME_PATHS, i as CONFIG_FIELDS, n as parseWebSkillConfig, o as WebSkillConfigError, r as CONFIGURED_RUNTIME_PATHS, t as CONFIG_TOP_LEVEL_SECTIONS } from "./parse-BaIF8Nm5.js";
|
|
3
3
|
|
|
4
|
+
//#region ../ui-kit/src/runtime-config/siteAccess.ts
|
|
5
|
+
/**
|
|
6
|
+
* 站点白名单的匹配规则(`RuntimeConfig.siteAccess.allowedHosts`)。
|
|
7
|
+
*
|
|
8
|
+
* 放在配置字段旁边而不是宿主里:规则一旦有第二份手抄,「配了却不生效」
|
|
9
|
+
* 和「以为拦住了其实没拦」就会同时存在,而后者是安全问题。
|
|
10
|
+
*/
|
|
11
|
+
/** 把用户写的模式归一:去空白、小写、去掉前导点与结尾点 */
|
|
12
|
+
function normalizePattern(pattern) {
|
|
13
|
+
return pattern.trim().toLowerCase().replace(/^\.+/, "").replace(/\.+$/, "");
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 单条模式是否命中主机名。
|
|
17
|
+
*
|
|
18
|
+
* - `*` 命中一切。
|
|
19
|
+
* - `*.example.com` 命中 `a.example.com`、`a.b.example.com`,**也命中** `example.com`
|
|
20
|
+
* 本体——与 Chrome 的 match pattern 同口径。用户写通配是为了「这个站」,
|
|
21
|
+
* 让主域漏网只会制造一条谁也想不到的缝。
|
|
22
|
+
* - `example.com` 只命中它自己。
|
|
23
|
+
*
|
|
24
|
+
* 端口与协议一律不参与:用户写的是域名。
|
|
25
|
+
*/
|
|
26
|
+
function matchesPattern(host, pattern) {
|
|
27
|
+
const p = normalizePattern(pattern);
|
|
28
|
+
if (p === "") return false;
|
|
29
|
+
if (p === "*") return true;
|
|
30
|
+
if (p.startsWith("*.")) {
|
|
31
|
+
const base = p.slice(2);
|
|
32
|
+
return base !== "" && (host === base || host.endsWith(`.${base}`));
|
|
33
|
+
}
|
|
34
|
+
return host === p;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* 地址是否落在白名单内。**空清单一律放行**——它表示「宿主没有设限」,
|
|
38
|
+
* 而不是「谁都不许」;把空当成全拒会让没配过的宿主整个瘫掉。
|
|
39
|
+
*
|
|
40
|
+
* 解析不出主机名的地址(`about:blank`、畸形串)在有清单时**拒绝**:
|
|
41
|
+
* 认不出来就不该当成自己人。
|
|
42
|
+
*
|
|
43
|
+
* @experimental
|
|
44
|
+
*/
|
|
45
|
+
function isAllowedSite(url, allowedHosts) {
|
|
46
|
+
if (allowedHosts.length === 0) return true;
|
|
47
|
+
if (url === void 0) return false;
|
|
48
|
+
let host;
|
|
49
|
+
try {
|
|
50
|
+
host = new URL(url).hostname.toLowerCase().replace(/\.+$/, "");
|
|
51
|
+
} catch {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
if (host === "") return false;
|
|
55
|
+
return allowedHosts.some((pattern) => matchesPattern(host, pattern));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
//#endregion
|
|
4
59
|
//#region src/config/merge.ts
|
|
5
60
|
function isPlainObject(value) {
|
|
6
61
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -197,4 +252,4 @@ function createConfigDefaultsStore(store, options) {
|
|
|
197
252
|
}
|
|
198
253
|
|
|
199
254
|
//#endregion
|
|
200
|
-
export { BAKED_KEY_SENTINEL, CONFIGURED_RUNTIME_PATHS, CONFIG_FIELDS, CONFIG_TOP_LEVEL_SECTIONS, NON_CONFIGURABLE_RUNTIME_PATHS, WebSkillConfigError, applyConfigDefaults, createConfigDefaultsStore, parseWebSkillConfig };
|
|
255
|
+
export { BAKED_KEY_SENTINEL, CONFIGURED_RUNTIME_PATHS, CONFIG_FIELDS, CONFIG_TOP_LEVEL_SECTIONS, NON_CONFIGURABLE_RUNTIME_PATHS, WebSkillConfigError, applyConfigDefaults, createConfigDefaultsStore, isAllowedSite, parseWebSkillConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -3240,6 +3240,6 @@ declare function ErrorCard({ code, message, loopLimits, onOpenSettings, onDismis
|
|
|
3240
3240
|
* Version of the published `@webskill/chatbot` package, injected at build time.
|
|
3241
3241
|
* @stable
|
|
3242
3242
|
*/
|
|
3243
|
-
declare const CHATBOT_VERSION = "0.
|
|
3243
|
+
declare const CHATBOT_VERSION = "0.23.0";
|
|
3244
3244
|
//#endregion
|
|
3245
3245
|
export { A2uiSurfaceHost, type A2uiSurfaceHostProps, A2uiSurfaceSnapshotHost, type A2uiSurfaceSnapshotHostProps, type AppearanceChange, CHATBOT_VERSION, type ChatAttachmentInput, type ChatAttachmentMeta, type ChatContentPart, ChatEngine, type ChatEngineOptions, type ChatEvent, type ChatInteractionRecord, type ChatLayout, type ChatMessage, type ChatRunPhase, type ChatSessionListResult, type ChatSessionMeta, type ChatTheme, type ChatThinking, type ChatTokenUsage, type ChatToolCall, Chatbot, type ChatbotConfig, type ChatbotGovernancePorts, type ChatbotHostAdapter, type ChatbotProps, ChatbotVisionDelegate, type ChatbotVisionDelegateOptions, CompositeUiBridge, type CompositeUiBridgeDeps, DEFAULT_RENDERER_CAPABILITIES, DEFAULT_RUNTIME_CONFIG_STORAGE_KEY, type DownloadableFile, type DwgHost, ErrorCard, type ErrorCardProps, InteractionCard, type InteractionCardProps, InterruptedBanner, type InterruptedBannerProps, type Locale, type LocalizedText, OpenUiSurfaceHost, type OpenUiSurfaceHostProps, OpenUiSurfaceSnapshotHost, type OpenUiSurfaceSnapshotHostProps, type QuickPrompt, type QuickPromptIconName, type RendererCapability, type RendererKind, type ResolvedChatLayout, ResultBlockList, type ResultBlockListProps, ResultBlocksPro, type ResultBlocksProProps, type RunSnapshot, type RuntimeAppearanceConfig, type RuntimeConfig, type RuntimeConfigStore, type RuntimeQuickPrompt, type RuntimeRendererId, type SandboxExecutorDeps, type SettingsSectionId, SkillBadges, SpecInteraction, type SpecInteractionProps, VercelPayloadPreview, type VercelPayloadPreviewProps, VercelSurfaceHost, type VercelSurfaceHostProps, VercelSurfaceSnapshotHost, type VercelSurfaceSnapshotHostProps, type VisionDelegationConsent, type VisionDelegationEndpoint, WEB_OFFICE_TEMPLATE_PREFIX, chatbotDictionary, configureA2uiMarkdown, createLocalStorageRuntimeConfigStore, createMemoryRuntimeConfigStore, isLlmEntryUsable, pickUsableLlmEntry, probeA2uiAvailability, probeOpenUiAvailability, sandboxExecutorDeps, useT };
|
package/dist/index.js
CHANGED
|
@@ -45631,7 +45631,7 @@ function VercelPayloadPreview({ bridge }) {
|
|
|
45631
45631
|
* Version of the published `@webskill/chatbot` package, injected at build time.
|
|
45632
45632
|
* @stable
|
|
45633
45633
|
*/
|
|
45634
|
-
const CHATBOT_VERSION = "0.
|
|
45634
|
+
const CHATBOT_VERSION = "0.23.0";
|
|
45635
45635
|
|
|
45636
45636
|
//#endregion
|
|
45637
45637
|
export { A2uiSurfaceHost, A2uiSurfaceSnapshotHost, CHATBOT_VERSION, ChatEngine, Chatbot, ChatbotVisionDelegate, CompositeUiBridge, DEFAULT_RENDERER_CAPABILITIES, DEFAULT_RUNTIME_CONFIG_STORAGE_KEY, ErrorCard, InteractionCard, InterruptedBanner, OpenUiSurfaceHost, OpenUiSurfaceSnapshotHost, ResultBlockList, ResultBlocksPro, SkillBadges, SpecInteraction, VercelPayloadPreview, VercelSurfaceHost, VercelSurfaceSnapshotHost, WEB_OFFICE_TEMPLATE_PREFIX, chatbotDictionary, configureA2uiMarkdown, createLocalStorageRuntimeConfigStore, createMemoryRuntimeConfigStore, isLlmEntryUsable, pickUsableLlmEntry, probeA2uiAvailability, probeOpenUiAvailability, sandboxExecutorDeps, useT };
|