@smartspace/chat-ui 1.14.4-pr.501.904a19b → 1.14.4-pr.571.e67e547

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
@@ -572,18 +572,9 @@ type MessageErrorDto = NonNullable<MessageDto['errors']>[number] & {
572
572
  error_code?: string | null;
573
573
  };
574
574
  type MessageError = NonNullable<Message['errors']>[number];
575
- /**
576
- * Maps one value as the API sent it. Does not apply the unknown-type rule, so
577
- * existing callers keep their contract; map a list through
578
- * `mapMessageValuesDtoToModels` to get it.
579
- */
580
575
  declare function mapMessageValueDtoToModel(dto: MessageValueDto): MessageValue;
581
- /**
582
- * Maps the values the UI can place and drops the rest, warning once per
583
- * unknown type. An API value this build has never seen hides that value; it
584
- * never breaks the message.
585
- */
586
- declare function mapMessageValuesDtoToModels(dtos: MessageValueDto[]): MessageValue[];
576
+ /** `type` is an extensible enum; a value this UI cannot place is dropped. */
577
+ declare const mapMessageValuesDtoToModels: (dtos: MessageValueDto[]) => MessageValue[];
587
578
  declare function mapMessageErrorDtoToModel(dto: MessageErrorDto): MessageError;
588
579
  declare function mapMessageDtoToModel(dto: MessageDto): Message;
589
580
  declare function mapMessagesDtoToModels(dto: MessageDto[]): Message[];
@@ -605,7 +596,7 @@ declare function applyDeltaToMessage(target: Message, delta: {
605
596
  /**
606
597
  * User-facing text for message errors.
607
598
  *
608
- * The backend attaches a stable machine-readable category to LLM failures
599
+ * The backend attaches a stable machine-readable category to failures
609
600
  * (`errorCode`, e.g. "llm.rate_limit") alongside the numeric HTTP `code`.
610
601
  * Prefer the category — it distinguishes causes the HTTP code can't (a 400
611
602
  * can be a content filter, a context-window blowout, or a malformed
package/dist/index.js CHANGED
@@ -19626,7 +19626,14 @@ var ERROR_CODE_TEXT = {
19626
19626
  "llm.content_policy": "\u26A0\uFE0F **The response was blocked by a content filter**\n\nPlease rephrase your request.",
19627
19627
  "llm.schema_validation": "\u26A0\uFE0F **The model returned an invalid response**\n\nPlease try again.",
19628
19628
  "llm.unsupported_modality": "\u26A0\uFE0F **This model can't read images**\n\nSwitch to a vision-capable model, or remove the attachment and describe it instead.",
19629
- "llm.unknown": GENERIC_ERROR_TEXT
19629
+ "llm.unknown": GENERIC_ERROR_TEXT,
19630
+ // Managed secrets. A secret's failure arrives as a 404 or 400, which the
19631
+ // status table below would read as a missing model or a generic error.
19632
+ "secret.user_value_not_set": "\u26A0\uFE0F **Your own key for this isn't set**\n\nThis step uses a credential each person sets for themselves, and none is set for you yet. Ask an administrator to add it.",
19633
+ "secret.run_has_no_user": "\u26A0\uFE0F **This step needs a signed-in user**\n\nIt uses a person's own credential, so it can't run when no one started the run.",
19634
+ "secret.user_mismatch": "\u26A0\uFE0F **A credential couldn't be loaded**\n\nAn administrator needs to check this flow's secrets.",
19635
+ "secret.run_required": "\u26A0\uFE0F **A credential couldn't be loaded**\n\nAn administrator needs to check this flow's secrets.",
19636
+ MS404: "\u26A0\uFE0F **A secret this flow uses doesn't exist**\n\nAn administrator needs to add it, or point the flow at another one."
19630
19637
  };
19631
19638
  var STATUS_CODE_TEXT = {
19632
19639
  408: ERROR_CODE_TEXT["llm.timeout"],
@@ -21147,6 +21154,11 @@ function MessageListSkeleton() {
21147
21154
  i
21148
21155
  )) });
21149
21156
  }
21157
+
21158
+ // src/shared/utils/enums.ts
21159
+ var isMember = (e, value) => Object.values(e).includes(value);
21160
+
21161
+ // src/domains/messages/mapper.ts
21150
21162
  var {
21151
21163
  messageThreadsThreadMessagesIdMessagesResponse: messagesResponseSchema
21152
21164
  } = ChatZod;
@@ -21161,8 +21173,6 @@ var toChannelNumber = (value) => {
21161
21173
  var normalizeChannels = (channels) => Object.fromEntries(
21162
21174
  Object.entries(channels).map(([key, val]) => [key, toChannelNumber(val)])
21163
21175
  );
21164
- var placeableTypes = new Set(Object.values(MessageValueType));
21165
- var warnedTypes = /* @__PURE__ */ new Set();
21166
21176
  function mapMessageValueDtoToModel(dto) {
21167
21177
  return {
21168
21178
  id: dto.id,
@@ -21175,24 +21185,7 @@ function mapMessageValueDtoToModel(dto) {
21175
21185
  createdByUserId: dto.createdByUserId ?? void 0
21176
21186
  };
21177
21187
  }
21178
- function mapMessageValuesDtoToModels(dtos) {
21179
- const kept = [];
21180
- for (const dto of dtos) {
21181
- if (!placeableTypes.has(dto.type)) {
21182
- if (!warnedTypes.has(dto.type)) {
21183
- warnedTypes.add(dto.type);
21184
- console.warn(
21185
- "[messages] dropped value with unknown type:",
21186
- dto.type,
21187
- dto.id
21188
- );
21189
- }
21190
- continue;
21191
- }
21192
- kept.push(mapMessageValueDtoToModel(dto));
21193
- }
21194
- return kept;
21195
- }
21188
+ var mapMessageValuesDtoToModels = (dtos) => dtos.filter((dto) => isMember(MessageValueType, dto.type)).map(mapMessageValueDtoToModel);
21196
21189
  function mapMessageErrorDtoToModel(dto) {
21197
21190
  const { error_code, ...rest } = dto;
21198
21191
  return {