@lambforge/agent-chat 0.0.7 → 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
@@ -2440,6 +2440,7 @@ __export(index_exports, {
2440
2440
  agentEvent: () => agentEvent,
2441
2441
  agentsLoaded: () => agentsLoaded,
2442
2442
  chatReducer: () => chatReducer,
2443
+ closeComment: () => closeComment,
2443
2444
  connecting: () => connecting,
2444
2445
  errorCode: () => errorCode,
2445
2446
  failed: () => failed,
@@ -2449,6 +2450,8 @@ __export(index_exports, {
2449
2450
  newConversation: () => newConversation,
2450
2451
  pickAgent: () => pickAgent,
2451
2452
  pickAgents: () => pickAgents,
2453
+ rate: () => rate,
2454
+ rateFailed: () => rateFailed,
2452
2455
  removeFile: () => removeFile,
2453
2456
  renderMarkdown: () => renderMarkdown,
2454
2457
  resume: () => resume,
@@ -2675,6 +2678,12 @@ var resume = action(
2675
2678
  var agentEvent = action("[chat] event", payload());
2676
2679
  var runEnded = action("[chat] run ended");
2677
2680
  var stop = action("[chat] stop", payload());
2681
+ var rate = action("[chat] rate", payload());
2682
+ var rateFailed = action(
2683
+ "[chat] rate failed",
2684
+ payload()
2685
+ );
2686
+ var closeComment = action("[chat] close comment");
2678
2687
 
2679
2688
  // ../../node_modules/@rxdi/redux-store/dist/esm/interfaces.js
2680
2689
  var FlattenOperator;
@@ -3013,6 +3022,20 @@ var ChatEffects = class {
3013
3022
  })
3014
3023
  )
3015
3024
  );
3025
+ /** Send a rating; a refusal puts the earlier one back. */
3026
+ this.rate$ = createEffect()(
3027
+ (action$) => action$.pipe(
3028
+ ofType(rate),
3029
+ (0, import_operators7.mergeMap)(({ payload: payload2 }) => {
3030
+ const { agentId, conversationId, messageId, rating, comment, previous } = payload2;
3031
+ if (!this.ctx.client) return import_rxjs6.EMPTY;
3032
+ return this.conversation(agentId, conversationId).rate(messageId, rating, comment).pipe(
3033
+ (0, import_operators7.ignoreElements)(),
3034
+ (0, import_operators7.catchError)(() => (0, import_rxjs6.of)(rateFailed({ messageId, previous })))
3035
+ );
3036
+ })
3037
+ )
3038
+ );
3016
3039
  /** Failures also reach the page as an `error` event. */
3017
3040
  this.failures$ = createEffect()(
3018
3041
  (action$) => action$.pipe(
@@ -3055,7 +3078,8 @@ var initialChatState = {
3055
3078
  answering: false,
3056
3079
  live: null,
3057
3080
  notice: null,
3058
- files: []
3081
+ files: [],
3082
+ commentFor: null
3059
3083
  };
3060
3084
  function toMessage(m4) {
3061
3085
  const tools = (m4.toolCalls ?? []).map((c9) => c9?.name).filter((n11) => !!n11);
@@ -3064,7 +3088,8 @@ function toMessage(m4) {
3064
3088
  role: m4.role,
3065
3089
  text: m4.text ?? "",
3066
3090
  tools: Array.from(new Set(tools)),
3067
- attachments: (m4.attachments ?? []).map((a5) => a5.name)
3091
+ attachments: (m4.attachments ?? []).map((a5) => a5.name),
3092
+ feedback: m4.feedback?.rating ?? null
3068
3093
  };
3069
3094
  }
3070
3095
 
@@ -3076,7 +3101,8 @@ var empty = {
3076
3101
  answering: false,
3077
3102
  live: null,
3078
3103
  notice: null,
3079
- files: []
3104
+ files: [],
3105
+ commentFor: null
3080
3106
  };
3081
3107
  var chatReducer = reducer(
3082
3108
  initialChatState,
@@ -3121,7 +3147,8 @@ var chatReducer = reducer(
3121
3147
  role: "user",
3122
3148
  text: payload2.text,
3123
3149
  tools: [],
3124
- attachments: (payload2.files ?? []).map((f4) => f4.name)
3150
+ attachments: (payload2.files ?? []).map((f4) => f4.name),
3151
+ feedback: null
3125
3152
  }
3126
3153
  ],
3127
3154
  files: [],
@@ -3148,6 +3175,22 @@ var chatReducer = reducer(
3148
3175
  live: null,
3149
3176
  notice: s9.notice?.kind === "busy" ? null : s9.notice
3150
3177
  })),
3178
+ on(rate, (s9, { payload: payload2 }) => ({
3179
+ ...s9,
3180
+ messages: s9.messages.map(
3181
+ (m4) => m4.id === payload2.messageId ? { ...m4, feedback: payload2.rating } : m4
3182
+ ),
3183
+ // a fresh thumbs down asks what was wrong; a comment or anything else closes it
3184
+ commentFor: payload2.rating === "down" && payload2.comment === void 0 && payload2.previous !== "down" ? payload2.messageId : null
3185
+ })),
3186
+ on(rateFailed, (s9, { payload: payload2 }) => ({
3187
+ ...s9,
3188
+ messages: s9.messages.map(
3189
+ (m4) => m4.id === payload2.messageId ? { ...m4, feedback: payload2.previous } : m4
3190
+ ),
3191
+ commentFor: s9.commentFor === payload2.messageId ? null : s9.commentFor
3192
+ })),
3193
+ on(closeComment, (s9) => ({ ...s9, commentFor: null })),
3151
3194
  on(stop, (s9) => ({ ...s9, answering: false, live: null, notice: { kind: "info", what: "stopped" } }))
3152
3195
  );
3153
3196
  function withEvent(s9, event) {
@@ -3162,6 +3205,7 @@ function withEvent(s9, event) {
3162
3205
  };
3163
3206
  }
3164
3207
  if (event.type === "delta") return withDelta({ ...s9, conversationId }, event);
3208
+ if (event.type === "step") return withStep({ ...s9, conversationId }, event);
3165
3209
  if (event.type !== "message" || !event.data?.id) return { ...s9, conversationId };
3166
3210
  const message = toMessage(event.data);
3167
3211
  if (s9.messages.some((m4) => m4.id === message.id)) return { ...s9, conversationId };
@@ -3172,6 +3216,13 @@ function withEvent(s9, event) {
3172
3216
  const live = message.role === "assistant" ? null : s9.live;
3173
3217
  return { ...s9, conversationId, messages, live };
3174
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
+ }
3175
3226
  function withDelta(s9, event) {
3176
3227
  if (!s9.answering || !event.runId) return s9;
3177
3228
  const segment = Number(event.data?.segment) || 0;
@@ -3199,6 +3250,7 @@ var ChatStore = class {
3199
3250
  effects.select$,
3200
3251
  effects.run$,
3201
3252
  effects.abort$,
3253
+ effects.rate$,
3202
3254
  effects.failures$,
3203
3255
  effects.connect$
3204
3256
  ),
@@ -3225,6 +3277,8 @@ var en = {
3225
3277
  send: "Send",
3226
3278
  stop: "Stop",
3227
3279
  thinking: "Thinking",
3280
+ checking: "Checking the data",
3281
+ lookingAt: "Looking at",
3228
3282
  connecting: "Connecting",
3229
3283
  pickAgent: "Assistant",
3230
3284
  usedTools: "Used",
@@ -3233,6 +3287,12 @@ var en = {
3233
3287
  attached: "Attached files",
3234
3288
  removeFile: "Remove",
3235
3289
  filesOnly: "Please look at the attached files.",
3290
+ helpful: "Helpful",
3291
+ notHelpful: "Not helpful",
3292
+ whatWentWrong: "What was wrong? (optional)",
3293
+ sendFeedback: "Send",
3294
+ skipFeedback: "Skip",
3295
+ thanks: "Thanks for the feedback",
3236
3296
  errors: {
3237
3297
  "limit-reached": "This conversation is full - start a new one.",
3238
3298
  "cap-reached": "The assistant is not available right now - try again later.",
@@ -3240,6 +3300,9 @@ var en = {
3240
3300
  "session-expired": "Your session ended - reload the page.",
3241
3301
  "credential-expired": "Please sign in again.",
3242
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.",
3243
3306
  internal: "Something went wrong - try again.",
3244
3307
  unauthorized: "This chat is not allowed here.",
3245
3308
  "bad-request": "That did not work - try again.",
@@ -3263,6 +3326,8 @@ var bg = {
3263
3326
  send: "\u0418\u0437\u043F\u0440\u0430\u0442\u0438",
3264
3327
  stop: "\u0421\u043F\u0440\u0438",
3265
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",
3266
3331
  connecting: "\u0421\u0432\u044A\u0440\u0437\u0432\u0430\u043D\u0435",
3267
3332
  pickAgent: "\u0410\u0441\u0438\u0441\u0442\u0435\u043D\u0442",
3268
3333
  usedTools: "\u0418\u0437\u043F\u043E\u043B\u0437\u0432\u0430\u043D\u043E",
@@ -3271,6 +3336,12 @@ var bg = {
3271
3336
  attached: "\u041F\u0440\u0438\u043A\u0430\u0447\u0435\u043D\u0438 \u0444\u0430\u0439\u043B\u043E\u0432\u0435",
3272
3337
  removeFile: "\u041F\u0440\u0435\u043C\u0430\u0445\u043D\u0438",
3273
3338
  filesOnly: "\u041C\u043E\u043B\u044F, \u0440\u0430\u0437\u0433\u043B\u0435\u0434\u0430\u0439\u0442\u0435 \u043F\u0440\u0438\u043A\u0430\u0447\u0435\u043D\u0438\u0442\u0435 \u0444\u0430\u0439\u043B\u043E\u0432\u0435.",
3339
+ helpful: "\u041F\u043E\u043B\u0435\u0437\u043D\u043E",
3340
+ notHelpful: "\u041D\u0435 \u0435 \u043F\u043E\u043B\u0435\u0437\u043D\u043E",
3341
+ whatWentWrong: "\u041A\u0430\u043A\u0432\u043E \u043D\u0435 \u0431\u0435\u0448\u0435 \u043D\u0430\u0440\u0435\u0434? (\u043F\u043E \u0436\u0435\u043B\u0430\u043D\u0438\u0435)",
3342
+ sendFeedback: "\u0418\u0437\u043F\u0440\u0430\u0442\u0438",
3343
+ skipFeedback: "\u041F\u0440\u043E\u043F\u0443\u0441\u043D\u0438",
3344
+ thanks: "\u0411\u043B\u0430\u0433\u043E\u0434\u0430\u0440\u0438\u043C \u0437\u0430 \u043E\u0442\u0437\u0438\u0432\u0430",
3274
3345
  errors: {
3275
3346
  "limit-reached": "\u0420\u0430\u0437\u0433\u043E\u0432\u043E\u0440\u044A\u0442 \u0435 \u043F\u044A\u043B\u0435\u043D - \u0437\u0430\u043F\u043E\u0447\u043D\u0435\u0442\u0435 \u043D\u043E\u0432.",
3276
3347
  "cap-reached": "\u0410\u0441\u0438\u0441\u0442\u0435\u043D\u0442\u044A\u0442 \u043D\u0435 \u0435 \u0434\u043E\u0441\u0442\u044A\u043F\u0435\u043D \u0432 \u043C\u043E\u043C\u0435\u043D\u0442\u0430 - \u043E\u043F\u0438\u0442\u0430\u0439\u0442\u0435 \u043F\u043E-\u043A\u044A\u0441\u043D\u043E.",
@@ -3278,6 +3349,9 @@ var bg = {
3278
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.",
3279
3350
  "credential-expired": "\u041C\u043E\u043B\u044F, \u0432\u043B\u0435\u0437\u0442\u0435 \u043E\u0442\u043D\u043E\u0432\u043E.",
3280
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.",
3281
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.",
3282
3356
  unauthorized: "\u0422\u043E\u0437\u0438 \u0447\u0430\u0442 \u043D\u0435 \u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043D \u0442\u0443\u043A.",
3283
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.",
@@ -3434,6 +3508,26 @@ header select {
3434
3508
  @keyframes lf-caret { 50% { opacity: 0; } }
3435
3509
  @media (prefers-reduced-motion: reduce) { .msg.live > :last-child::after { animation: none; } }
3436
3510
  .tools { font-size: 12px; color: var(--_muted); margin-top: 4px; }
3511
+ .rate { display: flex; align-items: center; gap: 2px; margin-top: -6px; }
3512
+ .thumb {
3513
+ border: 0; background: transparent; color: var(--_muted);
3514
+ width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; cursor: pointer;
3515
+ }
3516
+ .thumb svg { width: 14px; height: 14px; }
3517
+ .thumb:hover, .thumb:focus-visible { background: var(--_bot-bg); color: var(--_fg); }
3518
+ .thumb.on { color: var(--_accent); }
3519
+ .thanks { font-size: 12px; color: var(--_muted); margin-left: 4px; }
3520
+ .comment { display: flex; gap: 6px; align-items: center; max-width: 85%; }
3521
+ .comment input {
3522
+ flex: 1; min-width: 0; font: inherit; font-size: 13px; color: var(--_fg); background: var(--_bg);
3523
+ border: 1px solid var(--_border); border-radius: 8px; padding: 6px 8px;
3524
+ }
3525
+ .comment button {
3526
+ border: 1px solid var(--_border); background: transparent; color: var(--_fg);
3527
+ border-radius: 8px; padding: 5px 9px; font-size: 13px; cursor: pointer;
3528
+ }
3529
+ .comment button[type='submit'] { border-color: var(--_accent); color: var(--_accent); }
3530
+ .comment .skip { color: var(--_muted); }
3437
3531
 
3438
3532
  .welcome { color: var(--_muted); }
3439
3533
  .suggestions { display: flex; flex-wrap: wrap; gap: 6px; }
@@ -3585,6 +3679,8 @@ var TAG = "lambforge-agent-chat";
3585
3679
  var ICON_CHAT = import_lit_html19.svg`<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>`;
3586
3680
  var ICON_CLOSE = import_lit_html19.svg`<path d="M18 6 6 18M6 6l12 12"/>`;
3587
3681
  var ICON_NEW = import_lit_html19.svg`<path d="M12 5v14M5 12h14"/>`;
3682
+ var ICON_UP = import_lit_html19.svg`<path d="M7 10v12M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z"/>`;
3683
+ var ICON_DOWN = import_lit_html19.svg`<path d="M17 14V2M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z"/>`;
3588
3684
  var ICON_ATTACH = import_lit_html19.svg`<path d="m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48"/>`;
3589
3685
  var ACCEPT = [...import_agents2.ACCEPTED_ATTACHMENT_TYPES, ".md", ".csv", ".yaml", ".yml", ".json", ".txt"].join(",");
3590
3686
  var icon = (paths) => import_lit_html19.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${paths}</svg>`;
@@ -3804,7 +3900,11 @@ var LambforgeAgentChat = class extends import_lit_html19.LitElement {
3804
3900
  noticeText(notice) {
3805
3901
  if (!notice) return "";
3806
3902
  const t9 = this.t;
3807
- 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
+ }
3808
3908
  if (notice.kind === "info") return t9.errors.aborted;
3809
3909
  return t9.errors[notice.code] ?? t9.errors.default;
3810
3910
  }
@@ -3873,7 +3973,7 @@ var LambforgeAgentChat = class extends import_lit_html19.LitElement {
3873
3973
  aria-relevant="additions"
3874
3974
  aria-busy=${String(!!live)}
3875
3975
  >
3876
- ${state.messages.length ? state.messages.map((m4) => this.bubble(m4)) : this.intro(state)}
3976
+ ${state.messages.length ? state.messages.map((m4) => this.bubble(m4, state)) : this.intro(state)}
3877
3977
  ${live ? import_lit_html19.html`<div class="msg assistant live" part="message assistant live">${renderMarkdown(live.text)}</div>` : ""}
3878
3978
  </div>
3879
3979
  <div class="turnstile" ?hidden=${notice?.kind !== "busy" || notice.what !== "verifying"}></div>
@@ -3933,14 +4033,67 @@ var LambforgeAgentChat = class extends import_lit_html19.LitElement {
3933
4033
  </section>
3934
4034
  `;
3935
4035
  }
3936
- bubble(m4) {
4036
+ /**
4037
+ * Rate an answer: the same thumb again clears it. Only stored answers of
4038
+ * an agent that takes ratings (plan 51 §15 #7).
4039
+ */
4040
+ rateAnswer(m4, rating, comment) {
4041
+ return ([state]) => {
4042
+ if (!state.agentId || !state.conversationId) return;
4043
+ const next = comment === void 0 && m4.feedback === rating ? null : rating;
4044
+ this.dispatch(
4045
+ rate({
4046
+ agentId: state.agentId,
4047
+ conversationId: state.conversationId,
4048
+ messageId: m4.id,
4049
+ rating: next,
4050
+ ...comment !== void 0 ? { comment } : {},
4051
+ previous: m4.feedback
4052
+ })
4053
+ );
4054
+ };
4055
+ }
4056
+ sendComment(ev, m4, state) {
4057
+ ev.preventDefault();
4058
+ const input = ev.target.querySelector("input");
4059
+ const text = input?.value.trim() ?? "";
4060
+ if (!text) {
4061
+ this.dispatch(closeComment());
4062
+ return;
4063
+ }
4064
+ this.rateAnswer(m4, "down", text)([state]);
4065
+ }
4066
+ feedback(m4, state) {
4067
+ const agent = state.agents.find((a5) => a5.id === state.agentId);
4068
+ if (agent?.allowFeedback === false || m4.id.startsWith("local:") || !state.conversationId) return "";
4069
+ const t9 = this.t;
4070
+ return import_lit_html19.html`
4071
+ <div class="rate" part="rate">
4072
+ <button type="button" class="thumb ${m4.feedback === "up" ? "on" : ""}" part="thumb-up"
4073
+ title=${t9.helpful} aria-label=${t9.helpful} aria-pressed=${m4.feedback === "up" ? "true" : "false"}
4074
+ @click=${() => this.rateAnswer(m4, "up")([state])}>${icon(ICON_UP)}</button>
4075
+ <button type="button" class="thumb ${m4.feedback === "down" ? "on" : ""}" part="thumb-down"
4076
+ title=${t9.notHelpful} aria-label=${t9.notHelpful} aria-pressed=${m4.feedback === "down" ? "true" : "false"}
4077
+ @click=${() => this.rateAnswer(m4, "down")([state])}>${icon(ICON_DOWN)}</button>
4078
+ ${m4.feedback && state.commentFor !== m4.id ? import_lit_html19.html`<span class="thanks" aria-live="polite">${t9.thanks}</span>` : ""}
4079
+ </div>
4080
+ ${state.commentFor === m4.id ? import_lit_html19.html`<form class="comment" part="feedback-comment" @submit=${(ev) => this.sendComment(ev, m4, state)}>
4081
+ <input type="text" maxlength="1000" placeholder=${t9.whatWentWrong} aria-label=${t9.whatWentWrong}
4082
+ @keydown=${(ev) => ev.key === "Escape" && this.dispatch(closeComment())} />
4083
+ <button type="submit">${t9.sendFeedback}</button>
4084
+ <button type="button" class="skip" @click=${() => this.dispatch(closeComment())}>${t9.skipFeedback}</button>
4085
+ </form>` : ""}
4086
+ `;
4087
+ }
4088
+ bubble(m4, state) {
3937
4089
  if (m4.role === "user") {
3938
4090
  return import_lit_html19.html`<div class="msg user" part="message user">${m4.text}${m4.attachments?.length ? import_lit_html19.html`<div class="msg-files">${m4.attachments.map((name) => import_lit_html19.html`<span class="msg-file">${name}</span>`)}</div>` : ""}</div>`;
3939
4091
  }
3940
4092
  return import_lit_html19.html`<div class="msg assistant" part="message assistant">
3941
4093
  ${renderMarkdown(m4.text)}
3942
4094
  ${m4.tools.length ? import_lit_html19.html`<div class="tools">${this.t.usedTools}: ${m4.tools.join(", ")}</div>` : ""}
3943
- </div>`;
4095
+ </div>
4096
+ ${this.feedback(m4, state)}`;
3944
4097
  }
3945
4098
  intro(state) {
3946
4099
  const agent = state.agents.find((a5) => a5.id === state.agentId);
@@ -4024,6 +4177,11 @@ LambforgeAgentChat = __decorateClass([
4024
4177
  }
4025
4178
  })
4026
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
+ }
4027
4185
  /*! Bundled license information:
4028
4186
 
4029
4187
  lit-html/lit-html.js: