@sjhmars/happy-bridge 0.2.2 → 0.2.4
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 +9 -9
- package/lib/index.js +18 -1
- 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
|
+
"error": "l9rBEq_error",
|
|
21
|
+
"chevron": "l9rBEq_chevron",
|
|
22
|
+
"button": "l9rBEq_button",
|
|
22
23
|
"headText": "l9rBEq_headText",
|
|
23
|
-
"status": "l9rBEq_status",
|
|
24
24
|
"description": "l9rBEq_description",
|
|
25
|
+
"body": "l9rBEq_body",
|
|
25
26
|
"name": "l9rBEq_name",
|
|
27
|
+
"card": "l9rBEq_card",
|
|
26
28
|
"label": "l9rBEq_label",
|
|
27
|
-
"button": "l9rBEq_button",
|
|
28
29
|
"header": "l9rBEq_header",
|
|
29
|
-
"card": "l9rBEq_card",
|
|
30
|
-
"checkbox": "l9rBEq_checkbox",
|
|
31
|
-
"chevron": "l9rBEq_chevron",
|
|
32
|
-
"body": "l9rBEq_body",
|
|
33
30
|
"select": "l9rBEq_select",
|
|
34
|
-
"
|
|
31
|
+
"checkbox": "l9rBEq_checkbox",
|
|
32
|
+
"qr": "l9rBEq_qr",
|
|
33
|
+
"status": "l9rBEq_status",
|
|
34
|
+
"row": "l9rBEq_row"
|
|
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.
|
|
@@ -3950,6 +3966,7 @@ var HappyBridge = class {
|
|
|
3950
3966
|
const controller = new AbortController();
|
|
3951
3967
|
req.signal = req.signal === void 0 ? controller.signal : AbortSignal.any([req.signal, controller.signal]);
|
|
3952
3968
|
this.startTool(link, id, req.toolName, req.reason === void 0 ? {} : { reason: req.reason });
|
|
3969
|
+
this.pushRequests(link);
|
|
3953
3970
|
const phone = new Promise((resolve) => {
|
|
3954
3971
|
link.pendingHuman = {
|
|
3955
3972
|
kind: "approval",
|
|
@@ -3958,7 +3975,6 @@ var HappyBridge = class {
|
|
|
3958
3975
|
resolve
|
|
3959
3976
|
};
|
|
3960
3977
|
});
|
|
3961
|
-
this.pushRequests(link);
|
|
3962
3978
|
const web = next().then((outcome) => ({
|
|
3963
3979
|
src: "web",
|
|
3964
3980
|
outcome
|
|
@@ -3975,6 +3991,7 @@ var HappyBridge = class {
|
|
|
3975
3991
|
delete link.pendingHuman;
|
|
3976
3992
|
this.clearRequest(link, id, winner.outcome === "allowed-once" ? "approved" : "canceled");
|
|
3977
3993
|
}
|
|
3994
|
+
if (this.running) link.socket.keepAliveNow(true);
|
|
3978
3995
|
return winner.outcome;
|
|
3979
3996
|
}
|
|
3980
3997
|
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