@aintela/chat 0.3.0 → 0.3.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.
Files changed (45) hide show
  1. package/README.md +14 -0
  2. package/dist/{atMentions-CCNBOf5W.js → atMentions-CnHuJKhX.js} +92 -87
  3. package/dist/atMentions-CnHuJKhX.js.map +1 -0
  4. package/dist/components.js +9274 -10531
  5. package/dist/components.js.map +1 -1
  6. package/dist/hooks.js +1 -1
  7. package/dist/{httpArtifactService-kXjuQtGa.js → httpArtifactService-Ba9xFy1E.js} +43 -27
  8. package/dist/httpArtifactService-Ba9xFy1E.js.map +1 -0
  9. package/dist/{httpSessionService-CMT6k-Nu.js → httpSessionService-DXlT2vxT.js} +33 -22
  10. package/dist/httpSessionService-DXlT2vxT.js.map +1 -0
  11. package/dist/index.js +231 -217
  12. package/dist/services.js +2 -2
  13. package/dist/src/components/AiChat/AiChatContext.d.ts +0 -3
  14. package/dist/src/components/AiChat/AiChatTypes.d.ts +0 -11
  15. package/dist/src/components/AiChat/ChatPane/ChatPane.test.d.ts +1 -0
  16. package/dist/src/components/AiChat/ChatPane/MessageAgent.d.ts +0 -1
  17. package/dist/src/components/AiChat/ChatPane/MessagePart.d.ts +5 -3
  18. package/dist/src/components/AiChat/ChatPane/MessagePart.test.d.ts +1 -0
  19. package/dist/src/components/AiChat/ChatPane/friendlyToolConfig.test.d.ts +1 -0
  20. package/dist/src/components/AiChat/ChatPane/messageAgentThoughts.test.d.ts +1 -0
  21. package/dist/src/components/AiChat/ChatPane/parts/uiToolDispatcher.test.d.ts +1 -0
  22. package/dist/src/components/AiChat/ChatPane/parts/uiToolRegistry.test.d.ts +1 -0
  23. package/dist/src/components/AiChat/index.d.ts +1 -3
  24. package/dist/src/components/index.d.ts +0 -3
  25. package/dist/src/components/v2/AiChatFloating.d.ts +3 -0
  26. package/dist/src/components/v2/PromptV2.d.ts +21 -6
  27. package/dist/src/components/v2/PromptV2.test.d.ts +1 -0
  28. package/dist/src/components/v2/icons.d.ts +1 -0
  29. package/dist/src/components/v2/index.d.ts +25 -25
  30. package/dist/src/services/storageService.d.ts +18 -0
  31. package/dist/src/utils/urlParser.test.d.ts +1 -0
  32. package/dist/tests/fakes/fakeChatServices.d.ts +42 -0
  33. package/dist/{useChatSessions-CpHq0e1n.js → useChatSessions-1AAvAdPW.js} +2 -2
  34. package/dist/{useChatSessions-CpHq0e1n.js.map → useChatSessions-1AAvAdPW.js.map} +1 -1
  35. package/dist/utils.js +1 -1
  36. package/package.json +1 -1
  37. package/dist/atMentions-CCNBOf5W.js.map +0 -1
  38. package/dist/httpArtifactService-kXjuQtGa.js.map +0 -1
  39. package/dist/httpSessionService-CMT6k-Nu.js.map +0 -1
  40. package/dist/src/components/AiChat/AiChatFloating.d.ts +0 -3
  41. package/dist/src/components/AiChat/ChatPane/LastPrompts.d.ts +0 -9
  42. package/dist/src/components/AiChat/ChatPane/Prompt.d.ts +0 -9
  43. package/dist/src/components/AiChat/ChatPane/SubAgentBox.d.ts +0 -9
  44. package/dist/src/components/AiChat/ChatPane/TaskList.d.ts +0 -6
  45. package/dist/src/components/v2/AiChatFloatingV2.d.ts +0 -3
package/README.md CHANGED
@@ -103,6 +103,20 @@ flag is available on its own as `useTurnOpen()`
103
103
  (prefer it over `UiToolContext.onGoing`, which is a per-surface snapshot: `false`
104
104
  forever on a card that has settled into history, even while a later turn streams).
105
105
 
106
+ ### Component names (breaking in 0.3.0)
107
+
108
+ Every v2 component is exported under its **plain name** — `AppBar`, `Prompt`,
109
+ `TaskList`, `RunProgressStrip` — and again under its historical `…V2` name as an
110
+ alias, so no existing import breaks. Prefer the plain names.
111
+
112
+ The suffix existed to separate these from a v1 layer that no longer exists: the
113
+ last four v1 components (`Prompt`, `LastPrompts`, `TaskList`, `SubAgentBox`) were
114
+ deleted in 0.3.0 after confirming nothing consumed them, and the two
115
+ `AiChatFloating` implementations were merged into one. Gone with them are the
116
+ props that selected the v1 renderers — **`compactPrompt`**, **`showTaskList`**
117
+ and **`showSubAgents`**. The prompt is always the compact one now; the task list
118
+ and sub-agent trace live in the RunProgress panel.
119
+
106
120
  ### One engine, one agent (breaking in 0.3.0)
107
121
 
108
122
  The `AgentContext` — which agent answers — is owned by the **engine**, and by nothing
@@ -1,6 +1,8 @@
1
- var A = Object.defineProperty;
2
- var d = (n, t) => A(n, "name", { value: t, configurable: !0 });
3
- const H = /* @__PURE__ */ d((n, t, e) => {
1
+ var x = Object.defineProperty;
2
+ var $ = (n, t, e) => t in n ? x(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
+ var d = (n, t) => x(n, "name", { value: t, configurable: !0 });
4
+ var E = (n, t, e) => $(n, typeof t != "symbol" ? t + "" : t, e);
5
+ const F = /* @__PURE__ */ d((n, t, e) => {
4
6
  let s = "URL", o = null, i = null, r = null;
5
7
  if (n[0] == "#") {
6
8
  const a = n.indexOf("-"), l = n.slice(1, a);
@@ -15,10 +17,10 @@ const H = /* @__PURE__ */ d((n, t, e) => {
15
17
  } else
16
18
  n.indexOf("http") > -1 ? (s = "URL", i = n) : (n = n.replaceAll("exported/", `exported/${t}/`), s = "Export");
17
19
  return { action: s, url: i, question: o, parameter: r };
18
- }, "extractLinkAction"), k = /* @__PURE__ */ d((n, t) => Array.from(
20
+ }, "extractLinkAction"), I = /* @__PURE__ */ d((n, t) => Array.from(
19
21
  { length: Math.ceil(n.length / t) },
20
22
  (e, s) => n.slice(s * t, s * t + t)
21
- ), "chunkArray"), _ = /* @__PURE__ */ d((n) => {
23
+ ), "chunkArray"), z = /* @__PURE__ */ d((n) => {
22
24
  n = n.replaceAll("\\n", `
23
25
  `);
24
26
  const t = 90, e = n.split(" "), s = [];
@@ -26,14 +28,14 @@ const H = /* @__PURE__ */ d((n, t, e) => {
26
28
  for (const i of e)
27
29
  if (i.length > t) {
28
30
  o = !0;
29
- const r = [...i], l = k(r, t).map((c) => c.join("")).join(`
31
+ const r = [...i], l = I(r, t).map((c) => c.join("")).join(`
30
32
  `);
31
33
  s.push(l);
32
34
  } else
33
35
  s.push(i);
34
36
  return o ? s.join(" ") : n;
35
37
  }, "splitBigLinesWithSpaces");
36
- function $(n) {
38
+ function D(n) {
37
39
  let t = parseFloat(n);
38
40
  if (!isNaN(t))
39
41
  return n = n.replaceAll(/[,\.]/g, ""), parseInt(n);
@@ -43,37 +45,37 @@ function $(n) {
43
45
  const s = e.length / n.length;
44
46
  return t = parseInt(e), !isNaN(t) && s > 0.5 ? t : NaN;
45
47
  }
46
- d($, "parseRawNumber");
47
- const I = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i, N = /^[0-9a-f]{32}/i;
48
- function z(n) {
48
+ d(D, "parseRawNumber");
49
+ const W = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i, N = /^[0-9a-f]{32}/i;
50
+ function B(n) {
49
51
  if (!n || typeof n != "string")
50
52
  return !1;
51
- const t = W(n);
53
+ const t = q(n);
52
54
  return t === null ? !1 : n.startsWith(t);
53
55
  }
54
- d(z, "startsWithInteractionId");
55
- function W(n) {
56
+ d(B, "startsWithInteractionId");
57
+ function q(n) {
56
58
  if (!n || typeof n != "string")
57
59
  return null;
58
- const t = n.match(I);
60
+ const t = n.match(W);
59
61
  if (t)
60
62
  return t[0];
61
63
  const e = n.match(N);
62
64
  return e ? e[0] : null;
63
65
  }
64
- d(W, "extractInteractionId");
65
- function B(n) {
66
+ d(q, "extractInteractionId");
67
+ function V(n) {
66
68
  if (n.length == 0)
67
69
  return n;
68
70
  const t = n.replaceAll("_", " ").replaceAll("-", " ");
69
71
  return t[0].toUpperCase() + t.slice(1);
70
72
  }
71
- d(B, "prettiffyPythonFunctionName");
72
- function F(n) {
73
+ d(V, "prettiffyPythonFunctionName");
74
+ function P(n) {
73
75
  return !n || typeof n != "string" ? !1 : !!(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(n) || /^[0-9a-f]{32}$/i.test(n));
74
76
  }
75
- d(F, "isValidInteractionId");
76
- const x = /* @__PURE__ */ new Set(), C = class C {
77
+ d(P, "isValidInteractionId");
78
+ const L = /* @__PURE__ */ new Set(), v = class v {
77
79
  constructor(t = {}) {
78
80
  this.options = {
79
81
  // CSS class for sortable headers
@@ -184,7 +186,7 @@ const x = /* @__PURE__ */ new Set(), C = class C {
184
186
  direction: "none"
185
187
  }), t.hasAttribute("data-original-width") || t.setAttribute("data-original-width", t.getBoundingClientRect().width), this.applyTableStyles(t), this.originalColumnOrder.set(e, Array.from(i).map((a, l) => l)), i.forEach((a, l) => {
186
188
  this.options.excludeColumns.includes(l) || this.makeHeaderSortable(a, t, e, l);
187
- }), this.replaceExponentialValues(t), x.add(t);
189
+ }), this.replaceExponentialValues(t), L.add(t);
188
190
  }
189
191
  /**
190
192
  * Replace exponential values in table cells with full numbers
@@ -299,7 +301,7 @@ const x = /* @__PURE__ */ new Set(), C = class C {
299
301
  * Extract sortable value from cell
300
302
  */
301
303
  extractValue(t) {
302
- let e = t.textContent.trim(), s = $(e);
304
+ let e = t.textContent.trim(), s = D(e);
303
305
  if (!isNaN(s))
304
306
  return console.log(s), s;
305
307
  if (e = e.replace(/arrow_upward|arrow_downward|remove|keyboard_arrow_up|keyboard_arrow_down|unfold_more|expand_more|expand_less|trending_up|trending_down|↗|↘|↑|↓|→|←/g, "").trim(), /^(N\/A|N\/D|ND|N\/A|n\/a|n\/d|nd|N\/A|N\/D|ND|\s*)$/i.test(e))
@@ -592,9 +594,11 @@ const x = /* @__PURE__ */ new Set(), C = class C {
592
594
  const e = this.calculateTableWidth(t);
593
595
  t.style.width = e, t.style.maxWidth = "100%";
594
596
  }
595
- getCharWidth(t, e, s) {
596
- const i = document.createElement("canvas").getContext("2d");
597
- return i.fontFamily = e, i.fontMono = s, i.measureText("A ").width;
597
+ // Signature matches the single call site — `init()` passes (fontFamily,
598
+ // fontMono), which used to land on a leading `char` parameter nothing read.
599
+ getCharWidth(t, e) {
600
+ const s = document.createElement("canvas").getContext("2d");
601
+ return s ? (s.fontFamily = t, s.fontMono = e, s.measureText("A ").width) : v.DEFAULT_CHAR_WIDTH;
598
602
  }
599
603
  /**
600
604
  * Add CSS styles for sortable tables
@@ -748,7 +752,7 @@ const x = /* @__PURE__ */ new Set(), C = class C {
748
752
  });
749
753
  });
750
754
  const t = document.getElementById("sortable-table-styles");
751
- t && t.remove(), this.tables = [], this.sortStates.clear(), x.clear();
755
+ t && t.remove(), this.tables = [], this.sortStates.clear(), L.clear();
752
756
  }
753
757
  /**
754
758
  * Refresh the library (useful after DOM changes)
@@ -757,39 +761,40 @@ const x = /* @__PURE__ */ new Set(), C = class C {
757
761
  this.destroy(), this.init();
758
762
  }
759
763
  };
760
- d(C, "SortableTable");
761
- let S = C;
762
- typeof window < "u" && (window.SortableTable = S);
763
- const E = /* @__PURE__ */ new Set(["/", "@", "#"]), q = /* @__PURE__ */ d((n) => n === "/" ? "slash" : n === "@" ? "at" : "hash", "triggerTypeFor"), w = /[ \t\r\n\f\v]/, D = /\[[^\]\n]+\]/g, L = /* @__PURE__ */ d((n, t, e) => {
764
+ d(v, "SortableTable"), /** Fallback advance width, in px, for one character of the body font. */
765
+ E(v, "DEFAULT_CHAR_WIDTH", 8);
766
+ let C = v;
767
+ typeof window < "u" && (window.SortableTable = C);
768
+ const T = /* @__PURE__ */ new Set(["/", "@", "#"]), M = /* @__PURE__ */ d((n) => n === "/" ? "slash" : n === "@" ? "at" : "hash", "triggerTypeFor"), S = /[ \t\r\n\f\v]/, O = /\[[^\]\n]+\]/g, A = /* @__PURE__ */ d((n, t, e) => {
764
769
  let s = 0;
765
770
  const o = /* @__PURE__ */ d((i) => {
766
771
  const r = i === 0 ? t : n[i - 1];
767
- return r === void 0 || w.test(r);
772
+ return r === void 0 || S.test(r);
768
773
  }, "boundaryBefore");
769
774
  for (; s < n.length; ) {
770
775
  const i = n[s];
771
- if (o(s) && E.has(i)) {
776
+ if (o(s) && T.has(i)) {
772
777
  let r = s + 1;
773
- for (; r < n.length && !w.test(n[r]); ) r += 1;
774
- e.push({ type: q(i), text: n.slice(s, r) }), s = r;
778
+ for (; r < n.length && !S.test(n[r]); ) r += 1;
779
+ e.push({ type: M(i), text: n.slice(s, r) }), s = r;
775
780
  } else {
776
781
  let r = s + 1;
777
782
  for (; r < n.length; ) {
778
783
  const a = n[r];
779
- if (E.has(a) && w.test(n[r - 1])) break;
784
+ if (T.has(a) && S.test(n[r - 1])) break;
780
785
  r += 1;
781
786
  }
782
787
  e.push({ type: "plain", text: n.slice(s, r) }), s = r;
783
788
  }
784
789
  }
785
- }, "tokenizeSegment"), V = /* @__PURE__ */ d((n) => {
790
+ }, "tokenizeSegment"), U = /* @__PURE__ */ d((n) => {
786
791
  if (!n) return [];
787
- const t = [], e = new RegExp(D.source, "g");
792
+ const t = [], e = new RegExp(O.source, "g");
788
793
  let s = 0;
789
794
  for (let o = e.exec(n); o; o = e.exec(n))
790
- o.index > s && L(n.slice(s, o.index), s === 0 ? void 0 : n[s - 1], t), t.push({ type: "placeholder", text: o[0] }), s = o.index + o[0].length;
791
- return s < n.length && L(n.slice(s), s === 0 ? void 0 : n[s - 1], t), t;
792
- }, "tokenizeForHighlight"), P = /* @__PURE__ */ d((n, t) => {
795
+ o.index > s && A(n.slice(s, o.index), s === 0 ? void 0 : n[s - 1], t), t.push({ type: "placeholder", text: o[0] }), s = o.index + o[0].length;
796
+ return s < n.length && A(n.slice(s), s === 0 ? void 0 : n[s - 1], t), t;
797
+ }, "tokenizeForHighlight"), X = /* @__PURE__ */ d((n, t) => {
793
798
  const e = t.filter((o) => o.trim().length > 0).sort((o, i) => i.length - o.length);
794
799
  if (e.length === 0) return n;
795
800
  const s = [];
@@ -814,7 +819,7 @@ const E = /* @__PURE__ */ new Set(["/", "@", "#"]), q = /* @__PURE__ */ d((n) =>
814
819
  }
815
820
  return s;
816
821
  }, "chipLocations");
817
- function X(n, t, e = t, s = 600) {
822
+ function G(n, t, e = t, s = 600) {
818
823
  const o = n.value;
819
824
  let i = !1;
820
825
  const r = /* @__PURE__ */ d(() => {
@@ -832,9 +837,9 @@ function X(n, t, e = t, s = 600) {
832
837
  const c = window.setTimeout(r, s), p = window.setInterval(a, 50);
833
838
  return document.addEventListener("selectionchange", l), n.addEventListener("keydown", r), n.addEventListener("input", r), n.addEventListener("pointerdown", r), r;
834
839
  }
835
- d(X, "placeCaret");
836
- const M = 2;
837
- function U(n, t) {
840
+ d(G, "placeCaret");
841
+ const H = 2;
842
+ function j(n, t) {
838
843
  let e = 0;
839
844
  for (let s = t - 1; s >= 0; s -= 1) {
840
845
  const o = n[s];
@@ -847,17 +852,17 @@ function U(n, t) {
847
852
  };
848
853
  if (o === " ") return null;
849
854
  if (o === " " || o === " ") {
850
- if (e += 1, e > M) return null;
855
+ if (e += 1, e > H) return null;
851
856
  continue;
852
857
  }
853
858
  if (/\s/.test(o)) return null;
854
859
  }
855
860
  return null;
856
861
  }
857
- d(U, "detectTrigger");
858
- const O = /\[[^\]\n]+\]/g;
859
- function v(n, t = 0) {
860
- const e = new RegExp(O.source, "g");
862
+ d(j, "detectTrigger");
863
+ const R = /\[[^\]\n]+\]/g;
864
+ function w(n, t = 0) {
865
+ const e = new RegExp(R.source, "g");
861
866
  e.lastIndex = t;
862
867
  const s = e.exec(n);
863
868
  if (!s) return null;
@@ -869,33 +874,33 @@ function v(n, t = 0) {
869
874
  endIdx: s.index + s[0].length
870
875
  };
871
876
  }
872
- d(v, "findPlaceholder");
873
- function G(n, t) {
877
+ d(w, "findPlaceholder");
878
+ function K(n, t) {
874
879
  for (let e = 0; ; ) {
875
- const s = v(n, e);
880
+ const s = w(n, e);
876
881
  if (!s || s.startIdx > t) return null;
877
882
  if (t <= s.endIdx) return s;
878
883
  e = s.endIdx;
879
884
  }
880
885
  }
881
- d(G, "placeholderAt");
882
- function T(n, t) {
886
+ d(K, "placeholderAt");
887
+ function k(n, t) {
883
888
  if (t.trigger) {
884
889
  const e = n.slice(0, t.startIdx) + t.trigger + n.slice(t.endIdx), s = t.startIdx + 1;
885
890
  return { next: e, selectionStart: s, selectionEnd: s, reopenTrigger: !0 };
886
891
  }
887
892
  return { next: n, selectionStart: t.startIdx, selectionEnd: t.endIdx, reopenTrigger: !1 };
888
893
  }
889
- d(T, "activatePlaceholder");
890
- function j(n, t) {
891
- const e = v(n, t) ?? v(n, 0);
892
- return e ? T(n, e) : null;
894
+ d(k, "activatePlaceholder");
895
+ function Z(n, t) {
896
+ const e = w(n, t) ?? w(n, 0);
897
+ return e ? k(n, e) : null;
893
898
  }
894
- d(j, "advanceToPlaceholder");
895
- function K(n, t, e) {
896
- const s = n.slice(0, t.startIdx), o = n.slice(t.endIdx), i = v(e);
899
+ d(Z, "advanceToPlaceholder");
900
+ function J(n, t, e) {
901
+ const s = n.slice(0, t.startIdx), o = n.slice(t.endIdx), i = w(e);
897
902
  if (i) {
898
- const c = T(e, i);
903
+ const c = k(e, i);
899
904
  return {
900
905
  next: `${s}${c.next}${o}`,
901
906
  selectionStart: s.length + c.selectionStart,
@@ -911,8 +916,8 @@ function K(n, t, e) {
911
916
  const a = `${e} `, l = s.length + a.length;
912
917
  return { next: `${s}${a}${o}`, selectionStart: l, selectionEnd: l, reopenTrigger: !1 };
913
918
  }
914
- d(K, "applyTriggerInsertion");
915
- async function Z(n, { onAtQuery: t, onAtPersonQuery: e }, { personConfidence: s = 0, locationConfidence: o = 0, personFirstThreshold: i = 0.5 } = {}) {
919
+ d(J, "applyTriggerInsertion");
920
+ async function Y(n, { onAtQuery: t, onAtPersonQuery: e }, { personConfidence: s = 0, locationConfidence: o = 0, personFirstThreshold: i = 0.5 } = {}) {
916
921
  const [r, a] = await Promise.all([
917
922
  t ? t(n).catch(() => []) : Promise.resolve([]),
918
923
  e ? e(n).catch(() => []) : Promise.resolve([])
@@ -923,32 +928,32 @@ async function Z(n, { onAtQuery: t, onAtPersonQuery: e }, { personConfidence: s
923
928
  }
924
929
  return [...a, ...r];
925
930
  }
926
- d(Z, "fetchAtMentions");
927
- function J(n, t) {
931
+ d(Y, "fetchAtMentions");
932
+ function Q(n, t) {
928
933
  var s, o;
929
934
  const e = (s = n[t]) == null ? void 0 : s.group;
930
935
  return e !== void 0 && (t === 0 || ((o = n[t - 1]) == null ? void 0 : o.group) !== e);
931
936
  }
932
- d(J, "isSectionStart");
937
+ d(Q, "isSectionStart");
933
938
  export {
934
- S,
935
- T as a,
936
- j as b,
937
- K as c,
938
- P as d,
939
- k as e,
940
- U as f,
941
- W as g,
942
- H as h,
943
- Z as i,
944
- v as j,
945
- J as k,
946
- F as l,
947
- G as m,
948
- B as n,
949
- z as o,
950
- X as p,
951
- _ as s,
952
- V as t
939
+ C as S,
940
+ k as a,
941
+ Z as b,
942
+ J as c,
943
+ X as d,
944
+ I as e,
945
+ j as f,
946
+ q as g,
947
+ F as h,
948
+ Y as i,
949
+ w as j,
950
+ Q as k,
951
+ P as l,
952
+ K as m,
953
+ V as n,
954
+ B as o,
955
+ G as p,
956
+ z as s,
957
+ U as t
953
958
  };
954
- //# sourceMappingURL=atMentions-CCNBOf5W.js.map
959
+ //# sourceMappingURL=atMentions-CnHuJKhX.js.map