@pasko70/pibo 1.9.3 → 1.9.5
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/dist/apps/chat-ui/assets/{dist-BJBNSAIH.js → dist-9VBmpJr8.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-Cne74s6i.js → dist-BMCKifp3.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-CW6FHEaw.js → dist-C8DULORH.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-C3liNPZJ.js → dist-CsGU76rN.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-hWrpj7SE.js → dist-DabAeKNw.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-5WHjqNrY.js → dist-DoffBptN.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-jAuO8_bV.js → dist-PoWFH2Kk.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-f5KioIwL.js → dist-kjHfq8_4.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-CaNlj6v6.js → dist-lnQE_5IF.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-DvKZv20v.js → dist-ptO_u1F1.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-FYH7vzrh.js → dist-udBi7s0S.js} +1 -1
- package/dist/apps/chat-ui/assets/{index-Bf29pJph.js → index-C_TqW-Lr.js} +29 -29
- package/dist/apps/chat-ui/index.html +1 -1
- package/dist/core/session-router.js +24 -1
- package/dist/signals/projector.js +33 -1
- package/package.json +1 -1
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<link rel="manifest" href="/apps/chat/manifest.webmanifest" />
|
|
10
10
|
<link rel="apple-touch-icon" href="/apps/chat/assets/pwa-images/ios/180.png" />
|
|
11
11
|
<title>Pibo Web Chat</title>
|
|
12
|
-
<script type="module" crossorigin src="/apps/chat/assets/index-
|
|
12
|
+
<script type="module" crossorigin src="/apps/chat/assets/index-C_TqW-Lr.js"></script>
|
|
13
13
|
<link rel="modulepreload" crossorigin href="/apps/chat/assets/rolldown-runtime-S-ySWqyJ.js">
|
|
14
14
|
<link rel="modulepreload" crossorigin href="/apps/chat/assets/dist-SVPsM5Oi.js">
|
|
15
15
|
<link rel="stylesheet" crossorigin href="/apps/chat/assets/index-C0x9nEcf.css">
|
|
@@ -183,7 +183,30 @@ export class PiboSessionRouter {
|
|
|
183
183
|
async emit(event) {
|
|
184
184
|
if (this.closing)
|
|
185
185
|
throw new Error("Pibo session router is disposed.");
|
|
186
|
-
|
|
186
|
+
if (event.type === "message" && event.id) {
|
|
187
|
+
const stored = this.sessionStore.get(event.piboSessionId);
|
|
188
|
+
if (stored)
|
|
189
|
+
this.signalRegistry.project({ type: "session_created", session: stored });
|
|
190
|
+
this.signalRegistry.project({ type: "message_accepted", piboSessionId: event.piboSessionId, eventId: event.id, source: event.source });
|
|
191
|
+
}
|
|
192
|
+
let session;
|
|
193
|
+
try {
|
|
194
|
+
session = await this.getOrCreateSession(event.piboSessionId);
|
|
195
|
+
}
|
|
196
|
+
catch (error) {
|
|
197
|
+
if (event.type === "message" && event.id) {
|
|
198
|
+
this.signalRegistry.project({
|
|
199
|
+
type: "pibo_output",
|
|
200
|
+
event: {
|
|
201
|
+
type: "session_error",
|
|
202
|
+
piboSessionId: event.piboSessionId,
|
|
203
|
+
eventId: event.id,
|
|
204
|
+
error: error instanceof Error ? error.message : String(error),
|
|
205
|
+
},
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
throw error;
|
|
209
|
+
}
|
|
187
210
|
this.clearIdleSessionTimer(event.piboSessionId);
|
|
188
211
|
try {
|
|
189
212
|
if (event.type === "message") {
|
|
@@ -19,6 +19,7 @@ function runStatus(status) {
|
|
|
19
19
|
function settleActiveSessionNodes(piboSessionId, context, status, terminalSource) {
|
|
20
20
|
return context.getSessionNodes(piboSessionId)
|
|
21
21
|
.filter((node) => node.kind !== "session" && node.kind !== "yielded_run" && isActiveSignalStatus(node.status))
|
|
22
|
+
.filter((node) => terminalSource !== "processing_stopped" || node.kind !== "turn" || node.metadata?.accepted !== true)
|
|
22
23
|
.map((node) => ({
|
|
23
24
|
type: "patch_node",
|
|
24
25
|
nodeId: node.id,
|
|
@@ -27,7 +28,7 @@ function settleActiveSessionNodes(piboSessionId, context, status, terminalSource
|
|
|
27
28
|
}
|
|
28
29
|
export const sessionLifecycleSignalProducer = {
|
|
29
30
|
name: "session-lifecycle",
|
|
30
|
-
accepts: (input) => ["session_created", "session_disposed", "session_processing_changed", "queue_changed", "recovery", "session_interrupted", "signal_node_pruned"].includes(input.type),
|
|
31
|
+
accepts: (input) => ["session_created", "session_disposed", "session_processing_changed", "message_accepted", "queue_changed", "recovery", "session_interrupted", "signal_node_pruned"].includes(input.type),
|
|
31
32
|
project(input, context) {
|
|
32
33
|
const data = input;
|
|
33
34
|
if (data.type === "session_created") {
|
|
@@ -43,6 +44,37 @@ export const sessionLifecycleSignalProducer = {
|
|
|
43
44
|
metadata: { kind: session.kind, channel: session.channel, profile: session.profile },
|
|
44
45
|
}, context) }];
|
|
45
46
|
}
|
|
47
|
+
if (data.type === "message_accepted") {
|
|
48
|
+
const activeTurn = context.getSessionNodes(data.piboSessionId)
|
|
49
|
+
.find((candidate) => candidate.kind === "turn" && isActiveSignalStatus(candidate.status));
|
|
50
|
+
const mutations = [
|
|
51
|
+
{ type: "patch_node", nodeId: `session:${data.piboSessionId}`, patch: { status: "running" } },
|
|
52
|
+
{
|
|
53
|
+
type: "upsert_node",
|
|
54
|
+
node: node({
|
|
55
|
+
id: `message:${data.piboSessionId}:${data.eventId}`,
|
|
56
|
+
kind: "message",
|
|
57
|
+
status: "queued",
|
|
58
|
+
piboSessionId: data.piboSessionId,
|
|
59
|
+
metadata: { source: data.source },
|
|
60
|
+
}, context),
|
|
61
|
+
},
|
|
62
|
+
];
|
|
63
|
+
if (!activeTurn) {
|
|
64
|
+
mutations.push({
|
|
65
|
+
type: "upsert_node",
|
|
66
|
+
node: node({
|
|
67
|
+
id: `turn:${data.piboSessionId}:${data.eventId}`,
|
|
68
|
+
kind: "turn",
|
|
69
|
+
status: "starting",
|
|
70
|
+
piboSessionId: data.piboSessionId,
|
|
71
|
+
startedAt: context.now(),
|
|
72
|
+
metadata: { eventId: data.eventId, source: data.source, accepted: true },
|
|
73
|
+
}, context),
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
return mutations;
|
|
77
|
+
}
|
|
46
78
|
if (data.type === "session_disposed") {
|
|
47
79
|
return [
|
|
48
80
|
...settleActiveSessionNodes(data.piboSessionId, context, "cancelled", "session_disposed"),
|