@sjhmars/happy-bridge 0.2.2 → 0.2.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.
- package/lib/client.js +11 -11
- package/lib/index.js +18 -2
- package/lib/types/session-socket.d.ts +7 -0
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -17,21 +17,21 @@ window.__ModuleLoader__.load({
|
|
|
17
17
|
document.head.appendChild(tag);
|
|
18
18
|
}
|
|
19
19
|
var HappyBridgeCard_module_css_default = {
|
|
20
|
-
"
|
|
21
|
-
"
|
|
20
|
+
"chevron": "l9rBEq_chevron",
|
|
21
|
+
"header": "l9rBEq_header",
|
|
22
|
+
"select": "l9rBEq_select",
|
|
22
23
|
"headText": "l9rBEq_headText",
|
|
23
|
-
"
|
|
24
|
-
"description": "l9rBEq_description",
|
|
24
|
+
"body": "l9rBEq_body",
|
|
25
25
|
"name": "l9rBEq_name",
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"header": "l9rBEq_header",
|
|
26
|
+
"error": "l9rBEq_error",
|
|
27
|
+
"status": "l9rBEq_status",
|
|
29
28
|
"card": "l9rBEq_card",
|
|
29
|
+
"button": "l9rBEq_button",
|
|
30
|
+
"qr": "l9rBEq_qr",
|
|
31
|
+
"row": "l9rBEq_row",
|
|
32
|
+
"label": "l9rBEq_label",
|
|
30
33
|
"checkbox": "l9rBEq_checkbox",
|
|
31
|
-
"
|
|
32
|
-
"body": "l9rBEq_body",
|
|
33
|
-
"select": "l9rBEq_select",
|
|
34
|
-
"error": "l9rBEq_error"
|
|
34
|
+
"description": "l9rBEq_description"
|
|
35
35
|
};
|
|
36
36
|
//#endregion
|
|
37
37
|
//#region src/client/HappyBridgeCard.tsx
|
package/lib/index.js
CHANGED
|
@@ -2481,6 +2481,22 @@ var HappySessionSocket = class {
|
|
|
2481
2481
|
this.ensureAliveTimer();
|
|
2482
2482
|
}
|
|
2483
2483
|
/**
|
|
2484
|
+
* Assert the session state with a reliable (non-volatile) emit: state
|
|
2485
|
+
* transitions must not ride the droppable heartbeat path, or the App
|
|
2486
|
+
* flickers between online and thinking until the next 2s tick.
|
|
2487
|
+
* @param thinking - `true` while the Host turn is still executing.
|
|
2488
|
+
*/
|
|
2489
|
+
keepAliveNow(thinking) {
|
|
2490
|
+
this.thinking = thinking;
|
|
2491
|
+
this.socket?.emit("session-alive", {
|
|
2492
|
+
sid: this.happySessionId,
|
|
2493
|
+
time: Date.now(),
|
|
2494
|
+
thinking: this.thinking,
|
|
2495
|
+
mode: "remote"
|
|
2496
|
+
});
|
|
2497
|
+
this.ensureAliveTimer();
|
|
2498
|
+
}
|
|
2499
|
+
/**
|
|
2484
2500
|
* Restart session-alive if the timer was cleared. Happy lists the row as
|
|
2485
2501
|
* offline once heartbeats stop; opening the chat on the phone does not
|
|
2486
2502
|
* start them again.
|
|
@@ -3949,7 +3965,7 @@ var HappyBridge = class {
|
|
|
3949
3965
|
const id = req.callId;
|
|
3950
3966
|
const controller = new AbortController();
|
|
3951
3967
|
req.signal = req.signal === void 0 ? controller.signal : AbortSignal.any([req.signal, controller.signal]);
|
|
3952
|
-
this.
|
|
3968
|
+
this.pushRequests(link);
|
|
3953
3969
|
const phone = new Promise((resolve) => {
|
|
3954
3970
|
link.pendingHuman = {
|
|
3955
3971
|
kind: "approval",
|
|
@@ -3958,7 +3974,6 @@ var HappyBridge = class {
|
|
|
3958
3974
|
resolve
|
|
3959
3975
|
};
|
|
3960
3976
|
});
|
|
3961
|
-
this.pushRequests(link);
|
|
3962
3977
|
const web = next().then((outcome) => ({
|
|
3963
3978
|
src: "web",
|
|
3964
3979
|
outcome
|
|
@@ -3975,6 +3990,7 @@ var HappyBridge = class {
|
|
|
3975
3990
|
delete link.pendingHuman;
|
|
3976
3991
|
this.clearRequest(link, id, winner.outcome === "allowed-once" ? "approved" : "canceled");
|
|
3977
3992
|
}
|
|
3993
|
+
if (this.running) link.socket.keepAliveNow(true);
|
|
3978
3994
|
return winner.outcome;
|
|
3979
3995
|
}
|
|
3980
3996
|
onAsk(questions, original, request) {
|
|
@@ -116,6 +116,13 @@ export declare class HappySessionSocket {
|
|
|
116
116
|
* @param thinking - `agent/status === running`.
|
|
117
117
|
*/
|
|
118
118
|
keepAlive(thinking: boolean): void;
|
|
119
|
+
/**
|
|
120
|
+
* Assert the session state with a reliable (non-volatile) emit: state
|
|
121
|
+
* transitions must not ride the droppable heartbeat path, or the App
|
|
122
|
+
* flickers between online and thinking until the next 2s tick.
|
|
123
|
+
* @param thinking - `true` while the Host turn is still executing.
|
|
124
|
+
*/
|
|
125
|
+
keepAliveNow(thinking: boolean): void;
|
|
119
126
|
/**
|
|
120
127
|
* Restart session-alive if the timer was cleared. Happy lists the row as
|
|
121
128
|
* offline once heartbeats stop; opening the chat on the phone does not
|
package/package.json
CHANGED