@webskill/chatbot 0.21.0 → 0.22.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 CHANGED
@@ -1,5 +1,5 @@
1
- import { n as RuntimeConfig, r as RuntimeConfigStore } from "./index-DhXFYp0d.js";
2
- import { a as parseWebSkillConfig, c as ConfigFieldSpec, i as WebSkillConfigDefaults, l as ConfigLeafKind, n as ParseWebSkillConfigOptions, o as CONFIGURED_RUNTIME_PATHS, r as ParsedWebSkillConfig, s as CONFIG_FIELDS, t as CONFIG_TOP_LEVEL_SECTIONS, u as NON_CONFIGURABLE_RUNTIME_PATHS } from "./parse-Cu0G_3gS.js";
1
+ import { n as RuntimeConfig, r as RuntimeConfigStore } from "./index-6TE6MWZ2.js";
2
+ import { a as parseWebSkillConfig, c as ConfigFieldSpec, i as WebSkillConfigDefaults, l as ConfigLeafKind, n as ParseWebSkillConfigOptions, o as CONFIGURED_RUNTIME_PATHS, r as ParsedWebSkillConfig, s as CONFIG_FIELDS, t as CONFIG_TOP_LEVEL_SECTIONS, u as NON_CONFIGURABLE_RUNTIME_PATHS } from "./parse-60GnE8Co.js";
3
3
  //#region src/config/errors.d.ts
4
4
  /** 稳定错误码,供宿主可编程处理;`message` 一律英文 @experimental */
5
5
  type WebSkillConfigErrorCode = 'CONFIG_UNKNOWN_KEY' | 'CONFIG_TYPE' | 'CONFIG_RANGE' | 'CONFIG_ENUM' | 'CONFIG_SHAPE' | 'CONFIG_REFERENCE';
package/dist/config.js CHANGED
@@ -1,5 +1,5 @@
1
- import { r as mergeRuntimeConfigDefaults } from "./types-D6kVxBO9.js";
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-BtdRevDk.js";
1
+ import { r as mergeRuntimeConfigDefaults } from "./types-DzBMgDa6.js";
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
4
  //#region src/config/merge.ts
5
5
  function isPlainObject(value) {
@@ -1360,6 +1360,50 @@ interface RuntimeSkillStateConfig {
1360
1360
  */
1361
1361
  quarantineThreshold: number;
1362
1362
  }
1363
+ /**
1364
+ * 站点白名单:宿主只在这些站点上提供页面感知与页面操作。
1365
+ *
1366
+ * 与 `sandbox.remoteUrl` 不同:那一条管的是技能往外发请求,这一条管的是助手往内读页面。
1367
+ * @experimental
1368
+ */
1369
+ interface RuntimeSiteAccessConfig {
1370
+ /**
1371
+ * 允许服务的域名模式,支持 `*.example.com` 与 `*`。
1372
+ * **空数组即不设限**,匹配规则见 {@link isAllowedSite}。
1373
+ */
1374
+ allowedHosts: readonly string[];
1375
+ }
1376
+ /**
1377
+ * 概览页「消费金额」那一格(console 专用)。
1378
+ *
1379
+ * 单价与汇率必须可配:它们原先是写死在 `core/llmUsage.ts` 里的两个常量,
1380
+ * 而每个宿主的模型合同价、记账汇率都不一样——写死等于给用户看一个**算错的金额**,
1381
+ * 比不显示更糟,因为它看起来是权威的。`enabled` 关掉时那一格整个不渲染,
1382
+ * 也不做换算:宿主拿不到真实单价时,不报数就是唯一诚实的做法。
1383
+ * @experimental
1384
+ */
1385
+ interface RuntimeUsageCostConfig {
1386
+ /** 关掉即概览页不出现「消费金额」,只剩请求次数与 token 用量 */
1387
+ enabled: boolean;
1388
+ /** 每百万 token 折合多少人民币。0 是合法值(自建模型不计费),负数回退默认 */
1389
+ cnyPerMillionTokens: number;
1390
+ /** 1 美元折合多少人民币;英文界面按它把人民币折成美元展示。必须为正 */
1391
+ cnyPerUsd: number;
1392
+ }
1393
+ /**
1394
+ * console 导航树(console 专用)。
1395
+ *
1396
+ * **只管显示,不是访问控制**:藏起来的页面仍可由宿主经 `initialPage` 直达,
1397
+ * 它挡的是「菜单树上有没有这一项」。真要禁用某项能力,闸门在那项能力自己的配置里。
1398
+ * @experimental
1399
+ */
1400
+ interface RuntimeConsoleNavConfig {
1401
+ /**
1402
+ * 不在侧栏与命令面板里出现的页面 id(如 `'connections.models'`)。
1403
+ * 取 id 列表而不是逐页布尔:页面清单归 console 所有,ui-kit 不该跟着它一起改。
1404
+ */
1405
+ hiddenPages: readonly string[];
1406
+ }
1363
1407
  /** @experimental */
1364
1408
  interface RuntimeConfig {
1365
1409
  loop: RuntimeLoopConfig;
@@ -1379,6 +1423,12 @@ interface RuntimeConfig {
1379
1423
  documentSurface: RuntimeDocumentSurfaceConfig;
1380
1424
  userProfile: RuntimeUserProfileConfig;
1381
1425
  skillState: RuntimeSkillStateConfig;
1426
+ /** 概览页「消费金额」的开关与换算参数 @experimental */
1427
+ usageCost: RuntimeUsageCostConfig;
1428
+ /** 允许助手工作的站点 @experimental */
1429
+ siteAccess: RuntimeSiteAccessConfig;
1430
+ /** console 导航树的显示裁剪 @experimental */
1431
+ consoleNav: RuntimeConsoleNavConfig;
1382
1432
  /**
1383
1433
  * 快捷指令的**唯一权威**(0.13.0 分册 21 FR-21.5)。
1384
1434
  * `ChatbotConfig.quickPrompts` 降级为一次性种子源,不再参与渲染判断。
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as RuntimeRendererId, c as RuntimeQuickPrompt, d as TranslateFn, i as RuntimeLlmEntry, l as Locale, n as RuntimeConfig, o as QuickPrompt, r as RuntimeConfigStore, s as QuickPromptIconName, t as RuntimeAppearanceConfig, u as LocalizedText } from "./index-DhXFYp0d.js";
1
+ import { a as RuntimeRendererId, c as RuntimeQuickPrompt, d as TranslateFn, i as RuntimeLlmEntry, l as Locale, n as RuntimeConfig, o as QuickPrompt, r as RuntimeConfigStore, s as QuickPromptIconName, t as RuntimeAppearanceConfig, u as LocalizedText } from "./index-6TE6MWZ2.js";
2
2
  import "react";
3
3
  import { AgentLoopConfig, ApprovalScope, BridgeCapabilities, DataSourceInfo, DocumentSurfaceHost, DocxTextExtractor, ExternalSkillProvider, ExternalToolSource, FileSystemProvider, HookRunner, InteractionRequest, InteractionResponse, LifecycleEventInit, LinkedDocumentReader, LlmClient, NetworkPolicy, Page, PageQuery, PdfTextExtractor, PptxTextExtractor, RenderBlock, RenderResultRequest, RunSnapshot, RunSnapshotListEntry, RuntimePhase, RuntimeRun, ScriptExecutor, SessionStore, SkillCandidateMarker, SkillCatalogEntry, SkillIntegrityGuard, SkillOutcomeReporter, SkillStateGuard, UiBridge, UiSpecDrafts, UiSpecEvent, UiSpecSnapshot, UiSurfaceActionRequest, UiSurfaceActionResponse, UserProfile, UserProfileExport, VisionDelegate, VisionDelegateRequest, VisionDelegateResult, WebSkillErrorCode, XlsxTextExtractor, diffUserProfile } from "@webskill/sdk";
4
4
  import { PageImageHost, RemoteImageHost, SandboxMode, TypeScriptSupportOptions, WebOfficeConsent, WebOfficeHost } from "@webskill/sdk/browser";
@@ -1373,6 +1373,7 @@ declare const chatbotDictionary: {
1373
1373
  'interaction.webOffice.captureTitle': string;
1374
1374
  'interaction.webOffice.captureBody': string;
1375
1375
  'interaction.webOffice.claimedTypeNote': string;
1376
+ 'interaction.webOffice.claimedSourceNote': string;
1376
1377
  'interaction.webOffice.rememberFallback': string;
1377
1378
  'interaction.visionDelegation.title': string;
1378
1379
  'interaction.visionDelegation.reason': string;
@@ -1809,6 +1810,7 @@ declare const chatbotDictionary: {
1809
1810
  'interaction.webOffice.captureTitle': string;
1810
1811
  'interaction.webOffice.captureBody': string;
1811
1812
  'interaction.webOffice.claimedTypeNote': string;
1813
+ 'interaction.webOffice.claimedSourceNote': string;
1812
1814
  'interaction.webOffice.rememberFallback': string;
1813
1815
  'interaction.visionDelegation.title': string;
1814
1816
  'interaction.visionDelegation.reason': string;
@@ -2248,6 +2250,7 @@ declare const useT: () => TranslateFn<{
2248
2250
  'interaction.webOffice.captureTitle': string;
2249
2251
  'interaction.webOffice.captureBody': string;
2250
2252
  'interaction.webOffice.claimedTypeNote': string;
2253
+ 'interaction.webOffice.claimedSourceNote': string;
2251
2254
  'interaction.webOffice.rememberFallback': string;
2252
2255
  'interaction.visionDelegation.title': string;
2253
2256
  'interaction.visionDelegation.reason': string;
@@ -2684,6 +2687,7 @@ declare const useT: () => TranslateFn<{
2684
2687
  'interaction.webOffice.captureTitle': string;
2685
2688
  'interaction.webOffice.captureBody': string;
2686
2689
  'interaction.webOffice.claimedTypeNote': string;
2690
+ 'interaction.webOffice.claimedSourceNote': string;
2687
2691
  'interaction.webOffice.rememberFallback': string;
2688
2692
  'interaction.visionDelegation.title': string;
2689
2693
  'interaction.visionDelegation.reason': string;
@@ -3236,6 +3240,6 @@ declare function ErrorCard({ code, message, loopLimits, onOpenSettings, onDismis
3236
3240
  * Version of the published `@webskill/chatbot` package, injected at build time.
3237
3241
  * @stable
3238
3242
  */
3239
- declare const CHATBOT_VERSION = "0.21.0";
3243
+ declare const CHATBOT_VERSION = "0.22.0";
3240
3244
  //#endregion
3241
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
@@ -1,5 +1,5 @@
1
1
  import { i as __toESM, r as __require, t as __commonJSMin } from "./rolldown-runtime-DZ8SGSJo.js";
2
- import { i as withRuntimeConfigDefaults, n as defaultRuntimeConfig, o as mergeQuickPrompts, r as mergeRuntimeConfigDefaults, s as normalizeLocalizedText } from "./types-D6kVxBO9.js";
2
+ import { i as withRuntimeConfigDefaults, n as defaultRuntimeConfig, o as mergeQuickPrompts, r as mergeRuntimeConfigDefaults, s as normalizeLocalizedText } from "./types-DzBMgDa6.js";
3
3
  import { a as svg, i as html$1, n as refractor, o as find, r as stringify$1, s as stringify } from "./core-D3Tq37jA.js";
4
4
  import { t as require_core } from "./core-DBetA176.js";
5
5
  import { t as markup } from "./markup-D2NSmoAx.js";
@@ -26499,13 +26499,14 @@ const chatbotDictionary = defineDictionary({
26499
26499
  "interaction.downloadedFile.read": "Allow the assistant to read this file from your downloads?",
26500
26500
  "interaction.downloadedFile.file": "{name} · {size}",
26501
26501
  "interaction.downloadedFile.remember": "Don’t ask again for this kind of access",
26502
- "interaction.webOffice.listTitle": "WPS documents on this page",
26503
- "interaction.webOffice.listBody": "Allow the assistant to see which WPS documents are open on {origin}?",
26504
- "interaction.webOffice.readTitle": "Read this WPS document",
26505
- "interaction.webOffice.readBody": "Allow the assistant to read the contents of this WPS document on {origin}?",
26506
- "interaction.webOffice.captureTitle": "Screenshot this WPS document",
26507
- "interaction.webOffice.captureBody": "Allow the assistant to take screenshots of this WPS document on {origin}? It captures whatever is visible in the tab, including anything shown next to the document, and the screenshots stay in this conversation until you delete it.",
26502
+ "interaction.webOffice.listTitle": "Office documents on this page",
26503
+ "interaction.webOffice.listBody": "Allow the assistant to see which documents are open on {origin}?",
26504
+ "interaction.webOffice.readTitle": "Read this document",
26505
+ "interaction.webOffice.readBody": "Allow the assistant to read the contents of this document on {origin}?",
26506
+ "interaction.webOffice.captureTitle": "Screenshot this document",
26507
+ "interaction.webOffice.captureBody": "Allow the assistant to take screenshots of this document on {origin}? It captures whatever is visible in the tab, including anything shown next to the document, and the screenshots stay in this conversation until you delete it.",
26508
26508
  "interaction.webOffice.claimedTypeNote": "The page says this document is of type “{type}”.",
26509
+ "interaction.webOffice.claimedSourceNote": "The page says it is rendered by {source}.",
26509
26510
  "interaction.webOffice.rememberFallback": "Don’t ask again for this kind of access",
26510
26511
  "interaction.visionDelegation.title": "Send images to another model?",
26511
26512
  "interaction.visionDelegation.reason": "The model you selected cannot read images, so the {images} image(s) produced by “{source}” cannot be used in this turn unless another model describes them first.",
@@ -26935,13 +26936,14 @@ const chatbotDictionary = defineDictionary({
26935
26936
  "interaction.downloadedFile.read": "允许助手读取你下载目录里的这份文件吗?",
26936
26937
  "interaction.downloadedFile.file": "{name} · {size}",
26937
26938
  "interaction.downloadedFile.remember": "以后不再询问此类访问",
26938
- "interaction.webOffice.listTitle": "本页的 WPS 文档",
26939
- "interaction.webOffice.listBody": "允许助手查看 {origin} 上打开了哪些 WPS 文档吗?",
26940
- "interaction.webOffice.readTitle": "读取这份 WPS 文档",
26941
- "interaction.webOffice.readBody": "允许助手读取 {origin} 上这份 WPS 文档的内容吗?",
26942
- "interaction.webOffice.captureTitle": "截取这份 WPS 文档",
26943
- "interaction.webOffice.captureBody": "允许助手截取 {origin} 上这份 WPS 文档吗?将截取当前页面的画面,包括文档旁边显示的其它内容;截图会留在本次会话里,直到你删除这次会话。",
26939
+ "interaction.webOffice.listTitle": "本页的办公文档",
26940
+ "interaction.webOffice.listBody": "允许助手查看 {origin} 上打开了哪些文档吗?",
26941
+ "interaction.webOffice.readTitle": "读取这份文档",
26942
+ "interaction.webOffice.readBody": "允许助手读取 {origin} 上这份文档的内容吗?",
26943
+ "interaction.webOffice.captureTitle": "截取这份文档",
26944
+ "interaction.webOffice.captureBody": "允许助手截取 {origin} 上这份文档吗?将截取当前页面的画面,包括文档旁边显示的其它内容;截图会留在本次会话里,直到你删除这次会话。",
26944
26945
  "interaction.webOffice.claimedTypeNote": "页面自称这份文档的类型是「{type}」。",
26946
+ "interaction.webOffice.claimedSourceNote": "页面自称它由 {source} 渲染。",
26945
26947
  "interaction.webOffice.rememberFallback": "以后不再询问此类访问",
26946
26948
  "interaction.visionDelegation.title": "把图片发给另一个模型?",
26947
26949
  "interaction.visionDelegation.reason": "你选中的模型看不了图片。「{source}」产出的 {images} 张图,除非先由另一个模型描述一遍,否则这一轮用不上。",
@@ -29289,7 +29291,7 @@ var ChatEngine = class {
29289
29291
  * 还多一道闸:一个带资源的技能都没装时不提(AC-23.8)。探测只在真有模板工具时做。
29290
29292
  */
29291
29293
  const hasTemplateEngine = Boolean(this.#adapter.xlsxTemplateEngine || this.#adapter.docxTemplateEngine);
29292
- const templateIdHints = [...this.#adapter.webOfficeTemplateSource ? [`For a document open in an online WPS/WebOffice viewer, use "${WEB_OFFICE_TEMPLATE_PREFIX}<handle>" with the handle from list_weboffice_documents.`] : [], ...hasTemplateEngine && await this.#hasSkillResources(fs) ? [`For a file that ships inside an installed skill, use "${SKILL_FILE_PREFIX}<skill name>/<path inside the skill>", for example "${SKILL_FILE_PREFIX}quotation/assets/template.xlsx".`] : []];
29294
+ const templateIdHints = [...this.#adapter.webOfficeTemplateSource ? [`For a document open in an online office viewer on the page, use "${WEB_OFFICE_TEMPLATE_PREFIX}<handle>" with the handle from list_weboffice_documents.`] : [], ...hasTemplateEngine && await this.#hasSkillResources(fs) ? [`For a file that ships inside an installed skill, use "${SKILL_FILE_PREFIX}<skill name>/<path inside the skill>", for example "${SKILL_FILE_PREFIX}quotation/assets/template.xlsx".`] : []];
29293
29295
  const baseTools = [
29294
29296
  ...pageSkillSource ? [pageSkillSource] : [],
29295
29297
  createSpreadsheetToolSource({
@@ -30858,12 +30860,14 @@ function webOfficeDetails(details) {
30858
30860
  if (typeof origin !== "string" || origin === "") return void 0;
30859
30861
  if (channel !== "jssdk" && channel !== "vision") return void 0;
30860
30862
  const claimedOfficeType = record["claimedOfficeType"];
30863
+ const claimedSource = record["claimedSource"];
30861
30864
  const rememberLabel = record["rememberLabel"];
30862
30865
  return {
30863
30866
  action,
30864
30867
  origin,
30865
30868
  channel,
30866
30869
  ...typeof claimedOfficeType === "string" ? { claimedOfficeType } : {},
30870
+ ...typeof claimedSource === "string" ? { claimedSource } : {},
30867
30871
  ...record["rememberable"] === true ? { rememberable: true } : {},
30868
30872
  ...typeof rememberLabel === "string" ? { rememberLabel } : {}
30869
30873
  };
@@ -31031,8 +31035,8 @@ function localizedAuthorizeMessage(request, t) {
31031
31035
  const details = webOfficeDetails(request.details);
31032
31036
  if (details === void 0) return void 0;
31033
31037
  const head = t(`interaction.webOffice.${details.action}Body`, { origin: details.origin });
31034
- if (details.claimedOfficeType === void 0) return head;
31035
- return `${head} ${t("interaction.webOffice.claimedTypeNote", { type: details.claimedOfficeType })}`;
31038
+ const claims = [...details.claimedSource === void 0 ? [] : [t("interaction.webOffice.claimedSourceNote", { source: details.claimedSource })], ...details.claimedOfficeType === void 0 ? [] : [t("interaction.webOffice.claimedTypeNote", { type: details.claimedOfficeType })]];
31039
+ return claims.length === 0 ? head : `${head} ${claims.join(" ")}`;
31036
31040
  }
31037
31041
  if (request.capability === "delegateVision") {
31038
31042
  const details = visionDelegationDetails(request.details);
@@ -44158,6 +44162,11 @@ function ActiveInteractionCard({ request, bridge }) {
44158
44162
  className: "text-sm text-ink",
44159
44163
  children: t(`interaction.webOffice.${webOffice.action}Body`, { origin: webOffice.origin })
44160
44164
  }),
44165
+ webOffice.claimedSource !== void 0 ? /* @__PURE__ */ jsx("p", {
44166
+ "data-testid": "interaction-weboffice-claimed-source",
44167
+ className: "text-sm text-muted",
44168
+ children: t("interaction.webOffice.claimedSourceNote", { source: webOffice.claimedSource })
44169
+ }) : null,
44161
44170
  webOffice.claimedOfficeType !== void 0 ? /* @__PURE__ */ jsx("p", {
44162
44171
  "data-testid": "interaction-weboffice-claimed",
44163
44172
  className: "text-sm text-muted",
@@ -45622,7 +45631,7 @@ function VercelPayloadPreview({ bridge }) {
45622
45631
  * Version of the published `@webskill/chatbot` package, injected at build time.
45623
45632
  * @stable
45624
45633
  */
45625
- const CHATBOT_VERSION = "0.21.0";
45634
+ const CHATBOT_VERSION = "0.22.0";
45626
45635
 
45627
45636
  //#endregion
45628
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 };
@@ -1,4 +1,4 @@
1
- import { a as RuntimeRendererId, n as RuntimeConfig } from "./index-DhXFYp0d.js";
1
+ import { a as RuntimeRendererId, n as RuntimeConfig } from "./index-6TE6MWZ2.js";
2
2
  //#region src/config/schema.d.ts
3
3
  /**
4
4
  * 配置文件的字段表——**唯一**手写的部分。
@@ -211,6 +211,23 @@ declare const CONFIG_FIELDS: {
211
211
  readonly 'privacy.recordLimit': {
212
212
  readonly target: readonly ["userProfile", "recordLimit"];
213
213
  };
214
+ readonly 'siteAccess.allowedHosts': {
215
+ readonly target: readonly ["siteAccess", "allowedHosts"];
216
+ };
217
+ readonly 'console.usageCost.enabled': {
218
+ readonly target: readonly ["usageCost", "enabled"];
219
+ };
220
+ readonly 'console.usageCost.cnyPerMillionTokens': {
221
+ readonly target: readonly ["usageCost", "cnyPerMillionTokens"];
222
+ readonly kind: "number";
223
+ };
224
+ readonly 'console.usageCost.cnyPerUsd': {
225
+ readonly target: readonly ["usageCost", "cnyPerUsd"];
226
+ readonly kind: "number";
227
+ };
228
+ readonly 'console.hiddenPages': {
229
+ readonly target: readonly ["consoleNav", "hiddenPages"];
230
+ };
214
231
  readonly 'appearance.theme': {
215
232
  readonly target: readonly ["appearance", "theme"];
216
233
  readonly values: readonly ["light", "dark"];
@@ -1,4 +1,4 @@
1
- import { a as QUICK_PROMPT_ICON_NAMES, n as defaultRuntimeConfig, t as RUNTIME_RENDERER_IDS } from "./types-D6kVxBO9.js";
1
+ import { a as QUICK_PROMPT_ICON_NAMES, n as defaultRuntimeConfig, t as RUNTIME_RENDERER_IDS } from "./types-DzBMgDa6.js";
2
2
 
3
3
  //#region ../ui-kit/src/runtime-config/enums.ts
4
4
  const RUNTIME_LLM_PROVIDERS = [
@@ -299,6 +299,17 @@ const CONFIG_FIELDS = {
299
299
  "privacy.encryptProfile": { target: ["userProfile", "encrypted"] },
300
300
  "privacy.injectMaxBytes": { target: ["userProfile", "injectMaxBytes"] },
301
301
  "privacy.recordLimit": { target: ["userProfile", "recordLimit"] },
302
+ "siteAccess.allowedHosts": { target: ["siteAccess", "allowedHosts"] },
303
+ "console.usageCost.enabled": { target: ["usageCost", "enabled"] },
304
+ "console.usageCost.cnyPerMillionTokens": {
305
+ target: ["usageCost", "cnyPerMillionTokens"],
306
+ kind: "number"
307
+ },
308
+ "console.usageCost.cnyPerUsd": {
309
+ target: ["usageCost", "cnyPerUsd"],
310
+ kind: "number"
311
+ },
312
+ "console.hiddenPages": { target: ["consoleNav", "hiddenPages"] },
302
313
  "appearance.theme": {
303
314
  target: ["appearance", "theme"],
304
315
  values: RUNTIME_THEMES
@@ -298,6 +298,13 @@ function defaultRuntimeConfig() {
298
298
  encrypted: true
299
299
  },
300
300
  skillState: { quarantineThreshold: 5 },
301
+ usageCost: {
302
+ enabled: true,
303
+ cnyPerMillionTokens: 9,
304
+ cnyPerUsd: 6.8
305
+ },
306
+ siteAccess: { allowedHosts: [] },
307
+ consoleNav: { hiddenPages: [] },
301
308
  quickPrompts: [],
302
309
  quickPromptsSeeded: false,
303
310
  quickPromptLimit: 8,
@@ -386,6 +393,9 @@ function mergeRuntimeConfigDefaults(partial) {
386
393
  documentSurface: mergeDocumentSurface(p["documentSurface"], d.documentSurface),
387
394
  userProfile: mergeUserProfile(p["userProfile"], d.userProfile),
388
395
  skillState: mergeSkillState(p["skillState"], d.skillState),
396
+ usageCost: mergeUsageCost(p["usageCost"], d.usageCost),
397
+ siteAccess: { allowedHosts: readStringList(p["siteAccess"]?.["allowedHosts"], d.siteAccess.allowedHosts) },
398
+ consoleNav: { hiddenPages: readStringList(p["consoleNav"]?.["hiddenPages"], d.consoleNav.hiddenPages) },
389
399
  quickPrompts: readQuickPrompts(p["quickPrompts"]),
390
400
  quickPromptsSeeded: p["quickPromptsSeeded"] === true,
391
401
  quickPromptLimit: clampQuickPromptLimit(p["quickPromptLimit"]),
@@ -499,6 +509,20 @@ function mergeUserProfile(raw, d) {
499
509
  };
500
510
  }
501
511
  /** 与 multimodal 同一套判据:阈值非正整数会让隔离永不触发或立即触发,回退默认值 */
512
+ /**
513
+ * 消费金额段。单价允许 0(自建模型不计费,金额恒为 0 是真实的),
514
+ * 汇率必须为正:0 会把英文界面的金额除成 Infinity,负数直接变负值。
515
+ */
516
+ function mergeUsageCost(raw, d) {
517
+ const p = typeof raw === "object" && raw !== null ? raw : {};
518
+ const rate = p["cnyPerMillionTokens"];
519
+ const usd = p["cnyPerUsd"];
520
+ return {
521
+ enabled: typeof p["enabled"] === "boolean" ? p["enabled"] : d.enabled,
522
+ cnyPerMillionTokens: typeof rate === "number" && Number.isFinite(rate) && rate >= 0 ? rate : d.cnyPerMillionTokens,
523
+ cnyPerUsd: typeof usd === "number" && Number.isFinite(usd) && usd > 0 ? usd : d.cnyPerUsd
524
+ };
525
+ }
502
526
  function mergeSkillState(raw, d) {
503
527
  const value = (typeof raw === "object" && raw !== null ? raw : {})["quarantineThreshold"];
504
528
  return { quarantineThreshold: typeof value === "number" && Number.isFinite(value) && value > 0 ? Math.floor(value) : d.quarantineThreshold };
package/dist/vite.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as ParseWebSkillConfigOptions, r as ParsedWebSkillConfig } from "./parse-Cu0G_3gS.js";
1
+ import { n as ParseWebSkillConfigOptions, r as ParsedWebSkillConfig } from "./parse-60GnE8Co.js";
2
2
  import { Plugin } from "vite";
3
3
  //#region src/vite.d.ts
4
4
  /**
package/dist/vite.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as parseWebSkillConfig } from "./parse-BtdRevDk.js";
1
+ import { n as parseWebSkillConfig } from "./parse-BaIF8Nm5.js";
2
2
  import { readFileSync } from "node:fs";
3
3
  import { webcrypto } from "node:crypto";
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webskill/chatbot",
3
- "version": "0.21.0",
3
+ "version": "0.22.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -38,7 +38,7 @@
38
38
  "@a2ui/web_core": "^0.10.5",
39
39
  "@lit/context": "^1.1.0",
40
40
  "@openuidev/react-lang": "0.2.8",
41
- "@webskill/sdk": "^0.24.0",
41
+ "@webskill/sdk": "^0.25.0",
42
42
  "mermaid": "^12.0.0",
43
43
  "react": ">=19.0.0",
44
44
  "react-dom": ">=19.0.0",