@optima-chat/agentic-sdk 0.21.0 → 0.21.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.
|
@@ -18,6 +18,12 @@ export declare function useConnectionState(): {
|
|
|
18
18
|
* COO toggle ENTER/EXIT (#467/#1076): mode is baked at session creation, so
|
|
19
19
|
* switching it needs a fresh session. Await it to know the reconnect kicked
|
|
20
20
|
* off; the resulting `session_ready.mode` drives the shell via useSession().
|
|
21
|
+
*
|
|
22
|
+
* Reconciles the abandoned session's transient streaming state up front (clears
|
|
23
|
+
* `processingConversationIds` + resets the `isStreaming`/`isThinking` flags) — a
|
|
24
|
+
* forceNew deliberately drops the current session, so any turn still streaming on
|
|
25
|
+
* it can never emit `finish`, which would otherwise leave the composer stuck
|
|
26
|
+
* (#619). Does not touch `currentConversationId`.
|
|
21
27
|
*/
|
|
22
28
|
startNewSession: () => Promise<void>;
|
|
23
29
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-connection-state.d.ts","sourceRoot":"","sources":["../../src/hooks/use-connection-state.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9D,wBAAgB,kBAAkB,IAAI;IACpC,eAAe,EAAE,eAAe,CAAC;IACjC;;;;;;;OAOG;IACH,YAAY,EAAE,OAAO,CAAC;IACtB,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB
|
|
1
|
+
{"version":3,"file":"use-connection-state.d.ts","sourceRoot":"","sources":["../../src/hooks/use-connection-state.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9D,wBAAgB,kBAAkB,IAAI;IACpC,eAAe,EAAE,eAAe,CAAC;IACjC;;;;;;;OAOG;IACH,YAAY,EAAE,OAAO,CAAC;IACtB,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB;;;;;;;;;;;OAWG;IACH,eAAe,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACtC,CAqCA"}
|
|
@@ -13,7 +13,28 @@ export function useConnectionState() {
|
|
|
13
13
|
const reconnect = useCallback(() => {
|
|
14
14
|
void client.reconnect();
|
|
15
15
|
}, [client]);
|
|
16
|
-
const startNewSession = useCallback(() =>
|
|
16
|
+
const startNewSession = useCallback(async () => {
|
|
17
|
+
// A forceNew session deliberately abandons the current gateway session, so a
|
|
18
|
+
// turn that was mid-stream at switch time (e.g. the onboarding greeting when
|
|
19
|
+
// the user hits "Enter COO") will never emit `finish` — its socket is torn
|
|
20
|
+
// down by the reconnect below. Nothing else would then clear the streaming
|
|
21
|
+
// state: the abandoned conversation stays wedged in `processingConversationIds`
|
|
22
|
+
// and the global `isStreaming`/`isThinking` flags stay stuck true, locking the
|
|
23
|
+
// composer on "停止生成" (#619). Reconcile that abandoned state BEFORE
|
|
24
|
+
// reconnecting.
|
|
25
|
+
//
|
|
26
|
+
// We reset the transient streaming state only; `currentConversationId` is left
|
|
27
|
+
// untouched. It's a UI pointer to a still-restorable conversation, not
|
|
28
|
+
// abandoned-session state — nulling it here would fire on EXIT (COO→chat) too
|
|
29
|
+
// and drop the user's place. Route-level conversation reset is the caller's
|
|
30
|
+
// decision. Scoped to the forceNew path only: ordinary auto-reconnect must keep
|
|
31
|
+
// processing so restore can resume the live turn on the SAME session.
|
|
32
|
+
const s = store.getState();
|
|
33
|
+
s.clearProcessingConversations();
|
|
34
|
+
s.setStreaming(false);
|
|
35
|
+
s.setThinking(false);
|
|
36
|
+
await client.startNewSession();
|
|
37
|
+
}, [client, store]);
|
|
17
38
|
return { ...state, reconnect, startNewSession };
|
|
18
39
|
}
|
|
19
40
|
//# sourceMappingURL=use-connection-state.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-connection-state.js","sourceRoot":"","sources":["../../src/hooks/use-connection-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAG7D,MAAM,UAAU,kBAAkB;
|
|
1
|
+
{"version":3,"file":"use-connection-state.js","sourceRoot":"","sources":["../../src/hooks/use-connection-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAG7D,MAAM,UAAU,kBAAkB;IA4BhC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,cAAc,EAAE,CAAC;IAC3C,MAAM,KAAK,GAAG,QAAQ,CACpB,KAAK,EACL,UAAU,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACjB,eAAe,EAAE,CAAC,CAAC,eAAe;QAClC,YAAY,EAAE,CAAC,CAAC,YAAY;QAC5B,KAAK,EAAE,CAAC,CAAC,eAAe;QACxB,gBAAgB,EAAE,CAAC,CAAC,gBAAgB;KACrC,CAAC,CAAC,CACJ,CAAC;IACF,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE;QACjC,KAAK,MAAM,CAAC,SAAS,EAAE,CAAC;IAC1B,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IACb,MAAM,eAAe,GAAG,WAAW,CAAC,KAAK,IAAI,EAAE;QAC7C,6EAA6E;QAC7E,6EAA6E;QAC7E,2EAA2E;QAC3E,2EAA2E;QAC3E,gFAAgF;QAChF,+EAA+E;QAC/E,mEAAmE;QACnE,gBAAgB;QAChB,EAAE;QACF,+EAA+E;QAC/E,uEAAuE;QACvE,8EAA8E;QAC9E,4EAA4E;QAC5E,gFAAgF;QAChF,sEAAsE;QACtE,MAAM,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;QAC3B,CAAC,CAAC,4BAA4B,EAAE,CAAC;QACjC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QACrB,MAAM,MAAM,CAAC,eAAe,EAAE,CAAC;IACjC,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;IACpB,OAAO,EAAE,GAAG,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;AAClD,CAAC"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.21.
|
|
1
|
+
export declare const SDK_VERSION = "0.21.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
CHANGED