@evandu/super-pi 0.1.239 → 0.1.240
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/client/.super-pi-client-sources.json +7 -7
- package/dist/client/assets/{CodeMirrorEditor-CtzPSOsS.js → CodeMirrorEditor-CQea8mRO.js} +1 -1
- package/dist/client/assets/{GitDiffEditor-iNVZVVMb.js → GitDiffEditor-DZDcD4zI.js} +1 -1
- package/dist/client/assets/{index-DN0oBG6l.css → index-BGbZwftQ.css} +1 -1
- package/dist/client/assets/index-DxjIxdVK.js +340 -0
- package/dist/client/index.html +2 -2
- package/dist/server/application/run-service.d.ts +4 -49
- package/dist/server/application/run-service.js +48 -225
- package/dist/server/content-search.d.ts +13 -39
- package/dist/server/content-search.js +202 -219
- package/dist/server/http-server.js +56 -24
- package/dist/server/store.d.ts +4 -23
- package/dist/server/store.js +16 -27
- package/dist/shared/content-search.d.ts +22 -0
- package/dist/shared/content-search.js +1 -0
- package/package.json +1 -1
- package/dist/client/assets/index-C5kxyPTT.js +0 -340
package/dist/server/store.js
CHANGED
|
@@ -2054,6 +2054,11 @@ export class Store {
|
|
|
2054
2054
|
...(options?.delivery ? { delivery: options.delivery } : {}),
|
|
2055
2055
|
};
|
|
2056
2056
|
conversation.messages.push(message);
|
|
2057
|
+
if (options?.prioritizeWaiting && message.delivery === "waiting") {
|
|
2058
|
+
const waiting = this.waitingMessages(conversation);
|
|
2059
|
+
const lastSending = waiting.reduce((last, item, index) => item.delivery === "sending" ? index : last, -1);
|
|
2060
|
+
this.moveWaitingMessage(conversation, waiting, waiting.length - 1, lastSending + 1);
|
|
2061
|
+
}
|
|
2057
2062
|
conversation.updatedAt = message.createdAt;
|
|
2058
2063
|
await this.persist();
|
|
2059
2064
|
return structuredClone(message);
|
|
@@ -2815,6 +2820,13 @@ export class Store {
|
|
|
2815
2820
|
}
|
|
2816
2821
|
if (target === from)
|
|
2817
2822
|
return structuredClone(message);
|
|
2823
|
+
this.moveWaitingMessage(conversation, waiting, from, target);
|
|
2824
|
+
await this.persistMessages(conversation);
|
|
2825
|
+
return structuredClone(message);
|
|
2826
|
+
}
|
|
2827
|
+
moveWaitingMessage(conversation, waiting, from, target) {
|
|
2828
|
+
if (from === target)
|
|
2829
|
+
return;
|
|
2818
2830
|
// Permute THE WAITING SLOTS rather than splicing a message to an index. The waiting messages are
|
|
2819
2831
|
// usually a suffix of the array, but they are not guaranteed to be one - an assistant message sits
|
|
2820
2832
|
// between two of them once a steer has been delivered mid-turn - and an offset derived from "where in
|
|
@@ -2822,36 +2834,13 @@ export class Store {
|
|
|
2822
2834
|
// place is total: it cannot land a message outside the group, and it moves nothing that is not waiting.
|
|
2823
2835
|
const slots = waiting.map((item) => conversation.messages.indexOf(item));
|
|
2824
2836
|
const reordered = [...waiting];
|
|
2825
|
-
reordered.splice(from, 1);
|
|
2837
|
+
const [message] = reordered.splice(from, 1);
|
|
2826
2838
|
reordered.splice(target, 0, message);
|
|
2827
2839
|
slots.forEach((slot, order) => { conversation.messages[slot] = reordered[order]; });
|
|
2828
|
-
await this.persistMessages(conversation);
|
|
2829
|
-
return structuredClone(message);
|
|
2830
2840
|
}
|
|
2831
2841
|
/**
|
|
2832
|
-
*
|
|
2833
|
-
*
|
|
2834
|
-
* Oldest rather than matched on text, and that is forced on us by Pi rather than chosen: Pi identifies
|
|
2835
|
-
* its own queued entry by `indexOf` on the message text (`agent-session.ts:1123`), so two identical
|
|
2836
|
-
* steered messages are ONE entry to it and no host-side matching could do better. Position is sufficient
|
|
2837
|
-
* anyway because Pi's steering queue is FIFO and Super Pi only ever steers from the front of the waiting
|
|
2838
|
-
* group.
|
|
2839
|
-
*
|
|
2840
|
-
* ONE WRITE, because the reader must never see the intermediate: a message that has stopped waiting but
|
|
2841
|
-
* has no answer under it yet is the exact broken state this refactor exists to remove, and a browser
|
|
2842
|
-
* that broadcast between the two halves would put it right back on screen.
|
|
2843
|
-
*
|
|
2844
|
-
* WHAT IS DIFFERENT FROM BEFORE, and is the whole point: the message used to be DELETED here. It is now
|
|
2845
|
-
* merely unmarked, with an assistant message spliced in after it. It was on screen the whole time - it
|
|
2846
|
-
* was written into the transcript when the user pressed send, long before Pi ever saw it - and it stays
|
|
2847
|
-
* exactly where it was, now with the agent answering it. Deleting it is what made a steered reply appear
|
|
2848
|
-
* with no question above it.
|
|
2849
|
-
*
|
|
2850
|
-
* `messageId` says WHICH message Pi picked up, for the case where position cannot answer it. A message
|
|
2851
|
-
* handed to Pi's follow-up queue was never CLAIMED here - it is still `waiting`, because Super Pi keeps
|
|
2852
|
-
* it in its own list so the user can still withdraw it - and a conversation can hold a `waiting` message
|
|
2853
|
-
* and a `sending` one at the same time. The caller resolves the delivery by the text Pi announced,
|
|
2854
|
-
* which is the same text Pi itself matched on.
|
|
2842
|
+
* Open the reply to a Pi steer and clear its delivery state in one write.
|
|
2843
|
+
* The text match and the FIFO fallback both require a claimed `sending` row.
|
|
2855
2844
|
*/
|
|
2856
2845
|
async deliverWaitingMessage(conversationId, agentIdentity, messageId) {
|
|
2857
2846
|
const conversation = this.requireConversation(conversationId);
|
|
@@ -2865,7 +2854,7 @@ export class Store {
|
|
|
2865
2854
|
if (index < 0)
|
|
2866
2855
|
return undefined;
|
|
2867
2856
|
const user = conversation.messages[index];
|
|
2868
|
-
if (user.role !== "user" && user.role !== "tool")
|
|
2857
|
+
if ((user.role !== "user" && user.role !== "tool") || user.delivery !== "sending")
|
|
2869
2858
|
return undefined;
|
|
2870
2859
|
delete user.delivery;
|
|
2871
2860
|
const assistant = { id: id("message"), role: "assistant", content: "", createdAt: now(), ...(agentIdentity ? { agentIdentity: structuredClone(agentIdentity) } : {}) };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type ContentSearchHit = {
|
|
2
|
+
path: string;
|
|
3
|
+
name: string;
|
|
4
|
+
line: number;
|
|
5
|
+
column: number;
|
|
6
|
+
text: string;
|
|
7
|
+
};
|
|
8
|
+
export type ContentSearchSummary = {
|
|
9
|
+
complete: boolean;
|
|
10
|
+
truncated: boolean;
|
|
11
|
+
reasons: string[];
|
|
12
|
+
};
|
|
13
|
+
export type ContentSearchEvent = {
|
|
14
|
+
type: "matches";
|
|
15
|
+
hits: ContentSearchHit[];
|
|
16
|
+
} | {
|
|
17
|
+
type: "done";
|
|
18
|
+
summary: ContentSearchSummary;
|
|
19
|
+
} | {
|
|
20
|
+
type: "error";
|
|
21
|
+
error: string;
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|