@saadnvd1/agent-os 0.3.488 → 0.3.489
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/data/push/topics.test.ts +9 -0
- package/data/push/topics.ts +3 -14
- package/package.json +1 -1
package/data/push/topics.test.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { QueryClient } from "@tanstack/react-query";
|
|
|
2
2
|
import { describe, expect, it } from "vitest";
|
|
3
3
|
import { WATCHED_TABLES } from "@/lib/db/changes";
|
|
4
4
|
import { gitKeys } from "../git/keys";
|
|
5
|
+
import { taskKeys } from "../tasks/keys";
|
|
5
6
|
import { sessionKeys } from "../sessions/keys";
|
|
6
7
|
import { ALL_TOPICS, invalidateTopics, topicKeys } from "./topics";
|
|
7
8
|
|
|
@@ -16,6 +17,14 @@ describe("pushed topics", () => {
|
|
|
16
17
|
expect(topicKeys(topic), topic).not.toEqual([]);
|
|
17
18
|
});
|
|
18
19
|
|
|
20
|
+
it("a snapshot refetches the queue and every other watched table", () => {
|
|
21
|
+
for (const table of WATCHED_TABLES) expect(ALL_TOPICS).toContain(table);
|
|
22
|
+
const client = new QueryClient();
|
|
23
|
+
client.setQueryData(taskKeys.queue(), []);
|
|
24
|
+
invalidateTopics(client, ALL_TOPICS);
|
|
25
|
+
expect(client.getQueryState(taskKeys.queue())?.isInvalidated).toBe(true);
|
|
26
|
+
});
|
|
27
|
+
|
|
19
28
|
it("maps a git folder and a session's setup to their queries", () => {
|
|
20
29
|
expect(topicKeys("git:~/app")).toContainEqual(gitKeys.status("~/app"));
|
|
21
30
|
expect(topicKeys("git:~/app")).toContainEqual([
|
package/data/push/topics.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { QueryClient, QueryKey } from "@tanstack/react-query";
|
|
2
|
+
import { WATCHED_TABLES } from "@/lib/db/changes";
|
|
2
3
|
import { sessionKeys } from "../sessions/keys";
|
|
3
4
|
import { taskKeys } from "../tasks/keys";
|
|
4
5
|
import { projectKeys } from "../projects/keys";
|
|
@@ -88,19 +89,7 @@ export function invalidateTopics(
|
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
// Every pushed topic but git folders: after a gap the stream can't replay.
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
"projects",
|
|
94
|
-
"workspaces",
|
|
95
|
-
"hosts",
|
|
96
|
-
"discovered",
|
|
97
|
-
"stacks",
|
|
98
|
-
"bus_messages",
|
|
99
|
-
"schedules",
|
|
100
|
-
"orchestrator_asks",
|
|
101
|
-
"orchestrator_rules",
|
|
102
|
-
"away_periods",
|
|
103
|
-
"dev_servers",
|
|
104
|
-
];
|
|
92
|
+
// Every table the triggers watch is in it, so a new one can't be left out.
|
|
93
|
+
export const ALL_TOPICS = [...new Set([...WATCHED_TABLES, "discovered"])];
|
|
105
94
|
|
|
106
95
|
export { keysFor as topicKeys };
|