@ebowwa/coder 0.2.1 → 0.7.64
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/README.md +31 -32
- package/dist/core/__tests__/permissions.test.d.ts +12 -0
- package/dist/core/__tests__/permissions.test.d.ts.map +1 -0
- package/dist/core/__tests__/permissions.test.js +851 -0
- package/dist/core/agent-loop/__tests__/compaction.test.d.ts +5 -0
- package/dist/core/agent-loop/__tests__/compaction.test.d.ts.map +1 -0
- package/dist/core/agent-loop/__tests__/compaction.test.js +209 -0
- package/dist/core/agent-loop/__tests__/formatters.test.d.ts +5 -0
- package/dist/core/agent-loop/__tests__/formatters.test.d.ts.map +1 -0
- package/dist/core/agent-loop/__tests__/formatters.test.js +195 -0
- package/dist/core/agent-loop/__tests__/index.test.d.ts +5 -0
- package/dist/core/agent-loop/__tests__/index.test.d.ts.map +1 -0
- package/dist/core/agent-loop/__tests__/index.test.js +121 -0
- package/dist/core/agent-loop/__tests__/loop-state.test.d.ts +5 -0
- package/dist/core/agent-loop/__tests__/loop-state.test.d.ts.map +1 -0
- package/dist/core/agent-loop/__tests__/loop-state.test.js +340 -0
- package/dist/core/agent-loop/__tests__/message-builder.test.d.ts +5 -0
- package/dist/core/agent-loop/__tests__/message-builder.test.d.ts.map +1 -0
- package/dist/core/agent-loop/__tests__/message-builder.test.js +178 -0
- package/dist/core/agent-loop/__tests__/tool-executor.test.d.ts +5 -0
- package/dist/core/agent-loop/__tests__/tool-executor.test.d.ts.map +1 -0
- package/dist/core/agent-loop/__tests__/tool-executor.test.js +331 -0
- package/dist/core/agent-loop/compaction.d.ts +39 -0
- package/dist/core/agent-loop/compaction.d.ts.map +1 -0
- package/dist/core/agent-loop/compaction.js +51 -0
- package/dist/core/agent-loop/formatters.d.ts +21 -0
- package/dist/core/agent-loop/formatters.d.ts.map +1 -0
- package/dist/core/agent-loop/formatters.js +42 -0
- package/dist/core/agent-loop/index.d.ts +25 -0
- package/dist/core/agent-loop/index.d.ts.map +1 -0
- package/dist/core/agent-loop/index.js +83 -0
- package/dist/core/agent-loop/loop-state.d.ts +74 -0
- package/dist/core/agent-loop/loop-state.d.ts.map +1 -0
- package/dist/core/agent-loop/loop-state.js +147 -0
- package/dist/core/agent-loop/message-builder.d.ts +13 -0
- package/dist/core/agent-loop/message-builder.d.ts.map +1 -0
- package/dist/core/agent-loop/message-builder.js +49 -0
- package/dist/core/agent-loop/tool-executor.d.ts +23 -0
- package/dist/core/agent-loop/tool-executor.d.ts.map +1 -0
- package/dist/core/agent-loop/tool-executor.js +152 -0
- package/dist/core/agent-loop/turn-executor.d.ts +57 -0
- package/dist/core/agent-loop/turn-executor.d.ts.map +1 -0
- package/dist/core/agent-loop/turn-executor.js +124 -0
- package/dist/core/agent-loop/types.d.ts +141 -0
- package/dist/core/agent-loop/types.d.ts.map +1 -0
- package/dist/core/agent-loop/types.js +4 -0
- package/dist/core/agent-loop.d.ts +17 -0
- package/dist/core/agent-loop.d.ts.map +1 -0
- package/dist/core/agent-loop.js +16 -0
- package/dist/core/api-client-impl.d.ts +62 -0
- package/dist/core/api-client-impl.d.ts.map +1 -0
- package/dist/core/api-client-impl.js +479 -0
- package/dist/core/api-client.d.ts +6 -0
- package/dist/core/api-client.d.ts.map +1 -0
- package/dist/core/api-client.js +5 -0
- package/dist/core/checkpoints.d.ts +128 -0
- package/dist/core/checkpoints.d.ts.map +1 -0
- package/dist/core/checkpoints.js +438 -0
- package/dist/core/claude-md.d.ts +71 -0
- package/dist/core/claude-md.d.ts.map +1 -0
- package/dist/core/claude-md.js +198 -0
- package/dist/core/cognitive-security/hooks.d.ts +138 -0
- package/dist/core/cognitive-security/hooks.d.ts.map +1 -0
- package/dist/core/cognitive-security/hooks.js +389 -0
- package/dist/core/cognitive-security/index.d.ts +751 -0
- package/dist/core/cognitive-security/index.d.ts.map +1 -0
- package/dist/core/cognitive-security/index.js +1123 -0
- package/dist/core/cognitive-security/middleware.d.ts +136 -0
- package/dist/core/cognitive-security/middleware.d.ts.map +1 -0
- package/dist/core/cognitive-security/middleware.js +376 -0
- package/dist/core/config-loader.d.ts +127 -0
- package/dist/core/config-loader.d.ts.map +1 -0
- package/dist/core/config-loader.js +219 -0
- package/dist/core/context-compaction.d.ts +87 -0
- package/dist/core/context-compaction.d.ts.map +1 -0
- package/dist/core/context-compaction.js +428 -0
- package/dist/core/git-status.d.ts +25 -0
- package/dist/core/git-status.d.ts.map +1 -0
- package/dist/core/git-status.js +204 -0
- package/dist/core/image.d.ts +69 -0
- package/dist/core/image.d.ts.map +1 -0
- package/dist/core/image.js +290 -0
- package/dist/core/image.test.d.ts +2 -0
- package/dist/core/image.test.d.ts.map +1 -0
- package/dist/core/image.test.js +149 -0
- package/dist/core/models.d.ts +123 -0
- package/dist/core/models.d.ts.map +1 -0
- package/dist/core/models.js +325 -0
- package/dist/core/permissions.d.ts +81 -0
- package/dist/core/permissions.d.ts.map +1 -0
- package/dist/core/permissions.js +327 -0
- package/dist/core/retry.d.ts +25 -0
- package/dist/core/retry.d.ts.map +1 -0
- package/dist/core/retry.js +121 -0
- package/dist/core/session-store.d.ts +9 -0
- package/dist/core/session-store.d.ts.map +1 -0
- package/dist/core/session-store.js +10 -0
- package/dist/core/sessions/export.d.ts +47 -0
- package/dist/core/sessions/export.d.ts.map +1 -0
- package/dist/core/sessions/export.js +256 -0
- package/dist/core/sessions/index.d.ts +132 -0
- package/dist/core/sessions/index.d.ts.map +1 -0
- package/dist/core/sessions/index.js +442 -0
- package/dist/core/sessions/metadata.d.ts +77 -0
- package/dist/core/sessions/metadata.d.ts.map +1 -0
- package/dist/core/sessions/metadata.js +233 -0
- package/dist/core/sessions/persistence.d.ts +72 -0
- package/dist/core/sessions/persistence.d.ts.map +1 -0
- package/dist/core/sessions/persistence.js +201 -0
- package/dist/core/sessions/types.d.ts +110 -0
- package/dist/core/sessions/types.d.ts.map +1 -0
- package/dist/core/sessions/types.js +4 -0
- package/dist/core/stream-highlighter.d.ts +18 -0
- package/dist/core/stream-highlighter.d.ts.map +1 -0
- package/dist/core/stream-highlighter.js +916 -0
- package/dist/core/system-reminders.d.ts +89 -0
- package/dist/core/system-reminders.d.ts.map +1 -0
- package/dist/core/system-reminders.js +285 -0
- package/dist/ecosystem/hooks/__tests__/index.test.d.ts +5 -0
- package/dist/ecosystem/hooks/__tests__/index.test.d.ts.map +1 -0
- package/dist/ecosystem/hooks/__tests__/index.test.js +458 -0
- package/dist/ecosystem/hooks/index.d.ts +59 -0
- package/dist/ecosystem/hooks/index.d.ts.map +1 -0
- package/dist/ecosystem/hooks/index.js +294 -0
- package/dist/ecosystem/hooks/prompt-evaluator.d.ts +32 -0
- package/dist/ecosystem/hooks/prompt-evaluator.d.ts.map +1 -0
- package/dist/ecosystem/hooks/prompt-evaluator.js +229 -0
- package/dist/ecosystem/skills/index.d.ts +55 -0
- package/dist/ecosystem/skills/index.d.ts.map +1 -0
- package/dist/ecosystem/skills/index.js +258 -0
- package/dist/ecosystem/tools/__tests__/index.test.d.ts +7 -0
- package/dist/ecosystem/tools/__tests__/index.test.d.ts.map +1 -0
- package/dist/ecosystem/tools/__tests__/index.test.js +856 -0
- package/dist/ecosystem/tools/index.d.ts +24 -0
- package/dist/ecosystem/tools/index.d.ts.map +1 -0
- package/dist/ecosystem/tools/index.js +1709 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -2
- package/dist/interfaces/mcp/client.d.ts +40 -0
- package/dist/interfaces/mcp/client.d.ts.map +1 -0
- package/dist/interfaces/mcp/client.js +309 -0
- package/dist/interfaces/ui/index.d.ts +36 -0
- package/dist/interfaces/ui/index.d.ts.map +1 -0
- package/dist/interfaces/ui/index.js +61 -0
- package/dist/interfaces/ui/spinner.d.ts +140 -0
- package/dist/interfaces/ui/spinner.d.ts.map +1 -0
- package/dist/interfaces/ui/spinner.js +342 -0
- package/dist/interfaces/ui/terminal/cli/index.d.ts +12 -0
- package/dist/interfaces/ui/terminal/cli/index.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/cli/index.js +167 -0
- package/dist/interfaces/ui/terminal/shared/args.d.ts +39 -0
- package/dist/interfaces/ui/terminal/shared/args.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/shared/args.js +176 -0
- package/dist/interfaces/ui/terminal/shared/index.d.ts +11 -0
- package/dist/interfaces/ui/terminal/shared/index.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/shared/index.js +16 -0
- package/dist/interfaces/ui/terminal/shared/loading-state.d.ts +124 -0
- package/dist/interfaces/ui/terminal/shared/loading-state.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/shared/loading-state.js +246 -0
- package/dist/interfaces/ui/terminal/shared/query.d.ts +22 -0
- package/dist/interfaces/ui/terminal/shared/query.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/shared/query.js +100 -0
- package/dist/interfaces/ui/terminal/shared/setup.d.ts +33 -0
- package/dist/interfaces/ui/terminal/shared/setup.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/shared/setup.js +226 -0
- package/dist/interfaces/ui/terminal/shared/status-line.d.ts +117 -0
- package/dist/interfaces/ui/terminal/shared/status-line.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/shared/status-line.js +267 -0
- package/dist/interfaces/ui/terminal/shared/system-prompt.d.ts +38 -0
- package/dist/interfaces/ui/terminal/shared/system-prompt.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/shared/system-prompt.js +102 -0
- package/dist/interfaces/ui/terminal/tui/HelpPanel.d.ts +39 -0
- package/dist/interfaces/ui/terminal/tui/HelpPanel.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/HelpPanel.js +215 -0
- package/dist/interfaces/ui/terminal/tui/InputContext.d.ts +91 -0
- package/dist/interfaces/ui/terminal/tui/InputContext.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/InputContext.js +154 -0
- package/dist/interfaces/ui/terminal/tui/InputField.d.ts +18 -0
- package/dist/interfaces/ui/terminal/tui/InputField.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/InputField.js +41 -0
- package/dist/interfaces/ui/terminal/tui/InteractiveTUI.d.ts +16 -0
- package/dist/interfaces/ui/terminal/tui/InteractiveTUI.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/InteractiveTUI.js +451 -0
- package/dist/interfaces/ui/terminal/tui/MessageArea.d.ts +10 -0
- package/dist/interfaces/ui/terminal/tui/MessageArea.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/MessageArea.js +91 -0
- package/dist/interfaces/ui/terminal/tui/MessageStore.d.ts +48 -0
- package/dist/interfaces/ui/terminal/tui/MessageStore.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/MessageStore.js +151 -0
- package/dist/interfaces/ui/terminal/tui/StatusBar.d.ts +9 -0
- package/dist/interfaces/ui/terminal/tui/StatusBar.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/StatusBar.js +36 -0
- package/dist/interfaces/ui/terminal/tui/commands.d.ts +21 -0
- package/dist/interfaces/ui/terminal/tui/commands.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/commands.js +359 -0
- package/dist/interfaces/ui/terminal/tui/components/InteractiveElements.d.ts +115 -0
- package/dist/interfaces/ui/terminal/tui/components/InteractiveElements.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/components/InteractiveElements.js +306 -0
- package/dist/interfaces/ui/terminal/tui/components/MultilineInput.d.ts +92 -0
- package/dist/interfaces/ui/terminal/tui/components/MultilineInput.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/components/MultilineInput.js +399 -0
- package/dist/interfaces/ui/terminal/tui/components/PaneManager.d.ts +59 -0
- package/dist/interfaces/ui/terminal/tui/components/PaneManager.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/components/PaneManager.js +139 -0
- package/dist/interfaces/ui/terminal/tui/components/Sidebar.d.ts +68 -0
- package/dist/interfaces/ui/terminal/tui/components/Sidebar.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/components/Sidebar.js +340 -0
- package/dist/interfaces/ui/terminal/tui/components/index.d.ts +23 -0
- package/dist/interfaces/ui/terminal/tui/components/index.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/components/index.js +51 -0
- package/dist/interfaces/ui/terminal/tui/console.d.ts +20 -0
- package/dist/interfaces/ui/terminal/tui/console.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/console.js +46 -0
- package/dist/interfaces/ui/terminal/tui/index.d.ts +20 -0
- package/dist/interfaces/ui/terminal/tui/index.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/index.js +28 -0
- package/dist/interfaces/ui/terminal/tui/run.d.ts +13 -0
- package/dist/interfaces/ui/terminal/tui/run.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/run.js +31 -0
- package/dist/interfaces/ui/terminal/tui/spinner.d.ts +44 -0
- package/dist/interfaces/ui/terminal/tui/spinner.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/spinner.js +59 -0
- package/dist/interfaces/ui/terminal/tui/tui-app.d.ts +39 -0
- package/dist/interfaces/ui/terminal/tui/tui-app.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/tui-app.js +198 -0
- package/dist/interfaces/ui/terminal/tui/tui-footer.d.ts +167 -0
- package/dist/interfaces/ui/terminal/tui/tui-footer.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/tui-footer.js +330 -0
- package/dist/interfaces/ui/terminal/tui/types.d.ts +165 -0
- package/dist/interfaces/ui/terminal/tui/types.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/types.js +5 -0
- package/dist/interfaces/ui/terminal/tui/useInputHandler.d.ts +23 -0
- package/dist/interfaces/ui/terminal/tui/useInputHandler.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/useInputHandler.js +72 -0
- package/dist/interfaces/ui/terminal/tui/useNativeInput.d.ts +90 -0
- package/dist/interfaces/ui/terminal/tui/useNativeInput.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/useNativeInput.js +188 -0
- package/dist/native/index.d.ts +480 -0
- package/dist/native/index.d.ts.map +1 -0
- package/dist/native/index.js +1625 -0
- package/dist/teammates/index.d.ts +161 -0
- package/dist/teammates/index.d.ts.map +1 -0
- package/dist/teammates/index.js +827 -0
- package/dist/types/index.d.ts +482 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +52 -0
- package/native/README.md +5 -5
- package/native/index.darwin-arm64.node +0 -0
- package/native/index.node +0 -0
- package/native/package.json +4 -4
- package/package.json +33 -16
- package/packages/src/core/__tests__/permissions.test.ts +1091 -0
- package/packages/src/core/agent-loop/__tests__/compaction.test.ts +280 -0
- package/packages/src/core/agent-loop/__tests__/formatters.test.ts +234 -0
- package/packages/src/core/agent-loop/__tests__/index.test.ts +162 -0
- package/packages/src/core/agent-loop/__tests__/loop-state.test.ts +413 -0
- package/packages/src/core/agent-loop/__tests__/message-builder.test.ts +229 -0
- package/packages/src/core/agent-loop/__tests__/tool-executor.test.ts +457 -0
- package/packages/src/core/agent-loop/compaction.ts +88 -0
- package/packages/src/core/agent-loop/formatters.ts +50 -0
- package/packages/src/core/agent-loop/index.ts +135 -0
- package/packages/src/core/agent-loop/loop-state.ts +187 -0
- package/packages/src/core/agent-loop/message-builder.ts +62 -0
- package/packages/src/core/agent-loop/tool-executor.ts +211 -0
- package/packages/src/core/agent-loop/turn-executor.ts +222 -0
- package/packages/src/core/agent-loop/types.ts +148 -0
- package/packages/src/core/agent-loop.ts +18 -0
- package/packages/src/core/api-client-impl.ts +619 -0
- package/packages/src/core/api-client.ts +6 -0
- package/packages/src/core/checkpoints.ts +606 -0
- package/packages/src/core/claude-md.ts +272 -0
- package/packages/src/core/cognitive-security/hooks.ts +590 -0
- package/packages/src/core/cognitive-security/index.ts +2041 -0
- package/packages/src/core/cognitive-security/middleware.ts +536 -0
- package/packages/src/core/config-loader.ts +324 -0
- package/packages/src/core/context-compaction.ts +578 -0
- package/packages/src/core/git-status.ts +262 -0
- package/packages/src/core/image.test.ts +180 -0
- package/packages/src/core/image.ts +350 -0
- package/packages/src/core/lmdb.db +0 -0
- package/packages/src/core/lmdb.db-lock +0 -0
- package/packages/src/core/models.ts +430 -0
- package/packages/src/core/normalizers/todo +4 -0
- package/packages/src/core/permissions.ts +431 -0
- package/packages/src/core/retry.ts +170 -0
- package/packages/src/core/session-store.ts +36 -0
- package/packages/src/core/sessions/export.ts +329 -0
- package/packages/src/core/sessions/index.ts +587 -0
- package/packages/src/core/sessions/metadata.ts +309 -0
- package/packages/src/core/sessions/persistence.ts +244 -0
- package/packages/src/core/sessions/types.ts +169 -0
- package/packages/src/core/stream-highlighter.ts +1123 -0
- package/packages/src/core/system-reminders.ts +402 -0
- package/packages/src/core/todo +8 -0
- package/packages/src/ecosystem/hooks/__tests__/index.test.ts +561 -0
- package/packages/src/ecosystem/hooks/index.ts +341 -0
- package/packages/src/ecosystem/hooks/prompt-evaluator.ts +300 -0
- package/packages/src/ecosystem/skills/index.ts +295 -0
- package/packages/src/ecosystem/tools/__tests__/index.test.ts +1335 -0
- package/packages/src/ecosystem/tools/index.ts +1877 -0
- package/packages/src/index.ts +120 -0
- package/packages/src/interfaces/mcp/client.ts +389 -0
- package/packages/src/interfaces/ui/Screenshot 2026-03-02 at 9.23.10/342/200/257PM.png +0 -0
- package/packages/src/interfaces/ui/Screenshot 2026-03-03 at 10.55.11/342/200/257AM.png +0 -0
- package/packages/src/interfaces/ui/index.ts +161 -0
- package/packages/src/interfaces/ui/lmdb.db +0 -0
- package/packages/src/interfaces/ui/lmdb.db-lock +0 -0
- package/packages/src/interfaces/ui/spinner.ts +451 -0
- package/packages/src/interfaces/ui/terminal/cli/index.ts +228 -0
- package/packages/src/interfaces/ui/terminal/lmdb.db +0 -0
- package/packages/src/interfaces/ui/terminal/lmdb.db-lock +0 -0
- package/packages/src/interfaces/ui/terminal/shared/args.ts +222 -0
- package/packages/src/interfaces/ui/terminal/shared/index.ts +71 -0
- package/packages/src/interfaces/ui/terminal/shared/loading-state.ts +322 -0
- package/packages/src/interfaces/ui/terminal/shared/query.ts +146 -0
- package/packages/src/interfaces/ui/terminal/shared/setup.ts +295 -0
- package/packages/src/interfaces/ui/terminal/shared/status-line.ts +358 -0
- package/packages/src/interfaces/ui/terminal/shared/system-prompt.ts +146 -0
- package/packages/src/interfaces/ui/terminal/tui/HelpPanel.tsx +262 -0
- package/packages/src/interfaces/ui/terminal/tui/InputContext.tsx +232 -0
- package/packages/src/interfaces/ui/terminal/tui/InputField.tsx +62 -0
- package/packages/src/interfaces/ui/terminal/tui/InteractiveTUI.tsx +537 -0
- package/packages/src/interfaces/ui/terminal/tui/MessageArea.tsx +107 -0
- package/packages/src/interfaces/ui/terminal/tui/MessageStore.tsx +240 -0
- package/packages/src/interfaces/ui/terminal/tui/StatusBar.tsx +54 -0
- package/packages/src/interfaces/ui/terminal/tui/commands.ts +438 -0
- package/packages/src/interfaces/ui/terminal/tui/components/InteractiveElements.tsx +584 -0
- package/packages/src/interfaces/ui/terminal/tui/components/MultilineInput.tsx +614 -0
- package/packages/src/interfaces/ui/terminal/tui/components/PaneManager.tsx +333 -0
- package/packages/src/interfaces/ui/terminal/tui/components/Sidebar.tsx +604 -0
- package/packages/src/interfaces/ui/terminal/tui/components/index.ts +118 -0
- package/packages/src/interfaces/ui/terminal/tui/console.ts +49 -0
- package/packages/src/interfaces/ui/terminal/tui/index.ts +90 -0
- package/packages/src/interfaces/ui/terminal/tui/run.tsx +42 -0
- package/packages/src/interfaces/ui/terminal/tui/spinner.ts +69 -0
- package/packages/src/interfaces/ui/terminal/tui/tui-app.tsx +390 -0
- package/packages/src/interfaces/ui/terminal/tui/tui-footer.ts +422 -0
- package/packages/src/interfaces/ui/terminal/tui/types.ts +186 -0
- package/packages/src/interfaces/ui/terminal/tui/useInputHandler.ts +104 -0
- package/packages/src/interfaces/ui/terminal/tui/useNativeInput.ts +239 -0
- package/packages/src/lmdb.db +0 -0
- package/packages/src/lmdb.db-lock +0 -0
- package/packages/src/native/index.ts +2345 -0
- package/packages/src/teammates/index.ts +982 -0
- package/packages/src/types/index.ts +722 -0
- package/dist/cli.js +0 -148
- package/dist/index-0pkak453.js +0 -136
- package/dist/index-0qd0x8b4.js +0 -110
- package/dist/index-0x3kprq6.js +0 -240
- package/dist/index-1eawy937.js +0 -308
- package/dist/index-24m2aygy.js +0 -240
- package/dist/index-29xcjnne.js +0 -280
- package/dist/index-2avyytn5.js +0 -349
- package/dist/index-4ms367ey.js +0 -136
- package/dist/index-4w2t3b0m.js +0 -240
- package/dist/index-4xfgd8nz.js +0 -261
- package/dist/index-5acjp9gc.js +0 -157
- package/dist/index-5s15hr56.js +0 -136
- package/dist/index-6e4wf341.js +0 -349
- package/dist/index-6fvnkedw.js +0 -240
- package/dist/index-6rqpmd4g.js +0 -128
- package/dist/index-77ckwnbm.js +0 -280
- package/dist/index-9knxy49k.js +0 -128
- package/dist/index-9zrnw4zx.js +0 -128
- package/dist/index-bk21w99v.js +0 -280
- package/dist/index-c41n76fv.js +0 -240
- package/dist/index-cb4ppjdt.js +0 -255
- package/dist/index-cfb2edt6.js +0 -240
- package/dist/index-cmfa38hh.js +0 -308
- package/dist/index-datjz8q1.js +0 -257
- package/dist/index-eadf4wvn.js +0 -240
- package/dist/index-em5k0m3z.js +0 -345
- package/dist/index-gh8r333a.js +0 -110
- package/dist/index-gkx6k2tr.js +0 -261
- package/dist/index-h5cabfks.js +0 -155
- package/dist/index-hcrpwyy3.js +0 -261
- package/dist/index-hk7fwwa8.js +0 -257
- package/dist/index-jb8cw7f8.js +0 -136
- package/dist/index-kbyw4th1.js +0 -347
- package/dist/index-kgj5gqnm.js +0 -345
- package/dist/index-mdf6xp1z.js +0 -255
- package/dist/index-mrhv8kvc.js +0 -280
- package/dist/index-mt4743dd.js +0 -161
- package/dist/index-qnwsg97q.js +0 -240
- package/dist/index-qwdy6x44.js +0 -261
- package/dist/index-rmj77261.js +0 -157
- package/dist/index-sbbw1a61.js +0 -349
- package/dist/index-svy5bcpn.js +0 -345
- package/dist/index-tvmy7tm9.js +0 -261
- package/dist/index-tzz4vzkj.js +0 -312
- package/dist/index-vz80zmhe.js +0 -110
- package/dist/index-wed2fk67.js +0 -240
- package/dist/index-wksgzz8e.js +0 -280
- package/dist/index-wn2m4wma.js +0 -240
- package/dist/index-xha05vjc.js +0 -257
- package/dist/index-yc6eh8p8.js +0 -136
- package/dist/index-ycjxx9ft.js +0 -240
- package/dist/index-z0gzd0fc.js +0 -110
- package/dist/index-z8cwtf8j.js +0 -240
- package/dist/index-zy5mtt00.js +0 -128
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session Export - Export sessions to various formats
|
|
3
|
+
* Supports JSONL, JSON, and Markdown
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { join } from "path";
|
|
7
|
+
import type {
|
|
8
|
+
LoadedSession,
|
|
9
|
+
SessionSummary,
|
|
10
|
+
ExportFormat,
|
|
11
|
+
ISessionExporter,
|
|
12
|
+
SessionToolUse,
|
|
13
|
+
} from "./types.js";
|
|
14
|
+
import type { ContentBlock, ToolUseBlock, ToolResultBlock } from "../../types/index.js";
|
|
15
|
+
import { SessionPersistence } from "./persistence.js";
|
|
16
|
+
|
|
17
|
+
export class SessionExporter implements ISessionExporter {
|
|
18
|
+
private persistence: SessionPersistence;
|
|
19
|
+
|
|
20
|
+
constructor(persistence: SessionPersistence) {
|
|
21
|
+
this.persistence = persistence;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Export a loaded session to the specified format
|
|
26
|
+
*/
|
|
27
|
+
export(session: LoadedSession, format: ExportFormat): string {
|
|
28
|
+
switch (format) {
|
|
29
|
+
case "jsonl":
|
|
30
|
+
return this.toJsonl(session);
|
|
31
|
+
case "json":
|
|
32
|
+
return this.toJson(session);
|
|
33
|
+
case "markdown":
|
|
34
|
+
return this.toMarkdown(session);
|
|
35
|
+
default:
|
|
36
|
+
throw new Error(`Unsupported export format: ${format}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Export a session to a file
|
|
42
|
+
*/
|
|
43
|
+
async exportToFile(
|
|
44
|
+
sessionId: string,
|
|
45
|
+
format: ExportFormat,
|
|
46
|
+
outputPath?: string
|
|
47
|
+
): Promise<string> {
|
|
48
|
+
const sessionFile = this.persistence.getSessionPath(sessionId);
|
|
49
|
+
|
|
50
|
+
// For JSONL, just return the original file
|
|
51
|
+
if (format === "jsonl") {
|
|
52
|
+
const content = await Bun.file(sessionFile).text();
|
|
53
|
+
const finalPath = outputPath ?? join(process.cwd(), `session-${sessionId}.jsonl`);
|
|
54
|
+
await Bun.write(finalPath, content);
|
|
55
|
+
return finalPath;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// For other formats, we'd need to load and convert
|
|
59
|
+
// This is handled by the SessionStore which has access to the full session
|
|
60
|
+
throw new Error("Use SessionStore.exportSession for full export functionality");
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Export to JSONL format (raw session file)
|
|
65
|
+
*/
|
|
66
|
+
private toJsonl(session: LoadedSession): string {
|
|
67
|
+
const lines: string[] = [];
|
|
68
|
+
|
|
69
|
+
// Metadata first (with explicit type)
|
|
70
|
+
lines.push(JSON.stringify({ ...session.metadata, type: "metadata" }));
|
|
71
|
+
|
|
72
|
+
// Context
|
|
73
|
+
if (session.context) {
|
|
74
|
+
lines.push(JSON.stringify(session.context));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Messages
|
|
78
|
+
for (const msg of session.messages) {
|
|
79
|
+
lines.push(JSON.stringify({ type: "message", timestamp: Date.now(), data: msg }));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Tools
|
|
83
|
+
for (const tool of session.tools) {
|
|
84
|
+
lines.push(JSON.stringify(tool));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Metrics
|
|
88
|
+
for (const metric of session.metrics) {
|
|
89
|
+
lines.push(JSON.stringify({ type: "metrics", timestamp: Date.now(), data: metric }));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Checkpoints
|
|
93
|
+
for (const checkpoint of session.checkpoints) {
|
|
94
|
+
lines.push(JSON.stringify(checkpoint));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return lines.join("\n");
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Export to JSON format (pretty-printed)
|
|
102
|
+
*/
|
|
103
|
+
private toJson(session: LoadedSession): string {
|
|
104
|
+
return JSON.stringify(session, null, 2);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Export to Markdown format
|
|
109
|
+
*/
|
|
110
|
+
private toMarkdown(session: LoadedSession): string {
|
|
111
|
+
const lines: string[] = [];
|
|
112
|
+
|
|
113
|
+
// Header
|
|
114
|
+
lines.push(`# Session: ${session.metadata.id}`);
|
|
115
|
+
lines.push("");
|
|
116
|
+
lines.push(`**Created:** ${new Date(session.metadata.created).toISOString()}`);
|
|
117
|
+
lines.push(`**Model:** ${session.metadata.model}`);
|
|
118
|
+
lines.push(`**Working Directory:** ${session.metadata.workingDirectory}`);
|
|
119
|
+
|
|
120
|
+
if (session.metadata.agentName) {
|
|
121
|
+
lines.push(`**Agent:** ${session.metadata.agentName}`);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (session.metadata.teamName) {
|
|
125
|
+
lines.push(`**Team:** ${session.metadata.teamName}`);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
lines.push("");
|
|
129
|
+
|
|
130
|
+
// Messages
|
|
131
|
+
lines.push("## Conversation");
|
|
132
|
+
lines.push("");
|
|
133
|
+
|
|
134
|
+
for (const message of session.messages) {
|
|
135
|
+
const role = message.role === "user" ? "**User**" : "**Claude**";
|
|
136
|
+
lines.push(`### ${role}`);
|
|
137
|
+
lines.push("");
|
|
138
|
+
|
|
139
|
+
for (const block of message.content) {
|
|
140
|
+
this.formatBlock(block, lines);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Tools
|
|
145
|
+
if (session.tools.length > 0) {
|
|
146
|
+
lines.push("## Tool Calls");
|
|
147
|
+
lines.push("");
|
|
148
|
+
|
|
149
|
+
for (const tool of session.tools) {
|
|
150
|
+
lines.push(`### ${tool.toolName}`);
|
|
151
|
+
lines.push("");
|
|
152
|
+
lines.push("**Input:**");
|
|
153
|
+
lines.push("```json");
|
|
154
|
+
lines.push(JSON.stringify(tool.input, null, 2));
|
|
155
|
+
lines.push("```");
|
|
156
|
+
|
|
157
|
+
if (tool.result) {
|
|
158
|
+
lines.push("");
|
|
159
|
+
lines.push(`**Result:**${tool.isError ? " (error)" : ""}`);
|
|
160
|
+
lines.push("```");
|
|
161
|
+
lines.push(tool.result);
|
|
162
|
+
lines.push("```");
|
|
163
|
+
}
|
|
164
|
+
lines.push("");
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Metrics
|
|
169
|
+
if (session.metrics.length > 0) {
|
|
170
|
+
lines.push("## Metrics");
|
|
171
|
+
lines.push("");
|
|
172
|
+
|
|
173
|
+
const totalCost = session.metrics.reduce((sum, m) => sum + m.costUSD, 0);
|
|
174
|
+
const totalInput = session.metrics.reduce(
|
|
175
|
+
(sum, m) => sum + m.usage.input_tokens,
|
|
176
|
+
0
|
|
177
|
+
);
|
|
178
|
+
const totalOutput = session.metrics.reduce(
|
|
179
|
+
(sum, m) => sum + m.usage.output_tokens,
|
|
180
|
+
0
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
lines.push(`- **Total Cost:** $${totalCost.toFixed(4)}`);
|
|
184
|
+
lines.push(`- **Total Input Tokens:** ${totalInput.toLocaleString()}`);
|
|
185
|
+
lines.push(`- **Total Output Tokens:** ${totalOutput.toLocaleString()}`);
|
|
186
|
+
lines.push(`- **API Calls:** ${session.metrics.length}`);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// Checkpoints
|
|
190
|
+
if (session.checkpoints.length > 0) {
|
|
191
|
+
lines.push("");
|
|
192
|
+
lines.push("## Checkpoints");
|
|
193
|
+
lines.push("");
|
|
194
|
+
|
|
195
|
+
for (const cp of session.checkpoints) {
|
|
196
|
+
const date = new Date(cp.timestamp).toISOString();
|
|
197
|
+
lines.push(`- ${cp.label ?? cp.checkpointId} (${date}) - ${cp.messageCount} messages`);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return lines.join("\n");
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Format a content block for markdown
|
|
206
|
+
*/
|
|
207
|
+
private formatBlock(block: ContentBlock, lines: string[]): void {
|
|
208
|
+
switch (block.type) {
|
|
209
|
+
case "text":
|
|
210
|
+
lines.push(block.text);
|
|
211
|
+
lines.push("");
|
|
212
|
+
break;
|
|
213
|
+
|
|
214
|
+
case "tool_use": {
|
|
215
|
+
const tool = block as ToolUseBlock;
|
|
216
|
+
lines.push(`\`\`\`tool:${tool.name}`);
|
|
217
|
+
lines.push(JSON.stringify(tool.input, null, 2));
|
|
218
|
+
lines.push("```");
|
|
219
|
+
lines.push("");
|
|
220
|
+
break;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
case "tool_result": {
|
|
224
|
+
const result = block as ToolResultBlock;
|
|
225
|
+
lines.push(`**Result**${result.is_error ? " (error)" : ""}:`);
|
|
226
|
+
lines.push("```");
|
|
227
|
+
lines.push(
|
|
228
|
+
typeof result.content === "string"
|
|
229
|
+
? result.content
|
|
230
|
+
: JSON.stringify(result.content, null, 2)
|
|
231
|
+
);
|
|
232
|
+
lines.push("```");
|
|
233
|
+
lines.push("");
|
|
234
|
+
break;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
case "thinking":
|
|
238
|
+
lines.push("> **Thinking**");
|
|
239
|
+
lines.push(`> ${block.thinking.replace(/\n/g, "\n> ")}`);
|
|
240
|
+
lines.push("");
|
|
241
|
+
break;
|
|
242
|
+
|
|
243
|
+
case "image":
|
|
244
|
+
lines.push("*(Image)*");
|
|
245
|
+
lines.push("");
|
|
246
|
+
break;
|
|
247
|
+
|
|
248
|
+
default:
|
|
249
|
+
break;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Format a session summary for display
|
|
255
|
+
*/
|
|
256
|
+
static formatSummary(session: SessionSummary): string {
|
|
257
|
+
const created = new Date(session.created);
|
|
258
|
+
const updated = session.lastActivity
|
|
259
|
+
? new Date(session.lastActivity)
|
|
260
|
+
: new Date(session.updated);
|
|
261
|
+
const age = this.formatRelativeTime(updated);
|
|
262
|
+
|
|
263
|
+
const lines: string[] = [];
|
|
264
|
+
|
|
265
|
+
// Session ID and age
|
|
266
|
+
lines.push(`\x1b[1m${session.id}\x1b[0m (${age})`);
|
|
267
|
+
|
|
268
|
+
// Model and message count
|
|
269
|
+
lines.push(` Model: ${session.model} | Messages: ${session.messageCount}`);
|
|
270
|
+
|
|
271
|
+
// Cost and tokens
|
|
272
|
+
const cost =
|
|
273
|
+
session.totalCost < 0.01
|
|
274
|
+
? `$${session.totalCost.toFixed(4)}`
|
|
275
|
+
: `$${session.totalCost.toFixed(2)}`;
|
|
276
|
+
lines.push(
|
|
277
|
+
` Cost: ${cost} | Tokens: ${session.totalTokens.input.toLocaleString()} in, ${session.totalTokens.output.toLocaleString()} out`
|
|
278
|
+
);
|
|
279
|
+
|
|
280
|
+
// First message preview
|
|
281
|
+
if (session.firstMessage) {
|
|
282
|
+
lines.push(` Preview: ${session.firstMessage}`);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// Working directory
|
|
286
|
+
lines.push(` Directory: ${session.workingDirectory}`);
|
|
287
|
+
|
|
288
|
+
return lines.join("\n");
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Format relative time
|
|
293
|
+
*/
|
|
294
|
+
static formatRelativeTime(date: Date): string {
|
|
295
|
+
const now = new Date();
|
|
296
|
+
const diffMs = now.getTime() - date.getTime();
|
|
297
|
+
const diffMins = Math.floor(diffMs / 60000);
|
|
298
|
+
const diffHours = Math.floor(diffMs / 3600000);
|
|
299
|
+
const diffDays = Math.floor(diffMs / 86400000);
|
|
300
|
+
|
|
301
|
+
if (diffMins < 1) return "just now";
|
|
302
|
+
if (diffMins < 60) return `${diffMins}m ago`;
|
|
303
|
+
if (diffHours < 24) return `${diffHours}h ago`;
|
|
304
|
+
if (diffDays < 7) return `${diffDays}d ago`;
|
|
305
|
+
|
|
306
|
+
return date.toLocaleDateString();
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Print sessions list for CLI
|
|
311
|
+
*/
|
|
312
|
+
static printList(sessions: SessionSummary[]): void {
|
|
313
|
+
if (sessions.length === 0) {
|
|
314
|
+
console.log("No sessions found.");
|
|
315
|
+
console.log("\nStart a new conversation to create a session.");
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
console.log(`\x1b[1mRecent Sessions (${sessions.length})\x1b[0m\n`);
|
|
320
|
+
|
|
321
|
+
for (const session of sessions) {
|
|
322
|
+
console.log(this.formatSummary(session));
|
|
323
|
+
console.log("");
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
console.log("To resume a session:");
|
|
327
|
+
console.log(" coder --resume <session-id>");
|
|
328
|
+
}
|
|
329
|
+
}
|