@useago/sdk 1.7.2 → 1.9.0

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 (46) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/README.md +43 -1
  3. package/dist/angular.cjs +1 -1
  4. package/dist/angular.d.cts +89 -5
  5. package/dist/angular.d.ts +89 -5
  6. package/dist/angular.js +11 -7
  7. package/dist/{createConversationSession-DP90nY71.js → createConversationSession-BaaXBQ5b.js} +3 -3
  8. package/dist/createConversationSession-CU0b-t1W.cjs +1 -0
  9. package/dist/{createFormCollector-BivHRIAe.js → createFormCollector-Cf7kGhCB.js} +1 -1
  10. package/dist/createFormCollector-DfN1xZBy.cjs +1 -0
  11. package/dist/{createMockClient-BDLW6tVc.js → createMockClient-5YF-ZbVu.js} +22 -21
  12. package/dist/createMockClient-BZbOe-23.cjs +1 -0
  13. package/dist/devtools.cjs +61 -12
  14. package/dist/devtools.d.cts +90 -5
  15. package/dist/devtools.d.ts +90 -5
  16. package/dist/devtools.js +225 -73
  17. package/dist/errors-BLfjXnLB.js +32 -0
  18. package/dist/errors-o1IB5fEu.cjs +1 -0
  19. package/dist/index.cjs +1 -1
  20. package/dist/index.d.cts +100 -3
  21. package/dist/index.d.ts +100 -3
  22. package/dist/index.js +77 -75
  23. package/dist/react.cjs +4 -4
  24. package/dist/react.d.cts +197 -3
  25. package/dist/react.d.ts +197 -3
  26. package/dist/react.js +1034 -752
  27. package/dist/testing.cjs +1 -1
  28. package/dist/testing.d.cts +80 -3
  29. package/dist/testing.d.ts +80 -3
  30. package/dist/testing.js +1 -1
  31. package/dist/{AgoClient-DTkBRGFE.js → types-CPga11Of.js} +489 -386
  32. package/dist/types-D3YQl1jx.cjs +9 -0
  33. package/dist/vue.cjs +1 -1
  34. package/dist/vue.d.cts +110 -3
  35. package/dist/vue.d.ts +110 -3
  36. package/dist/vue.js +202 -154
  37. package/dist/widget.cjs +4 -4
  38. package/dist/widget.d.cts +148 -3
  39. package/dist/widget.d.ts +148 -3
  40. package/dist/widget.js +871 -651
  41. package/llms-full.txt +139 -25
  42. package/package.json +1 -1
  43. package/dist/AgoClient-7yXQ6R3O.cjs +0 -9
  44. package/dist/createConversationSession-Bv6a15E0.cjs +0 -1
  45. package/dist/createFormCollector-CwfiYn0V.cjs +0 -1
  46. package/dist/createMockClient-BSNuN3ys.cjs +0 -1
package/dist/testing.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./createMockClient-BSNuN3ys.cjs");exports.createMockClient=e.createMockClient;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./createMockClient-BZbOe-23.cjs");exports.createMockClient=e.createMockClient;
@@ -273,9 +273,40 @@ declare class AgoClient {
273
273
  */
274
274
  submitFormCollector(name: string, values: Record<string, unknown>): Promise<unknown>;
275
275
  /**
276
- * Submit feedback for a message
276
+ * Report an answer: thumbs up/down, optionally with what went wrong.
277
+ *
278
+ * ```ts
279
+ * await client.submitFeedback(message.id, "negative", {
280
+ * reasons: ["inaccurate"],
281
+ * comment: "The price it quoted is from last year.",
282
+ * });
283
+ * ```
284
+ *
285
+ * A bare rating is a reaction (the thumbs counted in the dashboard). Adding a
286
+ * reason or a comment also files it in the feedback list, the analytics and
287
+ * the CSV export, so someone can act on it.
288
+ */
289
+ submitFeedback(messageId: string, rating: FeedbackRating, details?: FeedbackDetails): Promise<void>;
290
+ /**
291
+ * Report a whole conversation ("this chat is not working").
292
+ *
293
+ * ```ts
294
+ * await client.submitConversationFeedback(conversationId, "negative", {
295
+ * reasons: ["information_not_found"],
296
+ * comment: "It never answered my question.",
297
+ * });
298
+ * ```
299
+ *
300
+ * Feedback is stored per message, so this attaches the report to the last
301
+ * answer of the conversation, which is the one the user is reacting to.
302
+ * Returns the message id it landed on.
303
+ *
304
+ * Pass `lastMessageId` when you already have it (the widget does) to skip the
305
+ * lookup round-trip.
277
306
  */
278
- submitFeedback(messageId: string, rating: "positive" | "negative"): Promise<void>;
307
+ submitConversationFeedback(conversationId: string, rating: FeedbackRating, details?: FeedbackDetails & {
308
+ lastMessageId?: string;
309
+ }): Promise<string>;
279
310
  /**
280
311
  * Register a client-side function that AGO can call.
281
312
  * Accepts either a definition object or (name, handler, schema) args.
@@ -907,12 +938,27 @@ declare interface AgoStateControl<T = unknown> {
907
938
  enum?: (string | number)[];
908
939
  };
909
940
  };
941
+ /** String-only: `""` means "clear" instead of being dropped as filler. */
942
+ clearable?: boolean;
910
943
  /** Current value → pushed as dynamic context so the agent knows what to change. */
911
944
  get?: () => T;
912
945
  /** Apply the state change on the page. May be async. */
913
- set: (value: T) => void | Promise<void>;
946
+ set: (value: T) => void | AgoStateSetResult | Promise<void | AgoStateSetResult>;
914
947
  }
915
948
 
949
+ /**
950
+ * Tagged outcome a page setter may return to reject or mark unchanged.
951
+ *
952
+ * Returning nothing (void) means APPLY. Returning an unrecognized JS value
953
+ * (e.g. a string from an assignment expression) is also treated as APPLY.
954
+ */
955
+ declare type AgoStateSetResult = {
956
+ result: "rejected";
957
+ reason: string;
958
+ } | {
959
+ result: "unchanged";
960
+ };
961
+
916
962
  /**
917
963
  * Single-object function definition — combines name, schema, and handler.
918
964
  *
@@ -1066,6 +1112,37 @@ export declare function createMockClient(options?: MockAgoClientOptions): MockAg
1066
1112
  */
1067
1113
  declare type DynamicContextProvider = () => ContextEntry | null | undefined;
1068
1114
 
1115
+ /**
1116
+ * Why the user is reporting a message (see `AgoClient.submitFeedback`).
1117
+ *
1118
+ * A rating on its own is a reaction (the thumbs count). Add a reason or a
1119
+ * comment and the report also lands in the feedback dashboard, the analytics
1120
+ * and the CSV export, where someone can act on it.
1121
+ */
1122
+ declare interface FeedbackDetails {
1123
+ /** What went wrong. Several can apply at once. */
1124
+ reasons?: FeedbackReason[];
1125
+ /** The user's own words. Trimmed server-side; 5000 characters max. */
1126
+ comment?: string;
1127
+ }
1128
+
1129
+ /** Thumbs up / thumbs down on an answer. */
1130
+ declare type FeedbackRating = "positive" | "negative";
1131
+
1132
+ /**
1133
+ * What went wrong with an answer. These are the four buckets the AGO feedback
1134
+ * dashboard filters and charts on.
1135
+ */
1136
+ declare type FeedbackReason =
1137
+ /** The answer states something false. */
1138
+ "inaccurate"
1139
+ /** The answer is right but stops short. */
1140
+ | "incomplete"
1141
+ /** The agent could not find the information. */
1142
+ | "information_not_found"
1143
+ /** Something broke: the widget, a tool call, the stream. */
1144
+ | "technical_issue";
1145
+
1069
1146
  /**
1070
1147
  * The backend-stored shape returned by `GET /api/sdk/v1/forms/{name}` (see
1071
1148
  * {@link AgoClient.getFormCollector}). Mirrors the persistable subset of
package/dist/testing.d.ts CHANGED
@@ -273,9 +273,40 @@ declare class AgoClient {
273
273
  */
274
274
  submitFormCollector(name: string, values: Record<string, unknown>): Promise<unknown>;
275
275
  /**
276
- * Submit feedback for a message
276
+ * Report an answer: thumbs up/down, optionally with what went wrong.
277
+ *
278
+ * ```ts
279
+ * await client.submitFeedback(message.id, "negative", {
280
+ * reasons: ["inaccurate"],
281
+ * comment: "The price it quoted is from last year.",
282
+ * });
283
+ * ```
284
+ *
285
+ * A bare rating is a reaction (the thumbs counted in the dashboard). Adding a
286
+ * reason or a comment also files it in the feedback list, the analytics and
287
+ * the CSV export, so someone can act on it.
288
+ */
289
+ submitFeedback(messageId: string, rating: FeedbackRating, details?: FeedbackDetails): Promise<void>;
290
+ /**
291
+ * Report a whole conversation ("this chat is not working").
292
+ *
293
+ * ```ts
294
+ * await client.submitConversationFeedback(conversationId, "negative", {
295
+ * reasons: ["information_not_found"],
296
+ * comment: "It never answered my question.",
297
+ * });
298
+ * ```
299
+ *
300
+ * Feedback is stored per message, so this attaches the report to the last
301
+ * answer of the conversation, which is the one the user is reacting to.
302
+ * Returns the message id it landed on.
303
+ *
304
+ * Pass `lastMessageId` when you already have it (the widget does) to skip the
305
+ * lookup round-trip.
277
306
  */
278
- submitFeedback(messageId: string, rating: "positive" | "negative"): Promise<void>;
307
+ submitConversationFeedback(conversationId: string, rating: FeedbackRating, details?: FeedbackDetails & {
308
+ lastMessageId?: string;
309
+ }): Promise<string>;
279
310
  /**
280
311
  * Register a client-side function that AGO can call.
281
312
  * Accepts either a definition object or (name, handler, schema) args.
@@ -907,12 +938,27 @@ declare interface AgoStateControl<T = unknown> {
907
938
  enum?: (string | number)[];
908
939
  };
909
940
  };
941
+ /** String-only: `""` means "clear" instead of being dropped as filler. */
942
+ clearable?: boolean;
910
943
  /** Current value → pushed as dynamic context so the agent knows what to change. */
911
944
  get?: () => T;
912
945
  /** Apply the state change on the page. May be async. */
913
- set: (value: T) => void | Promise<void>;
946
+ set: (value: T) => void | AgoStateSetResult | Promise<void | AgoStateSetResult>;
914
947
  }
915
948
 
949
+ /**
950
+ * Tagged outcome a page setter may return to reject or mark unchanged.
951
+ *
952
+ * Returning nothing (void) means APPLY. Returning an unrecognized JS value
953
+ * (e.g. a string from an assignment expression) is also treated as APPLY.
954
+ */
955
+ declare type AgoStateSetResult = {
956
+ result: "rejected";
957
+ reason: string;
958
+ } | {
959
+ result: "unchanged";
960
+ };
961
+
916
962
  /**
917
963
  * Single-object function definition — combines name, schema, and handler.
918
964
  *
@@ -1066,6 +1112,37 @@ export declare function createMockClient(options?: MockAgoClientOptions): MockAg
1066
1112
  */
1067
1113
  declare type DynamicContextProvider = () => ContextEntry | null | undefined;
1068
1114
 
1115
+ /**
1116
+ * Why the user is reporting a message (see `AgoClient.submitFeedback`).
1117
+ *
1118
+ * A rating on its own is a reaction (the thumbs count). Add a reason or a
1119
+ * comment and the report also lands in the feedback dashboard, the analytics
1120
+ * and the CSV export, where someone can act on it.
1121
+ */
1122
+ declare interface FeedbackDetails {
1123
+ /** What went wrong. Several can apply at once. */
1124
+ reasons?: FeedbackReason[];
1125
+ /** The user's own words. Trimmed server-side; 5000 characters max. */
1126
+ comment?: string;
1127
+ }
1128
+
1129
+ /** Thumbs up / thumbs down on an answer. */
1130
+ declare type FeedbackRating = "positive" | "negative";
1131
+
1132
+ /**
1133
+ * What went wrong with an answer. These are the four buckets the AGO feedback
1134
+ * dashboard filters and charts on.
1135
+ */
1136
+ declare type FeedbackReason =
1137
+ /** The answer states something false. */
1138
+ "inaccurate"
1139
+ /** The answer is right but stops short. */
1140
+ | "incomplete"
1141
+ /** The agent could not find the information. */
1142
+ | "information_not_found"
1143
+ /** Something broke: the widget, a tool call, the stream. */
1144
+ | "technical_issue";
1145
+
1069
1146
  /**
1070
1147
  * The backend-stored shape returned by `GET /api/sdk/v1/forms/{name}` (see
1071
1148
  * {@link AgoClient.getFormCollector}). Mirrors the persistable subset of
package/dist/testing.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as e } from "./createMockClient-BDLW6tVc.js";
1
+ import { t as e } from "./createMockClient-5YF-ZbVu.js";
2
2
  export {
3
3
  e as createMockClient
4
4
  };