spiracha 1.5.0 → 2.1.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 +94 -269
- package/apps/ui/AGENTS.md +17 -7
- package/apps/ui/README.md +52 -8
- package/apps/ui/components.json +21 -0
- package/apps/ui/package.json +65 -0
- package/apps/ui/src/components/antigravity-conversations-table.tsx +245 -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 +125 -0
- package/apps/ui/src/components/breadcrumbs.tsx +71 -0
- package/apps/ui/src/components/claude-code-sessions-table.tsx +150 -0
- package/apps/ui/src/components/claude-code-workspaces-table.tsx +57 -0
- package/apps/ui/src/components/cursor-threads-table.tsx +152 -0
- package/apps/ui/src/components/cursor-workspaces-table.tsx +140 -0
- package/apps/ui/src/components/data-table.tsx +243 -0
- package/apps/ui/src/components/delete-confirm-dialog.tsx +88 -0
- package/apps/ui/src/components/export-dialog.tsx +174 -0
- package/apps/ui/src/components/grok-sessions-table.tsx +146 -0
- package/apps/ui/src/components/grok-workspaces-table.tsx +53 -0
- package/apps/ui/src/components/json-panel.tsx +17 -0
- package/apps/ui/src/components/kiro-sessions-table.tsx +148 -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 +164 -0
- package/apps/ui/src/components/opencode-workspaces-table.tsx +57 -0
- package/apps/ui/src/components/page-header.tsx +39 -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 +133 -0
- package/apps/ui/src/components/qoder-workspaces-table.tsx +57 -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/selection-actions-toolbar.tsx +80 -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 +165 -0
- package/apps/ui/src/components/transcript-view.tsx +648 -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 +41 -0
- package/apps/ui/src/lib/antigravity-queries.ts +33 -0
- package/apps/ui/src/lib/antigravity-server.ts +273 -0
- package/apps/ui/src/lib/antigravity-transcript-events.ts +343 -0
- package/apps/ui/src/lib/claude-code-queries.ts +34 -0
- package/apps/ui/src/lib/claude-code-server.ts +243 -0
- package/apps/ui/src/lib/claude-code-transcript-events.ts +161 -0
- package/apps/ui/src/lib/codex-queries.ts +82 -0
- package/apps/ui/src/lib/codex-server.ts +291 -0
- package/apps/ui/src/lib/cursor-queries.ts +37 -0
- package/apps/ui/src/lib/cursor-server.ts +315 -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 +147 -0
- package/apps/ui/src/lib/grok-queries.ts +22 -0
- package/apps/ui/src/lib/grok-server.ts +169 -0
- package/apps/ui/src/lib/grok-transcript-events.ts +149 -0
- package/apps/ui/src/lib/kiro-queries.ts +22 -0
- package/apps/ui/src/lib/kiro-server.ts +151 -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 +151 -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 +135 -0
- package/apps/ui/src/lib/qoder-transcript-events.ts +139 -0
- package/apps/ui/src/lib/route-search.ts +182 -0
- package/apps/ui/src/lib/settings-store.tsx +59 -0
- package/apps/ui/src/lib/source-session-export-server.ts +139 -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-load.ts +15 -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/lib/workspace-delete-navigation.ts +12 -0
- package/apps/ui/src/routeTree.gen.ts +837 -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 +504 -0
- package/apps/ui/src/routes/antigravity.$workspaceKey.tsx +365 -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 +16 -0
- package/apps/ui/src/routes/api.v1.conversations.delete.ts +12 -0
- package/apps/ui/src/routes/api.v1.conversations.export.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 +468 -0
- package/apps/ui/src/routes/claude-code.$workspaceKey.tsx +274 -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 +426 -0
- package/apps/ui/src/routes/cursor.index.tsx +120 -0
- package/apps/ui/src/routes/grok-sessions.$sessionId.tsx +388 -0
- package/apps/ui/src/routes/grok.$workspaceKey.tsx +301 -0
- package/apps/ui/src/routes/grok.index.tsx +48 -0
- package/apps/ui/src/routes/index.tsx +124 -0
- package/apps/ui/src/routes/kiro-sessions.$sessionId.tsx +396 -0
- package/apps/ui/src/routes/kiro.$workspaceKey.tsx +303 -0
- package/apps/ui/src/routes/kiro.index.tsx +48 -0
- package/apps/ui/src/routes/opencode-sessions.$sessionId.tsx +420 -0
- package/apps/ui/src/routes/opencode.$workspaceKey.tsx +327 -0
- package/apps/ui/src/routes/opencode.index.tsx +61 -0
- package/apps/ui/src/routes/qoder-sessions.$sessionId.tsx +344 -0
- package/apps/ui/src/routes/qoder.$workspaceKey.tsx +186 -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 +1103 -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 +54 -80
- package/src/client.ts +423 -0
- package/src/lib/antigravity-db.ts +414 -44
- package/src/lib/antigravity-exporter-types.ts +4 -0
- package/src/lib/antigravity-projects.ts +201 -0
- package/src/lib/claude-code-db.ts +498 -32
- package/src/lib/claude-code-exporter-types.ts +5 -0
- package/src/lib/claude-code-transcript-phase.ts +60 -1
- package/src/lib/claude-code-transcript.ts +8 -5
- package/src/lib/codex-analytics.ts +1 -1
- package/src/lib/codex-browser-db.ts +410 -74
- package/src/lib/codex-browser-export.ts +29 -41
- package/src/lib/codex-browser-types.ts +1 -1
- package/src/lib/codex-thread-cache.ts +41 -13
- package/src/lib/codex-thread-parser.ts +86 -35
- package/src/lib/{codex-exporter-types.ts → codex-thread-types.ts} +2 -30
- package/src/lib/codex-transcript-filter.ts +31 -0
- package/src/lib/{codex-exporter-transcript.ts → codex-transcript-renderer.ts} +104 -48
- package/src/lib/concurrency.ts +41 -0
- package/src/lib/conversation-api.ts +1172 -0
- package/src/lib/conversation-data/adapter-helpers.ts +110 -0
- package/src/lib/conversation-data/antigravity-adapter.ts +167 -0
- package/src/lib/conversation-data/claude-code-adapter.ts +206 -0
- package/src/lib/conversation-data/codex-adapter.ts +269 -0
- package/src/lib/conversation-data/cursor-adapter.ts +205 -0
- package/src/lib/conversation-data/grok-adapter.ts +210 -0
- package/src/lib/conversation-data/index.ts +386 -0
- package/src/lib/conversation-data/kiro-adapter.ts +174 -0
- package/src/lib/conversation-data/message-selector.ts +37 -0
- package/src/lib/conversation-data/opencode-adapter.ts +202 -0
- package/src/lib/conversation-data/path-match.ts +79 -0
- package/src/lib/conversation-data/qoder-adapter.ts +255 -0
- package/src/lib/conversation-data/types.ts +159 -0
- package/src/lib/conversation-zip-export.ts +57 -0
- package/src/lib/cursor-db.ts +100 -25
- package/src/lib/cursor-exporter-types.ts +0 -19
- package/src/lib/grok-db.ts +1026 -0
- package/src/lib/grok-exporter-types.ts +110 -0
- package/src/lib/grok-transcript-phase.ts +52 -0
- package/src/lib/grok-transcript.ts +154 -0
- package/src/lib/kiro-db.ts +52 -1
- package/src/lib/model-label.ts +11 -3
- package/src/lib/opencode-db.ts +598 -55
- package/src/lib/opencode-transcript.ts +8 -5
- 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/src/lib/shared.ts +12 -0
- package/src/lib/transcript-load-limiter.ts +82 -0
- package/src/lib/ui-cache.ts +43 -17
- package/src/lib/ui-export-archive.ts +60 -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,167 @@
|
|
|
1
|
+
import {
|
|
2
|
+
deleteAntigravityConversation,
|
|
3
|
+
listAntigravityConversations,
|
|
4
|
+
readAntigravityConversationMessages,
|
|
5
|
+
} from '../antigravity-db';
|
|
6
|
+
import type { AntigravityConversation } from '../antigravity-exporter-types';
|
|
7
|
+
import { resolveAntigravityRoots } from '../antigravity-exporter-types';
|
|
8
|
+
import { cleanInlineTitle } from '../shared';
|
|
9
|
+
import { runWithTranscriptLoadLimit } from '../transcript-load-limiter';
|
|
10
|
+
import { createDeepLinks, decodeFileUri, finalizeMessages } from './adapter-helpers';
|
|
11
|
+
import { selectConversationMessages } from './message-selector';
|
|
12
|
+
import { getConversationPathMatch, getFirstConversationPathMatch } from './path-match';
|
|
13
|
+
import type {
|
|
14
|
+
ConversationAdapter,
|
|
15
|
+
ConversationDetail,
|
|
16
|
+
ConversationMessage,
|
|
17
|
+
ConversationPathMatch,
|
|
18
|
+
DeleteConversationOptions,
|
|
19
|
+
GetConversationOptions,
|
|
20
|
+
ListConversationsForPathOptions,
|
|
21
|
+
} from './types';
|
|
22
|
+
|
|
23
|
+
const getRoots = (options: { locations?: { antigravityRoots?: string[] } }) =>
|
|
24
|
+
options.locations?.antigravityRoots ?? resolveAntigravityRoots();
|
|
25
|
+
|
|
26
|
+
const getWorkspacePath = (conversation: AntigravityConversation) =>
|
|
27
|
+
conversation.workspaceFolder ?? decodeFileUri(conversation.workspaceUri);
|
|
28
|
+
|
|
29
|
+
const stripTrailingPathPunctuation = (value: string) => value.replace(/[),.;:\]`]+$/u, '');
|
|
30
|
+
|
|
31
|
+
const extractAbsolutePathReferences = (text: string): string[] => {
|
|
32
|
+
return [...new Set((text.match(/\/[^\s"'`)\]]+/gu) ?? []).map(stripTrailingPathPunctuation))];
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const readMessages = async (conversation: AntigravityConversation) => {
|
|
36
|
+
const messages = await runWithTranscriptLoadLimit(() => readAntigravityConversationMessages(conversation), {
|
|
37
|
+
id: conversation.conversationId,
|
|
38
|
+
path: conversation.transcriptPath ?? conversation.conversationPath ?? undefined,
|
|
39
|
+
source: 'antigravity-api',
|
|
40
|
+
});
|
|
41
|
+
return finalizeMessages(
|
|
42
|
+
messages.map(
|
|
43
|
+
(message): ConversationMessage => ({
|
|
44
|
+
...message,
|
|
45
|
+
id: `${conversation.conversationId}:${message.order}:${message.role}:${message.phase}`,
|
|
46
|
+
metadata: {
|
|
47
|
+
...message.metadata,
|
|
48
|
+
model: conversation.model,
|
|
49
|
+
transcriptSource: conversation.transcriptSource,
|
|
50
|
+
},
|
|
51
|
+
}),
|
|
52
|
+
),
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const buildConversation = async (
|
|
57
|
+
conversation: AntigravityConversation,
|
|
58
|
+
matches: ConversationPathMatch[],
|
|
59
|
+
options: Pick<ListConversationsForPathOptions, 'includeMessages' | 'messageSelector'>,
|
|
60
|
+
preloadedMessages: ConversationMessage[] | null = null,
|
|
61
|
+
): Promise<ConversationDetail> => {
|
|
62
|
+
const allMessages = options.includeMessages ? (preloadedMessages ?? (await readMessages(conversation))) : [];
|
|
63
|
+
const messages = options.includeMessages
|
|
64
|
+
? selectConversationMessages(allMessages, options.messageSelector ?? 'last_final_answer')
|
|
65
|
+
: [];
|
|
66
|
+
const workspacePath = getWorkspacePath(conversation);
|
|
67
|
+
|
|
68
|
+
return {
|
|
69
|
+
createdAtMs: conversation.createdAtMs,
|
|
70
|
+
deepLinks: createDeepLinks(
|
|
71
|
+
'antigravity',
|
|
72
|
+
conversation.conversationId,
|
|
73
|
+
`/antigravity-conversations/${conversation.conversationId}`,
|
|
74
|
+
),
|
|
75
|
+
id: conversation.conversationId,
|
|
76
|
+
matches,
|
|
77
|
+
messageCount: options.includeMessages ? allMessages.length : conversation.transcriptEntryCount,
|
|
78
|
+
messages,
|
|
79
|
+
metadata: {
|
|
80
|
+
artifactCount: conversation.artifactCount,
|
|
81
|
+
lockedTranscript: conversation.transcriptSource === 'safe-storage',
|
|
82
|
+
model: conversation.model,
|
|
83
|
+
transcriptSource: conversation.transcriptSource,
|
|
84
|
+
},
|
|
85
|
+
source: 'antigravity',
|
|
86
|
+
title: cleanInlineTitle(conversation.title),
|
|
87
|
+
updatedAtMs: conversation.lastUpdatedAtMs ?? conversation.conversationMtimeMs,
|
|
88
|
+
workspaceKey: conversation.workspaceKey,
|
|
89
|
+
workspacePath,
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const isWithinUpdatedWindow = (
|
|
94
|
+
conversation: AntigravityConversation,
|
|
95
|
+
options: Pick<ListConversationsForPathOptions, 'updatedAfterMs' | 'updatedBeforeMs'>,
|
|
96
|
+
) => {
|
|
97
|
+
const updatedAtMs = conversation.lastUpdatedAtMs ?? conversation.conversationMtimeMs ?? 0;
|
|
98
|
+
if (options.updatedAfterMs !== undefined && updatedAtMs < options.updatedAfterMs) {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
if (options.updatedBeforeMs !== undefined && updatedAtMs > options.updatedBeforeMs) {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
return true;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
const getReferencedPathMatch = async (
|
|
108
|
+
requestedPath: string,
|
|
109
|
+
messages: ConversationMessage[],
|
|
110
|
+
): Promise<ConversationPathMatch | null> => {
|
|
111
|
+
const referencedPaths = messages.flatMap((message) => extractAbsolutePathReferences(message.text));
|
|
112
|
+
return getFirstConversationPathMatch(requestedPath, referencedPaths);
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const listAntigravityConversationsForPath = async (options: ListConversationsForPathOptions) => {
|
|
116
|
+
const roots = getRoots(options);
|
|
117
|
+
const conversations = await listAntigravityConversations(roots);
|
|
118
|
+
const result: ConversationDetail[] = [];
|
|
119
|
+
|
|
120
|
+
for (const conversation of conversations) {
|
|
121
|
+
if (!isWithinUpdatedWindow(conversation, options)) {
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const workspacePath = getWorkspacePath(conversation);
|
|
126
|
+
const match = await getConversationPathMatch(options.cwd, workspacePath);
|
|
127
|
+
if (match) {
|
|
128
|
+
result.push(await buildConversation(conversation, [match], options));
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const messages = await readMessages(conversation);
|
|
133
|
+
const referencedPathMatch = await getReferencedPathMatch(options.cwd, messages);
|
|
134
|
+
if (referencedPathMatch) {
|
|
135
|
+
result.push(await buildConversation(conversation, [referencedPathMatch], options, messages));
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return result;
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
const getAntigravityConversation = async (options: GetConversationOptions): Promise<ConversationDetail | null> => {
|
|
143
|
+
const conversation = (await listAntigravityConversations(getRoots(options))).find(
|
|
144
|
+
(entry) => entry.conversationId === options.id,
|
|
145
|
+
);
|
|
146
|
+
return conversation
|
|
147
|
+
? buildConversation(conversation, [], {
|
|
148
|
+
includeMessages: true,
|
|
149
|
+
messageSelector: options.messageSelector ?? 'all',
|
|
150
|
+
})
|
|
151
|
+
: null;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
const deleteAntigravityConversationById = async (options: DeleteConversationOptions) => {
|
|
155
|
+
const result = await deleteAntigravityConversation(getRoots(options), options.id);
|
|
156
|
+
return {
|
|
157
|
+
deletedFiles: result.deletedPaths,
|
|
158
|
+
deletedIds: result.deletedConversationIds,
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
export const antigravityConversationAdapter: ConversationAdapter = {
|
|
163
|
+
deleteConversation: deleteAntigravityConversationById,
|
|
164
|
+
getConversation: getAntigravityConversation,
|
|
165
|
+
listConversationsForPath: listAntigravityConversationsForPath,
|
|
166
|
+
source: 'antigravity',
|
|
167
|
+
};
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import {
|
|
2
|
+
deleteClaudeCodeSession,
|
|
3
|
+
listClaudeCodeSessionsForGroup,
|
|
4
|
+
listClaudeCodeWorkspaceGroups,
|
|
5
|
+
readClaudeCodeSessionTranscript,
|
|
6
|
+
} from '../claude-code-db';
|
|
7
|
+
import type {
|
|
8
|
+
ClaudeCodeSessionSummary,
|
|
9
|
+
ClaudeCodeSessionTranscript,
|
|
10
|
+
ClaudeCodeTranscriptEntry,
|
|
11
|
+
ClaudeCodeTranscriptPart,
|
|
12
|
+
} from '../claude-code-exporter-types';
|
|
13
|
+
import { getClaudeCodeAssistantMessagePhase, resolveClaudeCodeProjectsDir } from '../claude-code-exporter-types';
|
|
14
|
+
import { cleanInlineTitle } from '../shared';
|
|
15
|
+
import { runWithTranscriptLoadLimit } from '../transcript-load-limiter';
|
|
16
|
+
import {
|
|
17
|
+
createDeepLinks,
|
|
18
|
+
createTextMessage,
|
|
19
|
+
finalizeMessages,
|
|
20
|
+
normalizeAssistantPhase,
|
|
21
|
+
normalizeRole,
|
|
22
|
+
toDateMs,
|
|
23
|
+
} from './adapter-helpers';
|
|
24
|
+
import { selectConversationMessages } from './message-selector';
|
|
25
|
+
import { getConversationPathMatch } from './path-match';
|
|
26
|
+
import type {
|
|
27
|
+
ConversationAdapter,
|
|
28
|
+
ConversationDetail,
|
|
29
|
+
ConversationMessage,
|
|
30
|
+
ConversationPathMatch,
|
|
31
|
+
DeleteConversationOptions,
|
|
32
|
+
GetConversationOptions,
|
|
33
|
+
ListConversationsForPathOptions,
|
|
34
|
+
} from './types';
|
|
35
|
+
|
|
36
|
+
const getProjectsDir = (options: { locations?: { claudeCodeProjectsDir?: string } }) =>
|
|
37
|
+
options.locations?.claudeCodeProjectsDir ?? resolveClaudeCodeProjectsDir();
|
|
38
|
+
|
|
39
|
+
const partToMessages = (
|
|
40
|
+
entry: ClaudeCodeTranscriptEntry,
|
|
41
|
+
part: ClaudeCodeTranscriptPart,
|
|
42
|
+
partIndex: number,
|
|
43
|
+
): ConversationMessage[] => {
|
|
44
|
+
const createdAtMs = toDateMs(entry.timestamp);
|
|
45
|
+
const baseId = `${entry.entryId}:${partIndex}`;
|
|
46
|
+
if (part.type === 'text') {
|
|
47
|
+
return createTextMessage({
|
|
48
|
+
createdAtMs,
|
|
49
|
+
id: baseId,
|
|
50
|
+
order: partIndex,
|
|
51
|
+
phase: normalizeAssistantPhase(getClaudeCodeAssistantMessagePhase(entry), 'unknown'),
|
|
52
|
+
role: normalizeRole(entry.role),
|
|
53
|
+
text: part.text,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (part.type === 'thinking') {
|
|
58
|
+
return createTextMessage({
|
|
59
|
+
createdAtMs,
|
|
60
|
+
id: baseId,
|
|
61
|
+
order: partIndex,
|
|
62
|
+
phase: 'reasoning',
|
|
63
|
+
role: 'assistant',
|
|
64
|
+
text: part.text,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (part.type === 'tool_use') {
|
|
69
|
+
return createTextMessage({
|
|
70
|
+
createdAtMs,
|
|
71
|
+
id: baseId,
|
|
72
|
+
metadata: { toolName: part.toolName, toolUseId: part.toolUseId },
|
|
73
|
+
order: partIndex,
|
|
74
|
+
phase: 'tool_call',
|
|
75
|
+
role: 'tool',
|
|
76
|
+
text: [part.toolName, part.argumentsText].filter(Boolean).join('\n'),
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (part.type === 'tool_result') {
|
|
81
|
+
return createTextMessage({
|
|
82
|
+
createdAtMs,
|
|
83
|
+
id: baseId,
|
|
84
|
+
metadata: { isError: part.isError, toolUseId: part.toolUseId },
|
|
85
|
+
order: partIndex,
|
|
86
|
+
phase: 'tool_output',
|
|
87
|
+
role: 'tool',
|
|
88
|
+
text: part.outputText,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return [];
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const transcriptToMessages = (transcript: ClaudeCodeSessionTranscript): ConversationMessage[] => {
|
|
96
|
+
return finalizeMessages(
|
|
97
|
+
transcript.entries.flatMap((entry) =>
|
|
98
|
+
entry.parts.flatMap((part, partIndex) => partToMessages(entry, part, partIndex)),
|
|
99
|
+
),
|
|
100
|
+
);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const buildConversation = async (
|
|
104
|
+
session: ClaudeCodeSessionSummary,
|
|
105
|
+
projectsDir: string,
|
|
106
|
+
matches: ConversationPathMatch[],
|
|
107
|
+
options: Pick<ListConversationsForPathOptions, 'includeMessages' | 'messageSelector'>,
|
|
108
|
+
loadedTranscript: ClaudeCodeSessionTranscript | null = null,
|
|
109
|
+
): Promise<ConversationDetail> => {
|
|
110
|
+
const transcript = options.includeMessages
|
|
111
|
+
? (loadedTranscript ??
|
|
112
|
+
(await runWithTranscriptLoadLimit(() => readClaudeCodeSessionTranscript(projectsDir, session.sessionId), {
|
|
113
|
+
id: session.sessionId,
|
|
114
|
+
path: session.filePath,
|
|
115
|
+
source: 'claude-code-api',
|
|
116
|
+
})))
|
|
117
|
+
: null;
|
|
118
|
+
const allMessages = transcript ? transcriptToMessages(transcript) : [];
|
|
119
|
+
const messages = options.includeMessages
|
|
120
|
+
? selectConversationMessages(allMessages, options.messageSelector ?? 'last_final_answer')
|
|
121
|
+
: [];
|
|
122
|
+
|
|
123
|
+
return {
|
|
124
|
+
createdAtMs: session.createdAtMs,
|
|
125
|
+
deepLinks: createDeepLinks('claude-code', session.sessionId, `/claude-code-sessions/${session.sessionId}`),
|
|
126
|
+
id: session.sessionId,
|
|
127
|
+
matches,
|
|
128
|
+
messageCount: options.includeMessages ? allMessages.length : session.messageCount,
|
|
129
|
+
messages,
|
|
130
|
+
metadata: {
|
|
131
|
+
filePath: session.filePath,
|
|
132
|
+
gitBranch: session.gitBranch,
|
|
133
|
+
model: session.model,
|
|
134
|
+
totalTokens: session.totalTokens,
|
|
135
|
+
version: session.version,
|
|
136
|
+
},
|
|
137
|
+
source: 'claude-code',
|
|
138
|
+
title: cleanInlineTitle(session.title),
|
|
139
|
+
updatedAtMs: session.lastActiveAtMs,
|
|
140
|
+
workspaceKey: session.workspaceKey,
|
|
141
|
+
workspacePath: session.worktree,
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const listClaudeConversationsForPath = async (
|
|
146
|
+
options: ListConversationsForPathOptions,
|
|
147
|
+
): Promise<ConversationDetail[]> => {
|
|
148
|
+
const projectsDir = getProjectsDir(options);
|
|
149
|
+
const groups = await listClaudeCodeWorkspaceGroups(projectsDir);
|
|
150
|
+
const conversations: ConversationDetail[] = [];
|
|
151
|
+
|
|
152
|
+
for (const group of groups) {
|
|
153
|
+
const match = await getConversationPathMatch(options.cwd, group.worktree);
|
|
154
|
+
if (!match) {
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const sessions = await listClaudeCodeSessionsForGroup(group.key, projectsDir);
|
|
159
|
+
for (const session of sessions) {
|
|
160
|
+
conversations.push(await buildConversation(session, projectsDir, [match], options));
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return conversations;
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
const getClaudeConversation = async (options: GetConversationOptions): Promise<ConversationDetail | null> => {
|
|
168
|
+
const projectsDir = getProjectsDir(options);
|
|
169
|
+
const transcript = await runWithTranscriptLoadLimit(
|
|
170
|
+
() => readClaudeCodeSessionTranscript(projectsDir, options.id),
|
|
171
|
+
{
|
|
172
|
+
id: options.id,
|
|
173
|
+
path: projectsDir,
|
|
174
|
+
source: 'claude-code-api',
|
|
175
|
+
},
|
|
176
|
+
);
|
|
177
|
+
if (!transcript) {
|
|
178
|
+
return null;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return buildConversation(
|
|
182
|
+
transcript.session,
|
|
183
|
+
projectsDir,
|
|
184
|
+
[],
|
|
185
|
+
{
|
|
186
|
+
includeMessages: true,
|
|
187
|
+
messageSelector: options.messageSelector ?? 'all',
|
|
188
|
+
},
|
|
189
|
+
transcript,
|
|
190
|
+
);
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
const deleteClaudeConversation = async (options: DeleteConversationOptions) => {
|
|
194
|
+
const result = await deleteClaudeCodeSession(getProjectsDir(options), options.id);
|
|
195
|
+
return {
|
|
196
|
+
deletedFiles: result.deletedFiles,
|
|
197
|
+
deletedIds: result.deletedSessionIds,
|
|
198
|
+
};
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
export const claudeCodeConversationAdapter: ConversationAdapter = {
|
|
202
|
+
deleteConversation: deleteClaudeConversation,
|
|
203
|
+
getConversation: getClaudeConversation,
|
|
204
|
+
listConversationsForPath: listClaudeConversationsForPath,
|
|
205
|
+
source: 'claude-code',
|
|
206
|
+
};
|