@webskill/chatbot 0.24.0 → 0.24.1

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/index.d.ts CHANGED
@@ -3494,6 +3494,6 @@ declare function ErrorCard({ code, message, loopLimits, onOpenSettings, onDismis
3494
3494
  * Version of the published `@webskill/chatbot` package, injected at build time.
3495
3495
  * @stable
3496
3496
  */
3497
- declare const CHATBOT_VERSION = "0.24.0";
3497
+ declare const CHATBOT_VERSION = "0.24.1";
3498
3498
  //#endregion
3499
3499
  export { A2uiSurfaceHost, type A2uiSurfaceHostProps, A2uiSurfaceSnapshotHost, type A2uiSurfaceSnapshotHostProps, type AppearanceChange, CHATBOT_VERSION, type ChatAttachmentInput, type ChatAttachmentMeta, type ChatComponent, type ChatComponentCallRecord, type ChatComponentConfirmation, type ChatComponentCredentialField, type ChatComponentInvokeContext, type ChatComponentOutcome, type ChatComponentStore, type ChatComponentText, 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, type HttpMessageComponentOptions, 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, createHttpMessageComponent, createLocalStorageRuntimeConfigStore, createMemoryRuntimeConfigStore, isLlmEntryUsable, pickUsableLlmEntry, probeA2uiAvailability, probeOpenUiAvailability, sandboxExecutorDeps, useT };
package/dist/index.js CHANGED
@@ -28767,6 +28767,28 @@ var ChatEngine = class {
28767
28767
  }
28768
28768
  }
28769
28769
  /**
28770
+ * 本 run 的附件与 run 所属会话里较早消息的附件字节,id 与文件名都认(模板工具用)。
28771
+ *
28772
+ * 范围与 `#loadTable` 相同:只查这个会话,别的会话的 id 取不到;路径取自附件记录,一寸都不来自模型。
28773
+ * 会话取 run 所属的那个而不是界面选中的:run 进行中用户可能已切走。
28774
+ */
28775
+ async #sessionAttachmentBytes(id, runId) {
28776
+ let hit = findAttachmentByRef(this.#runAttachments, id);
28777
+ if (hit === void 0) {
28778
+ const sessionId = (runId !== void 0 ? await this.#sessionOfRun(runId) : void 0) ?? this.#currentSessionId;
28779
+ const messages = sessionId === void 0 ? [] : (await this.#sessions.get(sessionId).catch(() => void 0))?.messages ?? [];
28780
+ for (let i = messages.length - 1; i >= 0 && hit === void 0; i -= 1) {
28781
+ const message = messages[i];
28782
+ if (message?.role === "user") hit = findAttachmentByRef(message.attachments ?? [], id);
28783
+ }
28784
+ }
28785
+ if (hit === void 0) return void 0;
28786
+ return {
28787
+ name: hit.name,
28788
+ bytes: await this.#adapter.storage.readBinary(resolveInsideRoot(this.attachmentsRoot, hit.path))
28789
+ };
28790
+ }
28791
+ /**
28770
28792
  * `skill:<技能名>/<路径>` 的取件(0.23.0 分册 23 FR-23.1)。
28771
28793
  *
28772
28794
  * 这条通路**不经过** `DownloadedFilePolicy`,所以既不弹授权卡也不列下载目录——
@@ -30136,6 +30158,10 @@ var ChatEngine = class {
30136
30158
  * `weboffice:` 在接了下载端口的宿主里就是这么失效的(设计 24 §1 实测)。
30137
30159
  *
30138
30160
  * 不回落同样是硬的:带前缀的号是指名的那一份,回落等于拿另一份文档冒充它。
30161
+ *
30162
+ * 附件不限本轮:「先传表、下一句再叫它填」是最常见的顺序,只认本轮附件,第二句话就读不到
30163
+ * (`query_table` 早已如此,FR-10.14)。本会话里没有的才回落到 `readDocumentBytes`,
30164
+ * 去查本 run 的页面字节与下载目录。
30139
30165
  */
30140
30166
  const readTemplateBytes = async (id, context) => {
30141
30167
  if (id.startsWith("skill:")) return await this.#readSkillTemplate(id, fs);
@@ -30144,7 +30170,7 @@ var ChatEngine = class {
30144
30170
  if (!online) throw new WebSkillError("TOOL_UNSUPPORTED", `Cannot read "${id}": this conversation has no online document source attached.`);
30145
30171
  return await online.read(id.slice(10), context);
30146
30172
  }
30147
- return await readDocumentBytes(id, context);
30173
+ return await this.#sessionAttachmentBytes(id, context?.runId) ?? await readDocumentBytes(id, context);
30148
30174
  };
30149
30175
  /**
30150
30176
  * 模板取件号里那些**宿主接了才存在**的说法(0.22.0 FR-42.12、0.23.0 FR-23.3)。
@@ -46794,7 +46820,7 @@ function VercelPayloadPreview({ bridge }) {
46794
46820
  * Version of the published `@webskill/chatbot` package, injected at build time.
46795
46821
  * @stable
46796
46822
  */
46797
- const CHATBOT_VERSION = "0.24.0";
46823
+ const CHATBOT_VERSION = "0.24.1";
46798
46824
 
46799
46825
  //#endregion
46800
46826
  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, createHttpMessageComponent, createLocalStorageRuntimeConfigStore, createMemoryRuntimeConfigStore, isLlmEntryUsable, pickUsableLlmEntry, probeA2uiAvailability, probeOpenUiAvailability, sandboxExecutorDeps, useT };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webskill/chatbot",
3
- "version": "0.24.0",
3
+ "version": "0.24.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {