@lambforge/agent-chat 0.0.8 → 0.0.9

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.cjs CHANGED
@@ -3205,6 +3205,7 @@ function withEvent(s9, event) {
3205
3205
  };
3206
3206
  }
3207
3207
  if (event.type === "delta") return withDelta({ ...s9, conversationId }, event);
3208
+ if (event.type === "step") return withStep({ ...s9, conversationId }, event);
3208
3209
  if (event.type !== "message" || !event.data?.id) return { ...s9, conversationId };
3209
3210
  const message = toMessage(event.data);
3210
3211
  if (s9.messages.some((m4) => m4.id === message.id)) return { ...s9, conversationId };
@@ -3215,6 +3216,13 @@ function withEvent(s9, event) {
3215
3216
  const live = message.role === "assistant" ? null : s9.live;
3216
3217
  return { ...s9, conversationId, messages, live };
3217
3218
  }
3219
+ function withStep(s9, event) {
3220
+ if (!s9.answering || s9.notice?.kind !== "busy" || s9.notice.what !== "thinking") return s9;
3221
+ const n11 = Number(event.data?.step) || 0;
3222
+ if (s9.notice.step && n11 < s9.notice.step.n) return s9;
3223
+ const tool = typeof event.data?.tool === "string" && event.data.tool ? event.data.tool : null;
3224
+ return { ...s9, notice: { ...s9.notice, step: { n: n11, tool } } };
3225
+ }
3218
3226
  function withDelta(s9, event) {
3219
3227
  if (!s9.answering || !event.runId) return s9;
3220
3228
  const segment = Number(event.data?.segment) || 0;
@@ -3269,6 +3277,8 @@ var en = {
3269
3277
  send: "Send",
3270
3278
  stop: "Stop",
3271
3279
  thinking: "Thinking",
3280
+ checking: "Checking the data",
3281
+ lookingAt: "Looking at",
3272
3282
  connecting: "Connecting",
3273
3283
  pickAgent: "Assistant",
3274
3284
  usedTools: "Used",
@@ -3290,6 +3300,9 @@ var en = {
3290
3300
  "session-expired": "Your session ended - reload the page.",
3291
3301
  "credential-expired": "Please sign in again.",
3292
3302
  aborted: "Stopped.",
3303
+ timeout: "The answer took too long - try again or ask something shorter.",
3304
+ "embeddings-off": "Something went wrong - try again.",
3305
+ "embeddings-cap-reached": "Something went wrong - try again.",
3293
3306
  internal: "Something went wrong - try again.",
3294
3307
  unauthorized: "This chat is not allowed here.",
3295
3308
  "bad-request": "That did not work - try again.",
@@ -3313,6 +3326,8 @@ var bg = {
3313
3326
  send: "\u0418\u0437\u043F\u0440\u0430\u0442\u0438",
3314
3327
  stop: "\u0421\u043F\u0440\u0438",
3315
3328
  thinking: "\u041C\u0438\u0441\u043B\u044F",
3329
+ checking: "\u041F\u0440\u043E\u0432\u0435\u0440\u044F\u0432\u0430\u043C \u0434\u0430\u043D\u043D\u0438\u0442\u0435",
3330
+ lookingAt: "\u0413\u043B\u0435\u0434\u0430\u043C",
3316
3331
  connecting: "\u0421\u0432\u044A\u0440\u0437\u0432\u0430\u043D\u0435",
3317
3332
  pickAgent: "\u0410\u0441\u0438\u0441\u0442\u0435\u043D\u0442",
3318
3333
  usedTools: "\u0418\u0437\u043F\u043E\u043B\u0437\u0432\u0430\u043D\u043E",
@@ -3334,6 +3349,9 @@ var bg = {
3334
3349
  "session-expired": "\u0421\u0435\u0441\u0438\u044F\u0442\u0430 \u0438\u0437\u0442\u0435\u0447\u0435 - \u043F\u0440\u0435\u0437\u0430\u0440\u0435\u0434\u0435\u0442\u0435 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430\u0442\u0430.",
3335
3350
  "credential-expired": "\u041C\u043E\u043B\u044F, \u0432\u043B\u0435\u0437\u0442\u0435 \u043E\u0442\u043D\u043E\u0432\u043E.",
3336
3351
  aborted: "\u0421\u043F\u0440\u044F\u043D\u043E.",
3352
+ timeout: "\u041E\u0442\u0433\u043E\u0432\u043E\u0440\u044A\u0442 \u043E\u0442\u043D\u0435 \u0442\u0432\u044A\u0440\u0434\u0435 \u0434\u044A\u043B\u0433\u043E - \u043E\u043F\u0438\u0442\u0430\u0439\u0442\u0435 \u043E\u0442\u043D\u043E\u0432\u043E \u0438\u043B\u0438 \u043F\u043E\u043F\u0438\u0442\u0430\u0439\u0442\u0435 \u043F\u043E-\u043A\u0440\u0430\u0442\u043A\u043E.",
3353
+ "embeddings-off": "\u041D\u0435\u0449\u043E \u0441\u0435 \u043E\u0431\u044A\u0440\u043A\u0430 - \u043E\u043F\u0438\u0442\u0430\u0439\u0442\u0435 \u043E\u0442\u043D\u043E\u0432\u043E.",
3354
+ "embeddings-cap-reached": "\u041D\u0435\u0449\u043E \u0441\u0435 \u043E\u0431\u044A\u0440\u043A\u0430 - \u043E\u043F\u0438\u0442\u0430\u0439\u0442\u0435 \u043E\u0442\u043D\u043E\u0432\u043E.",
3337
3355
  internal: "\u041D\u0435\u0449\u043E \u0441\u0435 \u043E\u0431\u044A\u0440\u043A\u0430 - \u043E\u043F\u0438\u0442\u0430\u0439\u0442\u0435 \u043E\u0442\u043D\u043E\u0432\u043E.",
3338
3356
  unauthorized: "\u0422\u043E\u0437\u0438 \u0447\u0430\u0442 \u043D\u0435 \u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043D \u0442\u0443\u043A.",
3339
3357
  "bad-request": "\u041D\u0435 \u0441\u0435 \u043F\u043E\u043B\u0443\u0447\u0438 - \u043E\u043F\u0438\u0442\u0430\u0439\u0442\u0435 \u043E\u0442\u043D\u043E\u0432\u043E.",
@@ -3882,7 +3900,11 @@ var LambforgeAgentChat = class extends import_lit_html19.LitElement {
3882
3900
  noticeText(notice) {
3883
3901
  if (!notice) return "";
3884
3902
  const t9 = this.t;
3885
- if (notice.kind === "busy") return t9[notice.what];
3903
+ if (notice.kind === "busy") {
3904
+ const step = notice.what === "thinking" ? notice.step : void 0;
3905
+ if (!step) return t9[notice.what];
3906
+ return `${t9[notice.what]} - ${step.tool ? `${t9.lookingAt}: ${toolLabel(step.tool)}` : t9.checking}`;
3907
+ }
3886
3908
  if (notice.kind === "info") return t9.errors.aborted;
3887
3909
  return t9.errors[notice.code] ?? t9.errors.default;
3888
3910
  }
@@ -4155,6 +4177,11 @@ LambforgeAgentChat = __decorateClass([
4155
4177
  }
4156
4178
  })
4157
4179
  ], LambforgeAgentChat);
4180
+ function toolLabel(name) {
4181
+ const bare = String(name).split("__").pop() ?? "";
4182
+ const words = bare.replace(/[_-]+/g, " ").replace(/([a-z0-9])([A-Z])/g, "$1 $2").trim().toLowerCase();
4183
+ return words ? words[0].toUpperCase() + words.slice(1) : "";
4184
+ }
4158
4185
  /*! Bundled license information:
4159
4186
 
4160
4187
  lit-html/lit-html.js: