@automattic/agenttic-client 0.1.48 → 0.1.49

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.js CHANGED
@@ -294,17 +294,17 @@ function ze(e, s = "") {
294
294
  `
295
295
  `,
296
296
  o
297
- ), u = l === -1 ? a.substring(o) : a.substring(o, l);
298
- if (u.startsWith("data:"))
297
+ ), d = l === -1 ? a.substring(o) : a.substring(o, l);
298
+ if (d.startsWith("data:"))
299
299
  n !== "" && (n += `
300
- `), n += u.substring(
301
- u.startsWith("data: ") ? 6 : 5
300
+ `), n += d.substring(
301
+ d.startsWith("data: ") ? 6 : 5
302
302
  );
303
- else if (u.trim() === "" && n) {
303
+ else if (d.trim() === "" && n) {
304
304
  try {
305
305
  t.push(JSON.parse(n)), r = l === -1 ? a.length : l + 1;
306
- } catch (d) {
307
- M("Failed to parse SSE event: %o", d), M("Problematic payload: %s", n);
306
+ } catch (u) {
307
+ M("Failed to parse SSE event: %o", u), M("Problematic payload: %s", n);
308
308
  }
309
309
  n = "";
310
310
  }
@@ -314,7 +314,7 @@ function ze(e, s = "") {
314
314
  return { events: t, nextBuffer: c };
315
315
  }
316
316
  async function* Ge(e, s = {}) {
317
- var u, d, p;
317
+ var d, u, p;
318
318
  const { supportDeltas: t = !1 } = s, a = e.getReader(), n = new TextDecoder();
319
319
  let r = "";
320
320
  const o = new Qe();
@@ -334,7 +334,7 @@ async function* Ge(e, s = {}) {
334
334
  throw new Error(
335
335
  `Streaming error: ${i.error.message}`
336
336
  );
337
- if (t && i.method === "message/delta" && ((u = i.params) != null && u.delta)) {
337
+ if (t && i.method === "message/delta" && ((d = i.params) != null && d.delta)) {
338
338
  const T = i.params.delta;
339
339
  try {
340
340
  if (T.deltaType === "content" && (o.processContentDelta(
@@ -356,7 +356,7 @@ async function* Ge(e, s = {}) {
356
356
  }
357
357
  } else if (i.result && i.result.status) {
358
358
  c = i.result.id, l = i.result.status, (o.getTextContent() || o.getCurrentMessage().parts.length > 0) && o.reset();
359
- const T = ((d = i.result.status) == null ? void 0 : d.message) || {
359
+ const T = ((u = i.result.status) == null ? void 0 : u.message) || {
360
360
  role: "agent",
361
361
  parts: []
362
362
  };
@@ -541,14 +541,14 @@ function Re(e, s, t) {
541
541
  };
542
542
  }
543
543
  async function Y(e, s, t, a, n, r) {
544
- const { message: o, sessionId: c, taskId: l, metadata: u } = e, { agentId: d, agentUrl: p, authProvider: m, proxy: f } = s, { isStreaming: I = !1, enableTokenStreaming: h = !1 } = t, A = c || r, g = Ze(p, d), i = await Ve(
544
+ const { message: o, sessionId: c, taskId: l, metadata: d } = e, { agentId: u, agentUrl: p, authProvider: m, proxy: f } = s, { isStreaming: I = !1, enableTokenStreaming: h = !1 } = t, A = c || r, g = Ze(p, u), i = await Ve(
545
545
  o,
546
546
  a,
547
547
  n
548
548
  ), T = {
549
549
  id: l,
550
550
  message: i,
551
- metadata: u
551
+ metadata: d
552
552
  };
553
553
  A && (T.sessionId = A);
554
554
  const x = De(
@@ -565,16 +565,16 @@ async function Y(e, s, t, a, n, r) {
565
565
  fullAgentUrl: g
566
566
  };
567
567
  }
568
- async function Ee(e, s, t = {}) {
569
- const { request: a, headers: n, fullAgentUrl: r } = e, { timeout: o } = s, { abortSignal: c } = t, { timeoutId: l, controller: u } = be(
568
+ async function _e(e, s, t = {}) {
569
+ const { request: a, headers: n, fullAgentUrl: r } = e, { timeout: o } = s, { abortSignal: c } = t, { timeoutId: l, controller: d } = be(
570
570
  o,
571
571
  "request"
572
- ), d = c ? ke(u.signal, c) : u.signal;
572
+ ), u = c ? ke(d.signal, c) : d.signal;
573
573
  try {
574
574
  const p = Re(
575
575
  n,
576
576
  JSON.stringify(a),
577
- d
577
+ u
578
578
  );
579
579
  M("Making request to %s with options: %O", r, {
580
580
  method: p.method,
@@ -593,18 +593,18 @@ async function Ee(e, s, t = {}) {
593
593
  Ae(p, l, "request");
594
594
  }
595
595
  }
596
- async function* _e(e, s, t) {
596
+ async function* Ee(e, s, t) {
597
597
  const { request: a, headers: n, fullAgentUrl: r } = e, {
598
598
  streamingTimeout: o = 6e4,
599
599
  abortSignal: c,
600
600
  enableTokenStreaming: l = !1
601
- } = t, { timeoutId: u, controller: d } = be(
601
+ } = t, { timeoutId: d, controller: u } = be(
602
602
  o,
603
603
  "streaming request"
604
- ), p = c ? ke(d.signal, c) : d.signal;
604
+ ), p = c ? ke(u.signal, c) : u.signal;
605
605
  try {
606
606
  const m = JSON.stringify(a), f = Re(n, m, p), I = await fetch(r, f);
607
- if (clearTimeout(u), Ye(I, "streaming request"), !I.body)
607
+ if (clearTimeout(d), Ye(I, "streaming request"), !I.body)
608
608
  throw new Error(
609
609
  "Response body is null - server may not support streaming"
610
610
  );
@@ -613,7 +613,7 @@ async function* _e(e, s, t) {
613
613
  supportDeltas: h
614
614
  });
615
615
  } catch (m) {
616
- Ae(m, u, "streaming request");
616
+ Ae(m, d, "streaming request");
617
617
  }
618
618
  }
619
619
  const st = 12e4;
@@ -629,12 +629,12 @@ async function Z(e, s, t, a, n) {
629
629
  const l = {
630
630
  ...t,
631
631
  ...a && { messageId: a }
632
- }, u = await o.callback(l);
632
+ }, d = await o.callback(l);
633
633
  return {
634
- result: u,
635
- returnToAgent: (u == null ? void 0 : u.returnToAgent) !== void 0 ? u.returnToAgent : !0,
636
- ...(u == null ? void 0 : u.agentMessage) && {
637
- agentMessage: u.agentMessage
634
+ result: d,
635
+ returnToAgent: (d == null ? void 0 : d.returnToAgent) !== void 0 ? d.returnToAgent : !0,
636
+ ...(d == null ? void 0 : d.agentMessage) && {
637
+ agentMessage: d.agentMessage
638
638
  }
639
639
  };
640
640
  } catch (l) {
@@ -731,15 +731,15 @@ async function Pe(e, s, t) {
731
731
  const a = [], n = [];
732
732
  let r = !1;
733
733
  for (const o of e) {
734
- const { toolCallId: c, toolId: l, arguments: u } = o.data;
734
+ const { toolCallId: c, toolId: l, arguments: d } = o.data;
735
735
  try {
736
- const d = await Z(
736
+ const u = await Z(
737
737
  s,
738
738
  l,
739
- u,
739
+ d,
740
740
  t,
741
741
  c
742
- ), { result: p, returnToAgent: m, agentMessage: f } = de(d);
742
+ ), { result: p, returnToAgent: m, agentMessage: f } = de(u);
743
743
  m && (r = !0), f && n.push(G(f)), a.push(
744
744
  W(
745
745
  c,
@@ -747,13 +747,13 @@ async function Pe(e, s, t) {
747
747
  p
748
748
  )
749
749
  );
750
- } catch (d) {
750
+ } catch (u) {
751
751
  r = !0, a.push(
752
752
  W(
753
753
  c,
754
754
  l,
755
755
  void 0,
756
- d instanceof Error ? d.message : String(d)
756
+ u instanceof Error ? u.message : String(u)
757
757
  )
758
758
  );
759
759
  }
@@ -787,27 +787,27 @@ async function ae(e, s, t, a, n, r, o) {
787
787
  n,
788
788
  r
789
789
  );
790
- return await Ee(l, t, {
790
+ return await _e(l, t, {
791
791
  abortSignal: o
792
792
  });
793
793
  }
794
794
  async function Ie(e, s, t, a, n, r, o, c, l = []) {
795
- const u = {
795
+ const d = {
796
796
  message: s,
797
797
  taskId: e,
798
798
  sessionId: r
799
799
  // Use the provided sessionId to maintain conversation continuity
800
- }, d = c || { isStreaming: !0 }, p = await Y(
801
- u,
800
+ }, u = c || { isStreaming: !0 }, p = await Y(
801
+ d,
802
802
  t,
803
803
  {
804
- ...d
804
+ ...u
805
805
  },
806
806
  a,
807
807
  n,
808
808
  r
809
- ), m = _e(p, t, {
810
- ...d,
809
+ ), m = Ee(p, t, {
810
+ ...u,
811
811
  abortSignal: o
812
812
  });
813
813
  return Oe(
@@ -821,27 +821,27 @@ async function Ie(e, s, t, a, n, r, o, c, l = []) {
821
821
  l,
822
822
  // preserve conversation parts across continuation
823
823
  o,
824
- d
824
+ u
825
825
  // Pass through the same request options
826
826
  );
827
827
  }
828
828
  async function* Oe(e, s, t, a, n, r = !0, o = [], c, l) {
829
- var u, d, p, m, f, I, h, A, g, i, T, x;
829
+ var d, u, p, m, f, I, h, A, g, i, T, x;
830
830
  for await (const w of e) {
831
831
  if (w.sessionId && !n && (n = w.sessionId), yield w, w.status.state === "running" && w.status.message && s && await at(
832
832
  s,
833
833
  w.status.message
834
834
  )) {
835
- const _ = L(
835
+ const E = L(
836
836
  w.status.message
837
837
  );
838
- for (const O of _) {
838
+ for (const O of E) {
839
839
  const { toolCallId: $, toolId: S, arguments: y } = O.data;
840
840
  Z(
841
841
  s,
842
842
  S,
843
843
  y,
844
- (d = (u = w.status) == null ? void 0 : u.message) == null ? void 0 : d.messageId,
844
+ (u = (d = w.status) == null ? void 0 : d.message) == null ? void 0 : u.messageId,
845
845
  $
846
846
  ).catch((C) => {
847
847
  M("Tool execution failed for %s: %O", S, C);
@@ -854,7 +854,7 @@ async function* Oe(e, s, t, a, n, r = !0, o = [], c, l) {
854
854
  message: {
855
855
  role: "agent",
856
856
  kind: "message",
857
- parts: _,
857
+ parts: E,
858
858
  messageId: N()
859
859
  }
860
860
  },
@@ -863,14 +863,14 @@ async function* Oe(e, s, t, a, n, r = !0, o = [], c, l) {
863
863
  };
864
864
  }
865
865
  if (w.status.state === "input-required" && w.status.message && s) {
866
- const _ = L(
866
+ const E = L(
867
867
  w.status.message
868
868
  );
869
- if (_.length > 0) {
869
+ if (E.length > 0) {
870
870
  const O = [];
871
871
  let $ = !1;
872
872
  const S = [], y = [];
873
- for (const C of _) {
873
+ for (const C of E) {
874
874
  const {
875
875
  toolCallId: v,
876
876
  toolId: R,
@@ -883,11 +883,11 @@ async function* Oe(e, s, t, a, n, r = !0, o = [], c, l) {
883
883
  k,
884
884
  (m = (p = w.status) == null ? void 0 : p.message) == null ? void 0 : m.messageId,
885
885
  v
886
- ), { result: E, returnToAgent: U, agentMessage: D } = de(b);
886
+ ), { result: _, returnToAgent: U, agentMessage: D } = de(b);
887
887
  if (U && ($ = !0), D && y.push(
888
888
  G(D)
889
- ), E.result instanceof Promise) {
890
- const P = E.result, J = {
889
+ ), _.result instanceof Promise) {
890
+ const P = _.result, J = {
891
891
  promise: P,
892
892
  resolvedValue: null
893
893
  };
@@ -909,17 +909,17 @@ async function* Oe(e, s, t, a, n, r = !0, o = [], c, l) {
909
909
  const q = W(
910
910
  v,
911
911
  R,
912
- E
912
+ _
913
913
  );
914
914
  O.push(q), S.push(q);
915
915
  } catch (b) {
916
- const E = W(
916
+ const _ = W(
917
917
  v,
918
918
  R,
919
919
  void 0,
920
920
  b instanceof Error ? b.message : String(b)
921
921
  );
922
- O.push(E), S.push(E);
922
+ O.push(_), S.push(_);
923
923
  }
924
924
  }
925
925
  if (o.push(w.status.message), O.length > 0 && o.push({
@@ -962,7 +962,7 @@ async function* Oe(e, s, t, a, n, r = !0, o = [], c, l) {
962
962
  );
963
963
  let b = (f = k.status) != null && f.message ? L(
964
964
  k.status.message
965
- ) : [], E = k;
965
+ ) : [], _ = k;
966
966
  if (b.length > 0)
967
967
  for (yield {
968
968
  ...k,
@@ -974,8 +974,8 @@ async function* Oe(e, s, t, a, n, r = !0, o = [], c, l) {
974
974
  }
975
975
  )
976
976
  }; b.length > 0; ) {
977
- (h = E.status) != null && h.message && o.push(
978
- E.status.message
977
+ (h = _.status) != null && h.message && o.push(
978
+ _.status.message
979
979
  );
980
980
  const {
981
981
  results: U,
@@ -983,10 +983,10 @@ async function* Oe(e, s, t, a, n, r = !0, o = [], c, l) {
983
983
  } = await Pe(
984
984
  b,
985
985
  s,
986
- (g = (A = E.status) == null ? void 0 : A.message) == null ? void 0 : g.messageId
986
+ (g = (A = _.status) == null ? void 0 : A.message) == null ? void 0 : g.messageId
987
987
  );
988
988
  if (U.length > 0 && (yield {
989
- id: E.id,
989
+ id: _.id,
990
990
  status: {
991
991
  state: "working",
992
992
  message: {
@@ -1006,7 +1006,7 @@ async function* Oe(e, s, t, a, n, r = !0, o = [], c, l) {
1006
1006
  U,
1007
1007
  q
1008
1008
  ), J = await Ie(
1009
- E.id,
1009
+ _.id,
1010
1010
  P,
1011
1011
  a,
1012
1012
  s,
@@ -1023,14 +1023,14 @@ async function* Oe(e, s, t, a, n, r = !0, o = [], c, l) {
1023
1023
  throw new Error(
1024
1024
  "Continue task stream ended without final result"
1025
1025
  );
1026
- E = H, b = (i = E.status) != null && i.message ? L(
1027
- E.status.message
1026
+ _ = H, b = (i = _.status) != null && i.message ? L(
1027
+ _.status.message
1028
1028
  ) : [], b.length > 0 && (yield {
1029
- id: E.id,
1030
- status: E.status,
1029
+ id: _.id,
1030
+ status: _.status,
1031
1031
  final: !1,
1032
1032
  text: j(
1033
- ((T = E.status) == null ? void 0 : T.message) || {
1033
+ ((T = _.status) == null ? void 0 : T.message) || {
1034
1034
  parts: [],
1035
1035
  messageId: N()
1036
1036
  }
@@ -1040,10 +1040,10 @@ async function* Oe(e, s, t, a, n, r = !0, o = [], c, l) {
1040
1040
  break;
1041
1041
  }
1042
1042
  yield {
1043
- ...E,
1043
+ ..._,
1044
1044
  final: !0,
1045
1045
  text: j(
1046
- ((x = E.status) == null ? void 0 : x.message) || {
1046
+ ((x = _.status) == null ? void 0 : x.message) || {
1047
1047
  parts: [],
1048
1048
  messageId: N()
1049
1049
  }
@@ -1090,28 +1090,28 @@ function rt(e) {
1090
1090
  toolProvider: o,
1091
1091
  contextProvider: c,
1092
1092
  enableStreaming: l = !1
1093
- } = e, u = {
1093
+ } = e, d = {
1094
1094
  agentId: s,
1095
1095
  agentUrl: t,
1096
1096
  authProvider: a,
1097
1097
  timeout: r
1098
1098
  };
1099
1099
  return {
1100
- async sendMessage(d) {
1100
+ async sendMessage(u) {
1101
1101
  var i, T;
1102
- const { abortSignal: p } = d, m = d.sessionId || n || void 0, f = [];
1103
- f.push(d.message);
1102
+ const { abortSignal: p } = u, m = u.sessionId || n || void 0, f = [];
1103
+ f.push(u.message);
1104
1104
  const I = await Y(
1105
- d,
1106
1105
  u,
1106
+ d,
1107
1107
  { isStreaming: !1 },
1108
1108
  o,
1109
1109
  c,
1110
1110
  m
1111
1111
  );
1112
- let h = await Ee(
1112
+ let h = await _e(
1113
1113
  I,
1114
- u,
1114
+ d,
1115
1115
  { abortSignal: p }
1116
1116
  );
1117
1117
  const A = [], g = [];
@@ -1123,7 +1123,7 @@ function rt(e) {
1123
1123
  break;
1124
1124
  A.push(...x);
1125
1125
  const w = [];
1126
- let _ = !1;
1126
+ let E = !1;
1127
1127
  for (const O of x) {
1128
1128
  const {
1129
1129
  toolCallId: $,
@@ -1136,7 +1136,7 @@ function rt(e) {
1136
1136
  S,
1137
1137
  y
1138
1138
  ), { result: v, returnToAgent: R, agentMessage: k } = de(C);
1139
- R && (_ = !0), k && g.push(
1139
+ R && (E = !0), k && g.push(
1140
1140
  G(k)
1141
1141
  );
1142
1142
  const b = W(
@@ -1155,12 +1155,12 @@ function rt(e) {
1155
1155
  w.push(v), A.push(v);
1156
1156
  }
1157
1157
  }
1158
- if (f.push(h.status.message), _) {
1158
+ if (f.push(h.status.message), E) {
1159
1159
  const O = X(w);
1160
1160
  h = await ae(
1161
1161
  h.id,
1162
1162
  O,
1163
- u,
1163
+ d,
1164
1164
  o,
1165
1165
  c,
1166
1166
  m,
@@ -1183,7 +1183,7 @@ function rt(e) {
1183
1183
  };
1184
1184
  }
1185
1185
  if (g.length > 0) {
1186
- const x = g.map((_) => j(_)).join(" "), w = G(x);
1186
+ const x = g.map((E) => j(E)).join(" "), w = G(x);
1187
1187
  return {
1188
1188
  ...h,
1189
1189
  // Keep the enhanced message with tool results
@@ -1203,16 +1203,16 @@ function rt(e) {
1203
1203
  )
1204
1204
  };
1205
1205
  },
1206
- async *sendMessageStream(d) {
1206
+ async *sendMessageStream(u) {
1207
1207
  const {
1208
1208
  withHistory: p = !0,
1209
1209
  abortSignal: m,
1210
1210
  enableStreaming: f
1211
- } = d, I = d.sessionId || n || void 0, h = f ?? l, A = [];
1212
- A.push(d.message);
1211
+ } = u, I = u.sessionId || n || void 0, h = f ?? l, A = [];
1212
+ A.push(u.message);
1213
1213
  const g = await Y(
1214
- d,
1215
1214
  u,
1215
+ d,
1216
1216
  {
1217
1217
  isStreaming: !0,
1218
1218
  // Always use message/stream endpoint for SSE
@@ -1221,9 +1221,9 @@ function rt(e) {
1221
1221
  o,
1222
1222
  c,
1223
1223
  I
1224
- ), i = _e(
1224
+ ), i = Ee(
1225
1225
  g,
1226
- u,
1226
+ d,
1227
1227
  {
1228
1228
  enableTokenStreaming: h,
1229
1229
  // Token streaming is optional
@@ -1235,7 +1235,7 @@ function rt(e) {
1235
1235
  i,
1236
1236
  o,
1237
1237
  c,
1238
- u,
1238
+ d,
1239
1239
  I,
1240
1240
  p,
1241
1241
  A,
@@ -1247,13 +1247,13 @@ function rt(e) {
1247
1247
  }
1248
1248
  );
1249
1249
  },
1250
- async continueTask(d, p, m) {
1250
+ async continueTask(u, p, m) {
1251
1251
  var A;
1252
1252
  const f = ie(p);
1253
1253
  let h = await ae(
1254
- d,
1255
- f,
1256
1254
  u,
1255
+ f,
1256
+ d,
1257
1257
  o,
1258
1258
  c,
1259
1259
  m
@@ -1270,7 +1270,7 @@ function rt(e) {
1270
1270
  h = await ae(
1271
1271
  h.id,
1272
1272
  x,
1273
- u,
1273
+ d,
1274
1274
  o,
1275
1275
  c,
1276
1276
  m
@@ -1346,13 +1346,13 @@ function lt(e) {
1346
1346
  }
1347
1347
  }
1348
1348
  function ct(e, s = !1) {
1349
- var r, o, c, l, u, d;
1349
+ var r, o, c, l, d, u;
1350
1350
  const a = e.messages.filter((p) => p.role === "tool_call" ? !1 : p.role === "tool_result" ? !(!s || lt(p)) : !0).map(it), n = {
1351
1351
  currentPage: ((r = e.metadata) == null ? void 0 : r.current_page) ?? 1,
1352
1352
  itemsPerPage: ((o = e.metadata) == null ? void 0 : o.items_per_page) ?? 10,
1353
1353
  totalPages: ((c = e.metadata) == null ? void 0 : c.total_pages) ?? 1,
1354
1354
  totalMessages: ((l = e.metadata) == null ? void 0 : l.total_messages) ?? a.length,
1355
- hasMore: (((u = e.metadata) == null ? void 0 : u.current_page) ?? 1) < (((d = e.metadata) == null ? void 0 : d.total_pages) ?? 1)
1355
+ hasMore: (((d = e.metadata) == null ? void 0 : d.current_page) ?? 1) < (((u = e.metadata) == null ? void 0 : u.total_pages) ?? 1)
1356
1356
  };
1357
1357
  return {
1358
1358
  messages: a,
@@ -1373,12 +1373,12 @@ async function le(e, s, t = 1, a = 50, n = !1) {
1373
1373
  throw new Error(
1374
1374
  "chatId and botId are required to load conversation from server"
1375
1375
  );
1376
- const l = Math.max(1, Math.min(t, 100)), u = Math.max(1, Math.min(a, 100)), d = new URL(
1376
+ const l = Math.max(1, Math.min(t, 100)), d = Math.max(1, Math.min(a, 100)), u = new URL(
1377
1377
  `${o}/wpcom/v2/odie/chat/${encodeURIComponent(
1378
1378
  r
1379
1379
  )}/${encodeURIComponent(e)}`
1380
1380
  );
1381
- d.searchParams.set("page_number", l.toString()), d.searchParams.set("items_per_page", u.toString()), M(
1381
+ u.searchParams.set("page_number", l.toString()), u.searchParams.set("items_per_page", d.toString()), M(
1382
1382
  "Loading conversation from server: %s (page %d)",
1383
1383
  e,
1384
1384
  l
@@ -1391,7 +1391,7 @@ async function le(e, s, t = 1, a = 50, n = !1) {
1391
1391
  const h = await c();
1392
1392
  Object.assign(p, h);
1393
1393
  }
1394
- const m = await fetch(d.toString(), {
1394
+ const m = await fetch(u.toString(), {
1395
1395
  method: "GET",
1396
1396
  headers: p
1397
1397
  });
@@ -1443,18 +1443,18 @@ async function Kt(e, s, t = !1) {
1443
1443
  "Content-Type": "application/json"
1444
1444
  };
1445
1445
  if (n) {
1446
- const u = await n();
1447
- Object.assign(o, u);
1446
+ const d = await n();
1447
+ Object.assign(o, d);
1448
1448
  }
1449
1449
  const c = await fetch(r.toString(), {
1450
1450
  method: "GET",
1451
1451
  headers: o
1452
1452
  });
1453
1453
  if (!c.ok) {
1454
- const u = await c.text(), d = `Failed to list conversations: ${c.status} ${c.statusText}`, p = new V(
1455
- d,
1454
+ const d = await c.text(), u = `Failed to list conversations: ${c.status} ${c.statusText}`, p = new V(
1455
+ u,
1456
1456
  c.status,
1457
- u
1457
+ d
1458
1458
  );
1459
1459
  throw M("Failed to list conversations: %O", p), p;
1460
1460
  }
@@ -1491,8 +1491,8 @@ async function Lt(e, s, t = 10, a = !1) {
1491
1491
  );
1492
1492
  try {
1493
1493
  const l = await Promise.all(c);
1494
- for (const u of l)
1495
- o.push(...u.messages);
1494
+ for (const d of l)
1495
+ o.push(...d.messages);
1496
1496
  return {
1497
1497
  messages: o,
1498
1498
  pagination: {
@@ -1537,12 +1537,12 @@ function ut(e) {
1537
1537
  name: f.file.name,
1538
1538
  mimeType: f.file.mimeType,
1539
1539
  uri: f.file.uri
1540
- })), l = n.length > 0 || r.length > 0 ? "agent" : e.role, u = ((p = e.metadata) == null ? void 0 : p.timestamp) ?? Date.now(), d = ((m = e.metadata) == null ? void 0 : m.archived) ?? void 0;
1540
+ })), l = n.length > 0 || r.length > 0 ? "agent" : e.role, d = ((p = e.metadata) == null ? void 0 : p.timestamp) ?? Date.now(), u = ((m = e.metadata) == null ? void 0 : m.archived) ?? void 0;
1541
1541
  return {
1542
1542
  role: l,
1543
1543
  content: t || "(No text content)",
1544
- timestamp: u,
1545
- ...d !== void 0 && { archived: d },
1544
+ timestamp: d,
1545
+ ...u !== void 0 && { archived: u },
1546
1546
  ...a && { contentType: a },
1547
1547
  ...o.length > 0 && { files: o },
1548
1548
  ...n.length > 0 && { toolCalls: n },
@@ -1857,10 +1857,10 @@ function St() {
1857
1857
  odieBotId: a.odieBotId,
1858
1858
  authProvider: a.authProvider
1859
1859
  };
1860
- let u = [];
1860
+ let d = [];
1861
1861
  if (r)
1862
1862
  try {
1863
- u = (await mt(
1863
+ d = (await mt(
1864
1864
  r,
1865
1865
  o,
1866
1866
  l
@@ -1871,16 +1871,16 @@ function St() {
1871
1871
  p
1872
1872
  );
1873
1873
  }
1874
- const d = {
1874
+ const u = {
1875
1875
  client: n,
1876
1876
  sessionId: r,
1877
1877
  conversationStorageKey: o,
1878
1878
  sessionIdStorageKey: c,
1879
1879
  storageConfig: l,
1880
- conversationHistory: u,
1880
+ conversationHistory: d,
1881
1881
  currentAbortController: null
1882
1882
  };
1883
- return e.set(t, d), n;
1883
+ return e.set(t, u), n;
1884
1884
  },
1885
1885
  getAgent(t) {
1886
1886
  const a = e.get(t);
@@ -1897,11 +1897,11 @@ function St() {
1897
1897
  const r = e.get(t);
1898
1898
  if (!r)
1899
1899
  throw new Error(`Agent with key "${t}" not found`);
1900
- const { withHistory: o = !0, sessionId: c, ...l } = n, { client: u, conversationHistory: d } = r, p = n.message || we(
1900
+ const { withHistory: o = !0, sessionId: c, ...l } = n, { client: d, conversationHistory: u } = r, p = n.message || we(
1901
1901
  a,
1902
- d,
1902
+ u,
1903
1903
  n.imageUrls
1904
- ), m = await u.sendMessage({
1904
+ ), m = await d.sendMessage({
1905
1905
  message: p,
1906
1906
  withHistory: o,
1907
1907
  sessionId: c || r.sessionId || void 0,
@@ -1936,7 +1936,7 @@ function St() {
1936
1936
  };
1937
1937
  }
1938
1938
  const I = [
1939
- ...d,
1939
+ ...u,
1940
1940
  // Store only the new content from the user message (without history parts)
1941
1941
  ie(a),
1942
1942
  // Add complete agent response with tool calls/results if present
@@ -1958,7 +1958,7 @@ function St() {
1958
1958
  ), m;
1959
1959
  },
1960
1960
  async *sendMessageStream(t, a, n = {}) {
1961
- var T, x, w, _, O, $;
1961
+ var T, x, w, E, O, $;
1962
1962
  const r = e.get(t);
1963
1963
  if (!r)
1964
1964
  throw new Error(`Agent with key "${t}" not found`);
@@ -1966,8 +1966,8 @@ function St() {
1966
1966
  withHistory: o = !0,
1967
1967
  abortSignal: c,
1968
1968
  metadata: l,
1969
- sessionId: u,
1970
- ...d
1969
+ sessionId: d,
1970
+ ...u
1971
1971
  } = n, { client: p } = r, m = l ? (({ contentType: S, ...y }) => y)(l) : void 0, f = new AbortController();
1972
1972
  r.currentAbortController = f, c && c.addEventListener(
1973
1973
  "abort",
@@ -2030,9 +2030,9 @@ function St() {
2030
2030
  for await (const S of p.sendMessageStream({
2031
2031
  message: g,
2032
2032
  withHistory: o,
2033
- sessionId: u || r.sessionId || void 0,
2033
+ sessionId: d || r.sessionId || void 0,
2034
2034
  abortSignal: f.signal,
2035
- ...d,
2035
+ ...u,
2036
2036
  ...m && Object.keys(m).length > 0 && {
2037
2037
  metadata: m
2038
2038
  }
@@ -2064,7 +2064,7 @@ function St() {
2064
2064
  I
2065
2065
  );
2066
2066
  }
2067
- if (((w = S.status) == null ? void 0 : w.state) === "working" && ((_ = S.status) != null && _.message) && !S.final) {
2067
+ if (((w = S.status) == null ? void 0 : w.state) === "working" && ((E = S.status) != null && E.message) && !S.final) {
2068
2068
  const C = wt(
2069
2069
  S.status.message
2070
2070
  ).filter(
@@ -2207,33 +2207,36 @@ const oe = (e) => [...e].sort((s, t) => s.timestamp - t.timestamp), Ne = (e, s =
2207
2207
  var o, c;
2208
2208
  if (e.parts.some((l) => {
2209
2209
  if (l.type === "data") {
2210
- const u = l.data;
2211
- return u.toolCallId || u.toolId || u.result;
2210
+ const d = l.data;
2211
+ return d.toolCallId || d.toolId || d.result;
2212
2212
  }
2213
2213
  return !1;
2214
2214
  }))
2215
2215
  return null;
2216
2216
  const a = e.parts.map((l) => {
2217
- var u;
2217
+ var d;
2218
2218
  if (l.type === "text")
2219
2219
  return {
2220
- type: ((u = l.metadata) == null ? void 0 : u.contentType) || "text",
2220
+ type: ((d = l.metadata) == null ? void 0 : d.contentType) || "text",
2221
2221
  text: l.text
2222
2222
  };
2223
2223
  if (l.type === "file") {
2224
- const d = l.file.uri || (l.file.mimeType && l.file.bytes ? `data:${l.file.mimeType};base64,${l.file.bytes}` : void 0);
2225
- if (d)
2226
- return Ne(d);
2224
+ const u = l.file.uri || (l.file.mimeType && l.file.bytes ? `data:${l.file.mimeType};base64,${l.file.bytes}` : void 0);
2225
+ if (u)
2226
+ return Ne(u);
2227
2227
  }
2228
2228
  if (l.type === "data") {
2229
- const d = l.data;
2230
- return d.component && d.componentProps ? {
2229
+ const u = l.data;
2230
+ return u.component && u.componentProps ? {
2231
2231
  type: "component",
2232
- component: d.component,
2233
- componentProps: d.componentProps
2232
+ component: u.component,
2233
+ componentProps: u.componentProps
2234
+ } : u.flags && typeof u.flags == "object" && "forward_to_human_support" in u.flags ? {
2235
+ type: "data",
2236
+ data: u
2234
2237
  } : {
2235
2238
  type: "text",
2236
- text: JSON.stringify(d)
2239
+ text: JSON.stringify(u)
2237
2240
  };
2238
2241
  }
2239
2242
  return {
@@ -2287,13 +2290,13 @@ function Bt(e) {
2287
2290
  unregisterMessageActions: o,
2288
2291
  clearAllMessageActions: c,
2289
2292
  registrations: l
2290
- } = Mt(), u = He(l);
2293
+ } = Mt(), d = He(l);
2291
2294
  se(() => {
2292
- u.current = l;
2295
+ d.current = l;
2293
2296
  }, [l]);
2294
- const d = F(
2297
+ const u = F(
2295
2298
  (g) => g.map(
2296
- (i) => re(i, u.current)
2299
+ (i) => re(i, d.current)
2297
2300
  ).filter((i) => i !== null),
2298
2301
  []
2299
2302
  // registrationsRef is stable, so no deps needed
@@ -2304,8 +2307,8 @@ function Bt(e) {
2304
2307
  (async () => {
2305
2308
  const i = Q(), T = s.agentId;
2306
2309
  if (i.hasAgent(T))
2307
- s.sessionId ? (i.updateSessionId(T, s.sessionId), i.getConversationHistory(T).length === 0 && n((_) => ({
2308
- ..._,
2310
+ s.sessionId ? (i.updateSessionId(T, s.sessionId), i.getConversationHistory(T).length === 0 && n((E) => ({
2311
+ ...E,
2309
2312
  clientMessages: [],
2310
2313
  uiMessages: []
2311
2314
  }))) : (i.updateSessionId(T, ""), await i.replaceMessages(T, []), n((w) => ({
@@ -2326,10 +2329,10 @@ function Bt(e) {
2326
2329
  odieBotId: e.odieBotId
2327
2330
  }), s.sessionId) {
2328
2331
  const w = i.getConversationHistory(T);
2329
- n((_) => {
2330
- const O = d(w);
2332
+ n((E) => {
2333
+ const O = u(w);
2331
2334
  return {
2332
- ..._,
2335
+ ...E,
2333
2336
  clientMessages: w,
2334
2337
  uiMessages: O
2335
2338
  };
@@ -2358,11 +2361,11 @@ function Bt(e) {
2358
2361
  var $, S;
2359
2362
  if (!t)
2360
2363
  throw new Error("Invalid agent configuration");
2361
- const T = Q(), x = s.agentId, w = Date.now(), _ = (i == null ? void 0 : i.type) || "text", O = {
2364
+ const T = Q(), x = s.agentId, w = Date.now(), E = (i == null ? void 0 : i.type) || "text", O = {
2362
2365
  id: `user-${w}`,
2363
2366
  role: "user",
2364
2367
  content: [
2365
- { type: _, text: g },
2368
+ { type: E, text: g },
2366
2369
  // Map image URLs to component content parts
2367
2370
  ...(($ = i == null ? void 0 : i.imageUrls) == null ? void 0 : $.map((y) => {
2368
2371
  const C = typeof y == "string" ? y : y.url;
@@ -2437,10 +2440,10 @@ function Bt(e) {
2437
2440
  C = !0;
2438
2441
  const k = y, b = re(
2439
2442
  R.status.message,
2440
- u.current
2443
+ d.current
2441
2444
  );
2442
- b && n((E) => {
2443
- const U = E.uiMessages.map(
2445
+ b && n((_) => {
2446
+ const U = _.uiMessages.map(
2444
2447
  (q) => {
2445
2448
  var P, J;
2446
2449
  if (q.id === k) {
@@ -2458,7 +2461,7 @@ function Bt(e) {
2458
2461
  x
2459
2462
  );
2460
2463
  return {
2461
- ...E,
2464
+ ..._,
2462
2465
  clientMessages: D,
2463
2466
  uiMessages: U,
2464
2467
  isProcessing: !1,
@@ -2474,10 +2477,10 @@ function Bt(e) {
2474
2477
  y && (b = k.uiMessages.filter(
2475
2478
  (P) => P.id !== y
2476
2479
  ));
2477
- const E = R.map(
2480
+ const _ = R.map(
2478
2481
  (P) => re(
2479
2482
  P,
2480
- u.current
2483
+ d.current
2481
2484
  )
2482
2485
  ).filter(
2483
2486
  (P) => P !== null
@@ -2486,7 +2489,7 @@ function Bt(e) {
2486
2489
  ), D = b.filter(
2487
2490
  (P) => !U.has(P.id) && P.role !== "user"
2488
2491
  ), q = oe([
2489
- ...E,
2492
+ ..._,
2490
2493
  ...D
2491
2494
  ]);
2492
2495
  return {
@@ -2539,7 +2542,7 @@ function Bt(e) {
2539
2542
  n((g) => {
2540
2543
  if (g.clientMessages.length === 0)
2541
2544
  return g;
2542
- const i = d(g.clientMessages), T = new Set(
2545
+ const i = u(g.clientMessages), T = new Set(
2543
2546
  g.clientMessages.map((w) => w.messageId)
2544
2547
  ), x = g.uiMessages.filter(
2545
2548
  (w) => !T.has(w.id) && w.role !== "user"
@@ -2564,7 +2567,7 @@ function Bt(e) {
2564
2567
  return;
2565
2568
  const i = Q(), T = s.agentId;
2566
2569
  await i.replaceMessages(T, g);
2567
- const x = d(g);
2570
+ const x = u(g);
2568
2571
  n((w) => ({
2569
2572
  ...w,
2570
2573
  clientMessages: g,
@@ -2598,29 +2601,29 @@ function Bt(e) {
2598
2601
  }
2599
2602
  var kt = /* @__PURE__ */ ((e) => (e[e.PARSE_ERROR = -32700] = "PARSE_ERROR", e[e.INVALID_REQUEST = -32600] = "INVALID_REQUEST", e[e.METHOD_NOT_FOUND = -32601] = "METHOD_NOT_FOUND", e[e.INVALID_PARAMS = -32602] = "INVALID_PARAMS", e[e.INTERNAL_ERROR = -32603] = "INTERNAL_ERROR", e[e.SERVER_ERROR = -32e3] = "SERVER_ERROR", e))(kt || {});
2600
2603
  const Te = "jetpack-ai-jwt-token", Rt = 30 * 60 * 1e3;
2601
- function Et() {
2604
+ function _t() {
2602
2605
  var t, a, n;
2603
2606
  return ((a = (t = window.JP_CONNECTION_INITIAL_STATE) == null ? void 0 : t.connectionStatus) == null ? void 0 : a.isRegistered) ? !1 : !!((n = window.Jetpack_Editor_Initial_State) != null && n.wpcomBlogId);
2604
2607
  }
2605
- async function _t(e, s = !0) {
2606
- var l, u;
2608
+ async function Et(e, s = !0) {
2609
+ var l, d;
2607
2610
  const t = localStorage.getItem(Te);
2608
2611
  let a;
2609
2612
  if (t)
2610
2613
  try {
2611
2614
  a = JSON.parse(t);
2612
- } catch (d) {
2613
- M("Invalid cached Jetpack token: %O", d);
2615
+ } catch (u) {
2616
+ M("Invalid cached Jetpack token: %O", u);
2614
2617
  }
2615
2618
  if (a && (a != null && a.token) && (a != null && a.expire) && (a == null ? void 0 : a.expire) > Date.now() && s)
2616
2619
  return a;
2617
- const n = (l = window.JP_CONNECTION_INITIAL_STATE) == null ? void 0 : l.apiNonce, r = (u = window.Jetpack_Editor_Initial_State) == null ? void 0 : u.wpcomBlogId;
2620
+ const n = (l = window.JP_CONNECTION_INITIAL_STATE) == null ? void 0 : l.apiNonce, r = (d = window.Jetpack_Editor_Initial_State) == null ? void 0 : d.wpcomBlogId;
2618
2621
  let o = {
2619
2622
  token: "",
2620
2623
  blog_id: ""
2621
2624
  };
2622
2625
  try {
2623
- Et() ? o = await pe({
2626
+ _t() ? o = await pe({
2624
2627
  path: "/wpcom/v2/sites/" + r + "/jetpack-openai-query/jwt",
2625
2628
  method: "POST"
2626
2629
  }) : o = await pe({
@@ -2631,8 +2634,8 @@ async function _t(e, s = !0) {
2631
2634
  },
2632
2635
  method: "POST"
2633
2636
  });
2634
- } catch (d) {
2635
- throw M("Failed to fetch Jetpack token: %O", d), new Error(e(d));
2637
+ } catch (u) {
2638
+ throw M("Failed to fetch Jetpack token: %O", u), new Error(e(u));
2636
2639
  }
2637
2640
  if (!(o != null && o.token))
2638
2641
  throw new Error(
@@ -2645,15 +2648,15 @@ async function _t(e, s = !0) {
2645
2648
  };
2646
2649
  try {
2647
2650
  localStorage.setItem(Te, JSON.stringify(c));
2648
- } catch (d) {
2649
- M("Error storing token in localStorage: %O", d);
2651
+ } catch (u) {
2652
+ M("Error storing token in localStorage: %O", u);
2650
2653
  }
2651
2654
  return c;
2652
2655
  }
2653
2656
  const Wt = (e) => async () => {
2654
2657
  const s = {};
2655
2658
  try {
2656
- const t = await _t(e);
2659
+ const t = await Et(e);
2657
2660
  t != null && t.token && (s.Authorization = `${t.token}`);
2658
2661
  } catch (t) {
2659
2662
  throw M("Failed to get Jetpack token for auth: %O", t), t;
@@ -21,10 +21,11 @@ export interface UIMessage {
21
21
  id: string;
22
22
  role: 'user' | 'agent';
23
23
  content: Array<{
24
- type: 'text' | 'component' | 'context';
24
+ type: 'text' | 'component' | 'context' | 'data';
25
25
  text?: string;
26
26
  component?: React.ComponentType;
27
27
  componentProps?: any;
28
+ data?: Record<string, unknown>;
28
29
  }>;
29
30
  timestamp: number;
30
31
  archived: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"useAgentChat.d.ts","sourceRoot":"","sources":["../../src/react/useAgentChat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EACX,YAAY,EACZ,OAAO,IAAI,aAAa,EACxB,WAAW,EACX,eAAe,EACf,YAAY,EACZ,MAAM,uBAAuB,CAAC;AAiC/B,MAAM,WAAW,UAAU;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,OAAO,GAAG,OAAO,CAAE,OAAO,CAAE,CAAC;CAC5C;AAGD,MAAM,WAAW,SAAS;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAE,MAAM,EAAE,OAAO,CAAE,CAAC;CACrC;AAGD,MAAM,WAAW,aAAa;IAC7B,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,CAAE,MAAM,GAAG,SAAS,CAAE,EAAE,CAAC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAGD,MAAM,WAAW,SAAS;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,OAAO,EAAE,KAAK,CAAE;QACf,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAAC;QACvC,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,SAAS,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QAChC,cAAc,CAAC,EAAE,GAAG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,CAAC;IACjD,sBAAsB,EAAE,MAAM,IAAI,CAAC;IAGnC,UAAU,EAAE,CAAE,OAAO,EAAE,SAAS,KAAM,IAAI,CAAC;IAG3C,mBAAmB,EAAE,MAAM,IAAI,CAAC;IAGhC,YAAY,EAAE,CAAE,QAAQ,EAAE,aAAa,EAAE,KAAM,OAAO,CAAE,IAAI,CAAE,CAAC;CAC/D;AAYD;;;;GAIG;AACH,wBAAgB,YAAY,CAAE,MAAM,EAAE,kBAAkB,GAAI,kBAAkB,CA8gB7E;AAED,eAAe,YAAY,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/agenttic-client",
3
- "version": "0.1.48",
3
+ "version": "0.1.49",
4
4
  "type": "module",
5
5
  "description": "A TypeScript client library for connection to the Automattic agent framework.",
6
6
  "main": "dist/index.js",