@automattic/agenttic-client 0.1.33 → 0.1.35

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
@@ -18,7 +18,7 @@ export { createJetpackAuthProvider, type JetpackErrorHandler, type JetpackApiErr
18
18
  export { convertAbilityToTool, convertAbilitiesToTools, isWordPressAbility, } from './utils/wordpressAbilities';
19
19
  export { listConversationsFromServer, loadChatFromServer, loadAllMessagesFromServer, } from './react/odieService';
20
20
  export type { OdieServiceConfig } from './react/odieService';
21
- export type { ServerLoadResult, PaginationMeta, ServerConversationListItem, } from './react/serverTypes';
21
+ export type { ServerLoadResult, PaginationMeta, ServerConversationListItem, ServerConversationListItemMessage, } from './react/serverTypes';
22
22
  export { createOdieBotId, parseOdieBotId, isOdieBotId, } from './react/odieConfig';
23
23
  export type { OdieBotConfig } from './react/odieConfig';
24
24
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EACN,cAAc,EACd,kBAAkB,EAClB,2BAA2B,EAC3B,KAAK,iCAAiC,GACtC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGpD,OAAO,EACN,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,2BAA2B,EAC3B,sBAAsB,EACtB,qBAAqB,GACrB,MAAM,qBAAqB,CAAC;AAG7B,YAAY,EAEX,SAAS,EACT,cAAc,EACd,eAAe,EACf,YAAY,EACZ,SAAS,EACT,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,IAAI,EACJ,OAAO,EACP,UAAU,EACV,QAAQ,EACR,IAAI,EACJ,iB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,EACN,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,GAClB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACN,2BAA2B,EAC3B,kBAAkB,EAClB,yBAAyB,GACzB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,YAAY,EACX,gBAAgB,EAChB,cAAc,EACd,0BAA0B,EAC1B,iCAAiC,GACjC,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACN,eAAe,EACf,cAAc,EACd,WAAW,GACX,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
package/dist/index.js CHANGED
@@ -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 d, u, w;
317
+ var d, u, h;
318
318
  const { supportDeltas: t = !1 } = s, a = e.getReader(), n = new TextDecoder();
319
319
  let r = "";
320
320
  const o = new Qe();
@@ -324,10 +324,10 @@ async function* Ge(e, s = {}) {
324
324
  const { done: m, value: g } = await a.read();
325
325
  if (m)
326
326
  break;
327
- const h = n.decode(g, { stream: !0 }), { events: y, nextBuffer: x } = ze(h, r);
328
- if (y && Array.isArray(y))
329
- for (let f = 0; f < y.length; f++) {
330
- const i = y[f];
327
+ const y = n.decode(g, { stream: !0 }), { events: I, nextBuffer: x } = ze(y, r);
328
+ if (I && Array.isArray(I))
329
+ for (let f = 0; f < I.length; f++) {
330
+ const i = I[f];
331
331
  if (f > 0 && i.method === "message/delta" && typeof requestAnimationFrame < "u" && await new Promise((T) => {
332
332
  requestAnimationFrame(() => T(void 0));
333
333
  }), i.error)
@@ -369,7 +369,7 @@ async function* Ge(e, s = {}) {
369
369
  progressMessage: he(T)
370
370
  };
371
371
  } else if (i.id && i.result && (c = i.result.id, i.result.status)) {
372
- const T = ((w = i.result.status) == null ? void 0 : w.message) || {
372
+ const T = ((h = i.result.status) == null ? void 0 : h.message) || {
373
373
  role: "agent",
374
374
  parts: []
375
375
  };
@@ -541,7 +541,7 @@ 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: d } = e, { agentId: u, agentUrl: w, authProvider: m, proxy: g } = s, { isStreaming: h = !1, enableTokenStreaming: y = !1 } = t, x = c || r, f = Ze(w, u), i = await Ve(
544
+ const { message: o, sessionId: c, taskId: l, metadata: d } = e, { agentId: u, agentUrl: h, authProvider: m, proxy: g } = s, { isStreaming: y = !1, enableTokenStreaming: I = !1 } = t, x = c || r, f = Ze(h, u), i = await Ve(
545
545
  o,
546
546
  a,
547
547
  n
@@ -553,13 +553,13 @@ async function Y(e, s, t, a, n, r) {
553
553
  x && (T.sessionId = x);
554
554
  const A = De(
555
555
  T,
556
- h ? "message/stream" : "message/send",
557
- y && h
556
+ y ? "message/stream" : "message/send",
557
+ I && y
558
558
  // Only enable token streaming if using SSE
559
- ), I = await tt(m, h);
560
- return et("POST", f, I, A), {
559
+ ), w = await tt(m, y);
560
+ return et("POST", f, w, A), {
561
561
  request: A,
562
- headers: I,
562
+ headers: w,
563
563
  enhancedMessage: i,
564
564
  effectiveSessionId: x,
565
565
  fullAgentUrl: f
@@ -571,16 +571,16 @@ async function Ee(e, s, t = {}) {
571
571
  "request"
572
572
  ), u = c ? ke(d.signal, c) : d.signal;
573
573
  try {
574
- const w = Re(
574
+ const h = Re(
575
575
  n,
576
576
  JSON.stringify(a),
577
577
  u
578
578
  );
579
579
  v("Making request to %s with options: %O", r, {
580
- method: w.method,
581
- headers: w.headers
580
+ method: h.method,
581
+ headers: h.headers
582
582
  });
583
- const m = await fetch(r, w);
583
+ const m = await fetch(r, h);
584
584
  clearTimeout(l), Ce(m, "request");
585
585
  const g = await m.json();
586
586
  return v(
@@ -589,8 +589,8 @@ async function Ee(e, s, t = {}) {
589
589
  m.status,
590
590
  ve(g)
591
591
  ), Xe(g, "request");
592
- } catch (w) {
593
- xe(w, l, "request");
592
+ } catch (h) {
593
+ xe(h, l, "request");
594
594
  }
595
595
  }
596
596
  async function* Pe(e, s, t) {
@@ -601,16 +601,16 @@ async function* Pe(e, s, t) {
601
601
  } = t, { timeoutId: d, controller: u } = be(
602
602
  o,
603
603
  "streaming request"
604
- ), w = c ? ke(u.signal, c) : u.signal;
604
+ ), h = c ? ke(u.signal, c) : u.signal;
605
605
  try {
606
- const m = JSON.stringify(a), g = Re(n, m, w), h = await fetch(r, g);
607
- if (clearTimeout(d), Ye(h, "streaming request"), !h.body)
606
+ const m = JSON.stringify(a), g = Re(n, m, h), y = await fetch(r, g);
607
+ if (clearTimeout(d), Ye(y, "streaming request"), !y.body)
608
608
  throw new Error(
609
609
  "Response body is null - server may not support streaming"
610
610
  );
611
- const y = l && a.tokenStreaming === !0;
612
- yield* Ge(h.body, {
613
- supportDeltas: y
611
+ const I = l && a.tokenStreaming === !0;
612
+ yield* Ge(y.body, {
613
+ supportDeltas: I
614
614
  });
615
615
  } catch (m) {
616
616
  xe(m, d, "streaming request");
@@ -739,12 +739,12 @@ async function Oe(e, s, t) {
739
739
  d,
740
740
  t,
741
741
  c
742
- ), { result: w, returnToAgent: m, agentMessage: g } = de(u);
742
+ ), { result: h, returnToAgent: m, agentMessage: g } = de(u);
743
743
  m && (r = !0), g && n.push(G(g)), a.push(
744
744
  W(
745
745
  c,
746
746
  l,
747
- w
747
+ h
748
748
  )
749
749
  );
750
750
  } catch (u) {
@@ -797,7 +797,7 @@ async function Ie(e, s, t, a, n, r, o, c, l = []) {
797
797
  taskId: e,
798
798
  sessionId: r
799
799
  // Use the provided sessionId to maintain conversation continuity
800
- }, u = c || { isStreaming: !0 }, w = await Y(
800
+ }, u = c || { isStreaming: !0 }, h = await Y(
801
801
  d,
802
802
  t,
803
803
  {
@@ -806,7 +806,7 @@ async function Ie(e, s, t, a, n, r, o, c, l = []) {
806
806
  a,
807
807
  n,
808
808
  r
809
- ), m = Pe(w, t, {
809
+ ), m = Pe(h, t, {
810
810
  ...u,
811
811
  abortSignal: o
812
812
  });
@@ -826,14 +826,14 @@ async function Ie(e, s, t, a, n, r, o, c, l = []) {
826
826
  );
827
827
  }
828
828
  async function* _e(e, s, t, a, n, r = !0, o = [], c, l) {
829
- var d, u, w, m, g, h, y, x, f, i, T, A;
830
- for await (const I of e) {
831
- if (I.sessionId && !n && (n = I.sessionId), yield I, I.status.state === "running" && I.status.message && s && await at(
829
+ var d, u, h, m, g, y, I, x, f, i, T, A;
830
+ for await (const w of e) {
831
+ if (w.sessionId && !n && (n = w.sessionId), yield w, w.status.state === "running" && w.status.message && s && await at(
832
832
  s,
833
- I.status.message
833
+ w.status.message
834
834
  )) {
835
835
  const P = B(
836
- I.status.message
836
+ w.status.message
837
837
  );
838
838
  for (const O of P) {
839
839
  const { toolCallId: $, toolId: S, arguments: p } = O.data;
@@ -841,14 +841,14 @@ async function* _e(e, s, t, a, n, r = !0, o = [], c, l) {
841
841
  s,
842
842
  S,
843
843
  p,
844
- (u = (d = I.status) == null ? void 0 : d.message) == null ? void 0 : u.messageId,
844
+ (u = (d = w.status) == null ? void 0 : d.message) == null ? void 0 : u.messageId,
845
845
  $
846
846
  ).catch((C) => {
847
847
  v("Tool execution failed for %s: %O", S, C);
848
848
  });
849
849
  }
850
850
  yield {
851
- id: I.id,
851
+ id: w.id,
852
852
  status: {
853
853
  state: "running",
854
854
  message: {
@@ -862,9 +862,9 @@ async function* _e(e, s, t, a, n, r = !0, o = [], c, l) {
862
862
  text: ""
863
863
  };
864
864
  }
865
- if (I.status.state === "input-required" && I.status.message && s) {
865
+ if (w.status.state === "input-required" && w.status.message && s) {
866
866
  const P = B(
867
- I.status.message
867
+ w.status.message
868
868
  );
869
869
  if (P.length > 0) {
870
870
  const O = [];
@@ -881,7 +881,7 @@ async function* _e(e, s, t, a, n, r = !0, o = [], c, l) {
881
881
  s,
882
882
  R,
883
883
  k,
884
- (m = (w = I.status) == null ? void 0 : w.message) == null ? void 0 : m.messageId,
884
+ (m = (h = w.status) == null ? void 0 : h.message) == null ? void 0 : m.messageId,
885
885
  M
886
886
  ), { result: E, returnToAgent: U, agentMessage: D } = de(b);
887
887
  if (U && ($ = !0), D && p.push(
@@ -922,7 +922,7 @@ async function* _e(e, s, t, a, n, r = !0, o = [], c, l) {
922
922
  O.push(E), S.push(E);
923
923
  }
924
924
  }
925
- if (o.push(I.status.message), O.length > 0 && o.push({
925
+ if (o.push(w.status.message), O.length > 0 && o.push({
926
926
  role: "agent",
927
927
  kind: "message",
928
928
  parts: O,
@@ -934,7 +934,7 @@ async function* _e(e, s, t, a, n, r = !0, o = [], c, l) {
934
934
  C
935
935
  );
936
936
  yield {
937
- id: I.id,
937
+ id: w.id,
938
938
  status: {
939
939
  state: "working",
940
940
  message: M
@@ -943,7 +943,7 @@ async function* _e(e, s, t, a, n, r = !0, o = [], c, l) {
943
943
  text: ""
944
944
  };
945
945
  const R = await Ie(
946
- I.id,
946
+ w.id,
947
947
  M,
948
948
  a,
949
949
  s,
@@ -968,13 +968,13 @@ async function* _e(e, s, t, a, n, r = !0, o = [], c, l) {
968
968
  ...k,
969
969
  final: !1,
970
970
  text: F(
971
- ((h = k.status) == null ? void 0 : h.message) || {
971
+ ((y = k.status) == null ? void 0 : y.message) || {
972
972
  parts: [],
973
973
  messageId: _()
974
974
  }
975
975
  )
976
976
  }; b.length > 0; ) {
977
- (y = E.status) != null && y.message && o.push(
977
+ (I = E.status) != null && I.message && o.push(
978
978
  E.status.message
979
979
  );
980
980
  const {
@@ -1051,12 +1051,12 @@ async function* _e(e, s, t, a, n, r = !0, o = [], c, l) {
1051
1051
  };
1052
1052
  } else {
1053
1053
  const C = {
1054
- ...I.status.message,
1054
+ ...w.status.message,
1055
1055
  parts: S
1056
1056
  }, M = {
1057
- ...I,
1057
+ ...w,
1058
1058
  status: {
1059
- ...I.status,
1059
+ ...w.status,
1060
1060
  message: C
1061
1061
  },
1062
1062
  final: p.length === 0,
@@ -1099,9 +1099,9 @@ function rt(e) {
1099
1099
  return {
1100
1100
  async sendMessage(u) {
1101
1101
  var i, T;
1102
- const { abortSignal: w } = u, m = u.sessionId || n || void 0, g = [];
1102
+ const { abortSignal: h } = u, m = u.sessionId || n || void 0, g = [];
1103
1103
  g.push(u.message);
1104
- const h = await Y(
1104
+ const y = await Y(
1105
1105
  u,
1106
1106
  d,
1107
1107
  { isStreaming: !1 },
@@ -1109,20 +1109,20 @@ function rt(e) {
1109
1109
  c,
1110
1110
  m
1111
1111
  );
1112
- let y = await Ee(
1113
- h,
1112
+ let I = await Ee(
1113
+ y,
1114
1114
  d,
1115
- { abortSignal: w }
1115
+ { abortSignal: h }
1116
1116
  );
1117
1117
  const x = [], f = [];
1118
- for (; y.status.message && o; ) {
1118
+ for (; I.status.message && o; ) {
1119
1119
  const A = B(
1120
- y.status.message
1120
+ I.status.message
1121
1121
  );
1122
1122
  if (A.length === 0)
1123
1123
  break;
1124
1124
  x.push(...A);
1125
- const I = [];
1125
+ const w = [];
1126
1126
  let P = !1;
1127
1127
  for (const O of A) {
1128
1128
  const {
@@ -1144,7 +1144,7 @@ function rt(e) {
1144
1144
  S,
1145
1145
  M
1146
1146
  );
1147
- I.push(b), x.push(b);
1147
+ w.push(b), x.push(b);
1148
1148
  } catch (C) {
1149
1149
  const M = W(
1150
1150
  $,
@@ -1152,51 +1152,51 @@ function rt(e) {
1152
1152
  void 0,
1153
1153
  C instanceof Error ? C.message : String(C)
1154
1154
  );
1155
- I.push(M), x.push(M);
1155
+ w.push(M), x.push(M);
1156
1156
  }
1157
1157
  }
1158
- if (g.push(y.status.message), P) {
1159
- const O = X(I);
1160
- y = await ae(
1161
- y.id,
1158
+ if (g.push(I.status.message), P) {
1159
+ const O = X(w);
1160
+ I = await ae(
1161
+ I.id,
1162
1162
  O,
1163
1163
  d,
1164
1164
  o,
1165
1165
  c,
1166
1166
  m,
1167
- w
1167
+ h
1168
1168
  );
1169
1169
  } else
1170
1170
  break;
1171
1171
  }
1172
- if (x.length > 0 && (i = y.status) != null && i.message) {
1172
+ if (x.length > 0 && (i = I.status) != null && i.message) {
1173
1173
  const A = {
1174
- ...y.status.message,
1174
+ ...I.status.message,
1175
1175
  parts: x
1176
1176
  };
1177
- y = {
1178
- ...y,
1177
+ I = {
1178
+ ...I,
1179
1179
  status: {
1180
- ...y.status,
1180
+ ...I.status,
1181
1181
  message: A
1182
1182
  }
1183
1183
  };
1184
1184
  }
1185
1185
  if (f.length > 0) {
1186
- const A = f.map((P) => F(P)).join(" "), I = G(A);
1186
+ const A = f.map((P) => F(P)).join(" "), w = G(A);
1187
1187
  return {
1188
- ...y,
1188
+ ...I,
1189
1189
  // Keep the enhanced message with tool results
1190
1190
  // The agent message will be handled separately by the caller
1191
1191
  text: A,
1192
- agentMessage: I
1192
+ agentMessage: w
1193
1193
  // Add this for the caller to handle
1194
1194
  };
1195
1195
  }
1196
1196
  return {
1197
- ...y,
1197
+ ...I,
1198
1198
  text: F(
1199
- ((T = y.status) == null ? void 0 : T.message) || {
1199
+ ((T = I.status) == null ? void 0 : T.message) || {
1200
1200
  parts: [],
1201
1201
  messageId: _()
1202
1202
  }
@@ -1205,10 +1205,10 @@ function rt(e) {
1205
1205
  },
1206
1206
  async *sendMessageStream(u) {
1207
1207
  const {
1208
- withHistory: w = !0,
1208
+ withHistory: h = !0,
1209
1209
  abortSignal: m,
1210
1210
  enableStreaming: g
1211
- } = u, h = u.sessionId || n || void 0, y = g ?? l, x = [];
1211
+ } = u, y = u.sessionId || n || void 0, I = g ?? l, x = [];
1212
1212
  x.push(u.message);
1213
1213
  const f = await Y(
1214
1214
  u,
@@ -1216,16 +1216,16 @@ function rt(e) {
1216
1216
  {
1217
1217
  isStreaming: !0,
1218
1218
  // Always use message/stream endpoint for SSE
1219
- enableTokenStreaming: y
1219
+ enableTokenStreaming: I
1220
1220
  },
1221
1221
  o,
1222
1222
  c,
1223
- h
1223
+ y
1224
1224
  ), i = Pe(
1225
1225
  f,
1226
1226
  d,
1227
1227
  {
1228
- enableTokenStreaming: y,
1228
+ enableTokenStreaming: I,
1229
1229
  // Token streaming is optional
1230
1230
  streamingTimeout: r,
1231
1231
  abortSignal: m
@@ -1236,21 +1236,21 @@ function rt(e) {
1236
1236
  o,
1237
1237
  c,
1238
1238
  d,
1239
+ y,
1239
1240
  h,
1240
- w,
1241
1241
  x,
1242
1242
  m,
1243
1243
  {
1244
1244
  isStreaming: !0,
1245
- enableTokenStreaming: y,
1245
+ enableTokenStreaming: I,
1246
1246
  streamingTimeout: r
1247
1247
  }
1248
1248
  );
1249
1249
  },
1250
- async continueTask(u, w, m) {
1250
+ async continueTask(u, h, m) {
1251
1251
  var x;
1252
- const g = ie(w);
1253
- let y = await ae(
1252
+ const g = ie(h);
1253
+ let I = await ae(
1254
1254
  u,
1255
1255
  g,
1256
1256
  d,
@@ -1258,17 +1258,17 @@ function rt(e) {
1258
1258
  c,
1259
1259
  m
1260
1260
  );
1261
- for (; y.status.state === "input-required" && y.status.message && o; ) {
1261
+ for (; I.status.state === "input-required" && I.status.message && o; ) {
1262
1262
  const f = B(
1263
- y.status.message
1263
+ I.status.message
1264
1264
  );
1265
1265
  if (f.length === 0)
1266
1266
  break;
1267
1267
  const { results: i, shouldReturnToAgent: T } = await Oe(f, o);
1268
1268
  if (T) {
1269
1269
  const A = X(i);
1270
- y = await ae(
1271
- y.id,
1270
+ I = await ae(
1271
+ I.id,
1272
1272
  A,
1273
1273
  d,
1274
1274
  o,
@@ -1279,9 +1279,9 @@ function rt(e) {
1279
1279
  break;
1280
1280
  }
1281
1281
  return {
1282
- ...y,
1282
+ ...I,
1283
1283
  text: F(
1284
- ((x = y.status) == null ? void 0 : x.message) || {
1284
+ ((x = I.status) == null ? void 0 : x.message) || {
1285
1285
  parts: [],
1286
1286
  messageId: _()
1287
1287
  }
@@ -1381,29 +1381,29 @@ async function le(e, s, t = 1, a = 50) {
1381
1381
  "Content-Type": "application/json"
1382
1382
  };
1383
1383
  if (o) {
1384
- const h = await o();
1385
- Object.assign(u, h);
1384
+ const y = await o();
1385
+ Object.assign(u, y);
1386
1386
  }
1387
- const w = await fetch(d.toString(), {
1387
+ const h = await fetch(d.toString(), {
1388
1388
  method: "GET",
1389
1389
  headers: u
1390
1390
  });
1391
- if (!w.ok) {
1392
- const h = await w.text();
1393
- let y = `Failed to load conversation from server: ${w.status} ${w.statusText}`;
1391
+ if (!h.ok) {
1392
+ const y = await h.text();
1393
+ let I = `Failed to load conversation from server: ${h.status} ${h.statusText}`;
1394
1394
  try {
1395
- const f = JSON.parse(h);
1396
- f.message && (y = f.message);
1395
+ const f = JSON.parse(y);
1396
+ f.message && (I = f.message);
1397
1397
  } catch {
1398
1398
  }
1399
1399
  const x = new V(
1400
- y,
1401
- w.status,
1402
- h
1400
+ I,
1401
+ h.status,
1402
+ y
1403
1403
  );
1404
1404
  throw v("Failed to load conversation from server: %O", x), x;
1405
1405
  }
1406
- const m = await w.json(), g = lt(m);
1406
+ const m = await h.json(), g = lt(m);
1407
1407
  return v(
1408
1408
  "Loaded %d messages from server (page %d/%d)",
1409
1409
  g.messages.length,
@@ -1413,52 +1413,55 @@ async function le(e, s, t = 1, a = 50) {
1413
1413
  } catch (u) {
1414
1414
  if (u instanceof V)
1415
1415
  throw u;
1416
- const w = new V(
1416
+ const h = new V(
1417
1417
  `Network error loading conversation: ${u.message}`,
1418
1418
  void 0,
1419
1419
  u
1420
1420
  );
1421
- throw v("Network error loading conversation: %O", u), w;
1421
+ throw v("Network error loading conversation: %O", u), h;
1422
1422
  }
1423
1423
  }
1424
- async function Jt(e, s) {
1425
- const { apiBaseUrl: t = fe, authProvider: a } = s, n = new URL(
1426
- `${t}/wpcom/v2/odie/conversations/${encodeURIComponent(
1424
+ async function Jt(e, s, t = !1) {
1425
+ const { apiBaseUrl: a = fe, authProvider: n } = s, r = new URL(
1426
+ `${a}/wpcom/v2/odie/conversations/${encodeURIComponent(
1427
1427
  e
1428
1428
  )}`
1429
1429
  );
1430
- v("Listing conversations from server for bot: %s", e);
1430
+ r.searchParams.set(
1431
+ "truncation_method",
1432
+ t ? "first_message" : "last_message"
1433
+ ), v("Listing conversations from server for bot: %s", e);
1431
1434
  try {
1432
- const r = {
1435
+ const o = {
1433
1436
  "Content-Type": "application/json"
1434
1437
  };
1435
- if (a) {
1436
- const l = await a();
1437
- Object.assign(r, l);
1438
+ if (n) {
1439
+ const d = await n();
1440
+ Object.assign(o, d);
1438
1441
  }
1439
- const o = await fetch(n.toString(), {
1442
+ const c = await fetch(r.toString(), {
1440
1443
  method: "GET",
1441
- headers: r
1444
+ headers: o
1442
1445
  });
1443
- if (!o.ok) {
1444
- const l = await o.text(), d = `Failed to list conversations: ${o.status} ${o.statusText}`, u = new V(
1445
- d,
1446
- o.status,
1447
- l
1446
+ if (!c.ok) {
1447
+ const d = await c.text(), u = `Failed to list conversations: ${c.status} ${c.statusText}`, h = new V(
1448
+ u,
1449
+ c.status,
1450
+ d
1448
1451
  );
1449
- throw v("Failed to list conversations: %O", u), u;
1452
+ throw v("Failed to list conversations: %O", h), h;
1450
1453
  }
1451
- const c = await o.json();
1452
- return v("Loaded %d conversations from server", c.length), c;
1453
- } catch (r) {
1454
- if (r instanceof V)
1455
- throw r;
1456
- const o = new V(
1457
- `Network error listing conversations: ${r.message}`,
1454
+ const l = await c.json();
1455
+ return v("Loaded %d conversations from server", l.length), l;
1456
+ } catch (o) {
1457
+ if (o instanceof V)
1458
+ throw o;
1459
+ const c = new V(
1460
+ `Network error listing conversations: ${o.message}`,
1458
1461
  void 0,
1459
- r
1462
+ o
1460
1463
  );
1461
- throw v("Network error listing conversations: %O", r), o;
1464
+ throw v("Network error listing conversations: %O", o), c;
1462
1465
  }
1463
1466
  }
1464
1467
  async function Lt(e, s, t = 10) {
@@ -1494,14 +1497,14 @@ async function Lt(e, s, t = 10) {
1494
1497
  }
1495
1498
  const me = "a8c_agenttic_conversation_history";
1496
1499
  function ct(e) {
1497
- var w, m;
1500
+ var h, m;
1498
1501
  const s = e.parts.filter(
1499
1502
  (g) => g.type === "text"
1500
1503
  ), t = s.map((g) => g.text).join(`
1501
1504
  `), a = s.some(
1502
1505
  (g) => {
1503
- var h;
1504
- return ((h = g.metadata) == null ? void 0 : h.contentType) === "context";
1506
+ var y;
1507
+ return ((y = g.metadata) == null ? void 0 : y.contentType) === "context";
1505
1508
  }
1506
1509
  ) ? "context" : void 0, n = e.parts.filter(
1507
1510
  (g) => g.type === "data" && "toolCallId" in g.data && "arguments" in g.data
@@ -1519,7 +1522,7 @@ function ct(e) {
1519
1522
  name: g.file.name,
1520
1523
  mimeType: g.file.mimeType,
1521
1524
  uri: g.file.uri
1522
- })), l = n.length > 0 || r.length > 0 ? "agent" : e.role, d = ((w = e.metadata) == null ? void 0 : w.timestamp) ?? Date.now(), u = ((m = e.metadata) == null ? void 0 : m.archived) ?? void 0;
1525
+ })), l = n.length > 0 || r.length > 0 ? "agent" : e.role, d = ((h = e.metadata) == null ? void 0 : h.timestamp) ?? Date.now(), u = ((m = e.metadata) == null ? void 0 : m.archived) ?? void 0;
1523
1526
  return {
1524
1527
  role: l,
1525
1528
  content: t || "(No text content)",
@@ -1847,10 +1850,10 @@ function Tt() {
1847
1850
  o,
1848
1851
  l
1849
1852
  )).messages;
1850
- } catch (w) {
1853
+ } catch (h) {
1851
1854
  L(
1852
1855
  `Failed to load conversation history for agent ${t} with session ${r}:`,
1853
- w
1856
+ h
1854
1857
  );
1855
1858
  }
1856
1859
  const u = {
@@ -1879,12 +1882,12 @@ function Tt() {
1879
1882
  const r = e.get(t);
1880
1883
  if (!r)
1881
1884
  throw new Error(`Agent with key "${t}" not found`);
1882
- const { withHistory: o = !0, sessionId: c, ...l } = n, { client: d, conversationHistory: u } = r, w = n.message || we(
1885
+ const { withHistory: o = !0, sessionId: c, ...l } = n, { client: d, conversationHistory: u } = r, h = n.message || we(
1883
1886
  a,
1884
1887
  u,
1885
1888
  n.imageUrls
1886
1889
  ), m = await d.sendMessage({
1887
- message: w,
1890
+ message: h,
1888
1891
  withHistory: o,
1889
1892
  sessionId: c || r.sessionId || void 0,
1890
1893
  ...l
@@ -1917,30 +1920,30 @@ function Tt() {
1917
1920
  }
1918
1921
  };
1919
1922
  }
1920
- const h = [
1923
+ const y = [
1921
1924
  ...u,
1922
1925
  // Store only the new content from the user message (without history parts)
1923
1926
  ie(a),
1924
1927
  // Add complete agent response with tool calls/results if present
1925
1928
  ...g ? [z(g)] : []
1926
1929
  ];
1927
- let y = h;
1930
+ let I = y;
1928
1931
  if (m.agentMessage) {
1929
1932
  const f = z(
1930
1933
  m.agentMessage
1931
1934
  );
1932
- y = [
1933
- ...h,
1935
+ I = [
1936
+ ...y,
1934
1937
  f
1935
1938
  ];
1936
1939
  }
1937
- return r.conversationHistory = y, o && await s(
1940
+ return r.conversationHistory = I, o && await s(
1938
1941
  t,
1939
- y
1942
+ I
1940
1943
  ), m;
1941
1944
  },
1942
1945
  async *sendMessageStream(t, a, n = {}) {
1943
- var T, A, I, P, O, $;
1946
+ var T, A, w, P, O, $;
1944
1947
  const r = e.get(t);
1945
1948
  if (!r)
1946
1949
  throw new Error(`Agent with key "${t}" not found`);
@@ -1950,18 +1953,18 @@ function Tt() {
1950
1953
  metadata: l,
1951
1954
  sessionId: d,
1952
1955
  ...u
1953
- } = n, { client: w } = r, m = l ? (({ contentType: S, ...p }) => p)(l) : void 0, g = new AbortController();
1956
+ } = n, { client: h } = r, m = l ? (({ contentType: S, ...p }) => p)(l) : void 0, g = new AbortController();
1954
1957
  r.currentAbortController = g, c && c.addEventListener(
1955
1958
  "abort",
1956
1959
  () => g.abort()
1957
1960
  );
1958
- let h = [
1961
+ let y = [
1959
1962
  ...r.conversationHistory
1960
- ], y = [];
1963
+ ], I = [];
1961
1964
  const x = await wt(
1962
- h
1965
+ y
1963
1966
  );
1964
- r.conversationHistory = x, h = x, o && await s(
1967
+ r.conversationHistory = x, y = x, o && await s(
1965
1968
  t,
1966
1969
  x
1967
1970
  );
@@ -2002,14 +2005,14 @@ function Tt() {
2002
2005
  );
2003
2006
  i.parts.push(...S);
2004
2007
  }
2005
- h = [
2006
- ...h,
2008
+ y = [
2009
+ ...y,
2007
2010
  i
2008
- ], r.conversationHistory = h, o && await s(
2011
+ ], r.conversationHistory = y, o && await s(
2009
2012
  t,
2010
- h
2013
+ y
2011
2014
  );
2012
- for await (const S of w.sendMessageStream({
2015
+ for await (const S of h.sendMessageStream({
2013
2016
  message: f,
2014
2017
  withHistory: o,
2015
2018
  sessionId: d || r.sessionId || void 0,
@@ -2030,7 +2033,7 @@ function Tt() {
2030
2033
  ));
2031
2034
  }
2032
2035
  if (((T = S.status) == null ? void 0 : T.state) === "input-required" && ((A = S.status) != null && A.message)) {
2033
- y = B(
2036
+ I = B(
2034
2037
  S.status.message
2035
2038
  ).map(
2036
2039
  (M) => M.data.toolCallId
@@ -2038,19 +2041,19 @@ function Tt() {
2038
2041
  const C = z(
2039
2042
  S.status.message
2040
2043
  );
2041
- h = [
2042
- ...h,
2044
+ y = [
2045
+ ...y,
2043
2046
  C
2044
- ], r.conversationHistory = h, o && await s(
2047
+ ], r.conversationHistory = y, o && await s(
2045
2048
  t,
2046
- h
2049
+ y
2047
2050
  );
2048
2051
  }
2049
- if (((I = S.status) == null ? void 0 : I.state) === "working" && ((P = S.status) != null && P.message) && !S.final) {
2052
+ if (((w = S.status) == null ? void 0 : w.state) === "working" && ((P = S.status) != null && P.message) && !S.final) {
2050
2053
  const C = It(
2051
2054
  S.status.message
2052
2055
  ).filter(
2053
- (M) => y.includes(
2056
+ (M) => I.includes(
2054
2057
  M.data.toolCallId
2055
2058
  )
2056
2059
  );
@@ -2061,26 +2064,26 @@ function Tt() {
2061
2064
  parts: C,
2062
2065
  messageId: _()
2063
2066
  };
2064
- h = [
2065
- ...h,
2067
+ y = [
2068
+ ...y,
2066
2069
  z(M)
2067
- ], r.conversationHistory = h, o && await s(
2070
+ ], r.conversationHistory = y, o && await s(
2068
2071
  t,
2069
- h
2072
+ y
2070
2073
  );
2071
2074
  }
2072
2075
  }
2073
2076
  if (S.final && ((O = S.status) == null ? void 0 : O.state) !== "input-required") {
2074
- y = [];
2077
+ I = [];
2075
2078
  let p = null;
2076
2079
  ($ = S.status) != null && $.message && (p = z(
2077
2080
  S.status.message
2078
- ), h = [
2079
- ...h,
2081
+ ), y = [
2082
+ ...y,
2080
2083
  p
2081
- ], r.conversationHistory = h, o && await s(
2084
+ ], r.conversationHistory = y, o && await s(
2082
2085
  t,
2083
- h
2086
+ y
2084
2087
  ));
2085
2088
  }
2086
2089
  yield S;
@@ -2290,8 +2293,8 @@ function Bt(e) {
2290
2293
  ...P,
2291
2294
  clientMessages: [],
2292
2295
  uiMessages: []
2293
- }))) : (i.updateSessionId(T, ""), await i.replaceMessages(T, []), n((I) => ({
2294
- ...I,
2296
+ }))) : (i.updateSessionId(T, ""), await i.replaceMessages(T, []), n((w) => ({
2297
+ ...w,
2295
2298
  clientMessages: [],
2296
2299
  uiMessages: []
2297
2300
  })));
@@ -2307,18 +2310,18 @@ function Bt(e) {
2307
2310
  enableStreaming: e.enableStreaming,
2308
2311
  odieBotId: e.odieBotId
2309
2312
  }), s.sessionId) {
2310
- const I = i.getConversationHistory(T);
2313
+ const w = i.getConversationHistory(T);
2311
2314
  n((P) => {
2312
- const O = u(I);
2315
+ const O = u(w);
2313
2316
  return {
2314
2317
  ...P,
2315
- clientMessages: I,
2318
+ clientMessages: w,
2316
2319
  uiMessages: O
2317
2320
  };
2318
2321
  });
2319
2322
  } else
2320
- n((I) => ({
2321
- ...I,
2323
+ n((w) => ({
2324
+ ...w,
2322
2325
  clientMessages: [],
2323
2326
  uiMessages: []
2324
2327
  }));
@@ -2335,13 +2338,13 @@ function Bt(e) {
2335
2338
  e.odieBotId,
2336
2339
  t
2337
2340
  ]);
2338
- const w = q(
2341
+ const h = q(
2339
2342
  async (f, i) => {
2340
2343
  var $, S;
2341
2344
  if (!t)
2342
2345
  throw new Error("Invalid agent configuration");
2343
- const T = Q(), A = s.agentId, I = Date.now(), P = (i == null ? void 0 : i.type) || "text", O = {
2344
- id: `user-${I}`,
2346
+ const T = Q(), A = s.agentId, w = Date.now(), P = (i == null ? void 0 : i.type) || "text", O = {
2347
+ id: `user-${w}`,
2345
2348
  role: "user",
2346
2349
  content: [
2347
2350
  { type: P, text: f },
@@ -2351,7 +2354,7 @@ function Bt(e) {
2351
2354
  return Ne(C);
2352
2355
  })) ?? []
2353
2356
  ],
2354
- timestamp: I,
2357
+ timestamp: w,
2355
2358
  archived: (i == null ? void 0 : i.archived) ?? !1,
2356
2359
  showIcon: !1
2357
2360
  };
@@ -2500,7 +2503,7 @@ function Bt(e) {
2500
2503
  ...i,
2501
2504
  suggestions: f
2502
2505
  }));
2503
- }, []), h = q(() => {
2506
+ }, []), y = q(() => {
2504
2507
  n((f) => ({
2505
2508
  ...f,
2506
2509
  suggestions: []
@@ -2511,11 +2514,11 @@ function Bt(e) {
2511
2514
  if (f.clientMessages.length === 0)
2512
2515
  return f;
2513
2516
  const i = u(f.clientMessages), T = new Set(
2514
- f.clientMessages.map((I) => I.messageId)
2517
+ f.clientMessages.map((w) => w.messageId)
2515
2518
  ), A = f.uiMessages.filter(
2516
- (I) => {
2519
+ (w) => {
2517
2520
  var P;
2518
- return !T.has(I.id) && ((P = I.content[0]) == null ? void 0 : P.type) === "component";
2521
+ return !T.has(w.id) && ((P = w.content[0]) == null ? void 0 : P.type) === "component";
2519
2522
  }
2520
2523
  );
2521
2524
  return {
@@ -2527,7 +2530,7 @@ function Bt(e) {
2527
2530
  };
2528
2531
  });
2529
2532
  }, [l]);
2530
- const y = q(() => {
2533
+ const I = q(() => {
2531
2534
  if (!t)
2532
2535
  return;
2533
2536
  const f = Q(), i = s.agentId;
@@ -2539,8 +2542,8 @@ function Bt(e) {
2539
2542
  const i = Q(), T = s.agentId;
2540
2543
  await i.replaceMessages(T, f);
2541
2544
  const A = u(f);
2542
- n((I) => ({
2543
- ...I,
2545
+ n((w) => ({
2546
+ ...w,
2544
2547
  clientMessages: f,
2545
2548
  uiMessages: A
2546
2549
  }));
@@ -2552,12 +2555,12 @@ function Bt(e) {
2552
2555
  messages: a.uiMessages,
2553
2556
  isProcessing: a.isProcessing,
2554
2557
  error: a.error,
2555
- onSubmit: w,
2558
+ onSubmit: h,
2556
2559
  suggestions: a.suggestions,
2557
2560
  progressMessage: a.progressMessage,
2558
2561
  // UI management methods
2559
2562
  registerSuggestions: g,
2560
- clearSuggestions: h,
2563
+ clearSuggestions: y,
2561
2564
  // Message actions methods
2562
2565
  registerMessageActions: r,
2563
2566
  unregisterMessageActions: o,
@@ -2565,7 +2568,7 @@ function Bt(e) {
2565
2568
  // Tool integration
2566
2569
  addMessage: m,
2567
2570
  // Abort control
2568
- abortCurrentRequest: y,
2571
+ abortCurrentRequest: I,
2569
2572
  // Conversation loading
2570
2573
  loadMessages: x
2571
2574
  };
@@ -20,11 +20,12 @@ export declare function loadChatFromServer(chatId: string, config: OdieServiceCo
20
20
  /**
21
21
  * List available conversations from server
22
22
  * Useful for testing and debugging - lists recent conversations for a bot
23
- * @param botId - The bot ID to get conversations for
24
- * @param config - Service configuration (omit botId, will use parameter)
23
+ * @param botId - The bot ID to get conversations for
24
+ * @param config - Service configuration (omit botId, will use parameter)
25
+ * @param useFirstMessage - If `true`, show first message as preview; if `false`, show last message (default: `false`)
25
26
  * @return Array of conversation list items
26
27
  */
27
- export declare function listConversationsFromServer(botId: string, config: Omit<OdieServiceConfig, 'botId'>): Promise<ServerConversationListItem[]>;
28
+ export declare function listConversationsFromServer(botId: string, config: Omit<OdieServiceConfig, 'botId'>, useFirstMessage?: boolean): Promise<ServerConversationListItem[]>;
28
29
  /**
29
30
  * Load multiple pages of messages and combine them
30
31
  * Useful for loading entire conversation history
@@ -1 +1 @@
1
- {"version":3,"file":"odieService.d.ts","sourceRoot":"","sources":["../../src/react/odieService.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAEX,0BAA0B,EAC1B,gBAA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AW,GACvB,OAAO,CAAE,gBAAgB,CAAE,CAsG7B;AAED;;;;;;;GAOG;AACH,wBAAsB,2BAA2B,CAChD,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,IAAI,CAAE,iBAAiB,EAAE,OAAO,CAAE,EAC1C,eAAe,UAAQ,GACrB,OAAO,CAAE,0BAA0B,EAAE,CAAE,CAoEzC;AAED;;;;;;GAMG;AACH,wBAAsB,yBAAyB,CAC9C,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,iBAAiB,EACzB,QAAQ,GAAE,MAAW,GACnB,OAAO,CAAE,gBAAgB,CAAE,CA+C7B"}
@@ -72,8 +72,15 @@ export interface ServerLoadResult {
72
72
  sessionId?: string;
73
73
  }
74
74
  /**
75
- * Conversation list item from server
76
- * Represents a chat with metadata and latest message preview
75
+ * Message preview for conversation list items
76
+ */
77
+ export interface ServerConversationListItemMessage {
78
+ content: string;
79
+ role: 'user' | 'bot' | 'system';
80
+ created_at: string;
81
+ }
82
+ /**
83
+ * Conversation list item with metadata and message preview
77
84
  */
78
85
  export interface ServerConversationListItem {
79
86
  chat_id: number;
@@ -81,11 +88,8 @@ export interface ServerConversationListItem {
81
88
  wpcom_user_id?: number;
82
89
  session_id?: string;
83
90
  created_at: string;
84
- last_message?: {
85
- content: string;
86
- role: 'user' | 'bot' | 'system';
87
- created_at: string;
88
- };
91
+ last_message?: ServerConversationListItemMessage;
92
+ first_message?: ServerConversationListItemMessage;
89
93
  }
90
94
  /**
91
95
  * Transform server message to client Message format
@@ -1 +1 @@
1
- {"version":3,"file":"serverTypes.d.ts","sourceRoot":"","sources":["../../src/react/serverTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAY,OAAO,EAAkB,MAAM,uBAAuB,CAAC;AAG/E;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC9B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACZ;AAED;;GAEG;AACH,MA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AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,iCAAiC,CAAC;IACjD,aAAa,CAAC,EAAE,iCAAiC,CAAC;CAClD;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACrC,aAAa,EAAE,aAAa,GAC1B,OAAO,CA+DT;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACrC,UAAU,EAAE,UAAU,GACpB,gBAAgB,CAwBlB;AAED;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,KAAK;aAGhC,UAAU,CAAC,EAAE,MAAM;aACnB,OAAO,CAAC,EAAE,OAAO;gBAFjC,OAAO,EAAE,MAAM,EACC,UAAU,CAAC,EAAE,MAAM,YAAA,EACnB,OAAO,CAAC,EAAE,OAAO,YAAA;CAKlC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/agenttic-client",
3
- "version": "0.1.33",
3
+ "version": "0.1.35",
4
4
  "type": "module",
5
5
  "description": "A TypeScript client library for connection to the Automattic agent framework.",
6
6
  "main": "dist/index.js",