@nexface/chat 0.1.21-alpha.2 → 0.1.21-alpha.3

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 (2) hide show
  1. package/dist/client.js +10 -6
  2. package/package.json +3 -3
package/dist/client.js CHANGED
@@ -875,13 +875,15 @@ class ChatClientImplementation {
875
875
  }
876
876
  }
877
877
  catch (error) {
878
- const unknown = (inFlight && (!signal.aborted || !serverCannotWrite)) ||
878
+ const executionOutcomeUnknown = (inFlight && !serverCannotWrite) ||
879
879
  completedBrowserCall ||
880
880
  this.#executingBrowserCall !== undefined;
881
- if (this.#appendOnly ? unknown || this.#cancelled : unknown && !signal.aborted) {
881
+ const recoveryStateUnknown = executionOutcomeUnknown || (inFlight && !signal.aborted);
882
+ if ((this.#appendOnly && (recoveryStateUnknown || this.#cancelled)) ||
883
+ (error instanceof ClientError && error.code === "CHAT_RECOVERY_UNAVAILABLE")) {
882
884
  this.#recoveryUnavailable = true;
883
885
  }
884
- else if (unknown) {
886
+ else if (recoveryStateUnknown) {
885
887
  this.#cancelledInterrupt = undefined;
886
888
  }
887
889
  else if (interruptId) {
@@ -915,12 +917,14 @@ class ChatClientImplementation {
915
917
  });
916
918
  }
917
919
  }
918
- if (signal.aborted && unknown && !this.#appendOnly) {
920
+ if (executionOutcomeUnknown && !this.#recoveryUnavailable) {
919
921
  this.#messages.push({
920
922
  id: id(),
921
923
  role: "assistant",
922
- content: "The previous run was stopped and its execution outcome is unknown. Check the result before repeating any action.",
923
- metadata: { nexface: { state: "cancelled" } },
924
+ content: signal.aborted
925
+ ? "The previous run was stopped and its execution outcome is unknown. Check the result before repeating any action."
926
+ : "Check the previous action results before repeating any action.",
927
+ metadata: { nexface: { state: signal.aborted ? "cancelled" : "error" } },
924
928
  });
925
929
  }
926
930
  throw error;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexface/chat",
3
- "version": "0.1.21-alpha.2",
3
+ "version": "0.1.21-alpha.3",
4
4
  "type": "module",
5
5
  "types": "./dist/index.d.ts",
6
6
  "sideEffects": [
@@ -19,7 +19,7 @@
19
19
  },
20
20
  "dependencies": {
21
21
  "@ag-ui/core": "0.0.59",
22
- "@nexface/agent": "0.1.21-alpha.2",
22
+ "@nexface/agent": "0.1.21-alpha.3",
23
23
  "class-variance-authority": "0.7.1",
24
24
  "clsx": "2.1.1",
25
25
  "fast-json-patch": "3.1.1",
@@ -28,7 +28,7 @@
28
28
  "use-sync-external-store": "1.7.0"
29
29
  },
30
30
  "peerDependencies": {
31
- "@nexface/tools": "0.1.21-alpha.2",
31
+ "@nexface/tools": "0.1.21-alpha.3",
32
32
  "react": ">=17",
33
33
  "react-dom": ">=17"
34
34
  },