spiracha 1.5.0 → 2.0.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 +114 -205
- package/README.md +89 -269
- package/apps/ui/AGENTS.md +17 -7
- package/apps/ui/README.md +34 -8
- package/apps/ui/components.json +21 -0
- package/apps/ui/package.json +65 -0
- package/apps/ui/src/components/antigravity-conversations-table.tsx +206 -0
- package/apps/ui/src/components/antigravity-keychain-panel.tsx +76 -0
- package/apps/ui/src/components/antigravity-workspaces-table.tsx +63 -0
- package/apps/ui/src/components/app-shell.tsx +124 -0
- package/apps/ui/src/components/breadcrumbs.tsx +53 -0
- package/apps/ui/src/components/claude-code-sessions-table.tsx +114 -0
- package/apps/ui/src/components/claude-code-workspaces-table.tsx +55 -0
- package/apps/ui/src/components/cursor-threads-table.tsx +189 -0
- package/apps/ui/src/components/cursor-workspaces-table.tsx +140 -0
- package/apps/ui/src/components/data-table.tsx +241 -0
- package/apps/ui/src/components/delete-confirm-dialog.tsx +88 -0
- package/apps/ui/src/components/export-dialog.tsx +184 -0
- package/apps/ui/src/components/json-panel.tsx +17 -0
- package/apps/ui/src/components/kiro-sessions-table.tsx +112 -0
- package/apps/ui/src/components/kiro-workspaces-table.tsx +53 -0
- package/apps/ui/src/components/list-search-input.tsx +18 -0
- package/apps/ui/src/components/loading-panel.tsx +23 -0
- package/apps/ui/src/components/metadata-section.tsx +31 -0
- package/apps/ui/src/components/metric-card.tsx +19 -0
- package/apps/ui/src/components/opencode-sessions-table.tsx +128 -0
- package/apps/ui/src/components/opencode-workspaces-table.tsx +57 -0
- package/apps/ui/src/components/page-header.tsx +33 -0
- package/apps/ui/src/components/projects-loading-state.tsx +74 -0
- package/apps/ui/src/components/projects-table.tsx +108 -0
- package/apps/ui/src/components/qoder-sessions-table.tsx +112 -0
- package/apps/ui/src/components/qoder-workspaces-table.tsx +53 -0
- package/apps/ui/src/components/recent-threads-list.tsx +52 -0
- package/apps/ui/src/components/reload-error-panel.tsx +20 -0
- package/apps/ui/src/components/text-document-panel.tsx +19 -0
- package/apps/ui/src/components/theme-toggle.tsx +48 -0
- package/apps/ui/src/components/threads-table.tsx +202 -0
- package/apps/ui/src/components/transcript-view.tsx +552 -0
- package/apps/ui/src/components/ui/alert-dialog.tsx +160 -0
- package/apps/ui/src/components/ui/badge.tsx +45 -0
- package/apps/ui/src/components/ui/button.tsx +62 -0
- package/apps/ui/src/components/ui/checkbox.tsx +29 -0
- package/apps/ui/src/components/ui/dialog.tsx +137 -0
- package/apps/ui/src/components/ui/dropdown-menu.tsx +217 -0
- package/apps/ui/src/components/ui/input.tsx +21 -0
- package/apps/ui/src/components/ui/scroll-area.tsx +46 -0
- package/apps/ui/src/components/ui/select.tsx +163 -0
- package/apps/ui/src/components/ui/separator.tsx +28 -0
- package/apps/ui/src/components/ui/sheet.tsx +107 -0
- package/apps/ui/src/components/ui/skeleton.tsx +7 -0
- package/apps/ui/src/components/ui/table.tsx +76 -0
- package/apps/ui/src/components/ui/tabs.tsx +71 -0
- package/apps/ui/src/components/ui/tooltip.tsx +44 -0
- package/apps/ui/src/integrations/tanstack-query/devtools.tsx +6 -0
- package/apps/ui/src/integrations/tanstack-query/root-provider.tsx +10 -0
- package/apps/ui/src/lib/antigravity-conversation-state.ts +28 -0
- package/apps/ui/src/lib/antigravity-queries.ts +33 -0
- package/apps/ui/src/lib/antigravity-server.ts +128 -0
- package/apps/ui/src/lib/antigravity-transcript-events.ts +335 -0
- package/apps/ui/src/lib/claude-code-queries.ts +26 -0
- package/apps/ui/src/lib/claude-code-server.ts +75 -0
- package/apps/ui/src/lib/claude-code-transcript-events.ts +154 -0
- package/apps/ui/src/lib/codex-queries.ts +66 -0
- package/apps/ui/src/lib/codex-server.ts +209 -0
- package/apps/ui/src/lib/cursor-queries.ts +37 -0
- package/apps/ui/src/lib/cursor-server.ts +272 -0
- package/apps/ui/src/lib/cursor-transcript-events.ts +229 -0
- package/apps/ui/src/lib/download.ts +166 -0
- package/apps/ui/src/lib/formatters.ts +149 -0
- package/apps/ui/src/lib/kiro-queries.ts +22 -0
- package/apps/ui/src/lib/kiro-server.ts +73 -0
- package/apps/ui/src/lib/kiro-transcript-events.ts +113 -0
- package/apps/ui/src/lib/opencode-queries.ts +37 -0
- package/apps/ui/src/lib/opencode-server.ts +73 -0
- package/apps/ui/src/lib/opencode-transcript-events.ts +221 -0
- package/apps/ui/src/lib/package-metadata.ts +16 -0
- package/apps/ui/src/lib/path-utils.ts +13 -0
- package/apps/ui/src/lib/qoder-queries.ts +22 -0
- package/apps/ui/src/lib/qoder-server.ts +79 -0
- package/apps/ui/src/lib/qoder-transcript-events.ts +139 -0
- package/apps/ui/src/lib/route-search.ts +68 -0
- package/apps/ui/src/lib/settings-store.tsx +59 -0
- package/apps/ui/src/lib/source-session-export-server.ts +56 -0
- package/apps/ui/src/lib/text-filter.ts +22 -0
- package/apps/ui/src/lib/thread-id.ts +3 -0
- package/apps/ui/src/lib/thread-transcript-stats.ts +57 -0
- package/apps/ui/src/lib/utils.ts +7 -0
- package/apps/ui/src/routeTree.gen.ts +730 -0
- package/apps/ui/src/router.tsx +20 -0
- package/apps/ui/src/routes/$threadId.tsx +22 -0
- package/apps/ui/src/routes/__root.tsx +127 -0
- package/apps/ui/src/routes/analytics.tsx +143 -0
- package/apps/ui/src/routes/antigravity-conversations.$conversationId.tsx +438 -0
- package/apps/ui/src/routes/antigravity.$workspaceKey.tsx +127 -0
- package/apps/ui/src/routes/antigravity.index.tsx +51 -0
- package/apps/ui/src/routes/api.v1.conversation-query.ts +12 -0
- package/apps/ui/src/routes/api.v1.conversations.$source.$id.export.ts +12 -0
- package/apps/ui/src/routes/api.v1.conversations.$source.$id.ts +12 -0
- package/apps/ui/src/routes/api.v1.conversations.ts +12 -0
- package/apps/ui/src/routes/api.v1.resolve.ts +12 -0
- package/apps/ui/src/routes/api.v1.sources.ts +12 -0
- package/apps/ui/src/routes/claude-code-sessions.$sessionId.tsx +342 -0
- package/apps/ui/src/routes/claude-code.$workspaceKey.tsx +135 -0
- package/apps/ui/src/routes/claude-code.index.tsx +48 -0
- package/apps/ui/src/routes/codex.$project.tsx +390 -0
- package/apps/ui/src/routes/codex.index.tsx +116 -0
- package/apps/ui/src/routes/cursor-threads.$composerId.tsx +435 -0
- package/apps/ui/src/routes/cursor.$workspaceKey.tsx +416 -0
- package/apps/ui/src/routes/cursor.index.tsx +120 -0
- package/apps/ui/src/routes/index.tsx +124 -0
- package/apps/ui/src/routes/kiro-sessions.$sessionId.tsx +345 -0
- package/apps/ui/src/routes/kiro.$workspaceKey.tsx +136 -0
- package/apps/ui/src/routes/kiro.index.tsx +48 -0
- package/apps/ui/src/routes/opencode-sessions.$sessionId.tsx +334 -0
- package/apps/ui/src/routes/opencode.$workspaceKey.tsx +135 -0
- package/apps/ui/src/routes/opencode.index.tsx +48 -0
- package/apps/ui/src/routes/qoder-sessions.$sessionId.tsx +341 -0
- package/apps/ui/src/routes/qoder.$workspaceKey.tsx +139 -0
- package/apps/ui/src/routes/qoder.index.tsx +48 -0
- package/apps/ui/src/routes/settings.tsx +91 -0
- package/apps/ui/src/routes/threads.$threadId.tsx +619 -0
- package/apps/ui/src/styles.css +122 -0
- package/apps/ui/tsconfig.json +29 -0
- package/apps/ui/vite.config.ts +84 -0
- package/bin/spiracha.ts +32 -0
- package/package.json +46 -73
- package/src/client.ts +290 -0
- package/src/lib/antigravity-db.ts +213 -19
- package/src/lib/antigravity-exporter-types.ts +1 -0
- package/src/lib/codex-analytics.ts +1 -1
- package/src/lib/codex-browser-db.ts +410 -74
- package/src/lib/codex-browser-export.ts +6 -14
- package/src/lib/codex-browser-types.ts +1 -1
- package/src/lib/{codex-exporter-types.ts → codex-thread-types.ts} +2 -30
- package/src/lib/{codex-exporter-transcript.ts → codex-transcript-renderer.ts} +64 -28
- package/src/lib/conversation-api.ts +792 -0
- package/src/lib/conversation-data/adapter-helpers.ts +110 -0
- package/src/lib/conversation-data/antigravity-adapter.ts +148 -0
- package/src/lib/conversation-data/claude-code-adapter.ts +175 -0
- package/src/lib/conversation-data/codex-adapter.ts +245 -0
- package/src/lib/conversation-data/cursor-adapter.ts +171 -0
- package/src/lib/conversation-data/index.ts +311 -0
- package/src/lib/conversation-data/kiro-adapter.ts +140 -0
- package/src/lib/conversation-data/message-selector.ts +37 -0
- package/src/lib/conversation-data/opencode-adapter.ts +180 -0
- package/src/lib/conversation-data/path-match.ts +79 -0
- package/src/lib/conversation-data/qoder-adapter.ts +230 -0
- package/src/lib/conversation-data/types.ts +116 -0
- package/src/lib/cursor-db.ts +67 -21
- package/src/lib/cursor-exporter-types.ts +0 -19
- package/src/lib/qoder-acp-client.ts +268 -0
- package/src/lib/qoder-db.ts +1601 -0
- package/src/lib/qoder-exporter-types.ts +114 -0
- package/src/lib/qoder-transcript-phase.ts +41 -0
- package/src/lib/qoder-transcript.ts +112 -0
- package/apps/ui/dist/client/assets/_threadId-CAIeH5mq.js +0 -1
- package/apps/ui/dist/client/assets/analytics-DOy1b6Sh.js +0 -1
- package/apps/ui/dist/client/assets/antigravity-conversations._conversationId-DqySVO2K.js +0 -7
- package/apps/ui/dist/client/assets/antigravity-conversations._conversationId-KAcXtNxI.js +0 -1
- package/apps/ui/dist/client/assets/antigravity-keychain-panel-B77qJz6f.js +0 -1
- package/apps/ui/dist/client/assets/antigravity._workspaceKey-B3NM6gRH.js +0 -1
- package/apps/ui/dist/client/assets/antigravity._workspaceKey-ByitGWki.js +0 -1
- package/apps/ui/dist/client/assets/antigravity.index-DP9JC2P9.js +0 -1
- package/apps/ui/dist/client/assets/antigravity.index-DgW25FEV.js +0 -1
- package/apps/ui/dist/client/assets/badge-C3i4OKs8.js +0 -1
- package/apps/ui/dist/client/assets/checkbox-CdHitXWQ.js +0 -1
- package/apps/ui/dist/client/assets/claude-code-sessions._sessionId-8pQ55ci2.js +0 -1
- package/apps/ui/dist/client/assets/claude-code-sessions._sessionId-DVz5UmtU.js +0 -1
- package/apps/ui/dist/client/assets/claude-code._workspaceKey-BBKskSum.js +0 -1
- package/apps/ui/dist/client/assets/claude-code._workspaceKey-OkikMUFs.js +0 -1
- package/apps/ui/dist/client/assets/claude-code.index-Cwu76dbb.js +0 -1
- package/apps/ui/dist/client/assets/claude-code.index-D6eMd08t.js +0 -1
- package/apps/ui/dist/client/assets/createServerFn-B-KkwmHU.js +0 -3
- package/apps/ui/dist/client/assets/cursor-threads._composerId-CmBFclK8.js +0 -1
- package/apps/ui/dist/client/assets/cursor-threads._composerId-hBWlP1D-.js +0 -1
- package/apps/ui/dist/client/assets/cursor._workspaceKey-BFPkIRi-.js +0 -1
- package/apps/ui/dist/client/assets/cursor._workspaceKey-CaAZjGmm.js +0 -1
- package/apps/ui/dist/client/assets/cursor.index-8y4o20kb.js +0 -2
- package/apps/ui/dist/client/assets/cursor.index-CrnMwDCi.js +0 -1
- package/apps/ui/dist/client/assets/data-table-Br78_dk3.js +0 -4
- package/apps/ui/dist/client/assets/delete-confirm-dialog-Bxs07u-j.js +0 -7
- package/apps/ui/dist/client/assets/dist-B9pyYCVU.js +0 -1
- package/apps/ui/dist/client/assets/dist-BrJhN2A0.js +0 -5
- package/apps/ui/dist/client/assets/dist-Cmd3AIfD.js +0 -1
- package/apps/ui/dist/client/assets/dist-DvMS2965.js +0 -1
- package/apps/ui/dist/client/assets/download-Bf0QJKD3.js +0 -1
- package/apps/ui/dist/client/assets/dropdown-menu-D5cvPaZt.js +0 -1
- package/apps/ui/dist/client/assets/es2015-ad6040dw.js +0 -41
- package/apps/ui/dist/client/assets/export-dialog-Dr8d2MqD.js +0 -1
- package/apps/ui/dist/client/assets/formatters-BtqyrX_c.js +0 -1
- package/apps/ui/dist/client/assets/index-C-STgIH4.js +0 -166
- package/apps/ui/dist/client/assets/jsx-runtime-DGeXAQPT.js +0 -1
- package/apps/ui/dist/client/assets/kiro-sessions._sessionId-CKgfJ7GR.js +0 -1
- package/apps/ui/dist/client/assets/kiro-sessions._sessionId-zvIJHtQF.js +0 -1
- package/apps/ui/dist/client/assets/kiro._workspaceKey-DhVuJuZB.js +0 -1
- package/apps/ui/dist/client/assets/kiro._workspaceKey-QArsjkTY.js +0 -1
- package/apps/ui/dist/client/assets/kiro.index-C-fr4m7i.js +0 -1
- package/apps/ui/dist/client/assets/kiro.index-OYgAdtZd.js +0 -1
- package/apps/ui/dist/client/assets/metric-card-Dplm0ZiM.js +0 -1
- package/apps/ui/dist/client/assets/opencode-sessions._sessionId-DLjiTst-.js +0 -1
- package/apps/ui/dist/client/assets/opencode-sessions._sessionId-biBwrRbt.js +0 -8
- package/apps/ui/dist/client/assets/opencode._workspaceKey-C7OIzMOJ.js +0 -1
- package/apps/ui/dist/client/assets/opencode._workspaceKey-sBakX0oI.js +0 -1
- package/apps/ui/dist/client/assets/opencode.index-Bl_kNs9N.js +0 -1
- package/apps/ui/dist/client/assets/opencode.index-CN53bVmb.js +0 -1
- package/apps/ui/dist/client/assets/page-header-Cwa3p6Tl.js +0 -1
- package/apps/ui/dist/client/assets/preload-helper-B8fFrdxC.js +0 -1
- package/apps/ui/dist/client/assets/projects._project-D8WloxQN.js +0 -1
- package/apps/ui/dist/client/assets/projects._project-DSDwH4NF.js +0 -1
- package/apps/ui/dist/client/assets/projects.index-5xRtuJdX.js +0 -3
- package/apps/ui/dist/client/assets/projects.index-DEfhWqa8.js +0 -1
- package/apps/ui/dist/client/assets/react-dom-DL96Jor4.js +0 -1
- package/apps/ui/dist/client/assets/refresh-ccw-BgKjOiA6.js +0 -1
- package/apps/ui/dist/client/assets/reload-error-panel-AHqu0akK.js +0 -1
- package/apps/ui/dist/client/assets/routes-DnzF_9CX.js +0 -1
- package/apps/ui/dist/client/assets/scroll-text-fM0sMOB3.js +0 -1
- package/apps/ui/dist/client/assets/select-CYF6pF37.js +0 -1
- package/apps/ui/dist/client/assets/settings-Dx70jgP_.js +0 -1
- package/apps/ui/dist/client/assets/sqlite-error-B6uZjUe8.js +0 -1
- package/apps/ui/dist/client/assets/styles-B7Zi9EFA.css +0 -1
- package/apps/ui/dist/client/assets/tabs-CmuhkT-c.js +0 -7
- package/apps/ui/dist/client/assets/text-filter-DVAZySUS.js +0 -2
- package/apps/ui/dist/client/assets/thread-transcript-stats-BUNz6u7F.js +0 -1
- package/apps/ui/dist/client/assets/threads._threadId-BB9tTsV4.js +0 -1
- package/apps/ui/dist/client/assets/threads._threadId-BMRSFow3.js +0 -1
- package/apps/ui/dist/client/assets/useMutation-BSFult2i.js +0 -1
- package/apps/ui/dist/client/assets/useQuery-CjINKZf1.js +0 -1
- package/apps/ui/dist/server/assets/_tanstack-start-manifest_v-CQ8Jjs3B.js +0 -387
- package/apps/ui/dist/server/assets/_threadId-B6SrBR9E.js +0 -6
- package/apps/ui/dist/server/assets/analytics-CYP_LT5Y.js +0 -16
- package/apps/ui/dist/server/assets/analytics-CtpOMVMO.js +0 -146
- package/apps/ui/dist/server/assets/antigravity-conversation-state-HgzS302O.js +0 -16
- package/apps/ui/dist/server/assets/antigravity-conversations._conversationId-BKOyL2T6.js +0 -613
- package/apps/ui/dist/server/assets/antigravity-conversations._conversationId-D426O-64.js +0 -11
- package/apps/ui/dist/server/assets/antigravity-conversations._conversationId-eS87Dx7g.js +0 -20
- package/apps/ui/dist/server/assets/antigravity-db-Bh8_U9uw.js +0 -580
- package/apps/ui/dist/server/assets/antigravity-keychain-DOiuHDwK.js +0 -126
- package/apps/ui/dist/server/assets/antigravity-keychain-panel-CC7FLmAK.js +0 -55
- package/apps/ui/dist/server/assets/antigravity-queries-CGrJO9Vr.js +0 -37
- package/apps/ui/dist/server/assets/antigravity-server-CHRjVFqN.js +0 -114
- package/apps/ui/dist/server/assets/antigravity._workspaceKey-3m_MzNFA.js +0 -11
- package/apps/ui/dist/server/assets/antigravity._workspaceKey-B0QeYUOh.js +0 -28
- package/apps/ui/dist/server/assets/antigravity._workspaceKey-C3kP-qyN.js +0 -210
- package/apps/ui/dist/server/assets/antigravity.index-CPCYkqCi.js +0 -104
- package/apps/ui/dist/server/assets/antigravity.index-DudTB3Tq.js +0 -11
- package/apps/ui/dist/server/assets/badge-EvdhKK_Z.js +0 -26
- package/apps/ui/dist/server/assets/button-CmTDnzOn.js +0 -46
- package/apps/ui/dist/server/assets/checkbox-C0hovF41.js +0 -19
- package/apps/ui/dist/server/assets/claude-code-db-Ik3VStKZ.js +0 -361
- package/apps/ui/dist/server/assets/claude-code-queries-Cgzi4K-e.js +0 -37
- package/apps/ui/dist/server/assets/claude-code-server-PfraClXS.js +0 -72
- package/apps/ui/dist/server/assets/claude-code-sessions._sessionId-C55oe6zj.js +0 -18
- package/apps/ui/dist/server/assets/claude-code-sessions._sessionId-D1RYYi3j.js +0 -473
- package/apps/ui/dist/server/assets/claude-code-sessions._sessionId-DSvPLEUL.js +0 -11
- package/apps/ui/dist/server/assets/claude-code-transcript-C-bxh3cS.js +0 -139
- package/apps/ui/dist/server/assets/claude-code-transcript-phase-DmUMc8VU.js +0 -10
- package/apps/ui/dist/server/assets/claude-code._workspaceKey-B5Xg_-tE.js +0 -28
- package/apps/ui/dist/server/assets/claude-code._workspaceKey-BPlzyXPa.js +0 -11
- package/apps/ui/dist/server/assets/claude-code._workspaceKey-DqDve2wl.js +0 -191
- package/apps/ui/dist/server/assets/claude-code.index-B7yYR7dD.js +0 -92
- package/apps/ui/dist/server/assets/claude-code.index-BUHThG1W.js +0 -11
- package/apps/ui/dist/server/assets/codex-queries-CtgeZ7VL.js +0 -99
- package/apps/ui/dist/server/assets/codex-server-CGXU4H8-.js +0 -2294
- package/apps/ui/dist/server/assets/concurrency-VXtYvlGh.js +0 -18
- package/apps/ui/dist/server/assets/createServerRpc-CF_DEwnm.js +0 -12
- package/apps/ui/dist/server/assets/createSsrRpc-C754NPki.js +0 -16
- package/apps/ui/dist/server/assets/cursor-db-CZnYy7aT.js +0 -830
- package/apps/ui/dist/server/assets/cursor-exporter-types-CI3goo-c.js +0 -34
- package/apps/ui/dist/server/assets/cursor-queries-NCIM0Nat.js +0 -67
- package/apps/ui/dist/server/assets/cursor-recovery-CXpO8KcD.js +0 -361
- package/apps/ui/dist/server/assets/cursor-server-DNu52A3K.js +0 -213
- package/apps/ui/dist/server/assets/cursor-threads._composerId-BB0Y_Mao.js +0 -11
- package/apps/ui/dist/server/assets/cursor-threads._composerId-Ckn6ItHI.js +0 -582
- package/apps/ui/dist/server/assets/cursor-threads._composerId-p9-ARAzc.js +0 -18
- package/apps/ui/dist/server/assets/cursor-transcript-B7tGnqtn.js +0 -125
- package/apps/ui/dist/server/assets/cursor._workspaceKey-CZuohIUL.js +0 -28
- package/apps/ui/dist/server/assets/cursor._workspaceKey-DPp5JSjy.js +0 -401
- package/apps/ui/dist/server/assets/cursor._workspaceKey-nmg3YIOQ.js +0 -11
- package/apps/ui/dist/server/assets/cursor.index-CcsX7DG0.js +0 -11
- package/apps/ui/dist/server/assets/cursor.index-DkWT-mxw.js +0 -189
- package/apps/ui/dist/server/assets/data-table-Cdct823O.js +0 -189
- package/apps/ui/dist/server/assets/delete-confirm-dialog-BcBNCxWB.js +0 -144
- package/apps/ui/dist/server/assets/download-DMmiy1xf.js +0 -92
- package/apps/ui/dist/server/assets/dropdown-menu-Dy_9t6TN.js +0 -36
- package/apps/ui/dist/server/assets/empty-plugin-adapters-B3lHh1La.js +0 -5
- package/apps/ui/dist/server/assets/export-dialog-D88ze9Gy.js +0 -240
- package/apps/ui/dist/server/assets/formatters-FJaGZgJk.js +0 -91
- package/apps/ui/dist/server/assets/kiro-db--fXrED_-.js +0 -552
- package/apps/ui/dist/server/assets/kiro-queries-CzNlM2ok.js +0 -37
- package/apps/ui/dist/server/assets/kiro-server-9WRxg2Au.js +0 -72
- package/apps/ui/dist/server/assets/kiro-sessions._sessionId-CRY2c7YO.js +0 -11
- package/apps/ui/dist/server/assets/kiro-sessions._sessionId-F1UlwxmR.js +0 -449
- package/apps/ui/dist/server/assets/kiro-sessions._sessionId-bvTulT7C.js +0 -18
- package/apps/ui/dist/server/assets/kiro-transcript-DoekQBaH.js +0 -112
- package/apps/ui/dist/server/assets/kiro-transcript-phase-CJG40nQg.js +0 -27
- package/apps/ui/dist/server/assets/kiro._workspaceKey-BDe9sQwo.js +0 -11
- package/apps/ui/dist/server/assets/kiro._workspaceKey-CJsjgNwO.js +0 -28
- package/apps/ui/dist/server/assets/kiro._workspaceKey-D_-4Qb7y.js +0 -193
- package/apps/ui/dist/server/assets/kiro.index-C__-UROk.js +0 -11
- package/apps/ui/dist/server/assets/kiro.index-CmTbqeYj.js +0 -93
- package/apps/ui/dist/server/assets/loading-panel-BGFnWseS.js +0 -27
- package/apps/ui/dist/server/assets/metric-card-ByEeLu0r.js +0 -23
- package/apps/ui/dist/server/assets/model-label-B1NWGc65.js +0 -13
- package/apps/ui/dist/server/assets/opencode-db-BM7KjOzc.js +0 -397
- package/apps/ui/dist/server/assets/opencode-queries-BeNYXnQv.js +0 -50
- package/apps/ui/dist/server/assets/opencode-server-BpQ_kRze.js +0 -72
- package/apps/ui/dist/server/assets/opencode-sessions._sessionId-CGQ-t0vD.js +0 -518
- package/apps/ui/dist/server/assets/opencode-sessions._sessionId-D8Q7in_Z.js +0 -18
- package/apps/ui/dist/server/assets/opencode-sessions._sessionId-DKOvi0lV.js +0 -11
- package/apps/ui/dist/server/assets/opencode-think-tags-CAoD-EcZ.js +0 -87
- package/apps/ui/dist/server/assets/opencode-transcript-BNTcGNym.js +0 -141
- package/apps/ui/dist/server/assets/opencode-transcript-phase-OqLkiQD0.js +0 -32
- package/apps/ui/dist/server/assets/opencode._workspaceKey-BdqcWHw1.js +0 -11
- package/apps/ui/dist/server/assets/opencode._workspaceKey-CfH96HTT.js +0 -28
- package/apps/ui/dist/server/assets/opencode._workspaceKey-DdbHPDrO.js +0 -207
- package/apps/ui/dist/server/assets/opencode.index-BbVzkJXP.js +0 -11
- package/apps/ui/dist/server/assets/opencode.index-Vh_Gq_1L.js +0 -93
- package/apps/ui/dist/server/assets/page-header-VNSaM3xd.js +0 -29
- package/apps/ui/dist/server/assets/path-transforms-DL2IwtYd.js +0 -31
- package/apps/ui/dist/server/assets/projects._project-4io5LO0E.js +0 -20
- package/apps/ui/dist/server/assets/projects._project-Bshqk7JA.js +0 -12
- package/apps/ui/dist/server/assets/projects._project-D6ZoGhJ8.js +0 -395
- package/apps/ui/dist/server/assets/projects.index-BLXOx5eL.js +0 -12
- package/apps/ui/dist/server/assets/projects.index-BkLiF2FF.js +0 -182
- package/apps/ui/dist/server/assets/projects.index-DesYXwfi.js +0 -14
- package/apps/ui/dist/server/assets/reload-error-panel-BJMxY3U1.js +0 -25
- package/apps/ui/dist/server/assets/route-search-ts4W9MJ9.js +0 -38
- package/apps/ui/dist/server/assets/router-Sac2DGk6.js +0 -518
- package/apps/ui/dist/server/assets/routes-Bsact1uB.js +0 -184
- package/apps/ui/dist/server/assets/routes-BzkJgq4W.js +0 -34
- package/apps/ui/dist/server/assets/select-GW76p-ld.js +0 -76
- package/apps/ui/dist/server/assets/settings-OayxIYQQ.js +0 -100
- package/apps/ui/dist/server/assets/settings-store-DpEJEQ7M.js +0 -52
- package/apps/ui/dist/server/assets/shared-DyhChtHf.js +0 -137
- package/apps/ui/dist/server/assets/source-session-export-server-DNutCawb.js +0 -38
- package/apps/ui/dist/server/assets/sqlite-error-LZDrnxdd.js +0 -13
- package/apps/ui/dist/server/assets/start-B_HFwkkk.js +0 -4
- package/apps/ui/dist/server/assets/tabs-DkaChNVg.js +0 -501
- package/apps/ui/dist/server/assets/text-filter-CGKxMCKt.js +0 -36
- package/apps/ui/dist/server/assets/thread-transcript-stats-Dh34mt2u.js +0 -45
- package/apps/ui/dist/server/assets/threads._threadId-BSSK4nkI.js +0 -26
- package/apps/ui/dist/server/assets/threads._threadId-BeXEc4Lo.js +0 -648
- package/apps/ui/dist/server/assets/threads._threadId-Ci0S4mKU.js +0 -18
- package/apps/ui/dist/server/assets/ui-export-files-BHLX9bhN.js +0 -83
- package/apps/ui/dist/server/assets/utils-C_uf36nf.js +0 -8
- package/apps/ui/dist/server/server.js +0 -5895
- package/bin/codex-chats-claude.js +0 -5
- package/bin/codex-chats.js +0 -5
- package/bin/spiracha.js +0 -5
- package/src/export-chats.ts +0 -120
- package/src/export-claude.ts +0 -36
- package/src/export-cursor.ts +0 -244
- package/src/lib/claude-exporter.ts +0 -864
- package/src/lib/codex-exporter-cli.ts +0 -277
- package/src/lib/codex-exporter-db.ts +0 -319
- package/src/lib/codex-exporter.ts +0 -115
- package/src/lib/cursor-exporter.ts +0 -266
- package/src/lib/interactive-cli.ts +0 -433
- package/src/lib/native-open.ts +0 -54
- package/src/mcp-server.ts +0 -137
- package/src/spiracha.ts +0 -116
- package/src/ui-cli.ts +0 -310
- /package/apps/ui/{dist/client → public}/icon.svg +0 -0
- /package/apps/ui/{dist/client → public}/manifest.json +0 -0
- /package/apps/ui/{dist/client → public}/robots.txt +0 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ConversationDeepLinks,
|
|
3
|
+
ConversationMessage,
|
|
4
|
+
ConversationMessagePhase,
|
|
5
|
+
ConversationMessageRole,
|
|
6
|
+
ConversationSource,
|
|
7
|
+
} from './types';
|
|
8
|
+
|
|
9
|
+
export const toDateMs = (value: string | number | null | undefined): number | null => {
|
|
10
|
+
if (typeof value === 'number') {
|
|
11
|
+
return Number.isFinite(value) ? value : null;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (!value) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const parsed = Date.parse(value);
|
|
19
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const decodeFileUri = (value: string | null | undefined): string | null => {
|
|
23
|
+
if (!value) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (!value.startsWith('file://')) {
|
|
28
|
+
return value;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
const url = new URL(value);
|
|
33
|
+
const pathname = decodeURIComponent(url.pathname);
|
|
34
|
+
if (url.hostname) {
|
|
35
|
+
return `//${url.hostname}${pathname}`;
|
|
36
|
+
}
|
|
37
|
+
return pathname.replace(/^\/([A-Za-z]:)/u, '$1');
|
|
38
|
+
} catch {
|
|
39
|
+
const pathValue = decodeURIComponent(value.slice('file://'.length));
|
|
40
|
+
return pathValue.replace(/^\/([A-Za-z]:)/u, '$1');
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const createDeepLinks = (
|
|
45
|
+
source: ConversationSource,
|
|
46
|
+
id: string,
|
|
47
|
+
uiPath: string,
|
|
48
|
+
native: string | null = null,
|
|
49
|
+
): ConversationDeepLinks => ({
|
|
50
|
+
native,
|
|
51
|
+
spiracha: `spiracha://conversation/${source}/${id}`,
|
|
52
|
+
ui: uiPath,
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
export const normalizeRole = (role: string | null | undefined): ConversationMessageRole => {
|
|
56
|
+
if (role === 'assistant' || role === 'system' || role === 'tool' || role === 'user') {
|
|
57
|
+
return role;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return 'unknown';
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export const normalizeAssistantPhase = (
|
|
64
|
+
phase: string | null | undefined,
|
|
65
|
+
fallback: ConversationMessagePhase = 'final_answer',
|
|
66
|
+
): ConversationMessagePhase => {
|
|
67
|
+
if (phase === 'final_answer' || phase === 'final') {
|
|
68
|
+
return 'final_answer';
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (phase === 'commentary') {
|
|
72
|
+
return 'commentary';
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return fallback;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const createTextMessage = (input: {
|
|
79
|
+
createdAtMs: number | null;
|
|
80
|
+
id: string;
|
|
81
|
+
metadata?: Record<string, unknown>;
|
|
82
|
+
order: number;
|
|
83
|
+
phase: ConversationMessagePhase;
|
|
84
|
+
role: ConversationMessageRole;
|
|
85
|
+
text: string | null | undefined;
|
|
86
|
+
}): ConversationMessage[] => {
|
|
87
|
+
const text = input.text?.trim();
|
|
88
|
+
if (!text) {
|
|
89
|
+
return [];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return [
|
|
93
|
+
{
|
|
94
|
+
createdAtMs: input.createdAtMs,
|
|
95
|
+
id: input.id,
|
|
96
|
+
metadata: input.metadata ?? {},
|
|
97
|
+
order: input.order,
|
|
98
|
+
phase: input.phase,
|
|
99
|
+
role: input.role,
|
|
100
|
+
text,
|
|
101
|
+
},
|
|
102
|
+
];
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export const finalizeMessages = (messages: ConversationMessage[]) => {
|
|
106
|
+
return messages.map((message, index) => ({
|
|
107
|
+
...message,
|
|
108
|
+
order: index,
|
|
109
|
+
}));
|
|
110
|
+
};
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { listAntigravityConversations, readAntigravityConversationMessages } from '../antigravity-db';
|
|
2
|
+
import type { AntigravityConversation } from '../antigravity-exporter-types';
|
|
3
|
+
import { resolveAntigravityRoots } from '../antigravity-exporter-types';
|
|
4
|
+
import { cleanInlineTitle } from '../shared';
|
|
5
|
+
import { createDeepLinks, decodeFileUri, finalizeMessages } from './adapter-helpers';
|
|
6
|
+
import { selectConversationMessages } from './message-selector';
|
|
7
|
+
import { getConversationPathMatch, getFirstConversationPathMatch } from './path-match';
|
|
8
|
+
import type {
|
|
9
|
+
ConversationAdapter,
|
|
10
|
+
ConversationDetail,
|
|
11
|
+
ConversationMessage,
|
|
12
|
+
ConversationPathMatch,
|
|
13
|
+
GetConversationOptions,
|
|
14
|
+
ListConversationsForPathOptions,
|
|
15
|
+
} from './types';
|
|
16
|
+
|
|
17
|
+
const getRoots = (options: { locations?: { antigravityRoots?: string[] } }) =>
|
|
18
|
+
options.locations?.antigravityRoots ?? resolveAntigravityRoots();
|
|
19
|
+
|
|
20
|
+
const getWorkspacePath = (conversation: AntigravityConversation) =>
|
|
21
|
+
conversation.workspaceFolder ?? decodeFileUri(conversation.workspaceUri);
|
|
22
|
+
|
|
23
|
+
const stripTrailingPathPunctuation = (value: string) => value.replace(/[),.;:\]`]+$/u, '');
|
|
24
|
+
|
|
25
|
+
const extractAbsolutePathReferences = (text: string): string[] => {
|
|
26
|
+
return [...new Set((text.match(/\/[^\s"'`)\]]+/gu) ?? []).map(stripTrailingPathPunctuation))];
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const readMessages = async (conversation: AntigravityConversation) => {
|
|
30
|
+
const messages = await readAntigravityConversationMessages(conversation);
|
|
31
|
+
return finalizeMessages(
|
|
32
|
+
messages.map(
|
|
33
|
+
(message): ConversationMessage => ({
|
|
34
|
+
...message,
|
|
35
|
+
id: `${conversation.conversationId}:${message.order}:${message.role}:${message.phase}`,
|
|
36
|
+
metadata: {
|
|
37
|
+
...message.metadata,
|
|
38
|
+
model: conversation.model,
|
|
39
|
+
transcriptSource: conversation.transcriptSource,
|
|
40
|
+
},
|
|
41
|
+
}),
|
|
42
|
+
),
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const buildConversation = async (
|
|
47
|
+
conversation: AntigravityConversation,
|
|
48
|
+
matches: ConversationPathMatch[],
|
|
49
|
+
options: Pick<ListConversationsForPathOptions, 'includeMessages' | 'messageSelector'>,
|
|
50
|
+
preloadedMessages: ConversationMessage[] | null = null,
|
|
51
|
+
): Promise<ConversationDetail> => {
|
|
52
|
+
const allMessages = options.includeMessages ? (preloadedMessages ?? (await readMessages(conversation))) : [];
|
|
53
|
+
const messages = options.includeMessages
|
|
54
|
+
? selectConversationMessages(allMessages, options.messageSelector ?? 'last_final_answer')
|
|
55
|
+
: [];
|
|
56
|
+
const workspacePath = getWorkspacePath(conversation);
|
|
57
|
+
|
|
58
|
+
return {
|
|
59
|
+
createdAtMs: conversation.createdAtMs,
|
|
60
|
+
deepLinks: createDeepLinks(
|
|
61
|
+
'antigravity',
|
|
62
|
+
conversation.conversationId,
|
|
63
|
+
`/antigravity-conversations/${conversation.conversationId}`,
|
|
64
|
+
),
|
|
65
|
+
id: conversation.conversationId,
|
|
66
|
+
matches,
|
|
67
|
+
messageCount: options.includeMessages ? allMessages.length : conversation.transcriptEntryCount,
|
|
68
|
+
messages,
|
|
69
|
+
metadata: {
|
|
70
|
+
artifactCount: conversation.artifactCount,
|
|
71
|
+
lockedTranscript: conversation.transcriptSource === 'safe-storage',
|
|
72
|
+
model: conversation.model,
|
|
73
|
+
transcriptSource: conversation.transcriptSource,
|
|
74
|
+
},
|
|
75
|
+
source: 'antigravity',
|
|
76
|
+
title: cleanInlineTitle(conversation.title),
|
|
77
|
+
updatedAtMs: conversation.lastUpdatedAtMs ?? conversation.conversationMtimeMs,
|
|
78
|
+
workspaceKey: conversation.workspaceKey,
|
|
79
|
+
workspacePath,
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const isWithinUpdatedWindow = (
|
|
84
|
+
conversation: AntigravityConversation,
|
|
85
|
+
options: Pick<ListConversationsForPathOptions, 'updatedAfterMs' | 'updatedBeforeMs'>,
|
|
86
|
+
) => {
|
|
87
|
+
const updatedAtMs = conversation.lastUpdatedAtMs ?? conversation.conversationMtimeMs ?? 0;
|
|
88
|
+
if (options.updatedAfterMs !== undefined && updatedAtMs < options.updatedAfterMs) {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
if (options.updatedBeforeMs !== undefined && updatedAtMs > options.updatedBeforeMs) {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
return true;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const getReferencedPathMatch = async (
|
|
98
|
+
requestedPath: string,
|
|
99
|
+
messages: ConversationMessage[],
|
|
100
|
+
): Promise<ConversationPathMatch | null> => {
|
|
101
|
+
const referencedPaths = messages.flatMap((message) => extractAbsolutePathReferences(message.text));
|
|
102
|
+
return getFirstConversationPathMatch(requestedPath, referencedPaths);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const listAntigravityConversationsForPath = async (options: ListConversationsForPathOptions) => {
|
|
106
|
+
const roots = getRoots(options);
|
|
107
|
+
const conversations = await listAntigravityConversations(roots);
|
|
108
|
+
const result: ConversationDetail[] = [];
|
|
109
|
+
|
|
110
|
+
for (const conversation of conversations) {
|
|
111
|
+
if (!isWithinUpdatedWindow(conversation, options)) {
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const workspacePath = getWorkspacePath(conversation);
|
|
116
|
+
const match = await getConversationPathMatch(options.cwd, workspacePath);
|
|
117
|
+
if (match) {
|
|
118
|
+
result.push(await buildConversation(conversation, [match], options));
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const messages = await readMessages(conversation);
|
|
123
|
+
const referencedPathMatch = await getReferencedPathMatch(options.cwd, messages);
|
|
124
|
+
if (referencedPathMatch) {
|
|
125
|
+
result.push(await buildConversation(conversation, [referencedPathMatch], options, messages));
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return result;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const getAntigravityConversation = async (options: GetConversationOptions): Promise<ConversationDetail | null> => {
|
|
133
|
+
const conversation = (await listAntigravityConversations(getRoots(options))).find(
|
|
134
|
+
(entry) => entry.conversationId === options.id,
|
|
135
|
+
);
|
|
136
|
+
return conversation
|
|
137
|
+
? buildConversation(conversation, [], {
|
|
138
|
+
includeMessages: true,
|
|
139
|
+
messageSelector: options.messageSelector ?? 'all',
|
|
140
|
+
})
|
|
141
|
+
: null;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
export const antigravityConversationAdapter: ConversationAdapter = {
|
|
145
|
+
getConversation: getAntigravityConversation,
|
|
146
|
+
listConversationsForPath: listAntigravityConversationsForPath,
|
|
147
|
+
source: 'antigravity',
|
|
148
|
+
};
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import {
|
|
2
|
+
listClaudeCodeSessionsForGroup,
|
|
3
|
+
listClaudeCodeWorkspaceGroups,
|
|
4
|
+
readClaudeCodeSessionTranscript,
|
|
5
|
+
} from '../claude-code-db';
|
|
6
|
+
import type {
|
|
7
|
+
ClaudeCodeSessionSummary,
|
|
8
|
+
ClaudeCodeSessionTranscript,
|
|
9
|
+
ClaudeCodeTranscriptEntry,
|
|
10
|
+
ClaudeCodeTranscriptPart,
|
|
11
|
+
} from '../claude-code-exporter-types';
|
|
12
|
+
import { getClaudeCodeAssistantMessagePhase, resolveClaudeCodeProjectsDir } from '../claude-code-exporter-types';
|
|
13
|
+
import { cleanInlineTitle } from '../shared';
|
|
14
|
+
import {
|
|
15
|
+
createDeepLinks,
|
|
16
|
+
createTextMessage,
|
|
17
|
+
finalizeMessages,
|
|
18
|
+
normalizeAssistantPhase,
|
|
19
|
+
normalizeRole,
|
|
20
|
+
toDateMs,
|
|
21
|
+
} from './adapter-helpers';
|
|
22
|
+
import { selectConversationMessages } from './message-selector';
|
|
23
|
+
import { getConversationPathMatch } from './path-match';
|
|
24
|
+
import type {
|
|
25
|
+
ConversationAdapter,
|
|
26
|
+
ConversationDetail,
|
|
27
|
+
ConversationMessage,
|
|
28
|
+
ConversationPathMatch,
|
|
29
|
+
GetConversationOptions,
|
|
30
|
+
ListConversationsForPathOptions,
|
|
31
|
+
} from './types';
|
|
32
|
+
|
|
33
|
+
const getProjectsDir = (options: { locations?: { claudeCodeProjectsDir?: string } }) =>
|
|
34
|
+
options.locations?.claudeCodeProjectsDir ?? resolveClaudeCodeProjectsDir();
|
|
35
|
+
|
|
36
|
+
const partToMessages = (
|
|
37
|
+
entry: ClaudeCodeTranscriptEntry,
|
|
38
|
+
part: ClaudeCodeTranscriptPart,
|
|
39
|
+
partIndex: number,
|
|
40
|
+
): ConversationMessage[] => {
|
|
41
|
+
const createdAtMs = toDateMs(entry.timestamp);
|
|
42
|
+
const baseId = `${entry.entryId}:${partIndex}`;
|
|
43
|
+
if (part.type === 'text') {
|
|
44
|
+
return createTextMessage({
|
|
45
|
+
createdAtMs,
|
|
46
|
+
id: baseId,
|
|
47
|
+
order: partIndex,
|
|
48
|
+
phase: normalizeAssistantPhase(getClaudeCodeAssistantMessagePhase(entry), 'unknown'),
|
|
49
|
+
role: normalizeRole(entry.role),
|
|
50
|
+
text: part.text,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (part.type === 'thinking') {
|
|
55
|
+
return createTextMessage({
|
|
56
|
+
createdAtMs,
|
|
57
|
+
id: baseId,
|
|
58
|
+
order: partIndex,
|
|
59
|
+
phase: 'reasoning',
|
|
60
|
+
role: 'assistant',
|
|
61
|
+
text: part.text,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (part.type === 'tool_use') {
|
|
66
|
+
return createTextMessage({
|
|
67
|
+
createdAtMs,
|
|
68
|
+
id: baseId,
|
|
69
|
+
metadata: { toolName: part.toolName, toolUseId: part.toolUseId },
|
|
70
|
+
order: partIndex,
|
|
71
|
+
phase: 'tool_call',
|
|
72
|
+
role: 'tool',
|
|
73
|
+
text: [part.toolName, part.argumentsText].filter(Boolean).join('\n'),
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (part.type === 'tool_result') {
|
|
78
|
+
return createTextMessage({
|
|
79
|
+
createdAtMs,
|
|
80
|
+
id: baseId,
|
|
81
|
+
metadata: { isError: part.isError, toolUseId: part.toolUseId },
|
|
82
|
+
order: partIndex,
|
|
83
|
+
phase: 'tool_output',
|
|
84
|
+
role: 'tool',
|
|
85
|
+
text: part.outputText,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return [];
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const transcriptToMessages = (transcript: ClaudeCodeSessionTranscript): ConversationMessage[] => {
|
|
93
|
+
return finalizeMessages(
|
|
94
|
+
transcript.entries.flatMap((entry) =>
|
|
95
|
+
entry.parts.flatMap((part, partIndex) => partToMessages(entry, part, partIndex)),
|
|
96
|
+
),
|
|
97
|
+
);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const buildConversation = async (
|
|
101
|
+
session: ClaudeCodeSessionSummary,
|
|
102
|
+
projectsDir: string,
|
|
103
|
+
matches: ConversationPathMatch[],
|
|
104
|
+
options: Pick<ListConversationsForPathOptions, 'includeMessages' | 'messageSelector'>,
|
|
105
|
+
): Promise<ConversationDetail> => {
|
|
106
|
+
const transcript = options.includeMessages
|
|
107
|
+
? await readClaudeCodeSessionTranscript(projectsDir, session.sessionId)
|
|
108
|
+
: null;
|
|
109
|
+
const allMessages = transcript ? transcriptToMessages(transcript) : [];
|
|
110
|
+
const messages = options.includeMessages
|
|
111
|
+
? selectConversationMessages(allMessages, options.messageSelector ?? 'last_final_answer')
|
|
112
|
+
: [];
|
|
113
|
+
|
|
114
|
+
return {
|
|
115
|
+
createdAtMs: session.createdAtMs,
|
|
116
|
+
deepLinks: createDeepLinks('claude-code', session.sessionId, `/claude-code-sessions/${session.sessionId}`),
|
|
117
|
+
id: session.sessionId,
|
|
118
|
+
matches,
|
|
119
|
+
messageCount: options.includeMessages ? allMessages.length : session.messageCount,
|
|
120
|
+
messages,
|
|
121
|
+
metadata: {
|
|
122
|
+
filePath: session.filePath,
|
|
123
|
+
gitBranch: session.gitBranch,
|
|
124
|
+
model: session.model,
|
|
125
|
+
totalTokens: session.totalTokens,
|
|
126
|
+
version: session.version,
|
|
127
|
+
},
|
|
128
|
+
source: 'claude-code',
|
|
129
|
+
title: cleanInlineTitle(session.title),
|
|
130
|
+
updatedAtMs: session.lastActiveAtMs,
|
|
131
|
+
workspaceKey: session.workspaceKey,
|
|
132
|
+
workspacePath: session.worktree,
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const listClaudeConversationsForPath = async (
|
|
137
|
+
options: ListConversationsForPathOptions,
|
|
138
|
+
): Promise<ConversationDetail[]> => {
|
|
139
|
+
const projectsDir = getProjectsDir(options);
|
|
140
|
+
const groups = await listClaudeCodeWorkspaceGroups(projectsDir);
|
|
141
|
+
const conversations: ConversationDetail[] = [];
|
|
142
|
+
|
|
143
|
+
for (const group of groups) {
|
|
144
|
+
const match = await getConversationPathMatch(options.cwd, group.worktree);
|
|
145
|
+
if (!match) {
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const sessions = await listClaudeCodeSessionsForGroup(group.key, projectsDir);
|
|
150
|
+
for (const session of sessions) {
|
|
151
|
+
conversations.push(await buildConversation(session, projectsDir, [match], options));
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return conversations;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
const getClaudeConversation = async (options: GetConversationOptions): Promise<ConversationDetail | null> => {
|
|
159
|
+
const projectsDir = getProjectsDir(options);
|
|
160
|
+
const transcript = await readClaudeCodeSessionTranscript(projectsDir, options.id);
|
|
161
|
+
if (!transcript) {
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return buildConversation(transcript.session, projectsDir, [], {
|
|
166
|
+
includeMessages: true,
|
|
167
|
+
messageSelector: options.messageSelector ?? 'all',
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
export const claudeCodeConversationAdapter: ConversationAdapter = {
|
|
172
|
+
getConversation: getClaudeConversation,
|
|
173
|
+
listConversationsForPath: listClaudeConversationsForPath,
|
|
174
|
+
source: 'claude-code',
|
|
175
|
+
};
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { getThreadBrowseData, listScopedThreads, resolveCodexThreadDbPath } from '../codex-browser-db';
|
|
2
|
+
import type { MessageEvent, ThreadBrowseData, ThreadEvent } from '../codex-browser-types';
|
|
3
|
+
import { parseCodexTranscriptFile } from '../codex-thread-parser';
|
|
4
|
+
import type { ThreadRow } from '../codex-thread-types';
|
|
5
|
+
import { cleanInlineTitle } from '../shared';
|
|
6
|
+
import { selectConversationMessages } from './message-selector';
|
|
7
|
+
import { getConversationPathMatch } from './path-match';
|
|
8
|
+
import type {
|
|
9
|
+
ConversationAdapter,
|
|
10
|
+
ConversationDetail,
|
|
11
|
+
ConversationMessage,
|
|
12
|
+
ConversationMessagePhase,
|
|
13
|
+
ConversationMessageRole,
|
|
14
|
+
ConversationPathMatch,
|
|
15
|
+
GetConversationOptions,
|
|
16
|
+
ListConversationsForPathOptions,
|
|
17
|
+
} from './types';
|
|
18
|
+
|
|
19
|
+
const getCodexDbPath = (options: { locations?: { codexDbPath?: string } }) => {
|
|
20
|
+
return options.locations?.codexDbPath ?? resolveCodexThreadDbPath();
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const toTimestampMs = (thread: ThreadRow) => {
|
|
24
|
+
return thread.updated_at_ms ?? thread.updated_at * 1000;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const toCreatedAtMs = (thread: ThreadRow) => {
|
|
28
|
+
return thread.created_at_ms ?? thread.created_at * 1000;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const buildCodexDeepLinks = (id: string) => ({
|
|
32
|
+
native: `codex://threads/${id}`,
|
|
33
|
+
spiracha: `spiracha://conversation/codex/${id}`,
|
|
34
|
+
ui: `/threads/${id}`,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const normalizeRole = (role: string): ConversationMessageRole => {
|
|
38
|
+
if (role === 'assistant' || role === 'user' || role === 'system') {
|
|
39
|
+
return role;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return 'unknown';
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const normalizeMessagePhase = (event: MessageEvent): ConversationMessagePhase => {
|
|
46
|
+
if (event.role !== 'assistant') {
|
|
47
|
+
return 'unknown';
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (event.phase === 'final_answer' || event.phase === 'final') {
|
|
51
|
+
return 'final_answer';
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (event.phase === 'commentary' || event.isHiddenByDefault) {
|
|
55
|
+
return 'commentary';
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return 'final_answer';
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const toMessageEventMessage = (event: MessageEvent): ConversationMessage | null => {
|
|
62
|
+
const text = event.text.trim();
|
|
63
|
+
if (!text) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
createdAtMs: event.timestamp ? Date.parse(event.timestamp) : null,
|
|
69
|
+
id: `codex:${event.sequence}`,
|
|
70
|
+
metadata: {
|
|
71
|
+
model: event.model,
|
|
72
|
+
variant: event.variant,
|
|
73
|
+
},
|
|
74
|
+
order: event.sequence,
|
|
75
|
+
phase: normalizeMessagePhase(event),
|
|
76
|
+
role: normalizeRole(event.role),
|
|
77
|
+
text,
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const toToolMessage = (event: ThreadEvent): ConversationMessage | null => {
|
|
82
|
+
if (event.kind === 'tool_call') {
|
|
83
|
+
return {
|
|
84
|
+
createdAtMs: event.timestamp ? Date.parse(event.timestamp) : null,
|
|
85
|
+
id: `codex:${event.sequence}`,
|
|
86
|
+
metadata: {
|
|
87
|
+
callId: event.callId,
|
|
88
|
+
command: event.command,
|
|
89
|
+
name: event.name,
|
|
90
|
+
workdir: event.workdir,
|
|
91
|
+
},
|
|
92
|
+
order: event.sequence,
|
|
93
|
+
phase: 'tool_call',
|
|
94
|
+
role: 'tool',
|
|
95
|
+
text: event.command ?? event.name,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (event.kind === 'tool_output') {
|
|
100
|
+
const text = event.summary || event.outputText;
|
|
101
|
+
return {
|
|
102
|
+
createdAtMs: event.timestamp ? Date.parse(event.timestamp) : null,
|
|
103
|
+
id: `codex:${event.sequence}`,
|
|
104
|
+
metadata: {
|
|
105
|
+
callId: event.callId,
|
|
106
|
+
exitCode: event.exitCode,
|
|
107
|
+
wallTime: event.wallTime,
|
|
108
|
+
},
|
|
109
|
+
order: event.sequence,
|
|
110
|
+
phase: 'tool_output',
|
|
111
|
+
role: 'tool',
|
|
112
|
+
text,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return null;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const toConversationMessage = (event: ThreadEvent): ConversationMessage | null => {
|
|
120
|
+
if (event.kind === 'message') {
|
|
121
|
+
return toMessageEventMessage(event);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (event.kind === 'reasoning') {
|
|
125
|
+
const text = event.summary.join('\n').trim();
|
|
126
|
+
return text
|
|
127
|
+
? {
|
|
128
|
+
createdAtMs: event.timestamp ? Date.parse(event.timestamp) : null,
|
|
129
|
+
id: `codex:${event.sequence}`,
|
|
130
|
+
metadata: {
|
|
131
|
+
hasEncryptedContent: event.hasEncryptedContent,
|
|
132
|
+
},
|
|
133
|
+
order: event.sequence,
|
|
134
|
+
phase: 'reasoning',
|
|
135
|
+
role: 'assistant',
|
|
136
|
+
text,
|
|
137
|
+
}
|
|
138
|
+
: null;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return toToolMessage(event);
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
const readCodexMessages = async (thread: ThreadRow): Promise<ConversationMessage[]> => {
|
|
145
|
+
const transcript = await parseCodexTranscriptFile(thread.rollout_path, {
|
|
146
|
+
includeRaw: false,
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
return transcript.events.flatMap((event) => {
|
|
150
|
+
const message = toConversationMessage(event);
|
|
151
|
+
return message ? [message] : [];
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
const buildCodexConversation = async (
|
|
156
|
+
thread: ThreadRow,
|
|
157
|
+
matches: ConversationPathMatch[],
|
|
158
|
+
options: { includeMessages: boolean; messageSelector: ListConversationsForPathOptions['messageSelector'] },
|
|
159
|
+
): Promise<ConversationDetail> => {
|
|
160
|
+
const allMessages = options.includeMessages ? await readCodexMessages(thread) : [];
|
|
161
|
+
const messages = options.includeMessages
|
|
162
|
+
? selectConversationMessages(allMessages, options.messageSelector ?? 'last_final_answer')
|
|
163
|
+
: [];
|
|
164
|
+
|
|
165
|
+
return {
|
|
166
|
+
createdAtMs: toCreatedAtMs(thread),
|
|
167
|
+
deepLinks: buildCodexDeepLinks(thread.id),
|
|
168
|
+
id: thread.id,
|
|
169
|
+
matches,
|
|
170
|
+
messageCount: options.includeMessages ? allMessages.length : null,
|
|
171
|
+
messages,
|
|
172
|
+
metadata: {
|
|
173
|
+
agentNickname: thread.agent_nickname,
|
|
174
|
+
agentPath: thread.agent_path,
|
|
175
|
+
agentRole: thread.agent_role,
|
|
176
|
+
archived: Boolean(thread.archived),
|
|
177
|
+
cliVersion: thread.cli_version,
|
|
178
|
+
model: thread.model,
|
|
179
|
+
modelProvider: thread.model_provider,
|
|
180
|
+
tokensUsed: thread.tokens_used,
|
|
181
|
+
},
|
|
182
|
+
source: 'codex',
|
|
183
|
+
title: cleanInlineTitle(thread.title || thread.first_user_message || thread.id),
|
|
184
|
+
updatedAtMs: toTimestampMs(thread),
|
|
185
|
+
workspaceKey: thread.cwd ? `folder:${thread.cwd}` : null,
|
|
186
|
+
workspacePath: thread.cwd || null,
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
const filterThreadsForPath = async (
|
|
191
|
+
threads: ThreadRow[],
|
|
192
|
+
cwd: string,
|
|
193
|
+
): Promise<Array<{ matches: ConversationPathMatch[]; thread: ThreadRow }>> => {
|
|
194
|
+
const filtered: Array<{ matches: ConversationPathMatch[]; thread: ThreadRow }> = [];
|
|
195
|
+
for (const thread of threads) {
|
|
196
|
+
const match = await getConversationPathMatch(cwd, thread.cwd);
|
|
197
|
+
if (match) {
|
|
198
|
+
filtered.push({ matches: [match], thread });
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
return filtered;
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
const listCodexConversationsForPath = async (
|
|
206
|
+
options: ListConversationsForPathOptions,
|
|
207
|
+
): Promise<ConversationDetail[]> => {
|
|
208
|
+
const dbPath = getCodexDbPath(options);
|
|
209
|
+
const threads = listScopedThreads(dbPath, null);
|
|
210
|
+
const matchedThreads = await filterThreadsForPath(threads, options.cwd);
|
|
211
|
+
|
|
212
|
+
return Promise.all(
|
|
213
|
+
matchedThreads.map(({ matches, thread }) =>
|
|
214
|
+
buildCodexConversation(thread, matches, {
|
|
215
|
+
includeMessages: options.includeMessages ?? false,
|
|
216
|
+
messageSelector: options.messageSelector,
|
|
217
|
+
}),
|
|
218
|
+
),
|
|
219
|
+
);
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
const getCodexConversation = async (options: GetConversationOptions): Promise<ConversationDetail | null> => {
|
|
223
|
+
const dbPath = getCodexDbPath(options);
|
|
224
|
+
let browseData: ThreadBrowseData;
|
|
225
|
+
try {
|
|
226
|
+
browseData = getThreadBrowseData(dbPath, options.id);
|
|
227
|
+
} catch (error) {
|
|
228
|
+
if (error instanceof Error && /not found/i.test(error.message)) {
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
throw error;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
return buildCodexConversation(browseData.thread, [], {
|
|
236
|
+
includeMessages: true,
|
|
237
|
+
messageSelector: options.messageSelector ?? 'all',
|
|
238
|
+
});
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
export const codexConversationAdapter: ConversationAdapter = {
|
|
242
|
+
getConversation: getCodexConversation,
|
|
243
|
+
listConversationsForPath: listCodexConversationsForPath,
|
|
244
|
+
source: 'codex',
|
|
245
|
+
};
|