spiracha 1.2.0 → 1.3.0
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/AGENTS.md +49 -12
- package/README.md +117 -64
- package/apps/ui/AGENTS.md +16 -8
- package/apps/ui/README.md +28 -12
- package/apps/ui/dist/client/assets/{analytics-Cv0JMDN2.js → analytics-B_hYz65v.js} +1 -1
- package/apps/ui/dist/client/assets/antigravity-conversations._conversationId-qiyygB7e.js +1 -0
- package/apps/ui/dist/client/assets/antigravity-conversations._conversationId-z1SQC2Kg.js +1 -0
- package/apps/ui/dist/client/assets/antigravity-keychain-panel-dYuRWtCf.js +1 -0
- package/apps/ui/dist/client/assets/antigravity._workspaceKey-CliqUr7o.js +1 -0
- package/apps/ui/dist/client/assets/antigravity._workspaceKey-CnoBzyX6.js +1 -0
- package/apps/ui/dist/client/assets/antigravity.index-CakfZz_E.js +1 -0
- package/apps/ui/dist/client/assets/antigravity.index-DY7M1KhG.js +1 -0
- package/apps/ui/dist/client/assets/badge-aHE9ETVe.js +1 -0
- package/apps/ui/dist/client/assets/checkbox-DN3XnJaA.js +1 -0
- package/apps/ui/dist/client/assets/cursor-threads._composerId-BMQyx8qG.js +1 -0
- package/apps/ui/dist/client/assets/cursor-threads._composerId-BTlaA-tV.js +1 -0
- package/apps/ui/dist/client/assets/cursor._workspaceKey-CrgrfevV.js +1 -0
- package/apps/ui/dist/client/assets/cursor._workspaceKey-bYS2syGL.js +1 -0
- package/apps/ui/dist/client/assets/cursor.index-CTqZMPYU.js +1 -0
- package/apps/ui/dist/client/assets/cursor.index-Clsz4E_e.js +2 -0
- package/apps/ui/dist/client/assets/{data-table-Bgnh7phF.js → data-table-Cj-v-uyB.js} +2 -2
- package/apps/ui/dist/client/assets/delete-confirm-dialog-DTpzBiNK.js +11 -0
- package/apps/ui/dist/client/assets/dist-BNAn99Pu.js +1 -0
- package/apps/ui/dist/client/assets/download-P3Rp23Ad.js +1 -0
- package/apps/ui/dist/client/assets/dropdown-menu-3qB5j9nt.js +1 -0
- package/apps/ui/dist/client/assets/es2015-Dwm_turD.js +41 -0
- package/apps/ui/dist/client/assets/export-dialog-CazdrASq.js +1 -0
- package/apps/ui/dist/client/assets/formatters-BdnWuM1z.js +1 -0
- package/apps/ui/dist/client/assets/index-BVFnfS78.js +22 -0
- package/apps/ui/dist/client/assets/json-panel-DLkS30sQ.js +1 -0
- package/apps/ui/dist/client/assets/metadata-section-jnIkB7dB.js +1 -0
- package/apps/ui/dist/client/assets/{metric-card-BJX5rkHK.js → metric-card-CBZuWLzQ.js} +1 -1
- package/apps/ui/dist/client/assets/page-header-CnD21cPn.js +1 -0
- package/apps/ui/dist/client/assets/projects._project-BLszwvYL.js +1 -0
- package/apps/ui/dist/client/assets/projects._project-DvLxYbvk.js +1 -0
- package/apps/ui/dist/client/assets/projects.index-COn8woBR.js +1 -0
- package/apps/ui/dist/client/assets/projects.index-DYs98skV.js +3 -0
- package/apps/ui/dist/client/assets/refresh-ccw-BDrYXjtD.js +1 -0
- package/apps/ui/dist/client/assets/reload-error-panel-DLAg0AW2.js +1 -0
- package/apps/ui/dist/client/assets/routes-BtF5-coe.js +1 -0
- package/apps/ui/dist/client/assets/scroll-text-CqaFm9by.js +1 -0
- package/apps/ui/dist/client/assets/select-DbnpwqL6.js +1 -0
- package/apps/ui/dist/client/assets/settings-CGX3VleN.js +1 -0
- package/apps/ui/dist/client/assets/styles-Ch0r3kMZ.css +1 -0
- package/apps/ui/dist/client/assets/text-document-panel-DPleOmmq.js +1 -0
- package/apps/ui/dist/client/assets/text-filter-7M6wRo-t.js +2 -0
- package/apps/ui/dist/client/assets/threads._threadId-D5w76IB-.js +7 -0
- package/apps/ui/dist/client/assets/{threads._threadId-CUiCZSwo.js → threads._threadId-Dx85sI9P.js} +1 -1
- package/apps/ui/dist/client/assets/useMutation-MZ3Hr9h9.js +1 -0
- package/apps/ui/dist/client/assets/useQuery-Cb4V0AT0.js +1 -0
- package/apps/ui/dist/client/icon.svg +28 -0
- package/apps/ui/dist/client/manifest.json +6 -16
- package/apps/ui/dist/server/assets/_tanstack-start-manifest_v-CBbkUXw6.js +227 -0
- package/apps/ui/dist/server/assets/{analytics-2QpLKjlG.js → analytics-CBNOYZwJ.js} +2 -2
- package/apps/ui/dist/server/assets/antigravity-conversation-state-HgzS302O.js +16 -0
- package/apps/ui/dist/server/assets/antigravity-conversations._conversationId-B9Rm4EXh.js +212 -0
- package/apps/ui/dist/server/assets/antigravity-conversations._conversationId-BIdYNy68.js +20 -0
- package/apps/ui/dist/server/assets/antigravity-conversations._conversationId-D426O-64.js +11 -0
- package/apps/ui/dist/server/assets/antigravity-db-D9gW1D8G.js +576 -0
- package/apps/ui/dist/server/assets/antigravity-keychain-DOiuHDwK.js +126 -0
- package/apps/ui/dist/server/assets/antigravity-keychain-panel-DcLyBBwd.js +55 -0
- package/apps/ui/dist/server/assets/antigravity-queries-CgQhlQ7J.js +37 -0
- package/apps/ui/dist/server/assets/antigravity-server-DFUx4Khk.js +114 -0
- package/apps/ui/dist/server/assets/antigravity._workspaceKey-3m_MzNFA.js +11 -0
- package/apps/ui/dist/server/assets/antigravity._workspaceKey-D42ixtzp.js +210 -0
- package/apps/ui/dist/server/assets/antigravity._workspaceKey-DnSlSC-C.js +28 -0
- package/apps/ui/dist/server/assets/antigravity.index-DZVT-cac.js +104 -0
- package/apps/ui/dist/server/assets/antigravity.index-DudTB3Tq.js +11 -0
- package/apps/ui/dist/server/assets/badge-EvdhKK_Z.js +26 -0
- package/apps/ui/dist/server/assets/{codex-queries-BH4Cb0v3.js → codex-queries-eOJGfHQj.js} +4 -16
- package/apps/ui/dist/server/assets/{codex-server-DqzruLmg.js → codex-server-nrETIF--.js} +149 -140
- package/apps/ui/dist/server/assets/createServerRpc-BtXIw2iP.js +12 -0
- package/apps/ui/dist/server/assets/createSsrRpc-COf5Zuye.js +16 -0
- package/apps/ui/dist/server/assets/cursor-db-B7agkAvM.js +643 -0
- package/apps/ui/dist/server/assets/cursor-exporter-types-CI3goo-c.js +34 -0
- package/apps/ui/dist/server/assets/cursor-queries-BMhuJeUO.js +65 -0
- package/apps/ui/dist/server/assets/cursor-recovery-9bJLs7vG.js +361 -0
- package/apps/ui/dist/server/assets/cursor-server-BgylIFgn.js +184 -0
- package/apps/ui/dist/server/assets/cursor-threads._composerId-BB0Y_Mao.js +11 -0
- package/apps/ui/dist/server/assets/cursor-threads._composerId-BsxFKzoJ.js +218 -0
- package/apps/ui/dist/server/assets/cursor-threads._composerId-DXffY_CK.js +18 -0
- package/apps/ui/dist/server/assets/cursor-transcript-2iL3KFSK.js +125 -0
- package/apps/ui/dist/server/assets/cursor._workspaceKey-BP2J1x_x.js +28 -0
- package/apps/ui/dist/server/assets/cursor._workspaceKey-BQd0e-Pd.js +399 -0
- package/apps/ui/dist/server/assets/cursor._workspaceKey-nmg3YIOQ.js +11 -0
- package/apps/ui/dist/server/assets/cursor.index-CQVxtCm8.js +189 -0
- package/apps/ui/dist/server/assets/cursor.index-CcsX7DG0.js +11 -0
- package/apps/ui/dist/server/assets/{delete-confirm-dialog-CWqcTXTF.js → delete-confirm-dialog-PCD7S0_M.js} +5 -4
- package/apps/ui/dist/server/assets/download-DMmiy1xf.js +92 -0
- package/apps/ui/dist/server/assets/{input-B4tEzctc.js → dropdown-menu-Dy_9t6TN.js} +1 -11
- package/apps/ui/dist/server/assets/{download-Drctxary.js → export-dialog-DaPlOGFT.js} +1 -92
- package/apps/ui/dist/server/assets/json-panel-RYsxWFae.js +16 -0
- package/apps/ui/dist/server/assets/{loading-panel-DbLdvjtR.js → loading-panel-BGFnWseS.js} +1 -1
- package/apps/ui/dist/server/assets/metadata-section-D6Lbc7D6.js +54 -0
- package/apps/ui/dist/server/assets/page-header-VNSaM3xd.js +29 -0
- package/apps/ui/dist/server/assets/projects._project-Bshqk7JA.js +12 -0
- package/apps/ui/dist/server/assets/{projects._project-gT01HBqH.js → projects._project-DUN3iWfg.js} +4 -4
- package/apps/ui/dist/server/assets/{projects._project-DreIU5b0.js → projects._project-Dim9Y0kD.js} +54 -26
- package/apps/ui/dist/server/assets/projects.index-BLXOx5eL.js +12 -0
- package/apps/ui/dist/server/assets/{projects.index-BYmgSGAj.js → projects.index-DjSQK5dm.js} +23 -27
- package/apps/ui/dist/server/assets/{projects.index-CaplpeMy.js → reload-error-panel-BJMxY3U1.js} +5 -6
- package/apps/ui/dist/server/assets/{router-Qj5Kn7bl.js → router-DrDgc-LD.js} +131 -44
- package/apps/ui/dist/server/assets/{routes-_LbCIjtJ.js → routes-B-GlEe2C.js} +54 -39
- package/apps/ui/dist/server/assets/{routes-BtcXuK0x.js → routes-CNHAUMwo.js} +2 -2
- package/apps/ui/dist/server/assets/{settings-MvWDgc1u.js → settings-OayxIYQQ.js} +1 -1
- package/apps/ui/dist/server/assets/shared-CPRNYIql.js +134 -0
- package/apps/ui/dist/server/assets/text-document-panel-D8JbQWAn.js +23 -0
- package/apps/ui/dist/server/assets/text-filter-CGKxMCKt.js +36 -0
- package/apps/ui/dist/server/assets/{threads._threadId-DcbAJkwf.js → threads._threadId-CJzm4KrZ.js} +3 -3
- package/apps/ui/dist/server/assets/{threads._threadId-D5m6ypGw.js → threads._threadId-DODTYddm.js} +69 -76
- package/apps/ui/dist/server/server.js +77 -13
- package/package.json +19 -9
- package/src/export-cursor.ts +244 -0
- package/src/lib/antigravity-db.ts +936 -0
- package/src/lib/antigravity-exporter-types.ts +70 -0
- package/src/lib/antigravity-keychain.ts +203 -0
- package/src/lib/codex-browser-db.ts +7 -1
- package/src/lib/codex-browser-types.ts +22 -1
- package/src/lib/codex-thread-recovery.ts +202 -0
- package/src/lib/cursor-db.ts +1096 -0
- package/src/lib/cursor-exporter-types.ts +190 -0
- package/src/lib/cursor-exporter.ts +266 -0
- package/src/lib/cursor-recovery.ts +543 -0
- package/src/lib/cursor-transcript.ts +183 -0
- package/src/spiracha.ts +16 -3
- package/src/ui-cli.ts +2 -2
- package/apps/ui/dist/client/assets/checkbox-DjHij7DJ.js +0 -1
- package/apps/ui/dist/client/assets/delete-confirm-dialog-CIZy_LXD.js +0 -11
- package/apps/ui/dist/client/assets/download-DQtfva4z.js +0 -1
- package/apps/ui/dist/client/assets/es2015-DsDKdYCE.js +0 -41
- package/apps/ui/dist/client/assets/formatters-CWFrMKSn.js +0 -1
- package/apps/ui/dist/client/assets/index-C_-e0lDI.js +0 -22
- package/apps/ui/dist/client/assets/input-BbgApiqZ.js +0 -1
- package/apps/ui/dist/client/assets/page-header-ODLuGLAB.js +0 -1
- package/apps/ui/dist/client/assets/projects._project-C2Pys_bB.js +0 -1
- package/apps/ui/dist/client/assets/projects._project-CHvAKvlu.js +0 -1
- package/apps/ui/dist/client/assets/projects.index-BmwtS1x-.js +0 -1
- package/apps/ui/dist/client/assets/projects.index-CuLw73mt.js +0 -1
- package/apps/ui/dist/client/assets/routes-CfnaTOlj.js +0 -1
- package/apps/ui/dist/client/assets/select-B1kH_5lx.js +0 -1
- package/apps/ui/dist/client/assets/settings-mYTB3sso.js +0 -1
- package/apps/ui/dist/client/assets/styles-CMrP9Jb4.css +0 -1
- package/apps/ui/dist/client/assets/threads._threadId-C_47okme.js +0 -7
- package/apps/ui/dist/client/favicon.ico +0 -0
- package/apps/ui/dist/client/logo192.png +0 -0
- package/apps/ui/dist/client/logo512.png +0 -0
- package/apps/ui/dist/server/assets/_tanstack-start-manifest_v-kj_QB_26.js +0 -99
- package/apps/ui/dist/server/assets/page-header-CxdZM86z.js +0 -25
- package/apps/ui/dist/server/assets/projects._project-CLSohrBp.js +0 -26
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { t as createServerFn } from "../server.js";
|
|
2
|
+
import { t as isRetryableSqliteError } from "./sqlite-error-LZDrnxdd.js";
|
|
3
|
+
import { t as createSsrRpc } from "./createSsrRpc-COf5Zuye.js";
|
|
4
|
+
import { queryOptions } from "@tanstack/react-query";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
//#region src/lib/cursor-server.ts
|
|
7
|
+
var workspaceSchema = z.object({ workspaceKey: z.string().min(1) });
|
|
8
|
+
var threadSchema = z.object({ composerId: z.string().min(1) });
|
|
9
|
+
var recoverSchema = z.object({
|
|
10
|
+
apply: z.boolean().default(false),
|
|
11
|
+
workspaceKey: z.string().min(1)
|
|
12
|
+
});
|
|
13
|
+
var exportSchema = z.object({
|
|
14
|
+
composerId: z.string().min(1),
|
|
15
|
+
includeCommentary: z.boolean().default(true),
|
|
16
|
+
includeMetadata: z.boolean().default(true),
|
|
17
|
+
includeTools: z.boolean().default(true),
|
|
18
|
+
outputFormat: z.enum(["md", "txt"]).default("md")
|
|
19
|
+
});
|
|
20
|
+
var exportThreadsSchema = z.object({
|
|
21
|
+
composerIds: z.array(z.string().min(1)).min(1),
|
|
22
|
+
includeCommentary: z.boolean().default(true),
|
|
23
|
+
includeMetadata: z.boolean().default(true),
|
|
24
|
+
includeTools: z.boolean().default(true),
|
|
25
|
+
outputFormat: z.enum(["md", "txt"]).default("md")
|
|
26
|
+
});
|
|
27
|
+
var deleteThreadsSchema = z.object({ composerIds: z.array(z.string().min(1)).min(1) });
|
|
28
|
+
var listCursorWorkspacesFn = createServerFn({ method: "GET" }).handler(createSsrRpc("8fcf452a4587a4d4dc0c2f6439255e98123f23d863ca0e861403ae2a687272f2"));
|
|
29
|
+
var listCursorThreadsFn = createServerFn({ method: "GET" }).inputValidator(workspaceSchema).handler(createSsrRpc("23fb197bac88fb9e4950ef7608cd311d67c0867e424136c8373071dc54746806"));
|
|
30
|
+
var getCursorThreadDetailFn = createServerFn({ method: "GET" }).inputValidator(threadSchema).handler(createSsrRpc("6e893e740c05aad65a8eb32901b4c39277ebf718f0ba14b04d8df989bed2f32b"));
|
|
31
|
+
var exportCursorThreadFn = createServerFn({ method: "POST" }).inputValidator(exportSchema).handler(createSsrRpc("03050b86e5481024283bee890347a9da7b2493493044dcde6df989b3334d6b73"));
|
|
32
|
+
var exportCursorThreadsFn = createServerFn({ method: "POST" }).inputValidator(exportThreadsSchema).handler(createSsrRpc("e9609d5ab12ea0bc4dbd3289fad95417dd01a0a719c8ee588c0b8c8a9dc80c99"));
|
|
33
|
+
var recoverCursorWorkspaceFn = createServerFn({ method: "POST" }).inputValidator(recoverSchema).handler(createSsrRpc("a9bd5d510f2d1173d2ef610dda4d59a795af17e7c2a4affaba7e1f99822b2c40"));
|
|
34
|
+
var deleteCursorThreadsFn = createServerFn({ method: "POST" }).inputValidator(deleteThreadsSchema).handler(createSsrRpc("17afb84da4a3d5022132756ead0adaf0323660f50fc58d7f14830b01fdd59a13"));
|
|
35
|
+
var deleteCursorWorkspaceFn = createServerFn({ method: "POST" }).inputValidator(workspaceSchema).handler(createSsrRpc("fc72eb7835fc18130f6d7c20e15e560320521cd01c93e08667b340bfe6b90930"));
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region src/lib/cursor-queries.ts
|
|
38
|
+
var retrySqliteQuery = (failureCount, error) => {
|
|
39
|
+
return failureCount < 3 && isRetryableSqliteError(error);
|
|
40
|
+
};
|
|
41
|
+
var retryDelay = (attemptIndex) => {
|
|
42
|
+
return [150, 400][attemptIndex] ?? 800;
|
|
43
|
+
};
|
|
44
|
+
var cursorWorkspacesQueryOptions = () => queryOptions({
|
|
45
|
+
queryFn: () => listCursorWorkspacesFn(),
|
|
46
|
+
queryKey: ["cursor-workspaces"],
|
|
47
|
+
retry: retrySqliteQuery,
|
|
48
|
+
retryDelay
|
|
49
|
+
});
|
|
50
|
+
var cursorThreadsQueryOptions = (workspaceKey) => queryOptions({
|
|
51
|
+
enabled: workspaceKey !== null,
|
|
52
|
+
queryFn: () => listCursorThreadsFn({ data: { workspaceKey: workspaceKey ?? "" } }),
|
|
53
|
+
queryKey: ["cursor-threads", workspaceKey ?? "none"],
|
|
54
|
+
retry: retrySqliteQuery,
|
|
55
|
+
retryDelay
|
|
56
|
+
});
|
|
57
|
+
var cursorThreadDetailQueryOptions = (composerId) => queryOptions({
|
|
58
|
+
enabled: composerId !== null,
|
|
59
|
+
queryFn: () => getCursorThreadDetailFn({ data: { composerId: composerId ?? "" } }),
|
|
60
|
+
queryKey: ["cursor-thread", composerId ?? "none"],
|
|
61
|
+
retry: retrySqliteQuery,
|
|
62
|
+
retryDelay
|
|
63
|
+
});
|
|
64
|
+
//#endregion
|
|
65
|
+
export { deleteCursorWorkspaceFn as a, recoverCursorWorkspaceFn as c, deleteCursorThreadsFn as i, cursorThreadsQueryOptions as n, exportCursorThreadFn as o, cursorWorkspacesQueryOptions as r, exportCursorThreadsFn as s, cursorThreadDetailQueryOptions as t };
|
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
import { COMPOSER_DATA_KEY, COMPOSER_HEADERS_KEY, getCursorGlobalDbPath, resolveCursorUserDir } from "./cursor-exporter-types-CI3goo-c.js";
|
|
2
|
+
import { findCursorTranscriptDirs, invalidateCursorDiscoveryCache, listCursorWorkspaceGroups, loadGlobalComposerHeaders, openCursorReadonlyDb } from "./cursor-db-B7agkAvM.js";
|
|
3
|
+
import { Database } from "bun:sqlite";
|
|
4
|
+
import { rm } from "node:fs/promises";
|
|
5
|
+
//#region ../../src/lib/cursor-recovery.ts
|
|
6
|
+
var isCursorRunning = async () => {
|
|
7
|
+
return await Bun.spawn([
|
|
8
|
+
"pgrep",
|
|
9
|
+
"-x",
|
|
10
|
+
"Cursor"
|
|
11
|
+
], {
|
|
12
|
+
stderr: "ignore",
|
|
13
|
+
stdout: "ignore"
|
|
14
|
+
}).exited === 0;
|
|
15
|
+
};
|
|
16
|
+
var backupStamp = () => (/* @__PURE__ */ new Date()).toISOString().replace(/[-:]/gu, "").replace(/\..+/u, "").replace("T", "-");
|
|
17
|
+
var backupComposerHeaders = async (globalDbPath) => {
|
|
18
|
+
const db = openCursorReadonlyDb(globalDbPath);
|
|
19
|
+
let headers;
|
|
20
|
+
try {
|
|
21
|
+
headers = readJsonItem(db, "composer.composerHeaders") ?? { allComposers: [] };
|
|
22
|
+
} finally {
|
|
23
|
+
db.close();
|
|
24
|
+
}
|
|
25
|
+
const backupPath = `${globalDbPath}.composerHeaders.${backupStamp()}.json`;
|
|
26
|
+
await Bun.write(backupPath, JSON.stringify(headers));
|
|
27
|
+
return backupPath;
|
|
28
|
+
};
|
|
29
|
+
var backupPrunedThreads = async (globalDbPath, composerIds) => {
|
|
30
|
+
const db = openCursorReadonlyDb(globalDbPath);
|
|
31
|
+
try {
|
|
32
|
+
const dump = composerIds.map((composerId) => ({
|
|
33
|
+
bubbles: db.query("SELECT key, value FROM cursorDiskKV WHERE key LIKE ?").all(`bubbleId:${composerId}:%`),
|
|
34
|
+
composerData: readJsonItemFromKv(db, `composerData:${composerId}`),
|
|
35
|
+
composerId
|
|
36
|
+
}));
|
|
37
|
+
const backupPath = `${globalDbPath}.prunedThreads.${backupStamp()}.json`;
|
|
38
|
+
await Bun.write(backupPath, JSON.stringify(dump));
|
|
39
|
+
return backupPath;
|
|
40
|
+
} finally {
|
|
41
|
+
db.close();
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
var readJsonItemFromKv = (db, key) => {
|
|
45
|
+
const row = db.query("SELECT value FROM cursorDiskKV WHERE key = ?").get(key);
|
|
46
|
+
if (!row?.value) return null;
|
|
47
|
+
try {
|
|
48
|
+
return JSON.parse(row.value);
|
|
49
|
+
} catch {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
var readJsonItem = (db, key) => {
|
|
54
|
+
const row = db.query("SELECT value FROM ItemTable WHERE key = ?").get(key);
|
|
55
|
+
if (!row?.value) return null;
|
|
56
|
+
try {
|
|
57
|
+
return JSON.parse(row.value);
|
|
58
|
+
} catch {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
var writeJsonItem = (db, key, value) => {
|
|
63
|
+
db.run(`INSERT INTO ItemTable (key, value) VALUES (?, ?)
|
|
64
|
+
ON CONFLICT(key) DO UPDATE SET value = excluded.value`, [key, JSON.stringify(value)]);
|
|
65
|
+
};
|
|
66
|
+
var scoreComposer = (entry) => Number(Boolean(entry.name)) + Number(entry.lastUpdatedAt ?? 0) + Number(entry.totalLinesAdded ?? 0);
|
|
67
|
+
var mergeComposerEntries = (entries) => {
|
|
68
|
+
const byId = /* @__PURE__ */ new Map();
|
|
69
|
+
for (const entry of entries) {
|
|
70
|
+
const id = entry.composerId;
|
|
71
|
+
if (!id) continue;
|
|
72
|
+
const current = byId.get(id);
|
|
73
|
+
if (!current || scoreComposer(entry) >= scoreComposer(current)) byId.set(id, entry);
|
|
74
|
+
}
|
|
75
|
+
return [...byId.values()].sort((a, b) => Number(b.lastUpdatedAt ?? b.createdAt ?? 0) - Number(a.lastUpdatedAt ?? a.createdAt ?? 0));
|
|
76
|
+
};
|
|
77
|
+
var buildWorkspaceIdentifier = (bucket) => {
|
|
78
|
+
if (bucket.kind === "folder" && bucket.folders[0]) {
|
|
79
|
+
const folder = bucket.folders[0];
|
|
80
|
+
return {
|
|
81
|
+
id: bucket.bucketId,
|
|
82
|
+
uri: {
|
|
83
|
+
$mid: 1,
|
|
84
|
+
external: `file://${folder}`,
|
|
85
|
+
fsPath: folder,
|
|
86
|
+
path: folder,
|
|
87
|
+
scheme: "file"
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
return { id: bucket.bucketId };
|
|
92
|
+
};
|
|
93
|
+
var composersForBucket = (bucket, headers) => {
|
|
94
|
+
let fromBucket = [];
|
|
95
|
+
try {
|
|
96
|
+
const db = openCursorReadonlyDb(bucket.dbPath);
|
|
97
|
+
try {
|
|
98
|
+
fromBucket = readJsonItem(db, "composer.composerData")?.allComposers ?? [];
|
|
99
|
+
} finally {
|
|
100
|
+
db.close();
|
|
101
|
+
}
|
|
102
|
+
} catch {
|
|
103
|
+
fromBucket = [];
|
|
104
|
+
}
|
|
105
|
+
const linked = headers.filter((header) => header.workspaceIdentifier?.id === bucket.bucketId);
|
|
106
|
+
return mergeComposerEntries([...fromBucket, ...linked]);
|
|
107
|
+
};
|
|
108
|
+
var chooseTargetBucket = (group) => {
|
|
109
|
+
const [target, ...sources] = [...group.buckets].sort((a, b) => b.mtimeMs - a.mtimeMs || b.dbSizeBytes - a.dbSizeBytes);
|
|
110
|
+
return {
|
|
111
|
+
sources,
|
|
112
|
+
target
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
var relinkHeaders = (db, composers, sourceBucketIds, target) => {
|
|
116
|
+
const headers = (readJsonItem(db, "composer.composerHeaders") ?? { allComposers: [] }).allComposers ?? [];
|
|
117
|
+
const byId = new Map(headers.filter((header) => header.composerId).map((header) => [header.composerId, header]));
|
|
118
|
+
const workspaceIdentifier = buildWorkspaceIdentifier(target);
|
|
119
|
+
let relinked = 0;
|
|
120
|
+
let added = 0;
|
|
121
|
+
for (const composer of composers) {
|
|
122
|
+
const id = composer.composerId;
|
|
123
|
+
if (!id) continue;
|
|
124
|
+
const existing = byId.get(id);
|
|
125
|
+
if (existing) {
|
|
126
|
+
const currentId = existing.workspaceIdentifier?.id;
|
|
127
|
+
if (currentId !== target.bucketId && (currentId === void 0 || sourceBucketIds.has(currentId))) {
|
|
128
|
+
existing.workspaceIdentifier = workspaceIdentifier;
|
|
129
|
+
relinked += 1;
|
|
130
|
+
}
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
headers.push({
|
|
134
|
+
...composer,
|
|
135
|
+
type: composer.type ?? "head",
|
|
136
|
+
workspaceIdentifier
|
|
137
|
+
});
|
|
138
|
+
byId.set(id, headers[headers.length - 1]);
|
|
139
|
+
added += 1;
|
|
140
|
+
}
|
|
141
|
+
if (relinked > 0 || added > 0) {
|
|
142
|
+
headers.sort((a, b) => Number(b.lastUpdatedAt ?? b.createdAt ?? 0) - Number(a.lastUpdatedAt ?? a.createdAt ?? 0));
|
|
143
|
+
writeJsonItem(db, COMPOSER_HEADERS_KEY, { allComposers: headers });
|
|
144
|
+
}
|
|
145
|
+
return {
|
|
146
|
+
added,
|
|
147
|
+
relinked
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
var countBubbles = (db, composerId) => {
|
|
151
|
+
return db.query("SELECT COUNT(*) AS count FROM cursorDiskKV WHERE key LIKE ?").get(`bubbleId:${composerId}:%`).count;
|
|
152
|
+
};
|
|
153
|
+
var recoverCursorWorkspaceGroup = async (group, apply, userDir = resolveCursorUserDir()) => {
|
|
154
|
+
if (group.buckets.length === 0) throw new Error(`"${group.label}" has no on-disk Cursor storage bucket to recover into. Its threads can still be exported or deleted.`);
|
|
155
|
+
const globalDbPath = getCursorGlobalDbPath(userDir);
|
|
156
|
+
const headers = loadGlobalComposerHeaders(globalDbPath);
|
|
157
|
+
const { target, sources } = chooseTargetBucket(group);
|
|
158
|
+
const sourceBucketIds = new Set(sources.map((bucket) => bucket.bucketId));
|
|
159
|
+
const merged = mergeComposerEntries([...composersForBucket(target, headers), ...sources.flatMap((bucket) => composersForBucket(bucket, headers))]);
|
|
160
|
+
if (!apply) return buildRecoverResult(group, target, merged, globalDbPath, 0, merged.length);
|
|
161
|
+
const currentBucketData = readTargetBucketComposerData(target);
|
|
162
|
+
await backupComposerHeaders(globalDbPath);
|
|
163
|
+
await backupTargetBucketComposerData(target, currentBucketData);
|
|
164
|
+
const db = new Database(globalDbPath);
|
|
165
|
+
let committed = false;
|
|
166
|
+
let relinked = 0;
|
|
167
|
+
let added = 0;
|
|
168
|
+
try {
|
|
169
|
+
db.exec("BEGIN IMMEDIATE");
|
|
170
|
+
writeTargetBucketComposerData(target, buildTargetBucketComposerData(currentBucketData.data, merged));
|
|
171
|
+
({relinked, added} = relinkHeaders(db, merged, sourceBucketIds, target));
|
|
172
|
+
db.exec("COMMIT");
|
|
173
|
+
committed = true;
|
|
174
|
+
} catch (error) {
|
|
175
|
+
if (!committed) {
|
|
176
|
+
try {
|
|
177
|
+
db.exec("ROLLBACK");
|
|
178
|
+
} catch {}
|
|
179
|
+
try {
|
|
180
|
+
writeTargetBucketComposerData(target, currentBucketData);
|
|
181
|
+
} catch {}
|
|
182
|
+
}
|
|
183
|
+
throw error;
|
|
184
|
+
} finally {
|
|
185
|
+
db.close();
|
|
186
|
+
invalidateCursorDiscoveryCache();
|
|
187
|
+
}
|
|
188
|
+
return buildRecoverResult(group, target, merged, globalDbPath, relinked, added);
|
|
189
|
+
};
|
|
190
|
+
var readTargetBucketComposerData = (target) => {
|
|
191
|
+
const db = openCursorReadonlyDb(target.dbPath);
|
|
192
|
+
try {
|
|
193
|
+
const data = readJsonItem(db, COMPOSER_DATA_KEY);
|
|
194
|
+
return {
|
|
195
|
+
data: data ?? {},
|
|
196
|
+
exists: data !== null
|
|
197
|
+
};
|
|
198
|
+
} finally {
|
|
199
|
+
db.close();
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
var backupTargetBucketComposerData = async (target, snapshot) => {
|
|
203
|
+
const backupPath = `${target.dbPath}.composerData.${backupStamp()}.json`;
|
|
204
|
+
await Bun.write(backupPath, JSON.stringify(snapshot));
|
|
205
|
+
return backupPath;
|
|
206
|
+
};
|
|
207
|
+
var buildTargetBucketComposerData = (existing, merged) => {
|
|
208
|
+
const selectedIds = merged.map((entry) => entry.composerId).filter((value) => Boolean(value));
|
|
209
|
+
return {
|
|
210
|
+
...existing,
|
|
211
|
+
allComposers: merged,
|
|
212
|
+
hasMigratedComposerData: true,
|
|
213
|
+
hasMigratedMultipleComposers: true,
|
|
214
|
+
lastFocusedComposerIds: selectedIds.slice(0, 1),
|
|
215
|
+
selectedComposerIds: selectedIds.slice(0, 5)
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
var writeTargetBucketComposerData = (target, snapshot) => {
|
|
219
|
+
const db = new Database(target.dbPath);
|
|
220
|
+
try {
|
|
221
|
+
if ("exists" in snapshot && !snapshot.exists) {
|
|
222
|
+
db.run("DELETE FROM ItemTable WHERE key = ?", [COMPOSER_DATA_KEY]);
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
writeJsonItem(db, COMPOSER_DATA_KEY, "exists" in snapshot ? snapshot.data : snapshot);
|
|
226
|
+
} finally {
|
|
227
|
+
db.close();
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
var buildRecoverResult = (group, target, merged, globalDbPath, relinked, added) => {
|
|
231
|
+
const db = openCursorReadonlyDb(globalDbPath);
|
|
232
|
+
try {
|
|
233
|
+
return {
|
|
234
|
+
activeBucketId: target.bucketId,
|
|
235
|
+
addedHeaderCount: added,
|
|
236
|
+
mergedThreadCount: merged.length,
|
|
237
|
+
relinkedHeaderCount: relinked,
|
|
238
|
+
threads: merged.filter((entry) => entry.composerId).map((entry) => ({
|
|
239
|
+
bubbleCount: countBubbles(db, entry.composerId),
|
|
240
|
+
composerId: entry.composerId,
|
|
241
|
+
name: typeof entry.name === "string" && entry.name ? entry.name : "(untitled)"
|
|
242
|
+
})),
|
|
243
|
+
workspaceKey: group.key
|
|
244
|
+
};
|
|
245
|
+
} finally {
|
|
246
|
+
db.close();
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
var removeThreadFromBucket = (db, composerIds) => {
|
|
250
|
+
const data = readJsonItem(db, COMPOSER_DATA_KEY);
|
|
251
|
+
if (!data?.allComposers?.length) return false;
|
|
252
|
+
const before = data.allComposers.length;
|
|
253
|
+
data.allComposers = data.allComposers.filter((entry) => !composerIds.has(entry.composerId ?? ""));
|
|
254
|
+
if (data.allComposers.length === before) return false;
|
|
255
|
+
data.selectedComposerIds = (data.selectedComposerIds ?? []).filter((id) => !composerIds.has(id));
|
|
256
|
+
data.lastFocusedComposerIds = (data.lastFocusedComposerIds ?? []).filter((id) => !composerIds.has(id));
|
|
257
|
+
writeJsonItem(db, COMPOSER_DATA_KEY, data);
|
|
258
|
+
return true;
|
|
259
|
+
};
|
|
260
|
+
var pruneGlobalThread = (db, composerId) => {
|
|
261
|
+
const bubbleResult = db.run("DELETE FROM cursorDiskKV WHERE key LIKE ?", [`bubbleId:${composerId}:%`]);
|
|
262
|
+
const headResult = db.run("DELETE FROM cursorDiskKV WHERE key = ?", [`composerData:${composerId}`]);
|
|
263
|
+
return {
|
|
264
|
+
bubbles: bubbleResult.changes ?? 0,
|
|
265
|
+
composerData: headResult.changes ?? 0
|
|
266
|
+
};
|
|
267
|
+
};
|
|
268
|
+
var removeThreadHeaders = (db, composerIds) => {
|
|
269
|
+
const data = readJsonItem(db, COMPOSER_HEADERS_KEY);
|
|
270
|
+
if (!data?.allComposers?.length) return 0;
|
|
271
|
+
const before = data.allComposers.length;
|
|
272
|
+
data.allComposers = data.allComposers.filter((entry) => !composerIds.has(entry.composerId ?? ""));
|
|
273
|
+
const removed = before - data.allComposers.length;
|
|
274
|
+
if (removed > 0) writeJsonItem(db, COMPOSER_HEADERS_KEY, data);
|
|
275
|
+
return removed;
|
|
276
|
+
};
|
|
277
|
+
var pruneCursorThreads = async (threads, apply, userDir = resolveCursorUserDir()) => {
|
|
278
|
+
const composerIds = new Set(threads.map((thread) => thread.composerId));
|
|
279
|
+
const globalDbPath = getCursorGlobalDbPath(userDir);
|
|
280
|
+
const result = {
|
|
281
|
+
bubblesDeleted: 0,
|
|
282
|
+
composerDataDeleted: 0,
|
|
283
|
+
composerIds: [...composerIds],
|
|
284
|
+
headersRemoved: 0,
|
|
285
|
+
transcriptDirsRemoved: 0,
|
|
286
|
+
workspaceBucketsUpdated: 0
|
|
287
|
+
};
|
|
288
|
+
if (composerIds.size === 0) return result;
|
|
289
|
+
if (!apply) {
|
|
290
|
+
result.bubblesDeleted = threads.reduce((sum, thread) => sum + thread.bubbleCount, 0);
|
|
291
|
+
result.composerDataDeleted = threads.length;
|
|
292
|
+
result.headersRemoved = threads.length;
|
|
293
|
+
result.transcriptDirsRemoved = threads.reduce((sum, thread) => sum + thread.transcriptDirs.length, 0);
|
|
294
|
+
return result;
|
|
295
|
+
}
|
|
296
|
+
await backupPrunedThreads(globalDbPath, [...composerIds]);
|
|
297
|
+
await pruneGlobalThreads(globalDbPath, threads, composerIds, result);
|
|
298
|
+
await pruneWorkspaceBuckets(threads, composerIds, result, userDir);
|
|
299
|
+
await pruneTranscriptDirs(threads, result);
|
|
300
|
+
invalidateCursorDiscoveryCache();
|
|
301
|
+
return result;
|
|
302
|
+
};
|
|
303
|
+
var pruneGlobalThreads = async (globalDbPath, threads, composerIds, result) => {
|
|
304
|
+
const db = new Database(globalDbPath);
|
|
305
|
+
try {
|
|
306
|
+
for (const thread of threads) {
|
|
307
|
+
const deleted = pruneGlobalThread(db, thread.composerId);
|
|
308
|
+
result.bubblesDeleted += deleted.bubbles;
|
|
309
|
+
result.composerDataDeleted += deleted.composerData;
|
|
310
|
+
}
|
|
311
|
+
result.headersRemoved = removeThreadHeaders(db, composerIds);
|
|
312
|
+
} finally {
|
|
313
|
+
db.close();
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
var pruneWorkspaceBuckets = async (_threads, composerIds, result, userDir) => {
|
|
317
|
+
const groups = await listCursorWorkspaceGroups(userDir);
|
|
318
|
+
const dbPaths = /* @__PURE__ */ new Set();
|
|
319
|
+
for (const group of groups) for (const bucket of group.buckets) dbPaths.add(bucket.dbPath);
|
|
320
|
+
for (const dbPath of dbPaths) {
|
|
321
|
+
const db = new Database(dbPath);
|
|
322
|
+
try {
|
|
323
|
+
if (removeThreadFromBucket(db, composerIds)) result.workspaceBucketsUpdated += 1;
|
|
324
|
+
} finally {
|
|
325
|
+
db.close();
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
var pruneTranscriptDirs = async (threads, result) => {
|
|
330
|
+
for (const thread of threads) for (const dir of thread.transcriptDirs) {
|
|
331
|
+
await rm(dir, {
|
|
332
|
+
force: true,
|
|
333
|
+
recursive: true
|
|
334
|
+
});
|
|
335
|
+
result.transcriptDirsRemoved += 1;
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
var collectCursorThreadsForDeletion = async (composerIds, userDir = resolveCursorUserDir()) => {
|
|
339
|
+
const db = openCursorReadonlyDb(getCursorGlobalDbPath(userDir));
|
|
340
|
+
const summaries = [];
|
|
341
|
+
try {
|
|
342
|
+
for (const composerId of composerIds) summaries.push({
|
|
343
|
+
bubbleBytes: 0,
|
|
344
|
+
bubbleCount: countBubbles(db, composerId),
|
|
345
|
+
bucketId: null,
|
|
346
|
+
composerId,
|
|
347
|
+
createdAtMs: null,
|
|
348
|
+
lastUpdatedAtMs: null,
|
|
349
|
+
mode: null,
|
|
350
|
+
name: "",
|
|
351
|
+
transcriptDirs: await findCursorTranscriptDirs(composerId, userDir),
|
|
352
|
+
workspaceKey: "",
|
|
353
|
+
workspaceLabel: ""
|
|
354
|
+
});
|
|
355
|
+
} finally {
|
|
356
|
+
db.close();
|
|
357
|
+
}
|
|
358
|
+
return summaries;
|
|
359
|
+
};
|
|
360
|
+
//#endregion
|
|
361
|
+
export { collectCursorThreadsForDeletion, isCursorRunning, pruneCursorThreads, recoverCursorWorkspaceGroup };
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { t as createServerFn } from "../server.js";
|
|
2
|
+
import { t as createServerRpc } from "./createServerRpc-BtXIw2iP.js";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
//#region src/lib/cursor-server.ts?tss-serverfn-split
|
|
5
|
+
var workspaceSchema = z.object({ workspaceKey: z.string().min(1) });
|
|
6
|
+
var threadSchema = z.object({ composerId: z.string().min(1) });
|
|
7
|
+
var recoverSchema = z.object({
|
|
8
|
+
apply: z.boolean().default(false),
|
|
9
|
+
workspaceKey: z.string().min(1)
|
|
10
|
+
});
|
|
11
|
+
var exportSchema = z.object({
|
|
12
|
+
composerId: z.string().min(1),
|
|
13
|
+
includeCommentary: z.boolean().default(true),
|
|
14
|
+
includeMetadata: z.boolean().default(true),
|
|
15
|
+
includeTools: z.boolean().default(true),
|
|
16
|
+
outputFormat: z.enum(["md", "txt"]).default("md")
|
|
17
|
+
});
|
|
18
|
+
var exportThreadsSchema = z.object({
|
|
19
|
+
composerIds: z.array(z.string().min(1)).min(1),
|
|
20
|
+
includeCommentary: z.boolean().default(true),
|
|
21
|
+
includeMetadata: z.boolean().default(true),
|
|
22
|
+
includeTools: z.boolean().default(true),
|
|
23
|
+
outputFormat: z.enum(["md", "txt"]).default("md")
|
|
24
|
+
});
|
|
25
|
+
var deleteThreadsSchema = z.object({ composerIds: z.array(z.string().min(1)).min(1) });
|
|
26
|
+
var ensureCursorClosedForWrite = async () => {
|
|
27
|
+
const { isCursorRunning } = await import("./cursor-recovery-9bJLs7vG.js");
|
|
28
|
+
if (await isCursorRunning()) throw new Error("Quit Cursor before deleting. It rewrites chat history on exit, which can resurrect deleted threads.");
|
|
29
|
+
};
|
|
30
|
+
var findGroupByKey = async (workspaceKey) => {
|
|
31
|
+
const { listCursorWorkspaceGroups } = await import("./cursor-db-B7agkAvM.js");
|
|
32
|
+
const group = (await listCursorWorkspaceGroups()).find((candidate) => candidate.key === workspaceKey);
|
|
33
|
+
if (!group) throw new Error(`Cursor workspace not found: ${workspaceKey}`);
|
|
34
|
+
return group;
|
|
35
|
+
};
|
|
36
|
+
var findCursorThreadByComposerId = async (composerId) => {
|
|
37
|
+
const { listCursorThreadsForGroup, listCursorWorkspaceGroups } = await import("./cursor-db-B7agkAvM.js");
|
|
38
|
+
for (const group of await listCursorWorkspaceGroups()) {
|
|
39
|
+
const thread = (await listCursorThreadsForGroup(group, void 0, { includeTranscriptDirs: false })).find((candidate) => candidate.composerId === composerId);
|
|
40
|
+
if (thread) return thread;
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
};
|
|
44
|
+
var renderCursorDownload = async (input) => {
|
|
45
|
+
const { readCursorThreadTranscript } = await import("./cursor-db-B7agkAvM.js");
|
|
46
|
+
const { getCursorGlobalDbPath } = await import("./cursor-exporter-types-CI3goo-c.js");
|
|
47
|
+
const { renderCursorTranscript } = await import("./cursor-transcript-2iL3KFSK.js");
|
|
48
|
+
const rendered = input.composerIds.map((composerId) => {
|
|
49
|
+
const transcript = readCursorThreadTranscript(getCursorGlobalDbPath(), composerId);
|
|
50
|
+
if (!transcript) throw new Error(`No transcript found for thread: ${composerId}`);
|
|
51
|
+
const content = renderCursorTranscript(transcript, {
|
|
52
|
+
includeCommentary: input.includeCommentary,
|
|
53
|
+
includeMetadata: input.includeMetadata,
|
|
54
|
+
includeTools: input.includeTools,
|
|
55
|
+
outputFormat: input.outputFormat
|
|
56
|
+
});
|
|
57
|
+
if (!content) throw new Error(`Thread has no exportable content: ${composerId}`);
|
|
58
|
+
return {
|
|
59
|
+
composerId,
|
|
60
|
+
content
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
if (rendered.length === 1) return {
|
|
64
|
+
content: rendered[0].content,
|
|
65
|
+
filename: `${rendered[0].composerId}.${input.outputFormat}`
|
|
66
|
+
};
|
|
67
|
+
const separator = input.outputFormat === "md" ? "\n\n---\n\n" : "\n\n================================================================\n\n";
|
|
68
|
+
return {
|
|
69
|
+
content: rendered.map((entry) => entry.content.trimEnd()).join(separator).concat("\n"),
|
|
70
|
+
filename: `cursor-threads-${rendered.length}.${input.outputFormat}`
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
var listCursorWorkspacesFn_createServerFn_handler = createServerRpc({
|
|
74
|
+
id: "8fcf452a4587a4d4dc0c2f6439255e98123f23d863ca0e861403ae2a687272f2",
|
|
75
|
+
name: "listCursorWorkspacesFn",
|
|
76
|
+
filename: "src/lib/cursor-server.ts"
|
|
77
|
+
}, (opts) => listCursorWorkspacesFn.__executeServer(opts));
|
|
78
|
+
var listCursorWorkspacesFn = createServerFn({ method: "GET" }).handler(listCursorWorkspacesFn_createServerFn_handler, async () => {
|
|
79
|
+
const { listCursorWorkspaceGroups } = await import("./cursor-db-B7agkAvM.js");
|
|
80
|
+
return listCursorWorkspaceGroups();
|
|
81
|
+
});
|
|
82
|
+
var listCursorThreadsFn_createServerFn_handler = createServerRpc({
|
|
83
|
+
id: "23fb197bac88fb9e4950ef7608cd311d67c0867e424136c8373071dc54746806",
|
|
84
|
+
name: "listCursorThreadsFn",
|
|
85
|
+
filename: "src/lib/cursor-server.ts"
|
|
86
|
+
}, (opts) => listCursorThreadsFn.__executeServer(opts));
|
|
87
|
+
var listCursorThreadsFn = createServerFn({ method: "GET" }).inputValidator(workspaceSchema).handler(listCursorThreadsFn_createServerFn_handler, async ({ data }) => {
|
|
88
|
+
const { listCursorThreadsForGroup } = await import("./cursor-db-B7agkAvM.js");
|
|
89
|
+
return listCursorThreadsForGroup(await findGroupByKey(data.workspaceKey), void 0, { includeTranscriptDirs: false });
|
|
90
|
+
});
|
|
91
|
+
var getCursorThreadDetailFn_createServerFn_handler = createServerRpc({
|
|
92
|
+
id: "6e893e740c05aad65a8eb32901b4c39277ebf718f0ba14b04d8df989bed2f32b",
|
|
93
|
+
name: "getCursorThreadDetailFn",
|
|
94
|
+
filename: "src/lib/cursor-server.ts"
|
|
95
|
+
}, (opts) => getCursorThreadDetailFn.__executeServer(opts));
|
|
96
|
+
var getCursorThreadDetailFn = createServerFn({ method: "GET" }).inputValidator(threadSchema).handler(getCursorThreadDetailFn_createServerFn_handler, async ({ data }) => {
|
|
97
|
+
const { readCursorThreadTranscript } = await import("./cursor-db-B7agkAvM.js");
|
|
98
|
+
const { getCursorGlobalDbPath } = await import("./cursor-exporter-types-CI3goo-c.js");
|
|
99
|
+
const { renderCursorTranscript } = await import("./cursor-transcript-2iL3KFSK.js");
|
|
100
|
+
const thread = await findCursorThreadByComposerId(data.composerId);
|
|
101
|
+
if (!thread) throw new Error(`Cursor thread not found: ${data.composerId}`);
|
|
102
|
+
const transcript = readCursorThreadTranscript(getCursorGlobalDbPath(), data.composerId);
|
|
103
|
+
return {
|
|
104
|
+
renderedTranscript: transcript ? renderCursorTranscript(transcript, {
|
|
105
|
+
includeCommentary: true,
|
|
106
|
+
includeMetadata: false,
|
|
107
|
+
includeTools: true,
|
|
108
|
+
outputFormat: "md"
|
|
109
|
+
}) : null,
|
|
110
|
+
thread,
|
|
111
|
+
transcript
|
|
112
|
+
};
|
|
113
|
+
});
|
|
114
|
+
var exportCursorThreadFn_createServerFn_handler = createServerRpc({
|
|
115
|
+
id: "03050b86e5481024283bee890347a9da7b2493493044dcde6df989b3334d6b73",
|
|
116
|
+
name: "exportCursorThreadFn",
|
|
117
|
+
filename: "src/lib/cursor-server.ts"
|
|
118
|
+
}, (opts) => exportCursorThreadFn.__executeServer(opts));
|
|
119
|
+
var exportCursorThreadFn = createServerFn({ method: "POST" }).inputValidator(exportSchema).handler(exportCursorThreadFn_createServerFn_handler, async ({ data }) => {
|
|
120
|
+
return await renderCursorDownload({
|
|
121
|
+
composerIds: [data.composerId],
|
|
122
|
+
includeCommentary: data.includeCommentary,
|
|
123
|
+
includeMetadata: data.includeMetadata,
|
|
124
|
+
includeTools: data.includeTools,
|
|
125
|
+
outputFormat: data.outputFormat
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
var exportCursorThreadsFn_createServerFn_handler = createServerRpc({
|
|
129
|
+
id: "e9609d5ab12ea0bc4dbd3289fad95417dd01a0a719c8ee588c0b8c8a9dc80c99",
|
|
130
|
+
name: "exportCursorThreadsFn",
|
|
131
|
+
filename: "src/lib/cursor-server.ts"
|
|
132
|
+
}, (opts) => exportCursorThreadsFn.__executeServer(opts));
|
|
133
|
+
var exportCursorThreadsFn = createServerFn({ method: "POST" }).inputValidator(exportThreadsSchema).handler(exportCursorThreadsFn_createServerFn_handler, async ({ data }) => {
|
|
134
|
+
return await renderCursorDownload({
|
|
135
|
+
composerIds: data.composerIds,
|
|
136
|
+
includeCommentary: data.includeCommentary,
|
|
137
|
+
includeMetadata: data.includeMetadata,
|
|
138
|
+
includeTools: data.includeTools,
|
|
139
|
+
outputFormat: data.outputFormat
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
var recoverCursorWorkspaceFn_createServerFn_handler = createServerRpc({
|
|
143
|
+
id: "a9bd5d510f2d1173d2ef610dda4d59a795af17e7c2a4affaba7e1f99822b2c40",
|
|
144
|
+
name: "recoverCursorWorkspaceFn",
|
|
145
|
+
filename: "src/lib/cursor-server.ts"
|
|
146
|
+
}, (opts) => recoverCursorWorkspaceFn.__executeServer(opts));
|
|
147
|
+
var recoverCursorWorkspaceFn = createServerFn({ method: "POST" }).inputValidator(recoverSchema).handler(recoverCursorWorkspaceFn_createServerFn_handler, async ({ data }) => {
|
|
148
|
+
const { isCursorRunning, recoverCursorWorkspaceGroup } = await import("./cursor-recovery-9bJLs7vG.js");
|
|
149
|
+
const group = await findGroupByKey(data.workspaceKey);
|
|
150
|
+
if (data.apply && await isCursorRunning()) throw new Error("Quit Cursor before recovering. It overwrites chat history on exit, undoing the recovery.");
|
|
151
|
+
return recoverCursorWorkspaceGroup(group, data.apply);
|
|
152
|
+
});
|
|
153
|
+
var deleteCursorThreadsFn_createServerFn_handler = createServerRpc({
|
|
154
|
+
id: "17afb84da4a3d5022132756ead0adaf0323660f50fc58d7f14830b01fdd59a13",
|
|
155
|
+
name: "deleteCursorThreadsFn",
|
|
156
|
+
filename: "src/lib/cursor-server.ts"
|
|
157
|
+
}, (opts) => deleteCursorThreadsFn.__executeServer(opts));
|
|
158
|
+
var deleteCursorThreadsFn = createServerFn({ method: "POST" }).inputValidator(deleteThreadsSchema).handler(deleteCursorThreadsFn_createServerFn_handler, async ({ data }) => {
|
|
159
|
+
const { collectCursorThreadsForDeletion, pruneCursorThreads } = await import("./cursor-recovery-9bJLs7vG.js");
|
|
160
|
+
await ensureCursorClosedForWrite();
|
|
161
|
+
return pruneCursorThreads(await collectCursorThreadsForDeletion(data.composerIds), true);
|
|
162
|
+
});
|
|
163
|
+
var deleteCursorWorkspaceFn_createServerFn_handler = createServerRpc({
|
|
164
|
+
id: "fc72eb7835fc18130f6d7c20e15e560320521cd01c93e08667b340bfe6b90930",
|
|
165
|
+
name: "deleteCursorWorkspaceFn",
|
|
166
|
+
filename: "src/lib/cursor-server.ts"
|
|
167
|
+
}, (opts) => deleteCursorWorkspaceFn.__executeServer(opts));
|
|
168
|
+
var deleteCursorWorkspaceFn = createServerFn({ method: "POST" }).inputValidator(workspaceSchema).handler(deleteCursorWorkspaceFn_createServerFn_handler, async ({ data }) => {
|
|
169
|
+
const { listCursorThreadsForGroup } = await import("./cursor-db-B7agkAvM.js");
|
|
170
|
+
const { collectCursorThreadsForDeletion, pruneCursorThreads } = await import("./cursor-recovery-9bJLs7vG.js");
|
|
171
|
+
await ensureCursorClosedForWrite();
|
|
172
|
+
const composerIds = (await listCursorThreadsForGroup(await findGroupByKey(data.workspaceKey), void 0, { includeTranscriptDirs: false })).map((thread) => thread.composerId);
|
|
173
|
+
if (composerIds.length === 0) return {
|
|
174
|
+
bubblesDeleted: 0,
|
|
175
|
+
composerDataDeleted: 0,
|
|
176
|
+
composerIds: [],
|
|
177
|
+
headersRemoved: 0,
|
|
178
|
+
transcriptDirsRemoved: 0,
|
|
179
|
+
workspaceBucketsUpdated: 0
|
|
180
|
+
};
|
|
181
|
+
return pruneCursorThreads(await collectCursorThreadsForDeletion(composerIds), true);
|
|
182
|
+
});
|
|
183
|
+
//#endregion
|
|
184
|
+
export { deleteCursorThreadsFn_createServerFn_handler, deleteCursorWorkspaceFn_createServerFn_handler, exportCursorThreadFn_createServerFn_handler, exportCursorThreadsFn_createServerFn_handler, getCursorThreadDetailFn_createServerFn_handler, listCursorThreadsFn_createServerFn_handler, listCursorWorkspacesFn_createServerFn_handler, recoverCursorWorkspaceFn_createServerFn_handler };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { t as ReloadErrorPanel } from "./reload-error-panel-BJMxY3U1.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/routes/cursor-threads.$composerId.tsx?tsr-split=errorComponent
|
|
4
|
+
var CursorThreadDetailErrorComponent = ({ error }) => {
|
|
5
|
+
return /* @__PURE__ */ jsx(ReloadErrorPanel, {
|
|
6
|
+
description: error.message,
|
|
7
|
+
title: "Failed to load Cursor thread"
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
export { CursorThreadDetailErrorComponent as errorComponent };
|