@rynx-ai/daemon 0.1.11-beta.51 → 0.1.11-beta.52
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.
|
@@ -12,7 +12,9 @@ export declare class SqliteSessionLogStore implements SessionLogStore {
|
|
|
12
12
|
append(sessionId: string, items: SessionItem[]): Promise<SessionItem[]>;
|
|
13
13
|
list(sessionId: string, opts?: {
|
|
14
14
|
afterId?: string;
|
|
15
|
+
beforeId?: string;
|
|
15
16
|
limit?: number;
|
|
17
|
+
order?: "asc" | "desc";
|
|
16
18
|
}): Promise<SessionItem[]>;
|
|
17
19
|
get(sessionId: string, itemId: string): Promise<SessionItem | undefined>;
|
|
18
20
|
snapshot(sessionId: string): Promise<SessionItem[]>;
|
|
@@ -93,23 +93,34 @@ export class SqliteSessionLogStore {
|
|
|
93
93
|
}
|
|
94
94
|
async list(sessionId, opts = {}) {
|
|
95
95
|
const conn = db();
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
const order = opts.order ?? "asc";
|
|
97
|
+
const cursorId = opts.afterId ?? opts.beforeId;
|
|
98
|
+
let cursorPosition;
|
|
99
|
+
if (cursorId) {
|
|
98
100
|
const cursor = conn
|
|
99
|
-
.prepare("SELECT position FROM session_items WHERE id = ?")
|
|
100
|
-
.get(
|
|
101
|
+
.prepare("SELECT position FROM session_items WHERE session_id = ? AND id = ?")
|
|
102
|
+
.get(sessionId, cursorId);
|
|
101
103
|
// Unknown cursor ⇒ empty page (rather than silently returning everything).
|
|
102
104
|
if (!cursor)
|
|
103
105
|
return [];
|
|
104
|
-
|
|
106
|
+
cursorPosition = cursor.position;
|
|
105
107
|
}
|
|
106
108
|
const limit = opts.limit ?? -1; // SQLite treats LIMIT -1 as "no limit"
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
109
|
+
const descending = order === "desc";
|
|
110
|
+
const before = opts.beforeId !== undefined;
|
|
111
|
+
const comparison = before
|
|
112
|
+
? (descending ? ">" : "<")
|
|
113
|
+
: (descending ? "<" : ">");
|
|
114
|
+
const positionBound = cursorPosition ?? (descending ? Number.MAX_SAFE_INTEGER : -1);
|
|
115
|
+
const sqlOrder = before
|
|
116
|
+
? (descending ? "ASC" : "DESC")
|
|
117
|
+
: (descending ? "DESC" : "ASC");
|
|
118
|
+
const rows = conn.prepare(`SELECT * FROM session_items
|
|
119
|
+
WHERE session_id = ? AND position ${cursorPosition === undefined ? (descending ? "<=" : ">=") : comparison} ?
|
|
120
|
+
ORDER BY position ${sqlOrder}
|
|
121
|
+
LIMIT ?`).all(sessionId, positionBound, limit);
|
|
122
|
+
if (before)
|
|
123
|
+
rows.reverse();
|
|
113
124
|
return rows.map(toItem);
|
|
114
125
|
}
|
|
115
126
|
async get(sessionId, itemId) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rynx-ai/daemon",
|
|
3
|
-
"version": "0.1.11-beta.
|
|
3
|
+
"version": "0.1.11-beta.52",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/rynx-ai/rynx.git",
|
|
@@ -52,18 +52,18 @@
|
|
|
52
52
|
"tar": "^7.5.19",
|
|
53
53
|
"undici": "^7.28.0",
|
|
54
54
|
"ws": "^8.21.0",
|
|
55
|
-
"@rynx-ai/
|
|
56
|
-
"@rynx-ai/
|
|
57
|
-
"@rynx-ai/plugin-runner": "0.1.11-beta.
|
|
58
|
-
"@rynx-ai/plugin-sdk": "0.1.11-beta.
|
|
59
|
-
"@rynx-ai/protocol": "0.1.11-beta.
|
|
60
|
-
"@rynx-ai/remote-runtime-client": "0.1.11-beta.
|
|
61
|
-
"@rynx-ai/server": "0.1.11-beta.
|
|
55
|
+
"@rynx-ai/emulator": "0.1.11-beta.52",
|
|
56
|
+
"@rynx-ai/core": "0.1.11-beta.52",
|
|
57
|
+
"@rynx-ai/plugin-runner": "0.1.11-beta.52",
|
|
58
|
+
"@rynx-ai/plugin-sdk": "0.1.11-beta.52",
|
|
59
|
+
"@rynx-ai/protocol": "0.1.11-beta.52",
|
|
60
|
+
"@rynx-ai/remote-runtime-client": "0.1.11-beta.52",
|
|
61
|
+
"@rynx-ai/server": "0.1.11-beta.52"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@types/ws": "^8.18.1",
|
|
65
|
-
"@rynx-ai/browser-cdp": "0.1.11-beta.
|
|
66
|
-
"@rynx-ai/plugin-channel-lark": "0.1.11-beta.
|
|
65
|
+
"@rynx-ai/browser-cdp": "0.1.11-beta.52",
|
|
66
|
+
"@rynx-ai/plugin-channel-lark": "0.1.11-beta.52"
|
|
67
67
|
},
|
|
68
68
|
"scripts": {
|
|
69
69
|
"build": "rm -rf dist bundled-plugins && tsc -p tsconfig.json && chmod +x dist/index-daemon.js && node scripts/prepare-agent-browser.mjs && node ../../scripts/stage-bundled-plugins.mjs",
|