@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
package/dist/index-mdf6xp1z.js
DELETED
|
@@ -1,255 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
var N9=Object.create;var{getPrototypeOf:D9,defineProperty:H7,getOwnPropertyNames:I9}=Object;var S9=Object.prototype.hasOwnProperty;var x9=(Q,X,Z)=>{Z=Q!=null?N9(D9(Q)):{};let $=X||!Q||!Q.__esModule?H7(Z,"default",{value:Q,enumerable:!0}):Z;for(let V of I9(Q))if(!S9.call($,V))H7($,V,{get:()=>Q[V],enumerable:!0});return $};var D6=import.meta.require;var V6={enabled:!0,ttl:"1h",cacheSystemPrompt:!0,cacheTools:!0,minTokensForCache:1024},T9={low:1024,medium:4096,high:16384,max:1e5},b8={enabled:!1,effort:"medium",interleaved:!0};function W7(Q,X){if(Q.budgetTokens)return Q.budgetTokens;let Z=Q.effort||"medium",$=T9[Z],V=Q.modelMultiplier??(X.includes("opus")?2:1);return Math.min($*V,1e5)}function G7(Q){return Q.includes("claude-opus-4")||Q.includes("claude-sonnet-4")||Q.includes("claude-haiku-4")||Q.includes("claude-4")}var f8={"claude-opus-4-6":{input:15,output:75,cache_write:18.75,cache_read:1.5},"claude-sonnet-4-6":{input:3,output:15,cache_write:3.75,cache_read:0.3},"claude-haiku-4-5":{input:0.8,output:4,cache_write:1,cache_read:0.08}};var E9={maxRetries:3,baseDelayMs:1000,maxDelayMs:30000,jitterFactor:0.2,retryableStatusCodes:[429,500,502,503,504,529],onRetry:void 0};function k9(Q,X,Z,$){let V=X*Math.pow(2,Q),J=V*$*(Math.random()*2-1);return Math.min(V+J,Z)}function y9(Q,X){if(Q.message.includes("429")||Q.message.includes("rate limit"))return!0;if(Q.message.includes("500")||Q.message.includes("502")||Q.message.includes("503")||Q.message.includes("504"))return!0;if(Q.message.includes("ECONNREFUSED")||Q.message.includes("ENOTFOUND")||Q.message.includes("ETIMEDOUT")||Q.message.includes("network")||Q.message.includes("fetch failed"))return!0;for(let Z of X)if(Q.message.includes(String(Z)))return!0;return!1}function b9(Q){return new Promise((X)=>setTimeout(X,Q))}async function j7(Q,X={}){let Z={...E9,...X},$=null;for(let V=0;V<=Z.maxRetries;V++)try{return await Q()}catch(J){if($=J instanceof Error?J:Error(String(J)),V<Z.maxRetries&&y9($,Z.retryableStatusCodes)){let z=k9(V,Z.baseDelayMs,Z.maxDelayMs,Z.jitterFactor);if(Z.onRetry)Z.onRetry(V+1,$,z);else console.warn(`\x1B[33mRetry ${V+1}/${Z.maxRetries} after ${z}ms: ${$.message}\x1B[0m`);await b9(z)}else throw $}throw $||Error("Max retries exceeded")}var _7={"claude-opus-4-6":{input:15,output:75,cache_write:18.75,cache_read:1.5},"claude-sonnet-4-6":{input:3,output:15,cache_write:3.75,cache_read:0.3},"claude-haiku-4-5":{input:0.8,output:4,cache_write:1,cache_read:0.08},"claude-3-5-sonnet":{input:3,output:15,cache_write:3.75,cache_read:0.3},"claude-3-5-haiku":{input:0.8,output:4,cache_write:1,cache_read:0.08},"claude-3-opus":{input:15,output:75,cache_write:18.75,cache_read:1.5}};function f9(Q,X){let Z=_7[Q]??_7["claude-sonnet-4-6"],$=X.input_tokens-(X.cache_read_input_tokens??0),V=X.cache_read_input_tokens??0,J=X.cache_creation_input_tokens??0,z=X.output_tokens,Y=$/1e6*Z.input,K=V/1e6*Z.cache_read,q=J/1e6*Z.cache_write,H=z/1e6*Z.output,W=Y+K+q+H,j=(V+J)/1e6*(Z.input-Z.cache_read);return{costUSD:W,estimatedSavingsUSD:j}}function u9(Q,X){if(!Q||!X.enabled||!X.cacheSystemPrompt)return typeof Q==="string"?Q:void 0;if(Array.isArray(Q)){let Z=[...Q];if(Z.length>0){let $=Z[Z.length-1];if($&&$.type==="text")Z[Z.length-1]={type:"text",text:$.text,cache_control:{type:"ephemeral",ttl:X.ttl}}}return Z}return[{type:"text",text:Q,cache_control:{type:"ephemeral",ttl:X.ttl}}]}function h9(Q,X){if(!X.enabled)return Q;let Z=[];for(let $=0;$<Q.length;$++){let V=Q[$],J=[];for(let z=0;z<V.content.length;z++){let Y=V.content[z],K=z===V.content.length-1,q=$===Q.length-1;if(Y.type==="text"&&Y.text.length>=X.minTokensForCache*4&&!Y.cache_control&&(K||q))J.push({...Y,cache_control:{type:"ephemeral",ttl:X.ttl}});else J.push(Y)}Z.push({...V,content:J})}if(Z.length>0&&X.enabled){let $=Z[Z.length-1],V=$.content[$.content.length-1];if(V&&!("cache_control"in V))$.content[$.content.length-1]={...V,cache_control:{type:"ephemeral",ttl:X.ttl}}}return Z}function g9(Q){let X=Q.cache_read_input_tokens??0,Z=Q.cache_creation_input_tokens??0,$=X+Z,V=X>0?1:0,J=Z>0?1:0,z=V+J;return{cacheHits:V,cacheMisses:J,totalCacheReadTokens:X,totalCacheWriteTokens:Z,cacheHitRate:z>0?V/z:0,estimatedSavingsUSD:0}}async function U7(Q,X){let{apiKey:Z,model:$="claude-sonnet-4-6",maxTokens:V=4096,tools:J,systemPrompt:z,cacheConfig:Y=V6,thinking:K,extendedThinking:q,stopSequences:H,onToken:W,onThinking:G,onRedactedThinking:j,onToolUse:_,signal:U}=X,A=Date.now(),w=0,B=!0,v=0,O=h9(Q,Y),F=u9(z,Y),E={model:$,max_tokens:V,messages:O.map((R)=>({role:R.role,content:R.content})),stream:!0};if(F)E.system=F;if(J&&J.length>0)E.tools=J;if(H&&H.length>0)E.stop_sequences=H;let t=`${process.env.ANTHROPIC_BASE_URL||"https://api.anthropic.com"}/v1/messages`,P={"Content-Type":"application/json","x-api-key":Z,"anthropic-version":"2023-06-01"};if(((q?.enabled??!1)||K&&K.type!=="disabled")&&G7($)){let R;if(q?.budgetTokens)R=q.budgetTokens;else if(K?.type==="enabled")R=K.budget_tokens;else{let L5=q?.effort||"medium";R=W7({enabled:!0,effort:L5,modelMultiplier:$.includes("opus")?2:1},$)}R=Math.max(1024,Math.min(R,1e5)),E.thinking={type:"enabled",budget_tokens:R};let o=["extended-thinking-2025-01-24"];if(q?.interleaved!==!1)o.push("interleaved-thinking-2025-01-24");P["anthropic-beta"]=o.join(",")}else P["anthropic-beta"]="max-tokens-3-5-sonnet-2024-07-15";let T5={maxRetries:3,baseDelayMs:1000,maxDelayMs:30000,retryableStatusCodes:[429,500,502,503,504,529],onRetry:(R,o,L5)=>{console.log(`\x1B[33mAPI retry ${R}/3 after ${L5}ms: ${o.message}\x1B[0m`)}},e=await j7(async()=>{let R=await fetch(t,{method:"POST",headers:P,body:JSON.stringify(E),signal:U});if(!R.ok&&T5.retryableStatusCodes?.includes(R.status)){let o=await R.text();throw Error(`API error: ${R.status} - ${o}`)}return R},T5);if(!e.ok){let R=await e.text();throw Error(`API error: ${e.status} - ${R}`)}if(!e.body)throw Error("No response body");let E5=e.body.getReader(),k5=new TextDecoder,Y5=null,K5=[],q5={input_tokens:0,output_tokens:0},T=null,U5=null,Q5=null,d=null,B5="",y5=new Map,q7="";try{let R="";while(!0){let{done:o,value:L5}=await E5.read();if(o)break;R+=k5.decode(L5,{stream:!0});let b5=R.split(`
|
|
3
|
-
`);R=b5.pop()||"";for(let f5 of b5){if(!f5.startsWith("data: "))continue;let R5=f5.slice(6);if(!R5)continue;try{let Z5=JSON.parse(R5);switch(Z5.type){case"message_start":{let L=Z5.message;Y5=L,q5=L.usage;break}case"content_block_start":{let{index:L,content_block:C}=Z5;if(y5.set(L,C.type),C.type==="text")T={type:"text",text:""};else if(C.type==="thinking")U5={type:"thinking",thinking:""};else if(C.type==="redacted_thinking")Q5={type:"redacted_thinking",data:""};else if(C.type==="tool_use")d={type:"tool_use",id:C.id,name:C.name,input:{}},B5="";break}case"content_block_delta":{let L=Z5.delta;if(L.type==="text_delta"&&T){let C=L.text;if(T.text+=C,W?.(C),B)w=Date.now()-A,B=!1}else if(L.type==="thinking_delta"&&U5){let C=L.thinking;U5.thinking+=C,G?.(C),v+=Math.ceil(C.length/4)}else if(L.type==="redacted_thinking_delta"&&Q5){let C=L.data;Q5.data+=C,j?.(C),v+=Math.ceil(C.length/4)}else if(L.type==="input_json_delta"&&d)B5+=L.partial_json;break}case"content_block_stop":{let L=Z5.index,C=y5.get(L);if(C==="text"&&T)K5.push(T),T=null;else if(C==="thinking"&&U5)K5.push(U5),U5=null;else if(C==="redacted_thinking"){let M={type:"redacted_thinking",data:Q5?.data||""};K5.push(M),j?.(M.data),Q5=null}else if(C==="tool_use"&&d){try{d.input=JSON.parse(B5)}catch{d.input={}}K5.push(d),_?.({id:d.id,name:d.name,input:d.input}),d=null}y5.delete(L);break}case"message_delta":{let L=Z5;if(L.usage)q5.output_tokens=L.usage.output_tokens;if(Y5&&L.delta?.stop_reason)Y5.stop_reason=L.delta.stop_reason;break}case"message_stop":break}}catch{}}}}finally{E5.releaseLock()}if(!Y5)throw Error("No message received from API");Y5.content=K5;let{costUSD:P6,estimatedSavingsUSD:H5}=f9($,q5),M5=g9(q5);M5.estimatedSavingsUSD=H5;let X5=Date.now()-A;return{message:Y5,usage:q5,cacheMetrics:M5,costUSD:P6,durationMs:X5,ttftMs:w||X5,thinkingTokens:v}}import*as w7 from"readline";var m9={Read:"low",Glob:"low",Grep:"low",Task:"low",Write:"medium",Edit:"medium",NotebookEdit:"medium",Bash:"high"},d9=[/\brm\s+-rf\b/,/\brm\s+-r\b/,/\brm\s+[^-]/,/\bgit\s+push\s+--force\b/,/\bgit\s+reset\s+--hard\b/,/\bgit\s+clean\s+-fd\b/,/\bdrop\b/i,/\bdelete\b/i,/\btruncate\b/i,/\bformat\b/i,/\bdd\s+if=/,/\bshred\b/,/\b:\(\)\{\s*:\|:\s*&\s*\};\s*:\b/];function c9(Q,X){let Z=m9[Q]??"medium";if(Q==="Bash"){let $=String(X.command??"");for(let V of d9)if(V.test($))return"critical";if(/\bsudo\b/.test($)||/\bchmod\b/.test($))Z="high"}if(Q==="Write"||Q==="Edit"){let $=String(X.file_path??X.path??"");if(/\.(env|pem|key|secret|credentials)/.test($))Z="high";if(/\/\.ssh\//.test($)||/\/\.gnupg\//.test($))Z="critical"}return Z}function l9(Q,X){switch(Q){case"Read":return`Read file: ${X.file_path??"unknown"}`;case"Write":return`Write file: ${X.file_path??"unknown"} (${String(X.content??"").length} chars)`;case"Edit":return`Edit file: ${X.file_path??"unknown"}`;case"Bash":return`Execute: ${String(X.command??"").slice(0,100)}${String(X.command??"").length>100?"...":""}`;case"Glob":return`Find files: ${X.pattern??"*"}`;case"Grep":return`Search: "${X.pattern??""}" in ${X.path??"."}`;case"Task":return`Spawn agent: ${X.subagent_type??"unknown"}`;default:return`Use tool: ${Q}`}}class I6{cache={};cacheTimeout=300000;promptCallback;mode;constructor(Q="default",X){this.mode=Q,this.promptCallback=X??this.defaultPrompt.bind(this)}async checkPermission(Q,X){if(this.mode==="bypassPermissions")return{decision:"allow"};if(this.mode==="dontAsk")return{decision:"deny",reason:"Permission mode is dontAsk"};if(this.mode==="acceptEdits"){if(["Read","Write","Edit","Glob","Grep"].includes(Q))return{decision:"allow"}}if(this.mode==="plan"){if(["Read","Glob","Grep","Task"].includes(Q))return{decision:"allow"};return{decision:"deny",reason:"Plan mode - write operations disabled"}}let Z=this.getCacheKey(Q,X),$=this.cache[Z];if($&&Date.now()-$.timestamp<this.cacheTimeout){if($.decision==="allowAlways")return{decision:"allow",reason:"Previously approved (always)"};if($.decision==="denyAlways")return{decision:"deny",reason:"Previously denied (always)"}}let V=c9(Q,X),J=l9(Q,X),z={toolName:Q,toolInput:X,riskLevel:V,description:J,file:X.file_path??X.path,command:Q==="Bash"?X.command:void 0};if(this.mode==="interactive"||this.mode==="default"){let Y=await this.promptCallback(z);if(Y.decision==="allowAlways"||Y.decision==="denyAlways")this.cache[Z]={decision:Y.decision,timestamp:Date.now()};return Y}return{decision:"allow"}}getCacheKey(Q,X){if(["Read","Write","Edit"].includes(Q))return`${Q}:${X.file_path??X.path??"unknown"}`;if(Q==="Bash"){let Z=String(X.command??"").slice(0,100);return`${Q}:${Z}`}return Q}async defaultPrompt(Q){return new Promise((X)=>{let Z=w7.createInterface({input:process.stdin,output:process.stdout}),V={low:"\x1B[32m",medium:"\x1B[33m",high:"\x1B[31m",critical:"\x1B[35m"}[Q.riskLevel]??"\x1B[0m",J="\x1B[0m";if(console.log(""),console.log("\x1B[36m\u2501\u2501\u2501 Permission Required \u2501\u2501\u2501\x1B[0m"),console.log(`Tool: \x1B[1m${Q.toolName}\x1B[0m`),console.log(`Risk: ${V}${Q.riskLevel.toUpperCase()}\x1B[0m`),console.log(`Action: ${Q.description}`),Q.file)console.log(`File: ${Q.file}`);if(Q.command)console.log(`Command: ${Q.command.slice(0,200)}${Q.command.length>200?"...":""}`);console.log("");let z="[y]es / [n]o / [a]lways / [d]eny always";Z.question(`Allow? ${z}: `,(Y)=>{switch(Z.close(),Y.trim().toLowerCase()){case"y":case"yes":X({decision:"allow"});break;case"a":case"always":X({decision:"allowAlways"});break;case"d":case"deny":case"deny always":X({decision:"denyAlways"});break;case"n":case"no":default:X({decision:"deny"});break}})})}clearCache(){this.cache={}}setMode(Q){this.mode=Q,this.clearCache()}}var S6={readOnly:["Read","Glob","Grep","Task"],fileEdit:["Write","Edit","NotebookEdit"],system:["Bash"],network:[]};function p8(Q){return S6.readOnly.includes(Q)}function i8(Q){return S6.fileEdit.includes(Q)}function n8(Q){return S6.system.includes(Q)}import{join as $5,dirname as p9}from"path";import{fileURLToPath as i9}from"url";import{existsSync as n9}from"fs";var u5=null,A7=!1;function J6(){if(u5)return u5;if(A7)return B7();A7=!0;let{platform:Q,arch:X}=process,Z=`${Q}-${X}`,$;try{$=p9(i9(import.meta.url))}catch{$=process.cwd()}let V=[$5($,"..","..","native",`claude-code-native.${Z}.node`),$5($,"..","native",`claude-code-native.${Z}.node`),$5($,"native",`claude-code-native.${Z}.node`),$5($,"..","..","native",`claude_code_native.${Z}.node`),$5($,"..","..","native","index.node"),$5($,"..","native","index.node"),$5($,"..","..","native","claude-code-native.node"),$5($,"..","..","node_modules","@ebowwa","coder-native","index.node"),$5(process.cwd(),"native",`claude-code-native.${Z}.node`),$5(process.cwd(),"native","index.node")];for(let J of V)if(n9(J))try{let z=D6(J);return console.debug(`[native] Loaded module from: ${J}`),u5=z,u5}catch(z){console.debug(`[native] Failed to load ${J}:`,z);continue}return console.debug("[native] No native module found, using JS fallback"),B7()}function T6(){try{return J6(),u5!==null}catch{return!1}}var o9=4,h5=10,L7=100;function g(Q){if(!Q||Q.length===0)return 0;return Math.ceil(Q.length/o9)}function x6(Q){switch(Q.type){case"text":return g(Q.text);case"image":return L7;case"tool_use":{let X=JSON.stringify(Q.input);return g(Q.name)+g(X)+h5}case"tool_result":{if(typeof Q.content==="string")return g(Q.content)+h5;return Q.content.reduce((X,Z)=>X+x6(Z),0)+h5}case"thinking":return g(Q.thinking);case"redacted_thinking":return g(Q.data);default:return 0}}function B7(){return{searchFiles:(Q,X,Z)=>{return{matches:[],total_count:0,files_searched:0}},countTokens:(Q)=>{return Math.ceil(Q.length/4)},estimateTokens:g,estimateTextBlockTokens:(Q)=>g(Q),estimateImageBlockTokens:()=>L7,estimateToolUseBlockTokens:(Q,X)=>{return g(Q)+g(X)+h5},estimateToolResultBlockTokens:(Q)=>{return g(Q)+h5},estimateThinkingBlockTokens:(Q)=>g(Q),estimateRedactedThinkingBlockTokens:(Q)=>g(Q),estimateBlocksFromJson:(Q)=>{try{return JSON.parse(Q).reduce((Z,$)=>Z+x6($),0)}catch{return 0}},estimateMessageTokensJson:(Q,X)=>{try{return 4+JSON.parse(X).reduce((J,z)=>J+x6(z),0)}catch{return 4}},calculateDiff:(Q,X)=>{let Z=Q.split(`
|
|
4
|
-
`),$=X.split(`
|
|
5
|
-
`),V=[];if(Q!==X)V.push({old_start:1,old_lines:Z.length,new_start:1,new_lines:$.length,content:`- ${Z.join(`
|
|
6
|
-
- `)}
|
|
7
|
-
+ ${$.join(`
|
|
8
|
-
+ `)}`});return V},compactContent:(Q,X,Z="truncate")=>{let V=X*4;if(Q.length<=V)return Q;switch(Z){case"truncate":return Q.slice(0,V/2)+`
|
|
9
|
-
|
|
10
|
-
... [truncated] ...
|
|
11
|
-
|
|
12
|
-
`+Q.slice(-V/2);case"summarize":let J=Math.floor(V/4);return`=== BEGINNING ===
|
|
13
|
-
`+Q.slice(0,J)+`
|
|
14
|
-
|
|
15
|
-
=== END ===
|
|
16
|
-
`+Q.slice(-J);case"extract":return Q.split(`
|
|
17
|
-
`).filter((K)=>K.trim().startsWith("#")||K.trim().startsWith("function")||K.trim().startsWith("const")||K.trim().startsWith("class")||K.trim().startsWith("export")||K.trim().startsWith("import")).slice(0,V/50).join(`
|
|
18
|
-
`);default:return Q.slice(0,V)}}}}function F7(Q){return JSON.stringify(Q.map((X)=>{switch(X.type){case"text":return{type:"text",text:X.text};case"image":return{type:"image"};case"tool_use":return{type:"tool_use",name:X.name,input:X.input};case"tool_result":return{type:"tool_result",content:X.content};case"thinking":return{type:"thinking",thinking:X.thinking};case"redacted_thinking":return{type:"redacted_thinking",data:X.data};default:return{type:"text",text:""}}}))}function v7(Q){return J6().estimateBlocksFromJson(F7(Q))}function O7(Q,X){return J6().estimateMessageTokensJson(Q,F7(X))}var F5=J6();var k6={tokenWarningThreshold:0.8,costUpdateInterval:5,toolSummaryInterval:3,envInfoOnStart:!0},E6={WARNING:0.8,CRITICAL:0.9,EMERGENCY:0.95};function a9(Q){let{current:X,max:Z,threshold:$=E6.WARNING}=Q;if(Z<=0)return"";let V=X/Z;if(V<$)return"";let J=Z-X,z=Math.round(V*100),Y,K;if(V>=E6.EMERGENCY)Y="emergency",K="\uD83D\uDEA8";else if(V>=E6.CRITICAL)Y="critical",K="\u26A0\uFE0F";else Y="warning",K="\u26A1";let q=[`${K} Token Usage ${Y.toUpperCase()}`,"",`Current: ${X.toLocaleString()} / ${Z.toLocaleString()} tokens (${z}%)`,`Remaining: ${J.toLocaleString()} tokens`];if(Y==="emergency")q.push(""),q.push("Consider summarizing or compacting the conversation to continue.");else if(Y==="critical")q.push(""),q.push("Approaching token limit. Consider wrapping up soon.");return q.join(`
|
|
19
|
-
`)}function r9(Q){let{cost:X,previousCost:Z=0,currency:$="USD"}=Q,V=s9($),J=C7(X,V),z=X-Z,Y=C7(Math.abs(z),V),K=["\uD83D\uDCB0 Cost Update","",`Total: ${J} ${$}`];if(z!==0){let q=z>0?"+":"-";K.push(`This turn: ${q}${Y} ${$}`)}return K.join(`
|
|
20
|
-
`)}function C7(Q,X){if(Q<0.01)return`${X}${Q.toFixed(4)}`;else if(Q<1)return`${X}${Q.toFixed(3)}`;return`${X}${Q.toFixed(2)}`}function s9(Q){return{USD:"$",EUR:"\u20AC",GBP:"\xA3",JPY:"\xA5"}[Q]||Q}function t9(Q){let{tools:X,maxDisplay:Z=10}=Q;if(X.length===0)return"No tools used this session.";let $=new Map;for(let Y of X){let K=$.get(Y.name)||0;$.set(Y.name,K+1)}let V=[...$.entries()].sort((Y,K)=>K[1]-Y[1]),J=[`\uD83D\uDD27 Tool Usage Summary (${X.length} total calls)`,""],z=V.slice(0,Z);for(let[Y,K]of z)J.push(` \u2022 ${Y}: ${K} call${K===1?"":"s"}`);if(V.length>Z){let Y=V.length-Z;J.push(` ... and ${Y} more tool${Y===1?"":"s"}`)}return J.join(`
|
|
21
|
-
`)}function e9(Q){let{workingDirectory:X,gitStatus:Z,platform:$=process.platform,shell:V=process.env.SHELL||"unknown"}=Q,J=["\uD83D\uDCCD Environment Information","",`Working Directory: ${X}`,`Platform: ${$}`,`Shell: ${V}`];if(Z){if(J.push(""),J.push("Git Status:"),J.push(` Branch: ${Z.branch}`),Z.ahead>0||Z.behind>0)J.push(` Ahead: ${Z.ahead}, Behind: ${Z.behind}`);let z=Z.staged.length+Z.unstaged.length+Z.untracked.length+Z.conflicted.length;if(z>0){if(J.push(` Changes: ${z} file${z===1?"":"s"}`),Z.staged.length>0)J.push(` Staged: ${Z.staged.length}`);if(Z.unstaged.length>0)J.push(` Unstaged: ${Z.unstaged.length}`);if(Z.untracked.length>0)J.push(` Untracked: ${Z.untracked.length}`);if(Z.conflicted.length>0)J.push(` Conflicted: ${Z.conflicted.length}`)}else J.push(" Working tree clean")}return J.join(`
|
|
22
|
-
`)}function M7(Q){let{usage:X,maxTokens:Z,totalCost:$,previousCost:V,toolsUsed:J,workingDirectory:z,gitStatus:Y,turnNumber:K,config:q}=Q,H={...k6,...q},W=[],G=X.input_tokens+X.output_tokens,j=a9({current:G,max:Z,threshold:H.tokenWarningThreshold});if(j)W.push(j);if(K%H.costUpdateInterval===0){let _=r9({cost:$,previousCost:V});W.push(_)}if(K%H.toolSummaryInterval===0&&J.length>0){let _=t9({tools:J});W.push(_)}if(K===1&&H.envInfoOnStart){let _=e9({workingDirectory:z,gitStatus:Y});W.push(_)}if(W.length===0)return"";return["---","System Reminders:","",...W,"---"].join(`
|
|
23
|
-
`)}var Q0=4,X0=5,Z0=1,$0=8,V0=0.9,R7=8000,z6=10,J0=100;function P5(Q){if(!Q||Q.length===0)return 0;return Math.ceil(Q.length/Q0)}function P7(Q){if(T6())try{switch(Q.type){case"text":return F5.estimate_text_block_tokens(Q.text);case"image":return F5.estimate_image_block_tokens();case"tool_use":return F5.estimate_tool_use_block_tokens(Q.name,JSON.stringify(Q.input));case"tool_result":if(typeof Q.content==="string")return F5.estimate_tool_result_block_tokens(Q.content);return v7(Q.content)+z6;case"thinking":return F5.estimate_thinking_block_tokens(Q.thinking);case"redacted_thinking":return F5.estimate_redacted_thinking_block_tokens(Q.data);default:return 0}}catch{}switch(Q.type){case"text":return P5(Q.text);case"image":return J0;case"tool_use":let X=JSON.stringify(Q.input);return P5(Q.name)+P5(X)+z6;case"tool_result":if(typeof Q.content==="string")return P5(Q.content)+z6;return Q.content.reduce((Z,$)=>Z+P7($),0)+z6;case"thinking":return P5(Q.thinking);case"redacted_thinking":return P5(Q.data);default:return 0}}function z0(Q){if(T6())try{return O7(Q.role,Q.content)}catch{}let X=4,Z=Q.content.reduce(($,V)=>$+P7(V),0);return X+Z}function y6(Q){if(!Q||Q.length===0)return 0;return Q.reduce((X,Z)=>X+z0(Z),0)}function Y0(Q){let X=[];for(let Z of Q.content)switch(Z.type){case"text":X.push(Z.text);break;case"tool_use":X.push(`[Tool: ${Z.name}(${JSON.stringify(Z.input)})]`);break;case"tool_result":let $=typeof Z.content==="string"?Z.content:Z.content.map((V)=>V.type==="text"?V.text:"[content]").join("");X.push(`[Result: ${$.slice(0,500)}${$.length>500?"...":""}]`);break;case"thinking":X.push(`[Thinking: ${Z.thinking.slice(0,200)}...]`);break}return X.join(`
|
|
24
|
-
`)}function K0(Q){let X=new Map;for(let Z of Q)for(let $ of Z.content)if($.type==="tool_use")X.set($.id,{use:$});for(let Z of Q)for(let $ of Z.content)if($.type==="tool_result"){let V=X.get($.tool_use_id);if(V)V.result=$}return X}async function q0(Q){if(!Q||Q.length===0)return"";let X=[];X.push(`[Context Summary: ${Q.length} messages compacted]
|
|
25
|
-
`);let Z=[];for(let V=0;V<Q.length;V++){let J=Q[V];if(!J)continue;let z=J.role.toUpperCase(),Y=Y0(J);for(let q of J.content)if(q.type==="tool_use")Z.push(`${q.name}`);let K=Y.length>300?`${Y.slice(0,300)}...`:Y;X.push(`${z}: ${K}
|
|
26
|
-
`)}if(Z.length>0){let V=Z.reduce((z,Y)=>{return z[Y]=(z[Y]||0)+1,z},{}),J=Object.entries(V).map(([z,Y])=>`${z}(${Y})`).join(", ");X.push(`
|
|
27
|
-
Tools used: ${J}
|
|
28
|
-
`)}let $=X.join("");if($.length>R7)$=$.slice(0,R7)+`
|
|
29
|
-
...[truncated]`;return $}async function b6(Q,X,Z={}){let{keepFirst:$=Z0,keepLast:V=X0,preserveToolPairs:J=!0}=Z,z=y6(Q);if(z<=X)return{messages:Q,messagesRemoved:0,tokensBefore:z,tokensAfter:z,didCompact:!1};if(Q.length<=$+V)return{messages:Q,messagesRemoved:0,tokensBefore:z,tokensAfter:z,didCompact:!1};let Y=Q.slice(0,$),K=Q.slice($,-V),q=Q.slice(-V),W={role:"user",content:[{type:"text",text:`[Previous context has been compacted for continuity]
|
|
30
|
-
|
|
31
|
-
${await q0(K)}`}]},G=[];if(J&&K.length>0){let A=K0(K),w=Array.from(A.values()).slice(-3).filter((B)=>B.result&&!B.result.is_error);for(let B of w)if(G.push(B.use),B.result)G.push(B.result)}let j=[...Y,W];if(G.length>0)j.push({role:"assistant",content:G.filter((A)=>A.type==="tool_use")}),j.push({role:"user",content:G.filter((A)=>A.type==="tool_result")});j.push(...q);let _=y6(j),U=Q.length-j.length;return console.log(`Context compaction: ${Q.length} -> ${j.length} messages, ${z} -> ${_} tokens`),{messages:j,messagesRemoved:U,tokensBefore:z,tokensAfter:_,didCompact:!0}}function N7(Q,X,Z=V0){if(Q.length<$0)return!1;let $=y6(Q),V=Math.floor(X*Z);return $>=V}function f6(Q){if(!Q.didCompact)return{reductionPercent:0,tokensSaved:0};let X=Q.tokensBefore-Q.tokensAfter,Z=X/Q.tokensBefore*100;return{reductionPercent:Math.round(Z*100)/100,tokensSaved:X}}async function GX(Q,X){let{apiKey:Z,model:$="claude-sonnet-4-6",maxTokens:V=4096,systemPrompt:J,tools:z,permissionMode:Y,workingDirectory:K,gitStatus:q=null,reminderConfig:H,cacheConfig:W=V6,thinking:G,extendedThinking:j,stopSequences:_,getStopSequences:U,onText:A,onThinking:w,onToolUse:B,onToolResult:v,onMetrics:O,onReminder:F,onPermissionRequest:E,signal:y}=X,t=new I6(Y,E),P=[...Q],n=[],T5=[],e=0,E5=0,k5=0,Y5=0,K5=0,q5=0,T={cacheHits:0,cacheMisses:0,totalCacheReadTokens:0,totalCacheWriteTokens:0,cacheHitRate:0,estimatedSavingsUSD:0},U5={...k6,...H},Q5=!0;while(Q5){if(y?.aborted)break;k5++;let d=n[n.length-1],B5=M7({usage:d?.usage??{input_tokens:0,output_tokens:0},maxTokens:V,totalCost:e,previousCost:Y5,toolsUsed:T5,workingDirectory:K,gitStatus:q,turnNumber:k5,config:U5});if(B5)F?.(B5);if(N7(P,V)){let L=await b6(P,V,{keepFirst:0,keepLast:3,preserveToolPairs:!0});if(L.didCompact&&L.tokensAfter<L.tokensBefore){P.length=0,P.push(...L.messages),K5++;let C=L.tokensBefore-L.tokensAfter;q5+=C;let M=f6(L);console.log(`Context compacted: ${M.reductionPercent}% reduction, ${M.tokensSaved} tokens saved`)}}let y5=H0(P,J,B5),q7=U?U(k5,{lastStopReason:n[n.length-1]?.stopReason}):_,P6=await U7(y5,{apiKey:Z,model:$,maxTokens:V,systemPrompt:J,cacheConfig:W,thinking:G,extendedThinking:j,stopSequences:q7,tools:z.map((L)=>({name:L.name,description:L.description,input_schema:L.input_schema})),onToken:A,onThinking:w,onToolUse:B,signal:y}),{message:H5,usage:M5,cacheMetrics:X5,costUSD:R,durationMs:o,ttftMs:L5}=P6,b5={model:$,messageCount:P.length,messageTokens:M5.input_tokens+M5.output_tokens,usage:M5,cacheMetrics:X5,durationMs:o,ttftMs:L5,costUSD:R,stopReason:H5.stop_reason,requestId:H5.id};if(n.push(b5),Y5=e,e+=R,E5+=o,X5)T.cacheHits+=X5.cacheHits,T.cacheMisses+=X5.cacheMisses,T.totalCacheReadTokens+=X5.totalCacheReadTokens,T.totalCacheWriteTokens+=X5.totalCacheWriteTokens,T.estimatedSavingsUSD+=X5.estimatedSavingsUSD;let f5=T.cacheHits+T.cacheMisses;if(T.cacheHitRate=f5>0?T.cacheHits/f5:0,O?.(b5),P.push({role:"assistant",content:H5.content}),H5.stop_reason==="end_turn"||H5.stop_reason==="stop_sequence"){Q5=!1;break}if(H5.stop_reason==="max_tokens"){let L=await b6(P,V,{keepFirst:0,keepLast:3,preserveToolPairs:!0});if(L.didCompact&&L.tokensAfter<L.tokensBefore){P.length=0,P.push(...L.messages),K5++;let C=L.tokensBefore-L.tokensAfter;q5+=C;let M=f6(L);console.log(`Context compacted: ${M.reductionPercent}% reduction, ${M.tokensSaved} tokens saved`);continue}else{Q5=!1;break}}let R5=H5.content.filter((L)=>L.type==="tool_use");if(T5.push(...R5),R5.length===0){Q5=!1;break}let Z5=[];if(y?.aborted);else{let L=R5.map(async(M)=>{let N6=z.find((W5)=>W5.name===M.name);if(!N6)return{toolUseId:M.id,result:{type:"tool_result",tool_use_id:M.id,content:`Error: Unknown tool "${M.name}"`,is_error:!0},toolResult:null};let $6=await t.checkPermission(N6.name,M.input);if($6.decision==="deny"||$6.decision==="denyAlways")return{toolUseId:M.id,result:{type:"tool_result",tool_use_id:M.id,content:`Permission denied for tool "${M.name}"${$6.reason?`: ${$6.reason}`:""}`,is_error:!0},toolResult:null};try{let W5=await N6.handler(M.input,{workingDirectory:K,permissionMode:Y,abortSignal:y});return{toolUseId:M.id,result:{type:"tool_result",tool_use_id:M.id,content:W5.content,is_error:W5.is_error},toolResult:{id:M.id,result:W5}}}catch(W5){let P9=W5 instanceof Error?W5.message:String(W5);return{toolUseId:M.id,result:{type:"tool_result",tool_use_id:M.id,content:`Error: ${P9}`,is_error:!0},toolResult:null}}}),C=await Promise.all(L);for(let M of C)if(Z5.push(M.result),M.toolResult)v?.(M.toolResult)}P.push({role:"user",content:Z5})}return{messages:P,metrics:n,totalCost:e,totalDuration:E5,totalCacheMetrics:T,compactionCount:K5,totalTokensCompacted:q5}}function H0(Q,X,Z){if(Z&&Q.length>0){let $=[...Q];for(let V=$.length-1;V>=0;V--){let J=$[V];if(J&&J.role==="user"){let z={role:"user",content:Array.isArray(J.content)?W0(J.content,Z):[{type:"text",text:`${String(J.content)}
|
|
32
|
-
|
|
33
|
-
${Z}`}]};$[V]=z;break}}return $}return Q}function W0(Q,X){if(Q.length>0){let $=Q[Q.length-1];if($&&$.type==="text"){let V={type:"text",text:`${$.text}
|
|
34
|
-
|
|
35
|
-
${X}`};return[...Q.slice(0,-1),V]}}let Z={type:"text",text:`
|
|
36
|
-
|
|
37
|
-
${X}`};return[...Q,Z]}function u6(Q){if(Q<0.01)return`$${Q.toFixed(4)}`;return`$${Q.toFixed(2)}`}function jX(Q){let X=u6(Q.costUSD),Z=`${Q.usage.input_tokens.toLocaleString()} input, ${Q.usage.output_tokens.toLocaleString()} output`;if(Q.usage.cache_read_input_tokens||Q.usage.cache_creation_input_tokens){let $=Q.usage.cache_read_input_tokens?.toLocaleString()??"0",V=Q.usage.cache_creation_input_tokens?.toLocaleString()??"0";return`Cost: ${X} | Tokens: ${Z} | Cache: ${$} read, ${V} write`}return`Cost: ${X} | Tokens: ${Z}`}function _X(Q){let X=u6(Q.costUSD),Z=Q.usage.input_tokens+Q.usage.output_tokens;return`Cost: ${X} | Tokens: ${Z.toLocaleString()}`}function UX(Q){let X=u6(Q.estimatedSavingsUSD);return`Cache: ${(Q.cacheHitRate*100).toFixed(1)}% hit rate | ${Q.totalCacheReadTokens.toLocaleString()} read | ${Q.totalCacheWriteTokens.toLocaleString()} written | Saved: ${X}`}import{homedir as G0}from"os";import{join as G5}from"path";class j0{sessionsDir;currentSessionId=null;currentSessionFile=null;writeQueue=Promise.resolve();constructor(Q){this.sessionsDir=Q??G5(G0(),".claude","sessions")}async init(){try{await Bun.write(G5(this.sessionsDir,".gitkeep"),"")}catch{}}generateSessionId(){let Q=Date.now().toString(36),X=Math.random().toString(36).slice(2,8);return`${Q}-${X}`}async createSession(Q){await this.init();let X=this.generateSessionId();this.currentSessionId=X,this.currentSessionFile=G5(this.sessionsDir,`${X}.jsonl`);let Z={id:X,created:Date.now(),updated:Date.now(),model:Q.model,workingDirectory:Q.workingDirectory,agentName:Q.agentName,agentColor:Q.agentColor,teamName:Q.teamName};await this.appendEntry(Z);let $={type:"context",timestamp:Date.now(),workingDirectory:Q.workingDirectory};return await this.appendEntry($),X}async resumeSession(Q){let X=G5(this.sessionsDir,`${Q}.jsonl`);try{let Z=await Bun.file(X).text();if(!Z)return null;let $=Z.trim().split(`
|
|
38
|
-
`),V=[];for(let J of $)try{V.push(JSON.parse(J))}catch{}return this.parseSessionEntries(V)}catch{return null}}parseSessionEntries(Q){let X=null,Z=[],$=[],V=[],J=null;for(let z of Q){if(!("type"in z)&&"id"in z&&"created"in z){X=z;continue}if("type"in z){let Y=z;switch(Y.type){case"message":Z.push(Y.data);break;case"tool_use":$.push(Y);break;case"metrics":V.push(Y.data);break;case"context":J=Y;break}}}if(!X)X={id:"unknown",created:Date.now(),updated:Date.now(),model:"claude-sonnet-4-6",workingDirectory:process.cwd()};return{metadata:X,messages:Z,tools:$,metrics:V,context:J}}async appendEntry(Q){if(!this.currentSessionFile)return;this.writeQueue=this.writeQueue.then(async()=>{let X=JSON.stringify(Q)+`
|
|
39
|
-
`,Z=Bun.file(this.currentSessionFile),$=await Z.exists()?await Z.text():"";await Bun.write(this.currentSessionFile,$+X)}),await this.writeQueue}async saveMessage(Q){let X={type:"message",timestamp:Date.now(),data:Q};await this.appendEntry(X),await this.updateTimestamp()}async saveToolUse(Q,X,Z,$,V){let J={type:"tool_use",timestamp:Date.now(),toolId:Q,toolName:X,input:Z,result:$,isError:V};await this.appendEntry(J)}async saveMetrics(Q){let X={type:"metrics",timestamp:Date.now(),data:Q};await this.appendEntry(X)}async updateTimestamp(){if(!this.currentSessionFile||!this.currentSessionId)return}async listSessions(Q=20){await this.init();let X=Bun.file(this.sessionsDir),Z=[];try{let V=[...new Bun.Glob("*.jsonl").scanSync(this.sessionsDir)],J=await Promise.all(V.map(async(z)=>{let Y=G5(this.sessionsDir,z),K=await Bun.file(Y).stat();return{file:z,fullPath:Y,mtime:K?.mtime??new Date(0)}}));J.sort((z,Y)=>Y.mtime.getTime()-z.mtime.getTime());for(let{file:z,fullPath:Y}of J.slice(0,Q)){let K=z.replace(".jsonl",""),q=await this.getSessionSummary(K,Y);if(q)Z.push(q)}}catch{}return Z}async getSessionSummary(Q,X){let Z=X??G5(this.sessionsDir,`${Q}.jsonl`);try{let $=await Bun.file(Z).text();if(!$)return null;let V=$.trim().split(`
|
|
40
|
-
`),J=null,z=0,Y=0,K=0,q=0,H;for(let W of V)try{let G=JSON.parse(W);if(G.id&&G.created)J=G;else if(G.type==="message"){z++;let j=G.data;if(!H&&j.role==="user"){let _=j.content.find((U)=>U.type==="text");if(_&&"text"in _){if(H=_.text.slice(0,100),_.text.length>100)H+="..."}}}else if(G.type==="metrics")Y+=G.data.costUSD,K+=G.data.usage.input_tokens,q+=G.data.usage.output_tokens}catch{}if(!J)return null;return{id:Q,created:J.created,updated:J.updated,model:J.model,messageCount:z,totalCost:Y,totalTokens:{input:K,output:q},firstMessage:H,workingDirectory:J.workingDirectory}}catch{return null}}getCurrentSessionId(){return this.currentSessionId}async exportSession(Q,X,Z){let $=await this.resumeSession(Q);if(!$)throw Error(`Session not found: ${Q}`);let V,J;switch(X){case"jsonl":{let Y=G5(this.sessionsDir,`${Q}.jsonl`);V=await Bun.file(Y).text(),J="jsonl";break}case"json":{V=JSON.stringify($,null,2),J="json";break}case"markdown":{V=this.sessionToMarkdown($),J="md";break}default:throw Error(`Unsupported format: ${X}`)}let z=Z??G5(process.cwd(),`session-${Q}.${J}`);return await Bun.write(z,V),z}sessionToMarkdown(Q){let X=[];X.push(`# Session: ${Q.metadata.id}`),X.push(""),X.push(`**Created:** ${new Date(Q.metadata.created).toISOString()}`),X.push(`**Model:** ${Q.metadata.model}`),X.push(`**Working Directory:** ${Q.metadata.workingDirectory}`),X.push(""),X.push("## Conversation"),X.push("");for(let Z of Q.messages){let $=Z.role==="user"?"**User**":"**Claude**";X.push(`### ${$}`),X.push("");for(let V of Z.content)if(V.type==="text")X.push(V.text),X.push("");else if(V.type==="tool_use"){let J=V;X.push(`\`\`\`tool:${J.name}`),X.push(JSON.stringify(J.input,null,2)),X.push("```"),X.push("")}else if(V.type==="tool_result"){let J=V;X.push(`**Result**${J.is_error?" (error)":""}:`),X.push("```"),X.push(typeof J.content==="string"?J.content:JSON.stringify(J.content,null,2)),X.push("```"),X.push("")}}if(Q.metrics.length>0){X.push("## Metrics"),X.push("");let Z=Q.metrics.reduce((J,z)=>J+z.costUSD,0),$=Q.metrics.reduce((J,z)=>J+z.usage.input_tokens,0),V=Q.metrics.reduce((J,z)=>J+z.usage.output_tokens,0);X.push(`- **Total Cost:** $${Z.toFixed(4)}`),X.push(`- **Total Input Tokens:** ${$.toLocaleString()}`),X.push(`- **Total Output Tokens:** ${V.toLocaleString()}`),X.push(`- **API Calls:** ${Q.metrics.length}`)}return X.join(`
|
|
41
|
-
`)}async deleteSession(Q){let X=G5(this.sessionsDir,`${Q}.jsonl`);try{if(await Bun.file(X).exists()){let{unlink:$}=await import("fs/promises");return await $(X),!0}return!1}catch{return!1}}}function _0(Q){let X=new Date(Q.created),Z=new Date(Q.updated),$=U0(Z),V=[];V.push(`\x1B[1m${Q.id}\x1B[0m (${$})`),V.push(` Model: ${Q.model} | Messages: ${Q.messageCount}`);let J=Q.totalCost<0.01?`$${Q.totalCost.toFixed(4)}`:`$${Q.totalCost.toFixed(2)}`;if(V.push(` Cost: ${J} | Tokens: ${Q.totalTokens.input.toLocaleString()} in, ${Q.totalTokens.output.toLocaleString()} out`),Q.firstMessage)V.push(` Preview: ${Q.firstMessage}`);return V.push(` Directory: ${Q.workingDirectory}`),V.join(`
|
|
42
|
-
`)}function U0(Q){let Z=new Date().getTime()-Q.getTime(),$=Math.floor(Z/60000),V=Math.floor(Z/3600000),J=Math.floor(Z/86400000);if($<1)return"just now";if($<60)return`${$}m ago`;if(V<24)return`${V}h ago`;if(J<7)return`${J}d ago`;return Q.toLocaleDateString()}function LX(Q){if(Q.length===0){console.log("No sessions found."),console.log(`
|
|
43
|
-
Start a new conversation to create a session.`);return}console.log(`\x1B[1mRecent Sessions (${Q.length})\x1B[0m
|
|
44
|
-
`);for(let X of Q)console.log(_0(X)),console.log("");console.log("To resume a session:"),console.log(" coder --resume <session-id>")}var h6=(Q,X,Z)=>{let $=Q instanceof RegExp?D7(Q,Z):Q,V=X instanceof RegExp?D7(X,Z):X,J=$!==null&&V!=null&&w0($,V,Z);return J&&{start:J[0],end:J[1],pre:Z.slice(0,J[0]),body:Z.slice(J[0]+$.length,J[1]),post:Z.slice(J[1]+V.length)}},D7=(Q,X)=>{let Z=X.match(Q);return Z?Z[0]:null},w0=(Q,X,Z)=>{let $,V,J,z=void 0,Y,K=Z.indexOf(Q),q=Z.indexOf(X,K+1),H=K;if(K>=0&&q>0){if(Q===X)return[K,q];$=[],J=Z.length;while(H>=0&&!Y){if(H===K)$.push(H),K=Z.indexOf(Q,H+1);else if($.length===1){let W=$.pop();if(W!==void 0)Y=[W,q]}else{if(V=$.pop(),V!==void 0&&V<J)J=V,z=q;q=Z.indexOf(X,H+1)}H=K<q&&K>=0?K:q}if($.length&&z!==void 0)Y=[J,z]}return Y};var I7="\x00SLASH"+Math.random()+"\x00",S7="\x00OPEN"+Math.random()+"\x00",m6="\x00CLOSE"+Math.random()+"\x00",x7="\x00COMMA"+Math.random()+"\x00",T7="\x00PERIOD"+Math.random()+"\x00",A0=new RegExp(I7,"g"),B0=new RegExp(S7,"g"),L0=new RegExp(m6,"g"),F0=new RegExp(x7,"g"),v0=new RegExp(T7,"g"),O0=/\\\\/g,C0=/\\{/g,M0=/\\}/g,R0=/\\,/g,P0=/\\./g,N0=1e5;function g6(Q){return!isNaN(Q)?parseInt(Q,10):Q.charCodeAt(0)}function D0(Q){return Q.replace(O0,I7).replace(C0,S7).replace(M0,m6).replace(R0,x7).replace(P0,T7)}function I0(Q){return Q.replace(A0,"\\").replace(B0,"{").replace(L0,"}").replace(F0,",").replace(v0,".")}function E7(Q){if(!Q)return[""];let X=[],Z=h6("{","}",Q);if(!Z)return Q.split(",");let{pre:$,body:V,post:J}=Z,z=$.split(",");z[z.length-1]+="{"+V+"}";let Y=E7(J);if(J.length)z[z.length-1]+=Y.shift(),z.push.apply(z,Y);return X.push.apply(X,z),X}function k7(Q,X={}){if(!Q)return[];let{max:Z=N0}=X;if(Q.slice(0,2)==="{}")Q="\\{\\}"+Q.slice(2);return g5(D0(Q),Z,!0).map(I0)}function S0(Q){return"{"+Q+"}"}function x0(Q){return/^-?0\d/.test(Q)}function T0(Q,X){return Q<=X}function E0(Q,X){return Q>=X}function g5(Q,X,Z){let $=[],V=h6("{","}",Q);if(!V)return[Q];let J=V.pre,z=V.post.length?g5(V.post,X,!1):[""];if(/\$$/.test(V.pre))for(let Y=0;Y<z.length&&Y<X;Y++){let K=J+"{"+V.body+"}"+z[Y];$.push(K)}else{let Y=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(V.body),K=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(V.body),q=Y||K,H=V.body.indexOf(",")>=0;if(!q&&!H){if(V.post.match(/,(?!,).*\}/))return Q=V.pre+"{"+V.body+m6+V.post,g5(Q,X,!0);return[Q]}let W;if(q)W=V.body.split(/\.\./);else if(W=E7(V.body),W.length===1&&W[0]!==void 0){if(W=g5(W[0],X,!1).map(S0),W.length===1)return z.map((j)=>V.pre+W[0]+j)}let G;if(q&&W[0]!==void 0&&W[1]!==void 0){let j=g6(W[0]),_=g6(W[1]),U=Math.max(W[0].length,W[1].length),A=W.length===3&&W[2]!==void 0?Math.abs(g6(W[2])):1,w=T0;if(_<j)A*=-1,w=E0;let v=W.some(x0);G=[];for(let O=j;w(O,_);O+=A){let F;if(K){if(F=String.fromCharCode(O),F==="\\")F=""}else if(F=String(O),v){let E=U-F.length;if(E>0){let y=Array(E+1).join("0");if(O<0)F="-"+y+F.slice(1);else F=y+F}}G.push(F)}}else{G=[];for(let j=0;j<W.length;j++)G.push.apply(G,g5(W[j],X,!1))}for(let j=0;j<G.length;j++)for(let _=0;_<z.length&&$.length<X;_++){let U=J+G[j]+z[_];if(!Z||q||U)$.push(U)}}return $}var m5=(Q)=>{if(typeof Q!=="string")throw TypeError("invalid pattern");if(Q.length>65536)throw TypeError("pattern is too long")};var k0={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},d5=(Q)=>Q.replace(/[[\]\\-]/g,"\\$&"),y0=(Q)=>Q.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),y7=(Q)=>Q.join(""),b7=(Q,X)=>{let Z=X;if(Q.charAt(Z)!=="[")throw Error("not in a brace expression");let $=[],V=[],J=Z+1,z=!1,Y=!1,K=!1,q=!1,H=Z,W="";Q:while(J<Q.length){let U=Q.charAt(J);if((U==="!"||U==="^")&&J===Z+1){q=!0,J++;continue}if(U==="]"&&z&&!K){H=J+1;break}if(z=!0,U==="\\"){if(!K){K=!0,J++;continue}}if(U==="["&&!K){for(let[A,[w,B,v]]of Object.entries(k0))if(Q.startsWith(A,J)){if(W)return["$.",!1,Q.length-Z,!0];if(J+=A.length,v)V.push(w);else $.push(w);Y=Y||B;continue Q}}if(K=!1,W){if(U>W)$.push(d5(W)+"-"+d5(U));else if(U===W)$.push(d5(U));W="",J++;continue}if(Q.startsWith("-]",J+1)){$.push(d5(U+"-")),J+=2;continue}if(Q.startsWith("-",J+1)){W=U,J+=2;continue}$.push(d5(U)),J++}if(H<J)return["",!1,0,!1];if(!$.length&&!V.length)return["$.",!1,Q.length-Z,!0];if(V.length===0&&$.length===1&&/^\\?.$/.test($[0])&&!q){let U=$[0].length===2?$[0].slice(-1):$[0];return[y0(U),!1,H-Z,!1]}let G="["+(q?"^":"")+y7($)+"]",j="["+(q?"":"^")+y7(V)+"]";return[$.length&&V.length?"("+G+"|"+j+")":$.length?G:j,Y,H-Z,!0]};var a=(Q,{windowsPathsNoEscape:X=!1,magicalBraces:Z=!0}={})=>{if(Z)return X?Q.replace(/\[([^\/\\])\]/g,"$1"):Q.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1");return X?Q.replace(/\[([^\/\\{}])\]/g,"$1"):Q.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1")};var h,b0=new Set(["!","?","+","*","@"]),d6=(Q)=>b0.has(Q),f7=(Q)=>d6(Q.type),f0=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),u0=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),h0=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),u7=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),g0="(?!(?:^|/)\\.\\.?(?:$|/))",Y6="(?!\\.)",m0=new Set(["[","."]),d0=new Set(["..","."]),c0=new Set("().*{}+?[]^$\\!"),l0=(Q)=>Q.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),c6="[^/]",h7=c6+"*?",g7=c6+"+?",p0=0;class N5{type;#Q;#$;#V=!1;#X=[];#z;#C;#B;#W=!1;#Y;#G;#H=!1;id=++p0;get depth(){return(this.#z?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#Q.id,parent:this.#z?.id,depth:this.depth,partsLength:this.#X.length,parts:this.#X}}constructor(Q,X,Z={}){if(this.type=Q,Q)this.#$=!0;if(this.#z=X,this.#Q=this.#z?this.#z.#Q:this,this.#Y=this.#Q===this?Z:this.#Q.#Y,this.#B=this.#Q===this?[]:this.#Q.#B,Q==="!"&&!this.#Q.#W)this.#B.push(this);this.#C=this.#z?this.#z.#X.length:0}get hasMagic(){if(this.#$!==void 0)return this.#$;for(let Q of this.#X){if(typeof Q==="string")continue;if(Q.type||Q.hasMagic)return this.#$=!0}return this.#$}toString(){if(this.#G!==void 0)return this.#G;if(!this.type)return this.#G=this.#X.map((Q)=>String(Q)).join("");else return this.#G=this.type+"("+this.#X.map((Q)=>String(Q)).join("|")+")"}#K(){if(this!==this.#Q)throw Error("should only call on root");if(this.#W)return this;this.toString(),this.#W=!0;let Q;while(Q=this.#B.pop()){if(Q.type!=="!")continue;let X=Q,Z=X.#z;while(Z){for(let $=X.#C+1;!Z.type&&$<Z.#X.length;$++)for(let V of Q.#X){if(typeof V==="string")throw Error("string part in extglob AST??");V.copyIn(Z.#X[$])}X=Z,Z=X.#z}}return this}push(...Q){for(let X of Q){if(X==="")continue;if(typeof X!=="string"&&!(X instanceof h&&X.#z===this))throw Error("invalid part: "+X);this.#X.push(X)}}toJSON(){let Q=this.type===null?this.#X.slice().map((X)=>typeof X==="string"?X:X.toJSON()):[this.type,...this.#X.map((X)=>X.toJSON())];if(this.isStart()&&!this.type)Q.unshift([]);if(this.isEnd()&&(this===this.#Q||this.#Q.#W&&this.#z?.type==="!"))Q.push({});return Q}isStart(){if(this.#Q===this)return!0;if(!this.#z?.isStart())return!1;if(this.#C===0)return!0;let Q=this.#z;for(let X=0;X<this.#C;X++){let Z=Q.#X[X];if(!(Z instanceof h&&Z.type==="!"))return!1}return!0}isEnd(){if(this.#Q===this)return!0;if(this.#z?.type==="!")return!0;if(!this.#z?.isEnd())return!1;if(!this.type)return this.#z?.isEnd();let Q=this.#z?this.#z.#X.length:0;return this.#C===Q-1}copyIn(Q){if(typeof Q==="string")this.push(Q);else this.push(Q.clone(this))}clone(Q){let X=new h(this.type,Q);for(let Z of this.#X)X.copyIn(Z);return X}static#J(Q,X,Z,$,V){let J=$.maxExtglobRecursion??2,z=!1,Y=!1,K=-1,q=!1;if(X.type===null){let _=Z,U="";while(_<Q.length){let A=Q.charAt(_++);if(z||A==="\\"){z=!z,U+=A;continue}if(Y){if(_===K+1){if(A==="^"||A==="!")q=!0}else if(A==="]"&&!(_===K+2&&q))Y=!1;U+=A;continue}else if(A==="["){Y=!0,K=_,q=!1,U+=A;continue}if(!$.noext&&d6(A)&&Q.charAt(_)==="("&&V<=J){X.push(U),U="";let B=new h(A,X);_=h.#J(Q,B,_,$,V+1),X.push(B);continue}U+=A}return X.push(U),_}let H=Z+1,W=new h(null,X),G=[],j="";while(H<Q.length){let _=Q.charAt(H++);if(z||_==="\\"){z=!z,j+=_;continue}if(Y){if(H===K+1){if(_==="^"||_==="!")q=!0}else if(_==="]"&&!(H===K+2&&q))Y=!1;j+=_;continue}else if(_==="["){Y=!0,K=H,q=!1,j+=_;continue}if(!$.noext&&d6(_)&&Q.charAt(H)==="("&&(V<=J||X&&X.#_(_))){let A=X&&X.#_(_)?0:1;W.push(j),j="";let w=new h(_,W);W.push(w),H=h.#J(Q,w,H,$,V+A);continue}if(_==="|"){W.push(j),j="",G.push(W),W=new h(null,X);continue}if(_===")"){if(j===""&&X.#X.length===0)X.#H=!0;return W.push(j),j="",X.push(...G,W),H}j+=_}return X.type=null,X.#$=void 0,X.#X=[Q.substring(Z-1)],H}#L(Q){return this.#v(Q,u0)}#v(Q,X=f0){if(!Q||typeof Q!=="object"||Q.type!==null||Q.#X.length!==1||this.type===null)return!1;let Z=Q.#X[0];if(!Z||typeof Z!=="object"||Z.type===null)return!1;return this.#_(Z.type,X)}#_(Q,X=h0){return!!X.get(this.type)?.includes(Q)}#U(Q,X){let Z=Q.#X[0],$=new h(null,Z,this.options);$.#X.push(""),Z.push($),this.#P(Q,X)}#P(Q,X){let Z=Q.#X[0];this.#X.splice(X,1,...Z.#X);for(let $ of Z.#X)if(typeof $==="object")$.#z=this;this.#G=void 0}#w(Q){return!!u7.get(this.type)?.has(Q)}#O(Q){if(!Q||typeof Q!=="object"||Q.type!==null||Q.#X.length!==1||this.type===null||this.#X.length!==1)return!1;let X=Q.#X[0];if(!X||typeof X!=="object"||X.type===null)return!1;return this.#w(X.type)}#M(Q){let X=u7.get(this.type),Z=Q.#X[0],$=X?.get(Z.type);if(!$)return!1;this.#X=Z.#X;for(let V of this.#X)if(typeof V==="object")V.#z=this;this.type=$,this.#G=void 0,this.#H=!1}static fromGlob(Q,X={}){let Z=new h(null,void 0,X);return h.#J(Q,Z,0,X,0),Z}toMMPattern(){if(this!==this.#Q)return this.#Q.toMMPattern();let Q=this.toString(),[X,Z,$,V]=this.toRegExpSource();if(!($||this.#$||this.#Y.nocase&&!this.#Y.nocaseMagicOnly&&Q.toUpperCase()!==Q.toLowerCase()))return Z;let z=(this.#Y.nocase?"i":"")+(V?"u":"");return Object.assign(new RegExp(`^${X}$`,z),{_src:X,_glob:Q})}get options(){return this.#Y}toRegExpSource(Q){let X=Q??!!this.#Y.dot;if(this.#Q===this)this.#j(),this.#K();if(!f7(this)){let Y=this.isStart()&&this.isEnd()&&!this.#X.some((G)=>typeof G!=="string"),K=this.#X.map((G)=>{let[j,_,U,A]=typeof G==="string"?h.#F(G,this.#$,Y):G.toRegExpSource(Q);return this.#$=this.#$||U,this.#V=this.#V||A,j}).join(""),q="";if(this.isStart()){if(typeof this.#X[0]==="string"){if(!(this.#X.length===1&&d0.has(this.#X[0]))){let j=m0,_=X&&j.has(K.charAt(0))||K.startsWith("\\.")&&j.has(K.charAt(2))||K.startsWith("\\.\\.")&&j.has(K.charAt(4)),U=!X&&!Q&&j.has(K.charAt(0));q=_?g0:U?Y6:""}}}let H="";if(this.isEnd()&&this.#Q.#W&&this.#z?.type==="!")H="(?:$|\\/)";return[q+K+H,a(K),this.#$=!!this.#$,this.#V]}let Z=this.type==="*"||this.type==="+",$=this.type==="!"?"(?:(?!(?:":"(?:",V=this.#A(X);if(this.isStart()&&this.isEnd()&&!V&&this.type!=="!"){let Y=this.toString(),K=this;return K.#X=[Y],K.type=null,K.#$=void 0,[Y,a(this.toString()),!1,!1]}let J=!Z||Q||X||!Y6?"":this.#A(!0);if(J===V)J="";if(J)V=`(?:${V})(?:${J})*?`;let z="";if(this.type==="!"&&this.#H)z=(this.isStart()&&!X?Y6:"")+g7;else{let Y=this.type==="!"?"))"+(this.isStart()&&!X&&!Q?Y6:"")+h7+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&J?")":this.type==="*"&&J?")?":`)${this.type}`;z=$+V+Y}return[z,a(V),this.#$=!!this.#$,this.#V]}#j(){if(!f7(this)){for(let Q of this.#X)if(typeof Q==="object")Q.#j()}else{let Q=0,X=!1;do{X=!0;for(let Z=0;Z<this.#X.length;Z++){let $=this.#X[Z];if(typeof $==="object"){if($.#j(),this.#v($))X=!1,this.#P($,Z);else if(this.#L($))X=!1,this.#U($,Z);else if(this.#O($))X=!1,this.#M($)}}}while(!X&&++Q<10)}this.#G=void 0}#A(Q){return this.#X.map((X)=>{if(typeof X==="string")throw Error("string type in extglob ast??");let[Z,$,V,J]=X.toRegExpSource(Q);return this.#V=this.#V||J,Z}).filter((X)=>!(this.isStart()&&this.isEnd())||!!X).join("|")}static#F(Q,X,Z=!1){let $=!1,V="",J=!1,z=!1;for(let Y=0;Y<Q.length;Y++){let K=Q.charAt(Y);if($){$=!1,V+=(c0.has(K)?"\\":"")+K;continue}if(K==="*"){if(z)continue;z=!0,V+=Z&&/^[*]+$/.test(Q)?g7:h7,X=!0;continue}else z=!1;if(K==="\\"){if(Y===Q.length-1)V+="\\\\";else $=!0;continue}if(K==="["){let[q,H,W,G]=b7(Q,Y);if(W){V+=q,J=J||H,Y+=W-1,X=X||G;continue}}if(K==="?"){V+=c6,X=!0;continue}V+=l0(K)}return[V,a(Q),!!X,J]}}h=N5;var D5=(Q,{windowsPathsNoEscape:X=!1,magicalBraces:Z=!1}={})=>{if(Z)return X?Q.replace(/[?*()[\]{}]/g,"[$&]"):Q.replace(/[?*()[\]\\{}]/g,"\\$&");return X?Q.replace(/[?*()[\]]/g,"[$&]"):Q.replace(/[?*()[\]\\]/g,"\\$&")};var b=(Q,X,Z={})=>{if(m5(X),!Z.nocomment&&X.charAt(0)==="#")return!1;return new l(X,Z).match(Q)},i0=/^\*+([^+@!?\*\[\(]*)$/,n0=(Q)=>(X)=>!X.startsWith(".")&&X.endsWith(Q),o0=(Q)=>(X)=>X.endsWith(Q),a0=(Q)=>{return Q=Q.toLowerCase(),(X)=>!X.startsWith(".")&&X.toLowerCase().endsWith(Q)},r0=(Q)=>{return Q=Q.toLowerCase(),(X)=>X.toLowerCase().endsWith(Q)},s0=/^\*+\.\*+$/,t0=(Q)=>!Q.startsWith(".")&&Q.includes("."),e0=(Q)=>Q!=="."&&Q!==".."&&Q.includes("."),QQ=/^\.\*+$/,XQ=(Q)=>Q!=="."&&Q!==".."&&Q.startsWith("."),ZQ=/^\*+$/,$Q=(Q)=>Q.length!==0&&!Q.startsWith("."),VQ=(Q)=>Q.length!==0&&Q!=="."&&Q!=="..",JQ=/^\?+([^+@!?\*\[\(]*)?$/,zQ=([Q,X=""])=>{let Z=c7([Q]);if(!X)return Z;return X=X.toLowerCase(),($)=>Z($)&&$.toLowerCase().endsWith(X)},YQ=([Q,X=""])=>{let Z=l7([Q]);if(!X)return Z;return X=X.toLowerCase(),($)=>Z($)&&$.toLowerCase().endsWith(X)},KQ=([Q,X=""])=>{let Z=l7([Q]);return!X?Z:($)=>Z($)&&$.endsWith(X)},qQ=([Q,X=""])=>{let Z=c7([Q]);return!X?Z:($)=>Z($)&&$.endsWith(X)},c7=([Q])=>{let X=Q.length;return(Z)=>Z.length===X&&!Z.startsWith(".")},l7=([Q])=>{let X=Q.length;return(Z)=>Z.length===X&&Z!=="."&&Z!==".."},p7=typeof process==="object"&&process?typeof process.env==="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",m7={win32:{sep:"\\"},posix:{sep:"/"}},HQ=p7==="win32"?m7.win32.sep:m7.posix.sep;b.sep=HQ;var N=Symbol("globstar **");b.GLOBSTAR=N;var WQ="[^/]",GQ=WQ+"*?",jQ="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",_Q="(?:(?!(?:\\/|^)\\.).)*?",UQ=(Q,X={})=>(Z)=>b(Z,Q,X);b.filter=UQ;var c=(Q,X={})=>Object.assign({},Q,X),wQ=(Q)=>{if(!Q||typeof Q!=="object"||!Object.keys(Q).length)return b;let X=b;return Object.assign(($,V,J={})=>X($,V,c(Q,J)),{Minimatch:class extends X.Minimatch{constructor(V,J={}){super(V,c(Q,J))}static defaults(V){return X.defaults(c(Q,V)).Minimatch}},AST:class extends X.AST{constructor(V,J,z={}){super(V,J,c(Q,z))}static fromGlob(V,J={}){return X.AST.fromGlob(V,c(Q,J))}},unescape:($,V={})=>X.unescape($,c(Q,V)),escape:($,V={})=>X.escape($,c(Q,V)),filter:($,V={})=>X.filter($,c(Q,V)),defaults:($)=>X.defaults(c(Q,$)),makeRe:($,V={})=>X.makeRe($,c(Q,V)),braceExpand:($,V={})=>X.braceExpand($,c(Q,V)),match:($,V,J={})=>X.match($,V,c(Q,J)),sep:X.sep,GLOBSTAR:N})};b.defaults=wQ;var i7=(Q,X={})=>{if(m5(Q),X.nobrace||!/\{(?:(?!\{).)*\}/.test(Q))return[Q];return k7(Q,{max:X.braceExpandMax})};b.braceExpand=i7;var AQ=(Q,X={})=>new l(Q,X).makeRe();b.makeRe=AQ;var BQ=(Q,X,Z={})=>{let $=new l(X,Z);if(Q=Q.filter((V)=>$.match(V)),$.options.nonull&&!Q.length)Q.push(X);return Q};b.match=BQ;var d7=/[?*]|[+@!]\(.*?\)|\[|\]/,LQ=(Q)=>Q.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");class l{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(Q,X={}){m5(Q),X=X||{},this.options=X,this.maxGlobstarRecursion=X.maxGlobstarRecursion??200,this.pattern=Q,this.platform=X.platform||p7,this.isWindows=this.platform==="win32";let Z="allowWindowsEscape";if(this.windowsPathsNoEscape=!!X.windowsPathsNoEscape||X[Z]===!1,this.windowsPathsNoEscape)this.pattern=this.pattern.replace(/\\/g,"/");this.preserveMultipleSlashes=!!X.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!X.nonegate,this.comment=!1,this.empty=!1,this.partial=!!X.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=X.windowsNoMagicRoot!==void 0?X.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let Q of this.set)for(let X of Q)if(typeof X!=="string")return!0;return!1}debug(...Q){}make(){let Q=this.pattern,X=this.options;if(!X.nocomment&&Q.charAt(0)==="#"){this.comment=!0;return}if(!Q){this.empty=!0;return}if(this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],X.debug)this.debug=(...V)=>console.error(...V);this.debug(this.pattern,this.globSet);let Z=this.globSet.map((V)=>this.slashSplit(V));this.globParts=this.preprocess(Z),this.debug(this.pattern,this.globParts);let $=this.globParts.map((V,J,z)=>{if(this.isWindows&&this.windowsNoMagicRoot){let Y=V[0]===""&&V[1]===""&&(V[2]==="?"||!d7.test(V[2]))&&!d7.test(V[3]),K=/^[a-z]:/i.test(V[0]);if(Y)return[...V.slice(0,4),...V.slice(4).map((q)=>this.parse(q))];else if(K)return[V[0],...V.slice(1).map((q)=>this.parse(q))]}return V.map((Y)=>this.parse(Y))});if(this.debug(this.pattern,$),this.set=$.filter((V)=>V.indexOf(!1)===-1),this.isWindows)for(let V=0;V<this.set.length;V++){let J=this.set[V];if(J[0]===""&&J[1]===""&&this.globParts[V][2]==="?"&&typeof J[3]==="string"&&/^[a-z]:$/i.test(J[3]))J[2]="?"}this.debug(this.pattern,this.set)}preprocess(Q){if(this.options.noglobstar){for(let Z=0;Z<Q.length;Z++)for(let $=0;$<Q[Z].length;$++)if(Q[Z][$]==="**")Q[Z][$]="*"}let{optimizationLevel:X=1}=this.options;if(X>=2)Q=this.firstPhasePreProcess(Q),Q=this.secondPhasePreProcess(Q);else if(X>=1)Q=this.levelOneOptimize(Q);else Q=this.adjascentGlobstarOptimize(Q);return Q}adjascentGlobstarOptimize(Q){return Q.map((X)=>{let Z=-1;while((Z=X.indexOf("**",Z+1))!==-1){let $=Z;while(X[$+1]==="**")$++;if($!==Z)X.splice(Z,$-Z)}return X})}levelOneOptimize(Q){return Q.map((X)=>{return X=X.reduce((Z,$)=>{let V=Z[Z.length-1];if($==="**"&&V==="**")return Z;if($===".."){if(V&&V!==".."&&V!=="."&&V!=="**")return Z.pop(),Z}return Z.push($),Z},[]),X.length===0?[""]:X})}levelTwoFileOptimize(Q){if(!Array.isArray(Q))Q=this.slashSplit(Q);let X=!1;do{if(X=!1,!this.preserveMultipleSlashes){for(let $=1;$<Q.length-1;$++){let V=Q[$];if($===1&&V===""&&Q[0]==="")continue;if(V==="."||V==="")X=!0,Q.splice($,1),$--}if(Q[0]==="."&&Q.length===2&&(Q[1]==="."||Q[1]===""))X=!0,Q.pop()}let Z=0;while((Z=Q.indexOf("..",Z+1))!==-1){let $=Q[Z-1];if($&&$!=="."&&$!==".."&&$!=="**")X=!0,Q.splice(Z-1,2),Z-=2}}while(X);return Q.length===0?[""]:Q}firstPhasePreProcess(Q){let X=!1;do{X=!1;for(let Z of Q){let $=-1;while(($=Z.indexOf("**",$+1))!==-1){let J=$;while(Z[J+1]==="**")J++;if(J>$)Z.splice($+1,J-$);let z=Z[$+1],Y=Z[$+2],K=Z[$+3];if(z!=="..")continue;if(!Y||Y==="."||Y===".."||!K||K==="."||K==="..")continue;X=!0,Z.splice($,1);let q=Z.slice(0);q[$]="**",Q.push(q),$--}if(!this.preserveMultipleSlashes){for(let J=1;J<Z.length-1;J++){let z=Z[J];if(J===1&&z===""&&Z[0]==="")continue;if(z==="."||z==="")X=!0,Z.splice(J,1),J--}if(Z[0]==="."&&Z.length===2&&(Z[1]==="."||Z[1]===""))X=!0,Z.pop()}let V=0;while((V=Z.indexOf("..",V+1))!==-1){let J=Z[V-1];if(J&&J!=="."&&J!==".."&&J!=="**"){X=!0;let Y=V===1&&Z[V+1]==="**"?["."]:[];if(Z.splice(V-1,2,...Y),Z.length===0)Z.push("");V-=2}}}}while(X);return Q}secondPhasePreProcess(Q){for(let X=0;X<Q.length-1;X++)for(let Z=X+1;Z<Q.length;Z++){let $=this.partsMatch(Q[X],Q[Z],!this.preserveMultipleSlashes);if($){Q[X]=[],Q[Z]=$;break}}return Q.filter((X)=>X.length)}partsMatch(Q,X,Z=!1){let $=0,V=0,J=[],z="";while($<Q.length&&V<X.length)if(Q[$]===X[V])J.push(z==="b"?X[V]:Q[$]),$++,V++;else if(Z&&Q[$]==="**"&&X[V]===Q[$+1])J.push(Q[$]),$++;else if(Z&&X[V]==="**"&&Q[$]===X[V+1])J.push(X[V]),V++;else if(Q[$]==="*"&&X[V]&&(this.options.dot||!X[V].startsWith("."))&&X[V]!=="**"){if(z==="b")return!1;z="a",J.push(Q[$]),$++,V++}else if(X[V]==="*"&&Q[$]&&(this.options.dot||!Q[$].startsWith("."))&&Q[$]!=="**"){if(z==="a")return!1;z="b",J.push(X[V]),$++,V++}else return!1;return Q.length===X.length&&J}parseNegate(){if(this.nonegate)return;let Q=this.pattern,X=!1,Z=0;for(let $=0;$<Q.length&&Q.charAt($)==="!";$++)X=!X,Z++;if(Z)this.pattern=Q.slice(Z);this.negate=X}matchOne(Q,X,Z=!1){let $=0,V=0;if(this.isWindows){let z=typeof Q[0]==="string"&&/^[a-z]:$/i.test(Q[0]),Y=!z&&Q[0]===""&&Q[1]===""&&Q[2]==="?"&&/^[a-z]:$/i.test(Q[3]),K=typeof X[0]==="string"&&/^[a-z]:$/i.test(X[0]),q=!K&&X[0]===""&&X[1]===""&&X[2]==="?"&&typeof X[3]==="string"&&/^[a-z]:$/i.test(X[3]),H=Y?3:z?0:void 0,W=q?3:K?0:void 0;if(typeof H==="number"&&typeof W==="number"){let[G,j]=[Q[H],X[W]];if(G.toLowerCase()===j.toLowerCase())X[W]=G,V=W,$=H}}let{optimizationLevel:J=1}=this.options;if(J>=2)Q=this.levelTwoFileOptimize(Q);if(X.includes(N))return this.#Q(Q,X,Z,$,V);return this.#V(Q,X,Z,$,V)}#Q(Q,X,Z,$,V){let J=X.indexOf(N,V),z=X.lastIndexOf(N),[Y,K,q]=Z?[X.slice(V,J),X.slice(J+1),[]]:[X.slice(V,J),X.slice(J+1,z),X.slice(z+1)];if(Y.length){let w=Q.slice($,$+Y.length);if(!this.#V(w,Y,Z,0,0))return!1;$+=Y.length,V+=Y.length}let H=0;if(q.length){if(q.length+$>Q.length)return!1;let w=Q.length-q.length;if(this.#V(Q,q,Z,w,0))H=q.length;else{if(Q[Q.length-1]!==""||$+q.length===Q.length)return!1;if(w--,!this.#V(Q,q,Z,w,0))return!1;H=q.length+1}}if(!K.length){let w=!!H;for(let B=$;B<Q.length-H;B++){let v=String(Q[B]);if(w=!0,v==="."||v===".."||!this.options.dot&&v.startsWith("."))return!1}return Z||w}let W=[[[],0]],G=W[0],j=0,_=[0];for(let w of K)if(w===N)_.push(j),G=[[],0],W.push(G);else G[0].push(w),j++;let U=W.length-1,A=Q.length-H;for(let w of W)w[1]=A-(_[U--]+w[0].length);return!!this.#$(Q,W,$,0,Z,0,!!H)}#$(Q,X,Z,$,V,J,z){let Y=X[$];if(!Y){for(let H=Z;H<Q.length;H++){z=!0;let W=Q[H];if(W==="."||W===".."||!this.options.dot&&W.startsWith("."))return!1}return z}let[K,q]=Y;while(Z<=q){if(this.#V(Q.slice(0,Z+K.length),K,V,Z,0)&&J<this.maxGlobstarRecursion){let G=this.#$(Q,X,Z+K.length,$+1,V,J+1,z);if(G!==!1)return G}let W=Q[Z];if(W==="."||W===".."||!this.options.dot&&W.startsWith("."))return!1;Z++}return V||null}#V(Q,X,Z,$,V){let J,z,Y,K;for(J=$,z=V,K=Q.length,Y=X.length;J<K&&z<Y;J++,z++){this.debug("matchOne loop");let q=X[z],H=Q[J];if(this.debug(X,q,H),q===!1||q===N)return!1;let W;if(typeof q==="string")W=H===q,this.debug("string match",q,H,W);else W=q.test(H),this.debug("pattern match",q,H,W);if(!W)return!1}if(J===K&&z===Y)return!0;else if(J===K)return Z;else if(z===Y)return J===K-1&&Q[J]==="";else throw Error("wtf?")}braceExpand(){return i7(this.pattern,this.options)}parse(Q){m5(Q);let X=this.options;if(Q==="**")return N;if(Q==="")return"";let Z,$=null;if(Z=Q.match(ZQ))$=X.dot?VQ:$Q;else if(Z=Q.match(i0))$=(X.nocase?X.dot?r0:a0:X.dot?o0:n0)(Z[1]);else if(Z=Q.match(JQ))$=(X.nocase?X.dot?YQ:zQ:X.dot?KQ:qQ)(Z);else if(Z=Q.match(s0))$=X.dot?e0:t0;else if(Z=Q.match(QQ))$=XQ;let V=N5.fromGlob(Q,this.options).toMMPattern();if($&&typeof V==="object")Reflect.defineProperty(V,"test",{value:$});return V}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let Q=this.set;if(!Q.length)return this.regexp=!1,this.regexp;let X=this.options,Z=X.noglobstar?GQ:X.dot?jQ:_Q,$=new Set(X.nocase?["i"]:[]),V=Q.map((Y)=>{let K=Y.map((H)=>{if(H instanceof RegExp)for(let W of H.flags.split(""))$.add(W);return typeof H==="string"?LQ(H):H===N?N:H._src});K.forEach((H,W)=>{let G=K[W+1],j=K[W-1];if(H!==N||j===N)return;if(j===void 0)if(G!==void 0&&G!==N)K[W+1]="(?:\\/|"+Z+"\\/)?"+G;else K[W]=Z;else if(G===void 0)K[W-1]=j+"(?:\\/|\\/"+Z+")?";else if(G!==N)K[W-1]=j+"(?:\\/|\\/"+Z+"\\/)"+G,K[W+1]=N});let q=K.filter((H)=>H!==N);if(this.partial&&q.length>=1){let H=[];for(let W=1;W<=q.length;W++)H.push(q.slice(0,W).join("/"));return"(?:"+H.join("|")+")"}return q.join("/")}).join("|"),[J,z]=Q.length>1?["(?:",")"]:["",""];if(V="^"+J+V+z+"$",this.partial)V="^(?:\\/|"+J+V.slice(1,-1)+z+")$";if(this.negate)V="^(?!"+V+").+$";try{this.regexp=new RegExp(V,[...$].join(""))}catch(Y){this.regexp=!1}return this.regexp}slashSplit(Q){if(this.preserveMultipleSlashes)return Q.split("/");else if(this.isWindows&&/^\/\/[^\/]+/.test(Q))return["",...Q.split(/\/+/)];else return Q.split(/\/+/)}match(Q,X=this.partial){if(this.debug("match",Q,this.pattern),this.comment)return!1;if(this.empty)return Q==="";if(Q==="/"&&X)return!0;let Z=this.options;if(this.isWindows)Q=Q.split("\\").join("/");let $=this.slashSplit(Q);this.debug(this.pattern,"split",$);let V=this.set;this.debug(this.pattern,"set",V);let J=$[$.length-1];if(!J)for(let z=$.length-2;!J&&z>=0;z--)J=$[z];for(let z=0;z<V.length;z++){let Y=V[z],K=$;if(Z.matchBase&&Y.length===1)K=[J];if(this.matchOne(K,Y,X)){if(Z.flipNegate)return!0;return!this.negate}}if(Z.flipNegate)return!1;return this.negate}static defaults(Q){return b.defaults(Q).Minimatch}}b.AST=N5;b.Minimatch=l;b.escape=D5;b.unescape=a;import{fileURLToPath as eQ}from"url";var FQ=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,o7=new Set,l6=typeof process=="object"&&process?process:{},a7=(Q,X,Z,$)=>{typeof l6.emitWarning=="function"?l6.emitWarning(Q,X,Z,$):console.error(`[${Z}] ${X}: ${Q}`)},q6=globalThis.AbortController,n7=globalThis.AbortSignal;if(typeof q6>"u"){n7=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(Z,$){this._onabort.push($)}},q6=class{constructor(){X()}signal=new n7;abort(Z){if(!this.signal.aborted){this.signal.reason=Z,this.signal.aborted=!0;for(let $ of this.signal._onabort)$(Z);this.signal.onabort?.(Z)}}};let Q=l6.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",X=()=>{Q&&(Q=!1,a7("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",X))}}var vQ=(Q)=>!o7.has(Q),gX=Symbol("type"),w5=(Q)=>Q&&Q===Math.floor(Q)&&Q>0&&isFinite(Q),r7=(Q)=>w5(Q)?Q<=Math.pow(2,8)?Uint8Array:Q<=Math.pow(2,16)?Uint16Array:Q<=Math.pow(2,32)?Uint32Array:Q<=Number.MAX_SAFE_INTEGER?K6:null:null,K6=class extends Array{constructor(Q){super(Q),this.fill(0)}},OQ=class Q{heap;length;static#Q=!1;static create(X){let Z=r7(X);if(!Z)return[];Q.#Q=!0;let $=new Q(X,Z);return Q.#Q=!1,$}constructor(X,Z){if(!Q.#Q)throw TypeError("instantiate Stack using Stack.create(n)");this.heap=new Z(X),this.length=0}push(X){this.heap[this.length++]=X}pop(){return this.heap[--this.length]}},c5=class Q{#Q;#$;#V;#X;#z;#C;#B;#W;get perf(){return this.#W}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#Y;#G;#H;#K;#J;#L;#v;#_;#U;#P;#w;#O;#M;#j;#A;#F;#N;#Z;#k;static unsafeExposeInternals(X){return{starts:X.#M,ttls:X.#j,autopurgeTimers:X.#A,sizes:X.#O,keyMap:X.#H,keyList:X.#K,valList:X.#J,next:X.#L,prev:X.#v,get head(){return X.#_},get tail(){return X.#U},free:X.#P,isBackgroundFetch:(Z)=>X.#q(Z),backgroundFetch:(Z,$,V,J)=>X.#d(Z,$,V,J),moveToTail:(Z)=>X.#b(Z),indexes:(Z)=>X.#S(Z),rindexes:(Z)=>X.#x(Z),isStale:(Z)=>X.#R(Z)}}get max(){return this.#Q}get maxSize(){return this.#$}get calculatedSize(){return this.#G}get size(){return this.#Y}get fetchMethod(){return this.#C}get memoMethod(){return this.#B}get dispose(){return this.#V}get onInsert(){return this.#X}get disposeAfter(){return this.#z}constructor(X){let{max:Z=0,ttl:$,ttlResolution:V=1,ttlAutopurge:J,updateAgeOnGet:z,updateAgeOnHas:Y,allowStale:K,dispose:q,onInsert:H,disposeAfter:W,noDisposeOnSet:G,noUpdateTTL:j,maxSize:_=0,maxEntrySize:U=0,sizeCalculation:A,fetchMethod:w,memoMethod:B,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:O,allowStaleOnFetchRejection:F,allowStaleOnFetchAbort:E,ignoreFetchAbort:y,perf:t}=X;if(t!==void 0&&typeof t?.now!="function")throw TypeError("perf option must have a now() method if specified");if(this.#W=t??FQ,Z!==0&&!w5(Z))throw TypeError("max option must be a nonnegative integer");let P=Z?r7(Z):Array;if(!P)throw Error("invalid max value: "+Z);if(this.#Q=Z,this.#$=_,this.maxEntrySize=U||this.#$,this.sizeCalculation=A,this.sizeCalculation){if(!this.#$&&!this.maxEntrySize)throw TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw TypeError("sizeCalculation set to non-function")}if(B!==void 0&&typeof B!="function")throw TypeError("memoMethod must be a function if defined");if(this.#B=B,w!==void 0&&typeof w!="function")throw TypeError("fetchMethod must be a function if specified");if(this.#C=w,this.#N=!!w,this.#H=new Map,this.#K=Array(Z).fill(void 0),this.#J=Array(Z).fill(void 0),this.#L=new P(Z),this.#v=new P(Z),this.#_=0,this.#U=0,this.#P=OQ.create(Z),this.#Y=0,this.#G=0,typeof q=="function"&&(this.#V=q),typeof H=="function"&&(this.#X=H),typeof W=="function"?(this.#z=W,this.#w=[]):(this.#z=void 0,this.#w=void 0),this.#F=!!this.#V,this.#k=!!this.#X,this.#Z=!!this.#z,this.noDisposeOnSet=!!G,this.noUpdateTTL=!!j,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!F,this.allowStaleOnFetchAbort=!!E,this.ignoreFetchAbort=!!y,this.maxEntrySize!==0){if(this.#$!==0&&!w5(this.#$))throw TypeError("maxSize must be a positive integer if specified");if(!w5(this.maxEntrySize))throw TypeError("maxEntrySize must be a positive integer if specified");this.#l()}if(this.allowStale=!!K,this.noDeleteOnStaleGet=!!O,this.updateAgeOnGet=!!z,this.updateAgeOnHas=!!Y,this.ttlResolution=w5(V)||V===0?V:1,this.ttlAutopurge=!!J,this.ttl=$||0,this.ttl){if(!w5(this.ttl))throw TypeError("ttl must be a positive integer if specified");this.#T()}if(this.#Q===0&&this.ttl===0&&this.#$===0)throw TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#Q&&!this.#$){let n="LRU_CACHE_UNBOUNDED";vQ(n)&&(o7.add(n),a7("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",n,Q))}}getRemainingTTL(X){return this.#H.has(X)?1/0:0}#T(){let X=new K6(this.#Q),Z=new K6(this.#Q);this.#j=X,this.#M=Z;let $=this.ttlAutopurge?Array(this.#Q):void 0;this.#A=$,this.#u=(z,Y,K=this.#W.now())=>{if(Z[z]=Y!==0?K:0,X[z]=Y,$?.[z]&&(clearTimeout($[z]),$[z]=void 0),Y!==0&&$){let q=setTimeout(()=>{this.#R(z)&&this.#I(this.#K[z],"expire")},Y+1);q.unref&&q.unref(),$[z]=q}},this.#D=(z)=>{Z[z]=X[z]!==0?this.#W.now():0},this.#E=(z,Y)=>{if(X[Y]){let K=X[Y],q=Z[Y];if(!K||!q)return;z.ttl=K,z.start=q,z.now=V||J();let H=z.now-q;z.remainingTTL=K-H}};let V=0,J=()=>{let z=this.#W.now();if(this.ttlResolution>0){V=z;let Y=setTimeout(()=>V=0,this.ttlResolution);Y.unref&&Y.unref()}return z};this.getRemainingTTL=(z)=>{let Y=this.#H.get(z);if(Y===void 0)return 0;let K=X[Y],q=Z[Y];if(!K||!q)return 1/0;let H=(V||J())-q;return K-H},this.#R=(z)=>{let Y=Z[z],K=X[z];return!!K&&!!Y&&(V||J())-Y>K}}#D=()=>{};#E=()=>{};#u=()=>{};#R=()=>!1;#l(){let X=new K6(this.#Q);this.#G=0,this.#O=X,this.#f=(Z)=>{this.#G-=X[Z],X[Z]=0},this.#h=(Z,$,V,J)=>{if(this.#q($))return 0;if(!w5(V))if(J){if(typeof J!="function")throw TypeError("sizeCalculation must be a function");if(V=J($,Z),!w5(V))throw TypeError("sizeCalculation return invalid (expect positive integer)")}else throw TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return V},this.#y=(Z,$,V)=>{if(X[Z]=$,this.#$){let J=this.#$-X[Z];for(;this.#G>J;)this.#m(!0)}this.#G+=X[Z],V&&(V.entrySize=$,V.totalCalculatedSize=this.#G)}}#f=(X)=>{};#y=(X,Z,$)=>{};#h=(X,Z,$,V)=>{if($||V)throw TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#S({allowStale:X=this.allowStale}={}){if(this.#Y)for(let Z=this.#U;!(!this.#g(Z)||((X||!this.#R(Z))&&(yield Z),Z===this.#_));)Z=this.#v[Z]}*#x({allowStale:X=this.allowStale}={}){if(this.#Y)for(let Z=this.#_;!(!this.#g(Z)||((X||!this.#R(Z))&&(yield Z),Z===this.#U));)Z=this.#L[Z]}#g(X){return X!==void 0&&this.#H.get(this.#K[X])===X}*entries(){for(let X of this.#S())this.#J[X]!==void 0&&this.#K[X]!==void 0&&!this.#q(this.#J[X])&&(yield[this.#K[X],this.#J[X]])}*rentries(){for(let X of this.#x())this.#J[X]!==void 0&&this.#K[X]!==void 0&&!this.#q(this.#J[X])&&(yield[this.#K[X],this.#J[X]])}*keys(){for(let X of this.#S()){let Z=this.#K[X];Z!==void 0&&!this.#q(this.#J[X])&&(yield Z)}}*rkeys(){for(let X of this.#x()){let Z=this.#K[X];Z!==void 0&&!this.#q(this.#J[X])&&(yield Z)}}*values(){for(let X of this.#S())this.#J[X]!==void 0&&!this.#q(this.#J[X])&&(yield this.#J[X])}*rvalues(){for(let X of this.#x())this.#J[X]!==void 0&&!this.#q(this.#J[X])&&(yield this.#J[X])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(X,Z={}){for(let $ of this.#S()){let V=this.#J[$],J=this.#q(V)?V.__staleWhileFetching:V;if(J!==void 0&&X(J,this.#K[$],this))return this.get(this.#K[$],Z)}}forEach(X,Z=this){for(let $ of this.#S()){let V=this.#J[$],J=this.#q(V)?V.__staleWhileFetching:V;J!==void 0&&X.call(Z,J,this.#K[$],this)}}rforEach(X,Z=this){for(let $ of this.#x()){let V=this.#J[$],J=this.#q(V)?V.__staleWhileFetching:V;J!==void 0&&X.call(Z,J,this.#K[$],this)}}purgeStale(){let X=!1;for(let Z of this.#x({allowStale:!0}))this.#R(Z)&&(this.#I(this.#K[Z],"expire"),X=!0);return X}info(X){let Z=this.#H.get(X);if(Z===void 0)return;let $=this.#J[Z],V=this.#q($)?$.__staleWhileFetching:$;if(V===void 0)return;let J={value:V};if(this.#j&&this.#M){let z=this.#j[Z],Y=this.#M[Z];if(z&&Y){let K=z-(this.#W.now()-Y);J.ttl=K,J.start=Date.now()}}return this.#O&&(J.size=this.#O[Z]),J}dump(){let X=[];for(let Z of this.#S({allowStale:!0})){let $=this.#K[Z],V=this.#J[Z],J=this.#q(V)?V.__staleWhileFetching:V;if(J===void 0||$===void 0)continue;let z={value:J};if(this.#j&&this.#M){z.ttl=this.#j[Z];let Y=this.#W.now()-this.#M[Z];z.start=Math.floor(Date.now()-Y)}this.#O&&(z.size=this.#O[Z]),X.unshift([$,z])}return X}load(X){this.clear();for(let[Z,$]of X){if($.start){let V=Date.now()-$.start;$.start=this.#W.now()-V}this.set(Z,$.value,$)}}set(X,Z,$={}){if(Z===void 0)return this.delete(X),this;let{ttl:V=this.ttl,start:J,noDisposeOnSet:z=this.noDisposeOnSet,sizeCalculation:Y=this.sizeCalculation,status:K}=$,{noUpdateTTL:q=this.noUpdateTTL}=$,H=this.#h(X,Z,$.size||0,Y);if(this.maxEntrySize&&H>this.maxEntrySize)return K&&(K.set="miss",K.maxEntrySizeExceeded=!0),this.#I(X,"set"),this;let W=this.#Y===0?void 0:this.#H.get(X);if(W===void 0)W=this.#Y===0?this.#U:this.#P.length!==0?this.#P.pop():this.#Y===this.#Q?this.#m(!1):this.#Y,this.#K[W]=X,this.#J[W]=Z,this.#H.set(X,W),this.#L[this.#U]=W,this.#v[W]=this.#U,this.#U=W,this.#Y++,this.#y(W,H,K),K&&(K.set="add"),q=!1,this.#k&&this.#X?.(Z,X,"add");else{this.#b(W);let G=this.#J[W];if(Z!==G){if(this.#N&&this.#q(G)){G.__abortController.abort(Error("replaced"));let{__staleWhileFetching:j}=G;j!==void 0&&!z&&(this.#F&&this.#V?.(j,X,"set"),this.#Z&&this.#w?.push([j,X,"set"]))}else z||(this.#F&&this.#V?.(G,X,"set"),this.#Z&&this.#w?.push([G,X,"set"]));if(this.#f(W),this.#y(W,H,K),this.#J[W]=Z,K){K.set="replace";let j=G&&this.#q(G)?G.__staleWhileFetching:G;j!==void 0&&(K.oldValue=j)}}else K&&(K.set="update");this.#k&&this.onInsert?.(Z,X,Z===G?"update":"replace")}if(V!==0&&!this.#j&&this.#T(),this.#j&&(q||this.#u(W,V,J),K&&this.#E(K,W)),!z&&this.#Z&&this.#w){let G=this.#w,j;for(;j=G?.shift();)this.#z?.(...j)}return this}pop(){try{for(;this.#Y;){let X=this.#J[this.#_];if(this.#m(!0),this.#q(X)){if(X.__staleWhileFetching)return X.__staleWhileFetching}else if(X!==void 0)return X}}finally{if(this.#Z&&this.#w){let X=this.#w,Z;for(;Z=X?.shift();)this.#z?.(...Z)}}}#m(X){let Z=this.#_,$=this.#K[Z],V=this.#J[Z];return this.#N&&this.#q(V)?V.__abortController.abort(Error("evicted")):(this.#F||this.#Z)&&(this.#F&&this.#V?.(V,$,"evict"),this.#Z&&this.#w?.push([V,$,"evict"])),this.#f(Z),this.#A?.[Z]&&(clearTimeout(this.#A[Z]),this.#A[Z]=void 0),X&&(this.#K[Z]=void 0,this.#J[Z]=void 0,this.#P.push(Z)),this.#Y===1?(this.#_=this.#U=0,this.#P.length=0):this.#_=this.#L[Z],this.#H.delete($),this.#Y--,Z}has(X,Z={}){let{updateAgeOnHas:$=this.updateAgeOnHas,status:V}=Z,J=this.#H.get(X);if(J!==void 0){let z=this.#J[J];if(this.#q(z)&&z.__staleWhileFetching===void 0)return!1;if(this.#R(J))V&&(V.has="stale",this.#E(V,J));else return $&&this.#D(J),V&&(V.has="hit",this.#E(V,J)),!0}else V&&(V.has="miss");return!1}peek(X,Z={}){let{allowStale:$=this.allowStale}=Z,V=this.#H.get(X);if(V===void 0||!$&&this.#R(V))return;let J=this.#J[V];return this.#q(J)?J.__staleWhileFetching:J}#d(X,Z,$,V){let J=Z===void 0?void 0:this.#J[Z];if(this.#q(J))return J;let z=new q6,{signal:Y}=$;Y?.addEventListener("abort",()=>z.abort(Y.reason),{signal:z.signal});let K={signal:z.signal,options:$,context:V},q=(U,A=!1)=>{let{aborted:w}=z.signal,B=$.ignoreFetchAbort&&U!==void 0,v=$.ignoreFetchAbort||!!($.allowStaleOnFetchAbort&&U!==void 0);if($.status&&(w&&!A?($.status.fetchAborted=!0,$.status.fetchError=z.signal.reason,B&&($.status.fetchAbortIgnored=!0)):$.status.fetchResolved=!0),w&&!B&&!A)return W(z.signal.reason,v);let O=j,F=this.#J[Z];return(F===j||B&&A&&F===void 0)&&(U===void 0?O.__staleWhileFetching!==void 0?this.#J[Z]=O.__staleWhileFetching:this.#I(X,"fetch"):($.status&&($.status.fetchUpdated=!0),this.set(X,U,K.options))),U},H=(U)=>($.status&&($.status.fetchRejected=!0,$.status.fetchError=U),W(U,!1)),W=(U,A)=>{let{aborted:w}=z.signal,B=w&&$.allowStaleOnFetchAbort,v=B||$.allowStaleOnFetchRejection,O=v||$.noDeleteOnFetchRejection,F=j;if(this.#J[Z]===j&&(!O||!A&&F.__staleWhileFetching===void 0?this.#I(X,"fetch"):B||(this.#J[Z]=F.__staleWhileFetching)),v)return $.status&&F.__staleWhileFetching!==void 0&&($.status.returnedStale=!0),F.__staleWhileFetching;if(F.__returned===F)throw U},G=(U,A)=>{let w=this.#C?.(X,J,K);w&&w instanceof Promise&&w.then((B)=>U(B===void 0?void 0:B),A),z.signal.addEventListener("abort",()=>{(!$.ignoreFetchAbort||$.allowStaleOnFetchAbort)&&(U(void 0),$.allowStaleOnFetchAbort&&(U=(B)=>q(B,!0)))})};$.status&&($.status.fetchDispatched=!0);let j=new Promise(G).then(q,H),_=Object.assign(j,{__abortController:z,__staleWhileFetching:J,__returned:void 0});return Z===void 0?(this.set(X,_,{...K.options,status:void 0}),Z=this.#H.get(X)):this.#J[Z]=_,_}#q(X){if(!this.#N)return!1;let Z=X;return!!Z&&Z instanceof Promise&&Z.hasOwnProperty("__staleWhileFetching")&&Z.__abortController instanceof q6}async fetch(X,Z={}){let{allowStale:$=this.allowStale,updateAgeOnGet:V=this.updateAgeOnGet,noDeleteOnStaleGet:J=this.noDeleteOnStaleGet,ttl:z=this.ttl,noDisposeOnSet:Y=this.noDisposeOnSet,size:K=0,sizeCalculation:q=this.sizeCalculation,noUpdateTTL:H=this.noUpdateTTL,noDeleteOnFetchRejection:W=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:G=this.allowStaleOnFetchRejection,ignoreFetchAbort:j=this.ignoreFetchAbort,allowStaleOnFetchAbort:_=this.allowStaleOnFetchAbort,context:U,forceRefresh:A=!1,status:w,signal:B}=Z;if(!this.#N)return w&&(w.fetch="get"),this.get(X,{allowStale:$,updateAgeOnGet:V,noDeleteOnStaleGet:J,status:w});let v={allowStale:$,updateAgeOnGet:V,noDeleteOnStaleGet:J,ttl:z,noDisposeOnSet:Y,size:K,sizeCalculation:q,noUpdateTTL:H,noDeleteOnFetchRejection:W,allowStaleOnFetchRejection:G,allowStaleOnFetchAbort:_,ignoreFetchAbort:j,status:w,signal:B},O=this.#H.get(X);if(O===void 0){w&&(w.fetch="miss");let F=this.#d(X,O,v,U);return F.__returned=F}else{let F=this.#J[O];if(this.#q(F)){let P=$&&F.__staleWhileFetching!==void 0;return w&&(w.fetch="inflight",P&&(w.returnedStale=!0)),P?F.__staleWhileFetching:F.__returned=F}let E=this.#R(O);if(!A&&!E)return w&&(w.fetch="hit"),this.#b(O),V&&this.#D(O),w&&this.#E(w,O),F;let y=this.#d(X,O,v,U),t=y.__staleWhileFetching!==void 0&&$;return w&&(w.fetch=E?"stale":"refresh",t&&E&&(w.returnedStale=!0)),t?y.__staleWhileFetching:y.__returned=y}}async forceFetch(X,Z={}){let $=await this.fetch(X,Z);if($===void 0)throw Error("fetch() returned undefined");return $}memo(X,Z={}){let $=this.#B;if(!$)throw Error("no memoMethod provided to constructor");let{context:V,forceRefresh:J,...z}=Z,Y=this.get(X,z);if(!J&&Y!==void 0)return Y;let K=$(X,Y,{options:z,context:V});return this.set(X,K,z),K}get(X,Z={}){let{allowStale:$=this.allowStale,updateAgeOnGet:V=this.updateAgeOnGet,noDeleteOnStaleGet:J=this.noDeleteOnStaleGet,status:z}=Z,Y=this.#H.get(X);if(Y!==void 0){let K=this.#J[Y],q=this.#q(K);return z&&this.#E(z,Y),this.#R(Y)?(z&&(z.get="stale"),q?(z&&$&&K.__staleWhileFetching!==void 0&&(z.returnedStale=!0),$?K.__staleWhileFetching:void 0):(J||this.#I(X,"expire"),z&&$&&(z.returnedStale=!0),$?K:void 0)):(z&&(z.get="hit"),q?K.__staleWhileFetching:(this.#b(Y),V&&this.#D(Y),K))}else z&&(z.get="miss")}#c(X,Z){this.#v[Z]=X,this.#L[X]=Z}#b(X){X!==this.#U&&(X===this.#_?this.#_=this.#L[X]:this.#c(this.#v[X],this.#L[X]),this.#c(this.#U,X),this.#U=X)}delete(X){return this.#I(X,"delete")}#I(X,Z){let $=!1;if(this.#Y!==0){let V=this.#H.get(X);if(V!==void 0)if(this.#A?.[V]&&(clearTimeout(this.#A?.[V]),this.#A[V]=void 0),$=!0,this.#Y===1)this.#p(Z);else{this.#f(V);let J=this.#J[V];if(this.#q(J)?J.__abortController.abort(Error("deleted")):(this.#F||this.#Z)&&(this.#F&&this.#V?.(J,X,Z),this.#Z&&this.#w?.push([J,X,Z])),this.#H.delete(X),this.#K[V]=void 0,this.#J[V]=void 0,V===this.#U)this.#U=this.#v[V];else if(V===this.#_)this.#_=this.#L[V];else{let z=this.#v[V];this.#L[z]=this.#L[V];let Y=this.#L[V];this.#v[Y]=this.#v[V]}this.#Y--,this.#P.push(V)}}if(this.#Z&&this.#w?.length){let V=this.#w,J;for(;J=V?.shift();)this.#z?.(...J)}return $}clear(){return this.#p("delete")}#p(X){for(let Z of this.#x({allowStale:!0})){let $=this.#J[Z];if(this.#q($))$.__abortController.abort(Error("deleted"));else{let V=this.#K[Z];this.#F&&this.#V?.($,V,X),this.#Z&&this.#w?.push([$,V,X])}}if(this.#H.clear(),this.#J.fill(void 0),this.#K.fill(void 0),this.#j&&this.#M){this.#j.fill(0),this.#M.fill(0);for(let Z of this.#A??[])Z!==void 0&&clearTimeout(Z);this.#A?.fill(void 0)}if(this.#O&&this.#O.fill(0),this.#_=0,this.#U=0,this.#P.length=0,this.#G=0,this.#Y=0,this.#Z&&this.#w){let Z=this.#w,$;for(;$=Z?.shift();)this.#z?.(...$)}}};import{posix as EQ,win32 as Q7}from"path";import{fileURLToPath as kQ}from"url";import{lstatSync as yQ,readdir as bQ,readdirSync as fQ,readlinkSync as uQ,realpathSync as hQ}from"fs";import*as gQ from"fs";import{lstat as dQ,readdir as cQ,readlink as lQ,realpath as pQ}from"fs/promises";import{EventEmitter as r6}from"events";import X9 from"stream";import{StringDecoder as CQ}from"string_decoder";var s7=typeof process==="object"&&process?process:{stdout:null,stderr:null},MQ=(Q)=>!!Q&&typeof Q==="object"&&(Q instanceof O5||Q instanceof X9||RQ(Q)||PQ(Q)),RQ=(Q)=>!!Q&&typeof Q==="object"&&Q instanceof r6&&typeof Q.pipe==="function"&&Q.pipe!==X9.Writable.prototype.pipe,PQ=(Q)=>!!Q&&typeof Q==="object"&&Q instanceof r6&&typeof Q.write==="function"&&typeof Q.end==="function",j5=Symbol("EOF"),_5=Symbol("maybeEmitEnd"),A5=Symbol("emittedEnd"),H6=Symbol("emittingEnd"),l5=Symbol("emittedError"),W6=Symbol("closed"),t7=Symbol("read"),G6=Symbol("flush"),e7=Symbol("flushChunk"),r=Symbol("encoding"),I5=Symbol("decoder"),I=Symbol("flowing"),p5=Symbol("paused"),S5=Symbol("resume"),S=Symbol("buffer"),f=Symbol("pipes"),x=Symbol("bufferLength"),p6=Symbol("bufferPush"),j6=Symbol("bufferShift"),k=Symbol("objectMode"),D=Symbol("destroyed"),i6=Symbol("error"),n6=Symbol("emitData"),Q9=Symbol("emitEnd"),o6=Symbol("emitEnd2"),V5=Symbol("async"),a6=Symbol("abort"),_6=Symbol("aborted"),i5=Symbol("signal"),v5=Symbol("dataListeners"),m=Symbol("discarded"),n5=(Q)=>Promise.resolve().then(Q),NQ=(Q)=>Q(),DQ=(Q)=>Q==="end"||Q==="finish"||Q==="prefinish",IQ=(Q)=>Q instanceof ArrayBuffer||!!Q&&typeof Q==="object"&&Q.constructor&&Q.constructor.name==="ArrayBuffer"&&Q.byteLength>=0,SQ=(Q)=>!Buffer.isBuffer(Q)&&ArrayBuffer.isView(Q);class s6{src;dest;opts;ondrain;constructor(Q,X,Z){this.src=Q,this.dest=X,this.opts=Z,this.ondrain=()=>Q[S5](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(Q){}end(){if(this.unpipe(),this.opts.end)this.dest.end()}}class Z9 extends s6{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(Q,X,Z){super(Q,X,Z);this.proxyErrors=($)=>this.dest.emit("error",$),Q.on("error",this.proxyErrors)}}var xQ=(Q)=>!!Q.objectMode,TQ=(Q)=>!Q.objectMode&&!!Q.encoding&&Q.encoding!=="buffer";class O5 extends r6{[I]=!1;[p5]=!1;[f]=[];[S]=[];[k];[r];[V5];[I5];[j5]=!1;[A5]=!1;[H6]=!1;[W6]=!1;[l5]=null;[x]=0;[D]=!1;[i5];[_6]=!1;[v5]=0;[m]=!1;writable=!0;readable=!0;constructor(...Q){let X=Q[0]||{};super();if(X.objectMode&&typeof X.encoding==="string")throw TypeError("Encoding and objectMode may not be used together");if(xQ(X))this[k]=!0,this[r]=null;else if(TQ(X))this[r]=X.encoding,this[k]=!1;else this[k]=!1,this[r]=null;if(this[V5]=!!X.async,this[I5]=this[r]?new CQ(this[r]):null,X&&X.debugExposeBuffer===!0)Object.defineProperty(this,"buffer",{get:()=>this[S]});if(X&&X.debugExposePipes===!0)Object.defineProperty(this,"pipes",{get:()=>this[f]});let{signal:Z}=X;if(Z)if(this[i5]=Z,Z.aborted)this[a6]();else Z.addEventListener("abort",()=>this[a6]())}get bufferLength(){return this[x]}get encoding(){return this[r]}set encoding(Q){throw Error("Encoding must be set at instantiation time")}setEncoding(Q){throw Error("Encoding must be set at instantiation time")}get objectMode(){return this[k]}set objectMode(Q){throw Error("objectMode must be set at instantiation time")}get["async"](){return this[V5]}set["async"](Q){this[V5]=this[V5]||!!Q}[a6](){this[_6]=!0,this.emit("abort",this[i5]?.reason),this.destroy(this[i5]?.reason)}get aborted(){return this[_6]}set aborted(Q){}write(Q,X,Z){if(this[_6])return!1;if(this[j5])throw Error("write after end");if(this[D])return this.emit("error",Object.assign(Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;if(typeof X==="function")Z=X,X="utf8";if(!X)X="utf8";let $=this[V5]?n5:NQ;if(!this[k]&&!Buffer.isBuffer(Q)){if(SQ(Q))Q=Buffer.from(Q.buffer,Q.byteOffset,Q.byteLength);else if(IQ(Q))Q=Buffer.from(Q);else if(typeof Q!=="string")throw Error("Non-contiguous data written to non-objectMode stream")}if(this[k]){if(this[I]&&this[x]!==0)this[G6](!0);if(this[I])this.emit("data",Q);else this[p6](Q);if(this[x]!==0)this.emit("readable");if(Z)$(Z);return this[I]}if(!Q.length){if(this[x]!==0)this.emit("readable");if(Z)$(Z);return this[I]}if(typeof Q==="string"&&!(X===this[r]&&!this[I5]?.lastNeed))Q=Buffer.from(Q,X);if(Buffer.isBuffer(Q)&&this[r])Q=this[I5].write(Q);if(this[I]&&this[x]!==0)this[G6](!0);if(this[I])this.emit("data",Q);else this[p6](Q);if(this[x]!==0)this.emit("readable");if(Z)$(Z);return this[I]}read(Q){if(this[D])return null;if(this[m]=!1,this[x]===0||Q===0||Q&&Q>this[x])return this[_5](),null;if(this[k])Q=null;if(this[S].length>1&&!this[k])this[S]=[this[r]?this[S].join(""):Buffer.concat(this[S],this[x])];let X=this[t7](Q||null,this[S][0]);return this[_5](),X}[t7](Q,X){if(this[k])this[j6]();else{let Z=X;if(Q===Z.length||Q===null)this[j6]();else if(typeof Z==="string")this[S][0]=Z.slice(Q),X=Z.slice(0,Q),this[x]-=Q;else this[S][0]=Z.subarray(Q),X=Z.subarray(0,Q),this[x]-=Q}if(this.emit("data",X),!this[S].length&&!this[j5])this.emit("drain");return X}end(Q,X,Z){if(typeof Q==="function")Z=Q,Q=void 0;if(typeof X==="function")Z=X,X="utf8";if(Q!==void 0)this.write(Q,X);if(Z)this.once("end",Z);if(this[j5]=!0,this.writable=!1,this[I]||!this[p5])this[_5]();return this}[S5](){if(this[D])return;if(!this[v5]&&!this[f].length)this[m]=!0;if(this[p5]=!1,this[I]=!0,this.emit("resume"),this[S].length)this[G6]();else if(this[j5])this[_5]();else this.emit("drain")}resume(){return this[S5]()}pause(){this[I]=!1,this[p5]=!0,this[m]=!1}get destroyed(){return this[D]}get flowing(){return this[I]}get paused(){return this[p5]}[p6](Q){if(this[k])this[x]+=1;else this[x]+=Q.length;this[S].push(Q)}[j6](){if(this[k])this[x]-=1;else this[x]-=this[S][0].length;return this[S].shift()}[G6](Q=!1){do;while(this[e7](this[j6]())&&this[S].length);if(!Q&&!this[S].length&&!this[j5])this.emit("drain")}[e7](Q){return this.emit("data",Q),this[I]}pipe(Q,X){if(this[D])return Q;this[m]=!1;let Z=this[A5];if(X=X||{},Q===s7.stdout||Q===s7.stderr)X.end=!1;else X.end=X.end!==!1;if(X.proxyErrors=!!X.proxyErrors,Z){if(X.end)Q.end()}else if(this[f].push(!X.proxyErrors?new s6(this,Q,X):new Z9(this,Q,X)),this[V5])n5(()=>this[S5]());else this[S5]();return Q}unpipe(Q){let X=this[f].find((Z)=>Z.dest===Q);if(X){if(this[f].length===1){if(this[I]&&this[v5]===0)this[I]=!1;this[f]=[]}else this[f].splice(this[f].indexOf(X),1);X.unpipe()}}addListener(Q,X){return this.on(Q,X)}on(Q,X){let Z=super.on(Q,X);if(Q==="data"){if(this[m]=!1,this[v5]++,!this[f].length&&!this[I])this[S5]()}else if(Q==="readable"&&this[x]!==0)super.emit("readable");else if(DQ(Q)&&this[A5])super.emit(Q),this.removeAllListeners(Q);else if(Q==="error"&&this[l5]){let $=X;if(this[V5])n5(()=>$.call(this,this[l5]));else $.call(this,this[l5])}return Z}removeListener(Q,X){return this.off(Q,X)}off(Q,X){let Z=super.off(Q,X);if(Q==="data"){if(this[v5]=this.listeners("data").length,this[v5]===0&&!this[m]&&!this[f].length)this[I]=!1}return Z}removeAllListeners(Q){let X=super.removeAllListeners(Q);if(Q==="data"||Q===void 0){if(this[v5]=0,!this[m]&&!this[f].length)this[I]=!1}return X}get emittedEnd(){return this[A5]}[_5](){if(!this[H6]&&!this[A5]&&!this[D]&&this[S].length===0&&this[j5]){if(this[H6]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[W6])this.emit("close");this[H6]=!1}}emit(Q,...X){let Z=X[0];if(Q!=="error"&&Q!=="close"&&Q!==D&&this[D])return!1;else if(Q==="data")return!this[k]&&!Z?!1:this[V5]?(n5(()=>this[n6](Z)),!0):this[n6](Z);else if(Q==="end")return this[Q9]();else if(Q==="close"){if(this[W6]=!0,!this[A5]&&!this[D])return!1;let V=super.emit("close");return this.removeAllListeners("close"),V}else if(Q==="error"){this[l5]=Z,super.emit(i6,Z);let V=!this[i5]||this.listeners("error").length?super.emit("error",Z):!1;return this[_5](),V}else if(Q==="resume"){let V=super.emit("resume");return this[_5](),V}else if(Q==="finish"||Q==="prefinish"){let V=super.emit(Q);return this.removeAllListeners(Q),V}let $=super.emit(Q,...X);return this[_5](),$}[n6](Q){for(let Z of this[f])if(Z.dest.write(Q)===!1)this.pause();let X=this[m]?!1:super.emit("data",Q);return this[_5](),X}[Q9](){if(this[A5])return!1;return this[A5]=!0,this.readable=!1,this[V5]?(n5(()=>this[o6]()),!0):this[o6]()}[o6](){if(this[I5]){let X=this[I5].end();if(X){for(let Z of this[f])Z.dest.write(X);if(!this[m])super.emit("data",X)}}for(let X of this[f])X.end();let Q=super.emit("end");return this.removeAllListeners("end"),Q}async collect(){let Q=Object.assign([],{dataLength:0});if(!this[k])Q.dataLength=0;let X=this.promise();return this.on("data",(Z)=>{if(Q.push(Z),!this[k])Q.dataLength+=Z.length}),await X,Q}async concat(){if(this[k])throw Error("cannot concat in objectMode");let Q=await this.collect();return this[r]?Q.join(""):Buffer.concat(Q,Q.dataLength)}async promise(){return new Promise((Q,X)=>{this.on(D,()=>X(Error("stream destroyed"))),this.on("error",(Z)=>X(Z)),this.on("end",()=>Q())})}[Symbol.asyncIterator](){this[m]=!1;let Q=!1,X=async()=>{return this.pause(),Q=!0,{value:void 0,done:!0}};return{next:()=>{if(Q)return X();let $=this.read();if($!==null)return Promise.resolve({done:!1,value:$});if(this[j5])return X();let V,J,z=(H)=>{this.off("data",Y),this.off("end",K),this.off(D,q),X(),J(H)},Y=(H)=>{this.off("error",z),this.off("end",K),this.off(D,q),this.pause(),V({value:H,done:!!this[j5]})},K=()=>{this.off("error",z),this.off("data",Y),this.off(D,q),X(),V({done:!0,value:void 0})},q=()=>z(Error("stream destroyed"));return new Promise((H,W)=>{J=W,V=H,this.once(D,q),this.once("error",z),this.once("end",K),this.once("data",Y)})},throw:X,return:X,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[m]=!1;let Q=!1,X=()=>{return this.pause(),this.off(i6,X),this.off(D,X),this.off("end",X),Q=!0,{done:!0,value:void 0}},Z=()=>{if(Q)return X();let $=this.read();return $===null?X():{done:!1,value:$}};return this.once("end",X),this.once(i6,X),this.once(D,X),{next:Z,throw:X,return:X,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(Q){if(this[D]){if(Q)this.emit("error",Q);else this.emit(D);return this}this[D]=!0,this[m]=!0,this[S].length=0,this[x]=0;let X=this;if(typeof X.close==="function"&&!this[W6])X.close();if(Q)this.emit("error",Q);else this.emit(D);return this}static get isStream(){return MQ}}var mQ=hQ.native,a5={lstatSync:yQ,readdir:bQ,readdirSync:fQ,readlinkSync:uQ,realpathSync:mQ,promises:{lstat:dQ,readdir:cQ,readlink:lQ,realpath:pQ}},Y9=(Q)=>!Q||Q===a5||Q===gQ?a5:{...a5,...Q,promises:{...a5.promises,...Q.promises||{}}},K9=/^\\\\\?\\([a-z]:)\\?$/i,iQ=(Q)=>Q.replace(/\//g,"\\").replace(K9,"$1\\"),nQ=/[\\\/]/,i=0,q9=1,H9=2,J5=4,W9=6,G9=8,C5=10,j9=12,p=15,o5=~p,t6=16,$9=32,r5=64,s=128,U6=256,A6=512,V9=r5|s|A6,oQ=1023,e6=(Q)=>Q.isFile()?G9:Q.isDirectory()?J5:Q.isSymbolicLink()?C5:Q.isCharacterDevice()?H9:Q.isBlockDevice()?W9:Q.isSocket()?j9:Q.isFIFO()?q9:i,J9=new c5({max:4096}),s5=(Q)=>{let X=J9.get(Q);if(X)return X;let Z=Q.normalize("NFKD");return J9.set(Q,Z),Z},z9=new c5({max:4096}),w6=(Q)=>{let X=z9.get(Q);if(X)return X;let Z=s5(Q.toLowerCase());return z9.set(Q,Z),Z};class X7 extends c5{constructor(){super({max:256})}}class _9 extends c5{constructor(Q=16384){super({maxSize:Q,sizeCalculation:(X)=>X.length+1})}}var U9=Symbol("PathScurry setAsCwd");class u{name;root;roots;parent;nocase;isCWD=!1;#Q;#$;get dev(){return this.#$}#V;get mode(){return this.#V}#X;get nlink(){return this.#X}#z;get uid(){return this.#z}#C;get gid(){return this.#C}#B;get rdev(){return this.#B}#W;get blksize(){return this.#W}#Y;get ino(){return this.#Y}#G;get size(){return this.#G}#H;get blocks(){return this.#H}#K;get atimeMs(){return this.#K}#J;get mtimeMs(){return this.#J}#L;get ctimeMs(){return this.#L}#v;get birthtimeMs(){return this.#v}#_;get atime(){return this.#_}#U;get mtime(){return this.#U}#P;get ctime(){return this.#P}#w;get birthtime(){return this.#w}#O;#M;#j;#A;#F;#N;#Z;#k;#T;#D;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(Q,X=i,Z,$,V,J,z){if(this.name=Q,this.#O=V?w6(Q):s5(Q),this.#Z=X&oQ,this.nocase=V,this.roots=$,this.root=Z||this,this.#k=J,this.#j=z.fullpath,this.#F=z.relative,this.#N=z.relativePosix,this.parent=z.parent,this.parent)this.#Q=this.parent.#Q;else this.#Q=Y9(z.fs)}depth(){if(this.#M!==void 0)return this.#M;if(!this.parent)return this.#M=0;return this.#M=this.parent.depth()+1}childrenCache(){return this.#k}resolve(Q){if(!Q)return this;let X=this.getRootString(Q),$=Q.substring(X.length).split(this.splitSep);return X?this.getRoot(X).#E($):this.#E($)}#E(Q){let X=this;for(let Z of Q)X=X.child(Z);return X}children(){let Q=this.#k.get(this);if(Q)return Q;let X=Object.assign([],{provisional:0});return this.#k.set(this,X),this.#Z&=~t6,X}child(Q,X){if(Q===""||Q===".")return this;if(Q==="..")return this.parent||this;let Z=this.children(),$=this.nocase?w6(Q):s5(Q);for(let Y of Z)if(Y.#O===$)return Y;let V=this.parent?this.sep:"",J=this.#j?this.#j+V+Q:void 0,z=this.newChild(Q,i,{...X,parent:this,fullpath:J});if(!this.canReaddir())z.#Z|=s;return Z.push(z),z}relative(){if(this.isCWD)return"";if(this.#F!==void 0)return this.#F;let Q=this.name,X=this.parent;if(!X)return this.#F=this.name;let Z=X.relative();return Z+(!Z||!X.parent?"":this.sep)+Q}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#N!==void 0)return this.#N;let Q=this.name,X=this.parent;if(!X)return this.#N=this.fullpathPosix();let Z=X.relativePosix();return Z+(!Z||!X.parent?"":"/")+Q}fullpath(){if(this.#j!==void 0)return this.#j;let Q=this.name,X=this.parent;if(!X)return this.#j=this.name;let $=X.fullpath()+(!X.parent?"":this.sep)+Q;return this.#j=$}fullpathPosix(){if(this.#A!==void 0)return this.#A;if(this.sep==="/")return this.#A=this.fullpath();if(!this.parent){let $=this.fullpath().replace(/\\/g,"/");if(/^[a-z]:\//i.test($))return this.#A=`//?/${$}`;else return this.#A=$}let Q=this.parent,X=Q.fullpathPosix(),Z=X+(!X||!Q.parent?"":"/")+this.name;return this.#A=Z}isUnknown(){return(this.#Z&p)===i}isType(Q){return this[`is${Q}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#Z&p)===G9}isDirectory(){return(this.#Z&p)===J5}isCharacterDevice(){return(this.#Z&p)===H9}isBlockDevice(){return(this.#Z&p)===W9}isFIFO(){return(this.#Z&p)===q9}isSocket(){return(this.#Z&p)===j9}isSymbolicLink(){return(this.#Z&C5)===C5}lstatCached(){return this.#Z&$9?this:void 0}readlinkCached(){return this.#T}realpathCached(){return this.#D}readdirCached(){let Q=this.children();return Q.slice(0,Q.provisional)}canReadlink(){if(this.#T)return!0;if(!this.parent)return!1;let Q=this.#Z&p;return!(Q!==i&&Q!==C5||this.#Z&U6||this.#Z&s)}calledReaddir(){return!!(this.#Z&t6)}isENOENT(){return!!(this.#Z&s)}isNamed(Q){return!this.nocase?this.#O===s5(Q):this.#O===w6(Q)}async readlink(){let Q=this.#T;if(Q)return Q;if(!this.canReadlink())return;if(!this.parent)return;try{let X=await this.#Q.promises.readlink(this.fullpath()),Z=(await this.parent.realpath())?.resolve(X);if(Z)return this.#T=Z}catch(X){this.#x(X.code);return}}readlinkSync(){let Q=this.#T;if(Q)return Q;if(!this.canReadlink())return;if(!this.parent)return;try{let X=this.#Q.readlinkSync(this.fullpath()),Z=this.parent.realpathSync()?.resolve(X);if(Z)return this.#T=Z}catch(X){this.#x(X.code);return}}#u(Q){this.#Z|=t6;for(let X=Q.provisional;X<Q.length;X++){let Z=Q[X];if(Z)Z.#R()}}#R(){if(this.#Z&s)return;this.#Z=(this.#Z|s)&o5,this.#l()}#l(){let Q=this.children();Q.provisional=0;for(let X of Q)X.#R()}#f(){this.#Z|=A6,this.#y()}#y(){if(this.#Z&r5)return;let Q=this.#Z;if((Q&p)===J5)Q&=o5;this.#Z=Q|r5,this.#l()}#h(Q=""){if(Q==="ENOTDIR"||Q==="EPERM")this.#y();else if(Q==="ENOENT")this.#R();else this.children().provisional=0}#S(Q=""){if(Q==="ENOTDIR")this.parent.#y();else if(Q==="ENOENT")this.#R()}#x(Q=""){let X=this.#Z;if(X|=U6,Q==="ENOENT")X|=s;if(Q==="EINVAL"||Q==="UNKNOWN")X&=o5;if(this.#Z=X,Q==="ENOTDIR"&&this.parent)this.parent.#y()}#g(Q,X){return this.#d(Q,X)||this.#m(Q,X)}#m(Q,X){let Z=e6(Q),$=this.newChild(Q.name,Z,{parent:this}),V=$.#Z&p;if(V!==J5&&V!==C5&&V!==i)$.#Z|=r5;return X.unshift($),X.provisional++,$}#d(Q,X){for(let Z=X.provisional;Z<X.length;Z++){let $=X[Z];if((this.nocase?w6(Q.name):s5(Q.name))!==$.#O)continue;return this.#q(Q,$,Z,X)}}#q(Q,X,Z,$){let V=X.name;if(X.#Z=X.#Z&o5|e6(Q),V!==Q.name)X.name=Q.name;if(Z!==$.provisional){if(Z===$.length-1)$.pop();else $.splice(Z,1);$.unshift(X)}return $.provisional++,X}async lstat(){if((this.#Z&s)===0)try{return this.#c(await this.#Q.promises.lstat(this.fullpath())),this}catch(Q){this.#S(Q.code)}}lstatSync(){if((this.#Z&s)===0)try{return this.#c(this.#Q.lstatSync(this.fullpath())),this}catch(Q){this.#S(Q.code)}}#c(Q){let{atime:X,atimeMs:Z,birthtime:$,birthtimeMs:V,blksize:J,blocks:z,ctime:Y,ctimeMs:K,dev:q,gid:H,ino:W,mode:G,mtime:j,mtimeMs:_,nlink:U,rdev:A,size:w,uid:B}=Q;this.#_=X,this.#K=Z,this.#w=$,this.#v=V,this.#W=J,this.#H=z,this.#P=Y,this.#L=K,this.#$=q,this.#C=H,this.#Y=W,this.#V=G,this.#U=j,this.#J=_,this.#X=U,this.#B=A,this.#G=w,this.#z=B;let v=e6(Q);if(this.#Z=this.#Z&o5|v|$9,v!==i&&v!==J5&&v!==C5)this.#Z|=r5}#b=[];#I=!1;#p(Q){this.#I=!1;let X=this.#b.slice();this.#b.length=0,X.forEach((Z)=>Z(null,Q))}readdirCB(Q,X=!1){if(!this.canReaddir()){if(X)Q(null,[]);else queueMicrotask(()=>Q(null,[]));return}let Z=this.children();if(this.calledReaddir()){let V=Z.slice(0,Z.provisional);if(X)Q(null,V);else queueMicrotask(()=>Q(null,V));return}if(this.#b.push(Q),this.#I)return;this.#I=!0;let $=this.fullpath();this.#Q.readdir($,{withFileTypes:!0},(V,J)=>{if(V)this.#h(V.code),Z.provisional=0;else{for(let z of J)this.#g(z,Z);this.#u(Z)}this.#p(Z.slice(0,Z.provisional));return})}#i;async readdir(){if(!this.canReaddir())return[];let Q=this.children();if(this.calledReaddir())return Q.slice(0,Q.provisional);let X=this.fullpath();if(this.#i)await this.#i;else{let Z=()=>{};this.#i=new Promise(($)=>Z=$);try{for(let $ of await this.#Q.promises.readdir(X,{withFileTypes:!0}))this.#g($,Q);this.#u(Q)}catch($){this.#h($.code),Q.provisional=0}this.#i=void 0,Z()}return Q.slice(0,Q.provisional)}readdirSync(){if(!this.canReaddir())return[];let Q=this.children();if(this.calledReaddir())return Q.slice(0,Q.provisional);let X=this.fullpath();try{for(let Z of this.#Q.readdirSync(X,{withFileTypes:!0}))this.#g(Z,Q);this.#u(Q)}catch(Z){this.#h(Z.code),Q.provisional=0}return Q.slice(0,Q.provisional)}canReaddir(){if(this.#Z&V9)return!1;let Q=p&this.#Z;if(!(Q===i||Q===J5||Q===C5))return!1;return!0}shouldWalk(Q,X){return(this.#Z&J5)===J5&&!(this.#Z&V9)&&!Q.has(this)&&(!X||X(this))}async realpath(){if(this.#D)return this.#D;if((A6|U6|s)&this.#Z)return;try{let Q=await this.#Q.promises.realpath(this.fullpath());return this.#D=this.resolve(Q)}catch(Q){this.#f()}}realpathSync(){if(this.#D)return this.#D;if((A6|U6|s)&this.#Z)return;try{let Q=this.#Q.realpathSync(this.fullpath());return this.#D=this.resolve(Q)}catch(Q){this.#f()}}[U9](Q){if(Q===this)return;Q.isCWD=!1,this.isCWD=!0;let X=new Set([]),Z=[],$=this;while($&&$.parent)X.add($),$.#F=Z.join(this.sep),$.#N=Z.join("/"),$=$.parent,Z.push("..");$=Q;while($&&$.parent&&!X.has($))$.#F=void 0,$.#N=void 0,$=$.parent}}class B6 extends u{sep="\\";splitSep=nQ;constructor(Q,X=i,Z,$,V,J,z){super(Q,X,Z,$,V,J,z)}newChild(Q,X=i,Z={}){return new B6(Q,X,this.root,this.roots,this.nocase,this.childrenCache(),Z)}getRootString(Q){return Q7.parse(Q).root}getRoot(Q){if(Q=iQ(Q.toUpperCase()),Q===this.root.name)return this.root;for(let[X,Z]of Object.entries(this.roots))if(this.sameRoot(Q,X))return this.roots[Q]=Z;return this.roots[Q]=new t5(Q,this).root}sameRoot(Q,X=this.root.name){return Q=Q.toUpperCase().replace(/\//g,"\\").replace(K9,"$1\\"),Q===X}}class L6 extends u{splitSep="/";sep="/";constructor(Q,X=i,Z,$,V,J,z){super(Q,X,Z,$,V,J,z)}getRootString(Q){return Q.startsWith("/")?"/":""}getRoot(Q){return this.root}newChild(Q,X=i,Z={}){return new L6(Q,X,this.root,this.roots,this.nocase,this.childrenCache(),Z)}}class Z7{root;rootPath;roots;cwd;#Q;#$;#V;nocase;#X;constructor(Q=process.cwd(),X,Z,{nocase:$,childrenCacheSize:V=16384,fs:J=a5}={}){if(this.#X=Y9(J),Q instanceof URL||Q.startsWith("file://"))Q=kQ(Q);let z=X.resolve(Q);this.roots=Object.create(null),this.rootPath=this.parseRootPath(z),this.#Q=new X7,this.#$=new X7,this.#V=new _9(V);let Y=z.substring(this.rootPath.length).split(Z);if(Y.length===1&&!Y[0])Y.pop();if($===void 0)throw TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=$,this.root=this.newRoot(this.#X),this.roots[this.rootPath]=this.root;let K=this.root,q=Y.length-1,H=X.sep,W=this.rootPath,G=!1;for(let j of Y){let _=q--;K=K.child(j,{relative:Array(_).fill("..").join(H),relativePosix:Array(_).fill("..").join("/"),fullpath:W+=(G?"":H)+j}),G=!0}this.cwd=K}depth(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.depth()}childrenCache(){return this.#V}resolve(...Q){let X="";for(let V=Q.length-1;V>=0;V--){let J=Q[V];if(!J||J===".")continue;if(X=X?`${J}/${X}`:J,this.isAbsolute(J))break}let Z=this.#Q.get(X);if(Z!==void 0)return Z;let $=this.cwd.resolve(X).fullpath();return this.#Q.set(X,$),$}resolvePosix(...Q){let X="";for(let V=Q.length-1;V>=0;V--){let J=Q[V];if(!J||J===".")continue;if(X=X?`${J}/${X}`:J,this.isAbsolute(J))break}let Z=this.#$.get(X);if(Z!==void 0)return Z;let $=this.cwd.resolve(X).fullpathPosix();return this.#$.set(X,$),$}relative(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.relative()}relativePosix(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.relativePosix()}basename(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.name}dirname(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return(Q.parent||Q).fullpath()}async readdir(Q=this.cwd,X={withFileTypes:!0}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof u))X=Q,Q=this.cwd;let{withFileTypes:Z}=X;if(!Q.canReaddir())return[];else{let $=await Q.readdir();return Z?$:$.map((V)=>V.name)}}readdirSync(Q=this.cwd,X={withFileTypes:!0}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof u))X=Q,Q=this.cwd;let{withFileTypes:Z=!0}=X;if(!Q.canReaddir())return[];else if(Z)return Q.readdirSync();else return Q.readdirSync().map(($)=>$.name)}async lstat(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.lstat()}lstatSync(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.lstatSync()}async readlink(Q=this.cwd,{withFileTypes:X}={withFileTypes:!1}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof u))X=Q.withFileTypes,Q=this.cwd;let Z=await Q.readlink();return X?Z:Z?.fullpath()}readlinkSync(Q=this.cwd,{withFileTypes:X}={withFileTypes:!1}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof u))X=Q.withFileTypes,Q=this.cwd;let Z=Q.readlinkSync();return X?Z:Z?.fullpath()}async realpath(Q=this.cwd,{withFileTypes:X}={withFileTypes:!1}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof u))X=Q.withFileTypes,Q=this.cwd;let Z=await Q.realpath();return X?Z:Z?.fullpath()}realpathSync(Q=this.cwd,{withFileTypes:X}={withFileTypes:!1}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof u))X=Q.withFileTypes,Q=this.cwd;let Z=Q.realpathSync();return X?Z:Z?.fullpath()}async walk(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof u))X=Q,Q=this.cwd;let{withFileTypes:Z=!0,follow:$=!1,filter:V,walkFilter:J}=X,z=[];if(!V||V(Q))z.push(Z?Q:Q.fullpath());let Y=new Set,K=(H,W)=>{Y.add(H),H.readdirCB((G,j)=>{if(G)return W(G);let _=j.length;if(!_)return W();let U=()=>{if(--_===0)W()};for(let A of j){if(!V||V(A))z.push(Z?A:A.fullpath());if($&&A.isSymbolicLink())A.realpath().then((w)=>w?.isUnknown()?w.lstat():w).then((w)=>w?.shouldWalk(Y,J)?K(w,U):U());else if(A.shouldWalk(Y,J))K(A,U);else U()}},!0)},q=Q;return new Promise((H,W)=>{K(q,(G)=>{if(G)return W(G);H(z)})})}walkSync(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof u))X=Q,Q=this.cwd;let{withFileTypes:Z=!0,follow:$=!1,filter:V,walkFilter:J}=X,z=[];if(!V||V(Q))z.push(Z?Q:Q.fullpath());let Y=new Set([Q]);for(let K of Y){let q=K.readdirSync();for(let H of q){if(!V||V(H))z.push(Z?H:H.fullpath());let W=H;if(H.isSymbolicLink()){if(!($&&(W=H.realpathSync())))continue;if(W.isUnknown())W.lstatSync()}if(W.shouldWalk(Y,J))Y.add(W)}}return z}[Symbol.asyncIterator](){return this.iterate()}iterate(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof u))X=Q,Q=this.cwd;return this.stream(Q,X)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof u))X=Q,Q=this.cwd;let{withFileTypes:Z=!0,follow:$=!1,filter:V,walkFilter:J}=X;if(!V||V(Q))yield Z?Q:Q.fullpath();let z=new Set([Q]);for(let Y of z){let K=Y.readdirSync();for(let q of K){if(!V||V(q))yield Z?q:q.fullpath();let H=q;if(q.isSymbolicLink()){if(!($&&(H=q.realpathSync())))continue;if(H.isUnknown())H.lstatSync()}if(H.shouldWalk(z,J))z.add(H)}}}stream(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof u))X=Q,Q=this.cwd;let{withFileTypes:Z=!0,follow:$=!1,filter:V,walkFilter:J}=X,z=new O5({objectMode:!0});if(!V||V(Q))z.write(Z?Q:Q.fullpath());let Y=new Set,K=[Q],q=0,H=()=>{let W=!1;while(!W){let G=K.shift();if(!G){if(q===0)z.end();return}q++,Y.add(G);let j=(U,A,w=!1)=>{if(U)return z.emit("error",U);if($&&!w){let B=[];for(let v of A)if(v.isSymbolicLink())B.push(v.realpath().then((O)=>O?.isUnknown()?O.lstat():O));if(B.length){Promise.all(B).then(()=>j(null,A,!0));return}}for(let B of A)if(B&&(!V||V(B))){if(!z.write(Z?B:B.fullpath()))W=!0}q--;for(let B of A){let v=B.realpathCached()||B;if(v.shouldWalk(Y,J))K.push(v)}if(W&&!z.flowing)z.once("drain",H);else if(!_)H()},_=!0;G.readdirCB(j,!0),_=!1}};return H(),z}streamSync(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof u))X=Q,Q=this.cwd;let{withFileTypes:Z=!0,follow:$=!1,filter:V,walkFilter:J}=X,z=new O5({objectMode:!0}),Y=new Set;if(!V||V(Q))z.write(Z?Q:Q.fullpath());let K=[Q],q=0,H=()=>{let W=!1;while(!W){let G=K.shift();if(!G){if(q===0)z.end();return}q++,Y.add(G);let j=G.readdirSync();for(let _ of j)if(!V||V(_)){if(!z.write(Z?_:_.fullpath()))W=!0}q--;for(let _ of j){let U=_;if(_.isSymbolicLink()){if(!($&&(U=_.realpathSync())))continue;if(U.isUnknown())U.lstatSync()}if(U.shouldWalk(Y,J))K.push(U)}}if(W&&!z.flowing)z.once("drain",H)};return H(),z}chdir(Q=this.cwd){let X=this.cwd;this.cwd=typeof Q==="string"?this.cwd.resolve(Q):Q,this.cwd[U9](X)}}class t5 extends Z7{sep="\\";constructor(Q=process.cwd(),X={}){let{nocase:Z=!0}=X;super(Q,Q7,"\\",{...X,nocase:Z});this.nocase=Z;for(let $=this.cwd;$;$=$.parent)$.nocase=this.nocase}parseRootPath(Q){return Q7.parse(Q).root.toUpperCase()}newRoot(Q){return new B6(this.rootPath,J5,void 0,this.roots,this.nocase,this.childrenCache(),{fs:Q})}isAbsolute(Q){return Q.startsWith("/")||Q.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(Q)}}class e5 extends Z7{sep="/";constructor(Q=process.cwd(),X={}){let{nocase:Z=!1}=X;super(Q,EQ,"/",{...X,nocase:Z});this.nocase=Z}parseRootPath(Q){return"/"}newRoot(Q){return new L6(this.rootPath,J5,void 0,this.roots,this.nocase,this.childrenCache(),{fs:Q})}isAbsolute(Q){return Q.startsWith("/")}}class F6 extends e5{constructor(Q=process.cwd(),X={}){let{nocase:Z=!0}=X;super(Q,{...X,nocase:Z})}}var XZ=process.platform==="win32"?B6:L6,w9=process.platform==="win32"?t5:process.platform==="darwin"?F6:e5;var aQ=(Q)=>Q.length>=1,rQ=(Q)=>Q.length>=1;class x5{#Q;#$;#V;length;#X;#z;#C;#B;#W;#Y;#G=!0;constructor(Q,X,Z,$){if(!aQ(Q))throw TypeError("empty pattern list");if(!rQ(X))throw TypeError("empty glob list");if(X.length!==Q.length)throw TypeError("mismatched pattern list and glob list lengths");if(this.length=Q.length,Z<0||Z>=this.length)throw TypeError("index out of range");if(this.#Q=Q,this.#$=X,this.#V=Z,this.#X=$,this.#V===0){if(this.isUNC()){let[V,J,z,Y,...K]=this.#Q,[q,H,W,G,...j]=this.#$;if(K[0]==="")K.shift(),j.shift();let _=[V,J,z,Y,""].join("/"),U=[q,H,W,G,""].join("/");this.#Q=[_,...K],this.#$=[U,...j],this.length=this.#Q.length}else if(this.isDrive()||this.isAbsolute()){let[V,...J]=this.#Q,[z,...Y]=this.#$;if(J[0]==="")J.shift(),Y.shift();let K=V+"/",q=z+"/";this.#Q=[K,...J],this.#$=[q,...Y],this.length=this.#Q.length}}}pattern(){return this.#Q[this.#V]}isString(){return typeof this.#Q[this.#V]==="string"}isGlobstar(){return this.#Q[this.#V]===N}isRegExp(){return this.#Q[this.#V]instanceof RegExp}globString(){return this.#C=this.#C||(this.#V===0?this.isAbsolute()?this.#$[0]+this.#$.slice(1).join("/"):this.#$.join("/"):this.#$.slice(this.#V).join("/"))}hasMore(){return this.length>this.#V+1}rest(){if(this.#z!==void 0)return this.#z;if(!this.hasMore())return this.#z=null;return this.#z=new x5(this.#Q,this.#$,this.#V+1,this.#X),this.#z.#Y=this.#Y,this.#z.#W=this.#W,this.#z.#B=this.#B,this.#z}isUNC(){let Q=this.#Q;return this.#W!==void 0?this.#W:this.#W=this.#X==="win32"&&this.#V===0&&Q[0]===""&&Q[1]===""&&typeof Q[2]==="string"&&!!Q[2]&&typeof Q[3]==="string"&&!!Q[3]}isDrive(){let Q=this.#Q;return this.#B!==void 0?this.#B:this.#B=this.#X==="win32"&&this.#V===0&&this.length>1&&typeof Q[0]==="string"&&/^[a-z]:$/i.test(Q[0])}isAbsolute(){let Q=this.#Q;return this.#Y!==void 0?this.#Y:this.#Y=Q[0]===""&&Q.length>1||this.isDrive()||this.isUNC()}root(){let Q=this.#Q[0];return typeof Q==="string"&&this.isAbsolute()&&this.#V===0?Q:""}checkFollowGlobstar(){return!(this.#V===0||!this.isGlobstar()||!this.#G)}markFollowGlobstar(){if(this.#V===0||!this.isGlobstar()||!this.#G)return!1;return this.#G=!1,!0}}var sQ=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class Q6{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(Q,{nobrace:X,nocase:Z,noext:$,noglobstar:V,platform:J=sQ}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=J,this.mmopts={dot:!0,nobrace:X,nocase:Z,noext:$,noglobstar:V,optimizationLevel:2,platform:J,nocomment:!0,nonegate:!0};for(let z of Q)this.add(z)}add(Q){let X=new l(Q,this.mmopts);for(let Z=0;Z<X.set.length;Z++){let $=X.set[Z],V=X.globParts[Z];if(!$||!V)throw Error("invalid pattern object");while($[0]==="."&&V[0]===".")$.shift(),V.shift();let J=new x5($,V,0,this.platform),z=new l(J.globString(),this.mmopts),Y=V[V.length-1]==="**",K=J.isAbsolute();if(K)this.absolute.push(z);else this.relative.push(z);if(Y)if(K)this.absoluteChildren.push(z);else this.relativeChildren.push(z)}}ignored(Q){let X=Q.fullpath(),Z=`${X}/`,$=Q.relative()||".",V=`${$}/`;for(let J of this.relative)if(J.match($)||J.match(V))return!0;for(let J of this.absolute)if(J.match(X)||J.match(Z))return!0;return!1}childrenIgnored(Q){let X=Q.fullpath()+"/",Z=(Q.relative()||".")+"/";for(let $ of this.relativeChildren)if($.match(Z))return!0;for(let $ of this.absoluteChildren)if($.match(X))return!0;return!1}}class $7{store;constructor(Q=new Map){this.store=Q}copy(){return new $7(new Map(this.store))}hasWalked(Q,X){return this.store.get(Q.fullpath())?.has(X.globString())}storeWalked(Q,X){let Z=Q.fullpath(),$=this.store.get(Z);if($)$.add(X.globString());else this.store.set(Z,new Set([X.globString()]))}}class A9{store=new Map;add(Q,X,Z){let $=(X?2:0)|(Z?1:0),V=this.store.get(Q);this.store.set(Q,V===void 0?$:$&V)}entries(){return[...this.store.entries()].map(([Q,X])=>[Q,!!(X&2),!!(X&1)])}}class B9{store=new Map;add(Q,X){if(!Q.canReaddir())return;let Z=this.store.get(Q);if(Z){if(!Z.find(($)=>$.globString()===X.globString()))Z.push(X)}else this.store.set(Q,[X])}get(Q){let X=this.store.get(Q);if(!X)throw Error("attempting to walk unknown path");return X}entries(){return this.keys().map((Q)=>[Q,this.store.get(Q)])}keys(){return[...this.store.keys()].filter((Q)=>Q.canReaddir())}}class X6{hasWalkedCache;matches=new A9;subwalks=new B9;patterns;follow;dot;opts;constructor(Q,X){this.opts=Q,this.follow=!!Q.follow,this.dot=!!Q.dot,this.hasWalkedCache=X?X.copy():new $7}processPatterns(Q,X){this.patterns=X;let Z=X.map(($)=>[Q,$]);for(let[$,V]of Z){this.hasWalkedCache.storeWalked($,V);let J=V.root(),z=V.isAbsolute()&&this.opts.absolute!==!1;if(J){$=$.resolve(J==="/"&&this.opts.root!==void 0?this.opts.root:J);let H=V.rest();if(!H){this.matches.add($,!0,!1);continue}else V=H}if($.isENOENT())continue;let Y,K,q=!1;while(typeof(Y=V.pattern())==="string"&&(K=V.rest()))$=$.resolve(Y),V=K,q=!0;if(Y=V.pattern(),K=V.rest(),q){if(this.hasWalkedCache.hasWalked($,V))continue;this.hasWalkedCache.storeWalked($,V)}if(typeof Y==="string"){let H=Y===".."||Y===""||Y===".";this.matches.add($.resolve(Y),z,H);continue}else if(Y===N){if(!$.isSymbolicLink()||this.follow||V.checkFollowGlobstar())this.subwalks.add($,V);let H=K?.pattern(),W=K?.rest();if(!K||(H===""||H===".")&&!W)this.matches.add($,z,H===""||H===".");else if(H===".."){let G=$.parent||$;if(!W)this.matches.add(G,z,!0);else if(!this.hasWalkedCache.hasWalked(G,W))this.subwalks.add(G,W)}}else if(Y instanceof RegExp)this.subwalks.add($,V)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new X6(this.opts,this.hasWalkedCache)}filterEntries(Q,X){let Z=this.subwalks.get(Q),$=this.child();for(let V of X)for(let J of Z){let z=J.isAbsolute(),Y=J.pattern(),K=J.rest();if(Y===N)$.testGlobstar(V,J,K,z);else if(Y instanceof RegExp)$.testRegExp(V,Y,K,z);else $.testString(V,Y,K,z)}return $}testGlobstar(Q,X,Z,$){if(this.dot||!Q.name.startsWith(".")){if(!X.hasMore())this.matches.add(Q,$,!1);if(Q.canReaddir()){if(this.follow||!Q.isSymbolicLink())this.subwalks.add(Q,X);else if(Q.isSymbolicLink()){if(Z&&X.checkFollowGlobstar())this.subwalks.add(Q,Z);else if(X.markFollowGlobstar())this.subwalks.add(Q,X)}}}if(Z){let V=Z.pattern();if(typeof V==="string"&&V!==".."&&V!==""&&V!==".")this.testString(Q,V,Z.rest(),$);else if(V===".."){let J=Q.parent||Q;this.subwalks.add(J,Z)}else if(V instanceof RegExp)this.testRegExp(Q,V,Z.rest(),$)}}testRegExp(Q,X,Z,$){if(!X.test(Q.name))return;if(!Z)this.matches.add(Q,$,!1);else this.subwalks.add(Q,Z)}testString(Q,X,Z,$){if(!Q.isNamed(X))return;if(!Z)this.matches.add(Q,$,!1);else this.subwalks.add(Q,Z)}}var tQ=(Q,X)=>typeof Q==="string"?new Q6([Q],X):Array.isArray(Q)?new Q6(Q,X):Q;class V7{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#Q=[];#$;#V;signal;maxDepth;includeChildMatches;constructor(Q,X,Z){if(this.patterns=Q,this.path=X,this.opts=Z,this.#V=!Z.posix&&Z.platform==="win32"?"\\":"/",this.includeChildMatches=Z.includeChildMatches!==!1,Z.ignore||!this.includeChildMatches){if(this.#$=tQ(Z.ignore??[],Z),!this.includeChildMatches&&typeof this.#$.add!=="function")throw Error("cannot ignore child matches, ignore lacks add() method.")}if(this.maxDepth=Z.maxDepth||1/0,Z.signal)this.signal=Z.signal,this.signal.addEventListener("abort",()=>{this.#Q.length=0})}#X(Q){return this.seen.has(Q)||!!this.#$?.ignored?.(Q)}#z(Q){return!!this.#$?.childrenIgnored?.(Q)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let Q=void 0;while(!this.paused&&(Q=this.#Q.shift()))Q()}onResume(Q){if(this.signal?.aborted)return;if(!this.paused)Q();else this.#Q.push(Q)}async matchCheck(Q,X){if(X&&this.opts.nodir)return;let Z;if(this.opts.realpath){if(Z=Q.realpathCached()||await Q.realpath(),!Z)return;Q=Z}let V=Q.isUnknown()||this.opts.stat?await Q.lstat():Q;if(this.opts.follow&&this.opts.nodir&&V?.isSymbolicLink()){let J=await V.realpath();if(J&&(J.isUnknown()||this.opts.stat))await J.lstat()}return this.matchCheckTest(V,X)}matchCheckTest(Q,X){return Q&&(this.maxDepth===1/0||Q.depth()<=this.maxDepth)&&(!X||Q.canReaddir())&&(!this.opts.nodir||!Q.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!Q.isSymbolicLink()||!Q.realpathCached()?.isDirectory())&&!this.#X(Q)?Q:void 0}matchCheckSync(Q,X){if(X&&this.opts.nodir)return;let Z;if(this.opts.realpath){if(Z=Q.realpathCached()||Q.realpathSync(),!Z)return;Q=Z}let V=Q.isUnknown()||this.opts.stat?Q.lstatSync():Q;if(this.opts.follow&&this.opts.nodir&&V?.isSymbolicLink()){let J=V.realpathSync();if(J&&(J?.isUnknown()||this.opts.stat))J.lstatSync()}return this.matchCheckTest(V,X)}matchFinish(Q,X){if(this.#X(Q))return;if(!this.includeChildMatches&&this.#$?.add){let V=`${Q.relativePosix()}/**`;this.#$.add(V)}let Z=this.opts.absolute===void 0?X:this.opts.absolute;this.seen.add(Q);let $=this.opts.mark&&Q.isDirectory()?this.#V:"";if(this.opts.withFileTypes)this.matchEmit(Q);else if(Z){let V=this.opts.posix?Q.fullpathPosix():Q.fullpath();this.matchEmit(V+$)}else{let V=this.opts.posix?Q.relativePosix():Q.relative(),J=this.opts.dotRelative&&!V.startsWith(".."+this.#V)?"."+this.#V:"";this.matchEmit(!V?"."+$:J+V+$)}}async match(Q,X,Z){let $=await this.matchCheck(Q,Z);if($)this.matchFinish($,X)}matchSync(Q,X,Z){let $=this.matchCheckSync(Q,Z);if($)this.matchFinish($,X)}walkCB(Q,X,Z){if(this.signal?.aborted)Z();this.walkCB2(Q,X,new X6(this.opts),Z)}walkCB2(Q,X,Z,$){if(this.#z(Q))return $();if(this.signal?.aborted)$();if(this.paused){this.onResume(()=>this.walkCB2(Q,X,Z,$));return}Z.processPatterns(Q,X);let V=1,J=()=>{if(--V===0)$()};for(let[z,Y,K]of Z.matches.entries()){if(this.#X(z))continue;V++,this.match(z,Y,K).then(()=>J())}for(let z of Z.subwalkTargets()){if(this.maxDepth!==1/0&&z.depth()>=this.maxDepth)continue;V++;let Y=z.readdirCached();if(z.calledReaddir())this.walkCB3(z,Y,Z,J);else z.readdirCB((K,q)=>this.walkCB3(z,q,Z,J),!0)}J()}walkCB3(Q,X,Z,$){Z=Z.filterEntries(Q,X);let V=1,J=()=>{if(--V===0)$()};for(let[z,Y,K]of Z.matches.entries()){if(this.#X(z))continue;V++,this.match(z,Y,K).then(()=>J())}for(let[z,Y]of Z.subwalks.entries())V++,this.walkCB2(z,Y,Z.child(),J);J()}walkCBSync(Q,X,Z){if(this.signal?.aborted)Z();this.walkCB2Sync(Q,X,new X6(this.opts),Z)}walkCB2Sync(Q,X,Z,$){if(this.#z(Q))return $();if(this.signal?.aborted)$();if(this.paused){this.onResume(()=>this.walkCB2Sync(Q,X,Z,$));return}Z.processPatterns(Q,X);let V=1,J=()=>{if(--V===0)$()};for(let[z,Y,K]of Z.matches.entries()){if(this.#X(z))continue;this.matchSync(z,Y,K)}for(let z of Z.subwalkTargets()){if(this.maxDepth!==1/0&&z.depth()>=this.maxDepth)continue;V++;let Y=z.readdirSync();this.walkCB3Sync(z,Y,Z,J)}J()}walkCB3Sync(Q,X,Z,$){Z=Z.filterEntries(Q,X);let V=1,J=()=>{if(--V===0)$()};for(let[z,Y,K]of Z.matches.entries()){if(this.#X(z))continue;this.matchSync(z,Y,K)}for(let[z,Y]of Z.subwalks.entries())V++,this.walkCB2Sync(z,Y,Z.child(),J);J()}}class v6 extends V7{matches=new Set;constructor(Q,X,Z){super(Q,X,Z)}matchEmit(Q){this.matches.add(Q)}async walk(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown())await this.path.lstat();return await new Promise((Q,X)=>{this.walkCB(this.path,this.patterns,()=>{if(this.signal?.aborted)X(this.signal.reason);else Q(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown())this.path.lstatSync();return this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}}class O6 extends V7{results;constructor(Q,X,Z){super(Q,X,Z);this.results=new O5({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(Q){if(this.results.write(Q),!this.results.flowing)this.pause()}stream(){let Q=this.path;if(Q.isUnknown())Q.lstat().then(()=>{this.walkCB(Q,this.patterns,()=>this.results.end())});else this.walkCB(Q,this.patterns,()=>this.results.end());return this.results}streamSync(){if(this.path.isUnknown())this.path.lstatSync();return this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}}var Q8=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class z5{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(Q,X){if(!X)throw TypeError("glob options required");if(this.withFileTypes=!!X.withFileTypes,this.signal=X.signal,this.follow=!!X.follow,this.dot=!!X.dot,this.dotRelative=!!X.dotRelative,this.nodir=!!X.nodir,this.mark=!!X.mark,!X.cwd)this.cwd="";else if(X.cwd instanceof URL||X.cwd.startsWith("file://"))X.cwd=eQ(X.cwd);if(this.cwd=X.cwd||"",this.root=X.root,this.magicalBraces=!!X.magicalBraces,this.nobrace=!!X.nobrace,this.noext=!!X.noext,this.realpath=!!X.realpath,this.absolute=X.absolute,this.includeChildMatches=X.includeChildMatches!==!1,this.noglobstar=!!X.noglobstar,this.matchBase=!!X.matchBase,this.maxDepth=typeof X.maxDepth==="number"?X.maxDepth:1/0,this.stat=!!X.stat,this.ignore=X.ignore,this.withFileTypes&&this.absolute!==void 0)throw Error("cannot set absolute and withFileTypes:true");if(typeof Q==="string")Q=[Q];if(this.windowsPathsNoEscape=!!X.windowsPathsNoEscape||X.allowWindowsEscape===!1,this.windowsPathsNoEscape)Q=Q.map((Y)=>Y.replace(/\\/g,"/"));if(this.matchBase){if(X.noglobstar)throw TypeError("base matching requires globstar");Q=Q.map((Y)=>Y.includes("/")?Y:`./**/${Y}`)}if(this.pattern=Q,this.platform=X.platform||Q8,this.opts={...X,platform:this.platform},X.scurry){if(this.scurry=X.scurry,X.nocase!==void 0&&X.nocase!==X.scurry.nocase)throw Error("nocase option contradicts provided scurry option")}else{let Y=X.platform==="win32"?t5:X.platform==="darwin"?F6:X.platform?e5:w9;this.scurry=new Y(this.cwd,{nocase:X.nocase,fs:X.fs})}this.nocase=this.scurry.nocase;let Z=this.platform==="darwin"||this.platform==="win32",$={...X,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:Z,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},V=this.pattern.map((Y)=>new l(Y,$)),[J,z]=V.reduce((Y,K)=>{return Y[0].push(...K.set),Y[1].push(...K.globParts),Y},[[],[]]);this.patterns=J.map((Y,K)=>{let q=z[K];if(!q)throw Error("invalid pattern object");return new x5(Y,q,0,this.platform)})}async walk(){return[...await new v6(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new v6(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new O6(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new O6(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}}var J7=(Q,X={})=>{if(!Array.isArray(Q))Q=[Q];for(let Z of Q)if(new l(Z,X).hasMagic())return!0;return!1};function M6(Q,X={}){return new z5(Q,X).streamSync()}function F9(Q,X={}){return new z5(Q,X).stream()}function v9(Q,X={}){return new z5(Q,X).walkSync()}async function L9(Q,X={}){return new z5(Q,X).walk()}function R6(Q,X={}){return new z5(Q,X).iterateSync()}function O9(Q,X={}){return new z5(Q,X).iterate()}var X8=M6,Z8=Object.assign(F9,{sync:M6}),$8=R6,V8=Object.assign(O9,{sync:R6}),J8=Object.assign(v9,{stream:M6,iterate:R6}),C6=Object.assign(L9,{glob:L9,globSync:v9,sync:J8,globStream:F9,stream:Z8,globStreamSync:M6,streamSync:X8,globIterate:O9,iterate:V8,globIterateSync:R6,iterateSync:$8,Glob:z5,hasMagic:J7,escape:D5,unescape:a});C6.glob=C6;var z8={name:"Read",description:"Reads a file from the local filesystem. You can access any file directly by using this tool.",input_schema:{type:"object",properties:{file_path:{type:"string",description:"The absolute path to the file to read"},offset:{type:"number",description:"The line number to start reading from (1-based)"},limit:{type:"number",description:"The number of lines to read"}},required:["file_path"]},handler:async(Q,X)=>{let Z=Q.file_path,$=Q.offset||1,V=Q.limit||2000;try{let Y=(await Bun.file(Z).text()).split(`
|
|
45
|
-
`),K=Math.max(0,$-1),q=Math.min(Y.length,K+V);return{content:Y.slice(K,q).map((G,j)=>`${K+j+1} ${G}`).join(`
|
|
46
|
-
`)}}catch(J){return{content:`Error reading file: ${J instanceof Error?J.message:String(J)}`,is_error:!0}}}},Y8={name:"Write",description:"Writes a file to the local filesystem. This tool will overwrite the existing file if there is one at the provided path.",input_schema:{type:"object",properties:{file_path:{type:"string",description:"The absolute path to the file to write"},content:{type:"string",description:"The content to write to the file"}},required:["file_path","content"]},handler:async(Q,X)=>{let{file_path:Z,content:$}=Q;try{return await Bun.write(Z,$),{content:`Successfully wrote to ${Z}`}}catch(V){return{content:`Error writing file: ${V instanceof Error?V.message:String(V)}`,is_error:!0}}}},K8={name:"Edit",description:"Performs exact string replacements in files. Use this tool to modify existing files.",input_schema:{type:"object",properties:{file_path:{type:"string",description:"The absolute path to the file to modify"},old_string:{type:"string",description:"The text to replace"},new_string:{type:"string",description:"The text to replace it with"},replace_all:{type:"boolean",description:"Replace all occurrences (default false)"}},required:["file_path","old_string","new_string"]},handler:async(Q,X)=>{let{file_path:Z,old_string:$,new_string:V}=Q,J=Q.replace_all||!1;try{let Y=await Bun.file(Z).text();if(J){let K=Y;Y=Y.split($).join(V);let q=(K.match(new RegExp(q8($),"g"))||[]).length;if(q===0)return{content:"Error: String not found in file",is_error:!0};return await Bun.write(Z,Y),{content:`Successfully replaced ${q} occurrences`}}else{let K=Y.indexOf($);if(K===-1)return{content:"Error: String not found in file",is_error:!0};if(Y.indexOf($,K+1)!==-1)return{content:"Error: String appears multiple times in file. Use replace_all or provide more context.",is_error:!0};return Y=Y.replace($,V),await Bun.write(Z,Y),{content:`Successfully edited ${Z}`}}}catch(z){return{content:`Error editing file: ${z instanceof Error?z.message:String(z)}`,is_error:!0}}}};function q8(Q){return Q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var H8={name:"Bash",description:"Executes a given bash command with optional timeout. Working directory persists between commands.",input_schema:{type:"object",properties:{command:{type:"string",description:"The command to execute"},timeout:{type:"number",description:"Optional timeout in milliseconds (max 600000)"},description:{type:"string",description:"Clear, concise description of what this command does"}},required:["command"]},handler:async(Q,X)=>{let Z=Q.command,$=Q.timeout||120000;try{let V=Bun.spawnSync(["sh","-c",Z],{cwd:X.workingDirectory,timeout:$,maxBuffer:31457280}),J=V.stdout?.toString()||"",z=V.stderr?.toString()||"";if(V.exitCode!==0)return{content:`Exit code: ${V.exitCode}
|
|
47
|
-
${J}
|
|
48
|
-
${z}`.trim(),is_error:!0};return{content:J||"(no output)"}}catch(V){return{content:`Error executing command: ${V instanceof Error?V.message:String(V)}`,is_error:!0}}}},W8={name:"Glob",description:"Fast file pattern matching tool that works with any codebase size. Supports glob patterns.",input_schema:{type:"object",properties:{pattern:{type:"string",description:"The glob pattern to match files"},path:{type:"string",description:"The directory to search (default: current directory)"}},required:["pattern"]},handler:async(Q,X)=>{let Z=Q.pattern,$=Q.path||X.workingDirectory;try{let V=await C6(Z,{cwd:$,absolute:!0,nodir:!0});if(V.length===0)return{content:"No files found matching pattern"};return{content:V.sort().join(`
|
|
49
|
-
`)}}catch(V){return{content:`Error searching files: ${V instanceof Error?V.message:String(V)}`,is_error:!0}}}},G8={name:"Grep",description:"A powerful search tool built on ripgrep. Supports full regex syntax.",input_schema:{type:"object",properties:{pattern:{type:"string",description:"The regular expression pattern to search for"},path:{type:"string",description:"File or directory to search"},glob:{type:"string",description:"Glob pattern to filter files"},output_mode:{type:"string",enum:["content","files_with_matches","count"],description:"Output mode (default: content)"},"-i:":{type:"boolean",description:"Case insensitive search"},"-C:":{type:"number",description:"Context lines around match"},head_limit:{type:"number",description:"Maximum number of results"}},required:["pattern"]},handler:async(Q,X)=>{let Z=Q.pattern,$=Q.path||X.workingDirectory,V=Q.glob,J=Q.output_mode||"content",z=Q["-i:"],Y=Q["-C:"],K=Q.head_limit;try{let q=["--json"];if(z)q.push("-i");if(Y)q.push("-C",String(Y));if(V)q.push("--glob",V);if(J==="files_with_matches")q.push("--files-with-matches");if(J==="count")q.push("--count");q.push(Z,$);let W=Bun.spawnSync(["rg",...q],{cwd:X.workingDirectory,maxBuffer:10485760}).stdout?.toString()||"";if(!W.trim())return{content:"No matches found"};if(J==="content"){let G=W.trim().split(`
|
|
50
|
-
`),j=[];for(let _ of G.slice(0,K||100))try{let U=JSON.parse(_);if(U.type==="match"){let A=U.data?.path?.text||"",w=U.data?.line_number||0,B=U.data?.lines?.text||"";j.push(`${A}:${w}:${B.trim()}`)}}catch{j.push(_)}return{content:j.join(`
|
|
51
|
-
`)||"No matches found"}}return{content:W.trim()}}catch(q){return{content:`Error searching: ${q instanceof Error?q.message:String(q)}`,is_error:!0}}}},j8={name:"Task",description:`Launch a new agent to handle complex, multi-step tasks autonomously.
|
|
52
|
-
|
|
53
|
-
The Task tool launches specialized agents (subprocesses) that autonomously handle complex tasks. Each agent type has specific capabilities and tools available to it.
|
|
54
|
-
|
|
55
|
-
Available agent types and their tools:
|
|
56
|
-
- Bash: Command execution specialist for running bash commands. Use for git operations, command execution, and other terminal tasks.
|
|
57
|
-
- general-purpose: General-purpose agent for researching complex questions, searching for code, and executing multi-step tasks.
|
|
58
|
-
- Explore: Fast agent specialized for exploring codebases. Use to quickly find files by patterns, search code for keywords, or answer questions about the codebase.
|
|
59
|
-
- Plan: Software architect agent for designing implementation plans. Returns step-by-step plans, identifies critical files and considers architectural trade-offs.
|
|
60
|
-
|
|
61
|
-
When using the Task tool, you must specify a subagent_type parameter to select the agent type.
|
|
62
|
-
|
|
63
|
-
Usage notes:
|
|
64
|
-
- Always include a short description (3-5 words) summarizing what the agent will do
|
|
65
|
-
- Launch multiple agents concurrently whenever possible to maximize performance
|
|
66
|
-
- Agents can be resumed using the "resume" parameter by passing the agent ID from a previous invocation.`,input_schema:{type:"object",properties:{subagent_type:{type:"string",enum:["Bash","general-purpose","Explore","Plan"],description:"The agent type to launch"},description:{type:"string",description:"A short (3-5 word) description of what the agent will do"},prompt:{type:"string",description:"The task for the agent to perform"},resume:{type:"string",description:"Resume a previous agent by its ID"},model:{type:"string",enum:["sonnet","opus","haiku"],description:"Model for the subagent (default: haiku for quick tasks)"},run_in_background:{type:"boolean",description:"Run the agent in the background"}},required:["subagent_type","prompt"]},handler:async(Q,X)=>{let{subagent_type:Z,prompt:$,description:V}=Q,J=Q.model||"haiku",z=Q.resume,Y=Q.run_in_background,K=z||`${Z.toLowerCase()}-${Date.now().toString(36)}`;try{let q=process.env.ANTHROPIC_API_KEY||process.env.CLAUDE_API_KEY||process.env.ANTHROPIC_AUTH_TOKEN||process.env.Z_AI_API_KEY||"";if(!q)return{content:"Error: No API key available for subagent. Set ANTHROPIC_API_KEY, CLAUDE_API_KEY, ANTHROPIC_AUTH_TOKEN, or Z_AI_API_KEY environment variable.",is_error:!0};let H={haiku:"claude-haiku-4-5",sonnet:"claude-sonnet-4-6",opus:"claude-opus-4-6"},W=H[J]||H.haiku,G=[import.meta.dir+"/../../dist/cli.js",import.meta.dir+"/../cli.ts",process.cwd()+"/dist/cli.js",process.cwd()+"/src/cli.ts"],j=null;for(let B of G)try{if(await Bun.file(B).exists()){j=B;break}}catch{}if(!j)return{content:`Error: Could not find CLI. Tried:
|
|
67
|
-
${G.join(`
|
|
68
|
-
`)}`,is_error:!0};let _=["run",j,"-m",W,"-p",X.permissionMode,"-q",$];if(Y)return Bun.spawn(["bun",..._],{cwd:X.workingDirectory,detached:!0,stdio:["ignore","pipe","pipe"],env:{...process.env,ANTHROPIC_API_KEY:q}}).unref(),{content:JSON.stringify({agentId:K,status:"running",message:`Agent started in background. Use TaskOutput tool with task_id: "${K}" to check results.`,description:V||"Background task"})};let U=Bun.spawnSync(["bun",..._],{cwd:X.workingDirectory,timeout:300000,maxBuffer:10485760,env:{...process.env,ANTHROPIC_API_KEY:q}}),A=U.stdout?.toString()||"",w=U.stderr?.toString()||"";if(U.exitCode!==0)return{content:`Agent failed with exit code ${U.exitCode}
|
|
69
|
-
${w}
|
|
70
|
-
${A}`.trim(),is_error:!0};return{content:JSON.stringify({agentId:K,status:"completed",output:A,description:V||"Task completed"})}}catch(q){return{content:`Error running subagent: ${q instanceof Error?q.message:String(q)}`,is_error:!0}}}},_8={name:"TaskOutput",description:`Retrieves output from a running or completed task (background shell, agent, or remote session).
|
|
71
|
-
|
|
72
|
-
Takes a task_id parameter identifying the task.
|
|
73
|
-
Returns the task output along with status information.
|
|
74
|
-
Use block=true (default) to wait for task completion.
|
|
75
|
-
Use block=false for non-blocking check of current status.
|
|
76
|
-
|
|
77
|
-
Task IDs can be found using the /tasks command
|
|
78
|
-
Works with all task types: background shells, async agents, and remote sessions`,input_schema:{type:"object",properties:{task_id:{type:"string",description:"The task ID to get output from"},block:{type:"boolean",description:"Whether to wait for completion (default: true)",default:!0},timeout:{type:"number",description:"Max wait time in ms (default: 30000, max: 600000)",default:30000,minimum:0,maximum:600000}},required:["task_id"]},handler:async(Q,X)=>{let Z=Q.task_id,$=Q.block??!0,V=Q.timeout??30000;try{let J=`${X.workingDirectory}/.claude/tasks/${Z}.json`,z=Bun.file(J);if(!await z.exists())return{content:`Task not found: ${Z}. Use /tasks to list available tasks.`,is_error:!0};let Y=await z.json();if($&&Y.status==="running"){let K=Date.now();while(Date.now()-K<V){await new Promise((H)=>setTimeout(H,1000));let q=Bun.file(J);if(await q.exists()){let H=await q.json();if(H.status!=="running")return{content:JSON.stringify({task_id:Z,status:H.status,output:H.output,error:H.error,duration:H.endTime?H.endTime-H.startTime:null},null,2)}}}return{content:JSON.stringify({task_id:Z,status:"timeout",message:`Task still running after ${V}ms`},null,2)}}return{content:JSON.stringify({task_id:Z,status:Y.status,output:Y.output,error:Y.error,duration:Y.endTime?Y.endTime-Y.startTime:null},null,2)}}catch(J){return{content:`Error getting task output: ${J instanceof Error?J.message:String(J)}`,is_error:!0}}}},U8={name:"AskUserQuestion",description:`Use this tool when you need to ask the user questions during execution.
|
|
79
|
-
|
|
80
|
-
This allows you to:
|
|
81
|
-
1. Gather user preferences or requirements
|
|
82
|
-
2. Clarify ambiguous instructions
|
|
83
|
-
3. Get decisions on implementation choices
|
|
84
|
-
4. Offer choices to the user about what direction to take
|
|
85
|
-
|
|
86
|
-
Plan mode note: In plan mode, use this tool to clarify requirements or choose between approaches BEFORE finalizing your plan. Do NOT use this tool if your plan is ready - that's what ExitPlanMode is for.
|
|
87
|
-
|
|
88
|
-
The options array should have 2-4 options. Each option should be a distinct, mutually exclusive choice.
|
|
89
|
-
The preview feature allows showing markdown content in a side-by-side layout.
|
|
90
|
-
|
|
91
|
-
User can always select "Other" to provide custom text input.`,input_schema:{type:"object",properties:{questions:{type:"array",description:"Questions to ask the user (1-4 questions)",items:{type:"object",properties:{question:{type:"string",description:"The complete question to ask the user"},header:{type:"string",description:"Very short label displayed as a chip/tag (max 12 chars)"},options:{type:"array",description:"The available choices (2-4 options)",items:{type:"object",properties:{label:{type:"string",description:"The display text for this option (5 words max)"},description:{type:"string",description:"Explanation of what this option means"},markdown:{type:"string",description:"Optional preview content shown in a monospace box"}},required:["label","description"]},minItems:2,maxItems:4},multiSelect:{type:"boolean",description:"Allow selecting multiple options (default: false)",default:!1}},required:["question","header","options"]},minItems:1,maxItems:4}},required:["questions"]},handler:async(Q,X)=>{let Z=Q.questions;try{let $=Z.map((V,J)=>{let z=V.options.map((Y,K)=>{let q=` ${K+1}. ${Y.label}`;if(Y.description)q+=` - ${Y.description}`;return q}).join(`
|
|
92
|
-
`);return`## Question ${J+1}: [${V.header}]
|
|
93
|
-
${V.question}
|
|
94
|
-
|
|
95
|
-
Options:
|
|
96
|
-
${z}${V.multiSelect?`
|
|
97
|
-
(multi-select enabled)`:""}`}).join(`
|
|
98
|
-
|
|
99
|
-
---
|
|
100
|
-
|
|
101
|
-
`);return{content:JSON.stringify({type:"user_question",questions:Z,formatted:$,message:"Questions prepared for user response"},null,2)}}catch($){return{content:`Error preparing questions: ${$ instanceof Error?$.message:String($)}`,is_error:!0}}}},w8={name:"EnterPlanMode",description:`Use this tool when you are in plan mode and have finished writing your plan to the plan file and are ready for user approval.
|
|
102
|
-
|
|
103
|
-
How This Tool Works:
|
|
104
|
-
- You should have already written your plan to the plan file specified in the plan mode system message
|
|
105
|
-
- This tool does NOT take the plan content as a parameter - it will read the plan from the file you wrote
|
|
106
|
-
- This tool simply signals that you're done planning and ready for the user to review and approve
|
|
107
|
-
|
|
108
|
-
When to Use This Tool:
|
|
109
|
-
IMPORTANT: Only use this tool when the task requires planning the implementation steps of a task that requires writing code. For research tasks where you're gathering information, searching files, reading files or in general trying to understand the codebase - do NOT use this tool.
|
|
110
|
-
|
|
111
|
-
Plan mode note: In plan mode, use this tool to clarify requirements or choose between approaches BEFORE finalizing your plan. Do NOT use this tool if your plan is ready - that's what ExitPlanMode is for.
|
|
112
|
-
|
|
113
|
-
Examples:
|
|
114
|
-
- "Search for and understand the implementation of vim mode" - Do NOT use this tool
|
|
115
|
-
- "Help me implement yank mode for vim" - Use EnterPlanMode
|
|
116
|
-
|
|
117
|
-
Important notes:
|
|
118
|
-
- NEVER run additional commands to read or explore code, besides git bash commands
|
|
119
|
-
- NEVER use the TodoWrite or Task tools
|
|
120
|
-
- DO NOT commit files that likely contain secrets (.env, credentials.json, etc.)
|
|
121
|
-
- If you discover unexpected state like unfamiliar files, branches, or configuration, investigate before deleting or overwriting`,input_schema:{type:"object",properties:{allowedPrompts:{type:"array",description:"Prompt-based permissions needed to implement the plan",items:{type:"object",properties:{tool:{type:"string",description:"The tool this prompt applies to (e.g., 'Bash')"},prompt:{type:"string",description:"Semantic description of the action (e.g., 'run tests', 'install dependencies')"}},required:["tool","prompt"]}}},required:[]},handler:async(Q,X)=>{let Z=Q.allowedPrompts;try{let $=`${X.workingDirectory}/.claude/plan.md`,V=Bun.file($);if(!await V.exists())return{content:"Error: No plan file found. Please write your plan to .claude/plan.md first.",is_error:!0};let J=await V.text();return{content:JSON.stringify({type:"plan_ready",planFile:$,planLength:J.length,allowedPrompts:Z||[],message:"Plan is ready for user review. ExitPlanMode will request user approval."},null,2)}}catch($){return{content:`Error entering plan mode: ${$ instanceof Error?$.message:String($)}`,is_error:!0}}}},A8={name:"ExitPlanMode",description:`Use this tool when you are in plan mode and have finished writing your plan to the plan file and are ready for user approval.
|
|
122
|
-
|
|
123
|
-
This tool does NOT take the plan content as a parameter - it will read the plan from the file you wrote.
|
|
124
|
-
This tool simply signals that you're done planning and ready for the user to review and approve.
|
|
125
|
-
|
|
126
|
-
IMPORTANT: Only use this tool when the task requires planning the implementation steps of a task that requires writing code.
|
|
127
|
-
ExitPlanMode inherently requests user approval of the plan.`,input_schema:{type:"object",properties:{allowedPrompts:{type:"array",description:"Prompt-based permissions needed to implement the plan",items:{type:"object",properties:{tool:{type:"string",description:"The tool this prompt applies to"},prompt:{type:"string",description:"Semantic description of the action"}},required:["tool","prompt"]}}},required:[]},handler:async(Q,X)=>{let Z=Q.allowedPrompts;try{let $=`${X.workingDirectory}/.claude/plan.md`,V=Bun.file($);if(!await V.exists())return{content:"Error: No plan file found at .claude/plan.md",is_error:!0};let J=await V.text();return{content:JSON.stringify({type:"exit_plan_mode",status:"awaiting_approval",planFile:$,planPreview:J.slice(0,500)+(J.length>500?"...":""),allowedPrompts:Z||[],message:"Plan submitted for user approval."},null,2)}}catch($){return{content:`Error exiting plan mode: ${$ instanceof Error?$.message:String($)}`,is_error:!0}}}},B8={name:"Skill",description:`Execute a skill within the main conversation.
|
|
128
|
-
|
|
129
|
-
When users ask you to perform tasks, check if any of the available skills match. Skills provide specialized capabilities and domain knowledge.
|
|
130
|
-
|
|
131
|
-
When users reference a "slash command" or "/<something>" (e.g., "/commit", "/review-pr"), they are referring to a skill. Use this tool to invoke it.
|
|
132
|
-
|
|
133
|
-
How to invoke:
|
|
134
|
-
- Use this tool with the skill name and optional arguments
|
|
135
|
-
- Examples:
|
|
136
|
-
- skill: "commit" - invoke the commit skill
|
|
137
|
-
- skill: "review-pr", args: "123" - invoke with arguments
|
|
138
|
-
- Use fully qualified name for namespaced skills: skill: "ms-office-suite:pdf"
|
|
139
|
-
|
|
140
|
-
Available skills are listed in system-reminder messages in the conversation.
|
|
141
|
-
When a skill matches the user's request, this is a BLOCKING REQUIREMENT: invoke the relevant Skill tool BEFORE generating any other response about the task.
|
|
142
|
-
|
|
143
|
-
Important:
|
|
144
|
-
- NEVER mention a skill without actually calling this tool
|
|
145
|
-
- Do not invoke a skill that is already running
|
|
146
|
-
- Do not use this tool for built-in CLI commands (like /help, /clear)`,input_schema:{type:"object",properties:{skill:{type:"string",description:"The skill name (e.g., 'commit', 'review-pr', or fully qualified 'namespace:skill')"},args:{type:"string",description:"Optional arguments for the skill"}},required:["skill"]},handler:async(Q,X)=>{let{skill:Z,args:$}=Q;try{let V=`${X.workingDirectory}/.claude/skills`,J=`${process.env.HOME||""}/.claude/skills`,z=[`${V}/${Z}.md`,`${V}/${Z}/skill.md`,`${J}/${Z}.md`,`${J}/${Z}/skill.md`],Y=null;for(let H of z)if(await Bun.file(H).exists()){Y=H;break}if(!Y)return{content:`Skill not found: ${Z}. Available skills can be listed with /help.`,is_error:!0};let q=await Bun.file(Y).text();return{content:JSON.stringify({type:"skill_invocation",skill:Z,args:$,skillFile:Y,content:q,message:`Skill "${Z}" loaded. Follow the instructions in the skill content.`},null,2)}}catch(V){return{content:`Error invoking skill: ${V instanceof Error?V.message:String(V)}`,is_error:!0}}}},L8={name:"TaskStop",description:`Stops a running background task by its ID.
|
|
147
|
-
Takes a task_id parameter identifying the task to stop.
|
|
148
|
-
Returns a success or failure status.
|
|
149
|
-
Use this tool to terminate a long-running task.`,input_schema:{type:"object",properties:{task_id:{type:"string",description:"The ID of the background task to stop"},shell_id:{type:"string",description:"Deprecated: use task_id instead"}},required:["task_id"]},handler:async(Q,X)=>{let Z=Q.task_id;try{let $=`${X.workingDirectory}/.claude/tasks/${Z}.json`,V=Bun.file($);if(!await V.exists())return{content:`Task not found: ${Z}`,is_error:!0};let J=await V.json();if(J.status!=="running")return{content:JSON.stringify({task_id:Z,status:J.status,message:`Task is already ${J.status}`},null,2)};return J.status="stopped",await Bun.write($,JSON.stringify(J,null,2)),{content:JSON.stringify({task_id:Z,status:"stopped",message:"Task stopped successfully"},null,2)}}catch($){return{content:`Error stopping task: ${$ instanceof Error?$.message:String($)}`,is_error:!0}}}},F8={name:"NotebookEdit",description:`Completely replaces the contents of a specific cell in a Jupyter notebook (.ipynb file) with new source.
|
|
150
|
-
|
|
151
|
-
Jupyter notebooks are interactive documents that combine code, text, and visualizations. The notebook_path parameter must be an absolute path, not a relative path. The cell_number is 0-indexed. Use edit_mode=insert to add a new cell at the index specified by cell_number. Use edit_mode=delete to delete the cell at the index specified by cell_number.`,input_schema:{type:"object",properties:{notebook_path:{type:"string",description:"The absolute path to the Jupyter notebook file to edit"},cell_id:{type:"string",description:"The ID of the cell to edit (optional, alternative to cell_number)"},cell_number:{type:"number",description:"The index of the cell to edit (0-indexed)"},new_source:{type:"string",description:"The new source for the cell"},cell_type:{type:"string",enum:["code","markdown"],description:"The type of the cell (code or markdown). Defaults to code."},edit_mode:{type:"string",enum:["replace","insert","delete"],description:"The type of edit to perform (replace, insert, delete)"}},required:["notebook_path"]},handler:async(Q,X)=>{let{notebook_path:Z,cell_id:$,cell_number:V,new_source:J}=Q,z=Q.cell_type||"code",Y=Q.edit_mode||"replace";try{let K=Bun.file(Z);if(!await K.exists())return{content:`Error: Notebook not found: ${Z}`,is_error:!0};let q=await K.json();if(!q.cells||!Array.isArray(q.cells))return{content:"Error: Invalid notebook format - no cells array",is_error:!0};let H;if($){if(H=q.cells.findIndex((W)=>W.id===$),H===-1)return{content:`Error: Cell with ID "${$}" not found`,is_error:!0}}else if(V!==void 0){if(H=V,H<0||H>=q.cells.length)if(Y==="insert")H=q.cells.length;else return{content:`Error: Cell number ${H} out of range (0-${q.cells.length-1})`,is_error:!0}}else if(Y!=="insert")return{content:"Error: Must specify either cell_id or cell_number",is_error:!0};else H=q.cells.length;switch(Y){case"delete":{q.cells.splice(H,1);break}case"insert":{let W={id:`cell-${Date.now()}`,cell_type:z,source:J||"",metadata:{},...z==="code"?{outputs:[],execution_count:null}:{}};q.cells.splice(H,0,W);break}case"replace":default:{if(J===void 0)return{content:"Error: new_source is required for replace mode",is_error:!0};let W=q.cells[H];if(!W)return{content:`Error: Cell at index ${H} not found`,is_error:!0};q.cells[H]={...W,source:J,cell_type:z,...z==="code"?{execution_count:null}:{}};break}}return await Bun.write(Z,JSON.stringify(q,null,1)),{content:JSON.stringify({success:!0,message:`Successfully ${Y}d cell in ${Z}`,cellCount:q.cells.length})}}catch(K){return{content:`Error editing notebook: ${K instanceof Error?K.message:String(K)}`,is_error:!0}}}},v8=[z8,Y8,K8,H8,W8,G8,j8,_8,L8,U8,w8,A8,B8,F8];function xZ(Q){return v8.find((X)=>X.name===Q)}import{spawn as O8}from"child_process";import z7 from"ws";class Y7{static MCPClient=Y7;name;config;connected=!1;tools=[];process=null;websocket=null;requestId=0;pendingRequests=new Map;buffer="";onLog;constructor(Q){this.name=Q.name,this.config=Q.config,this.onLog=Q.onLog}async connect(){if(this.config.type==="stdio")await this.connectStdio();else if(this.config.type==="http"||this.config.type==="sse")await this.connectHttp();else if(this.config.type==="ws")await this.connectWebSocket()}async connectStdio(){if(!this.config.command)throw Error("No command specified for stdio transport");this.log(`Starting stdio transport: ${this.config.command}`),this.process=O8(this.config.command,this.config.args||[],{env:{...process.env,...this.config.env},stdio:["pipe","pipe","pipe"]}),this.process.stdout?.on("data",(Q)=>{this.handleData(Q.toString())}),this.process.stderr?.on("data",(Q)=>{this.log(`stderr: ${Q.toString()}`)}),this.process.on("error",(Q)=>{this.log(`Process error: ${Q.message}`)}),this.process.on("close",(Q)=>{this.log(`Process closed with code ${Q}`),this.connected=!1}),await new Promise((Q)=>setTimeout(Q,100)),await this.initialize()}async connectHttp(){if(!this.config.url)throw Error("No URL specified for HTTP transport");this.log(`Starting HTTP transport: ${this.config.url}`);try{let Q=await fetch(this.config.url,{method:"POST",headers:{"Content-Type":"application/json",...this.config.headers},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"initialize",params:{protocolVersion:"2024-11-05",capabilities:{},clientInfo:{name:"coder",version:"0.1.0"}}})});if(!Q.ok)throw Error(`HTTP error: ${Q.status}`);let X=await Q.json();this.connected=!0,await this.loadTools()}catch(Q){let X=Q instanceof Error?Q.message:String(Q);throw Error(`Failed to connect to HTTP server: ${X}`)}}async connectWebSocket(){if(!this.config.url)throw Error("No URL specified for WebSocket transport");let Q=this.config.url;return this.log(`Starting WebSocket transport: ${Q}`),new Promise((X,Z)=>{let $={...this.config.headers},V=new z7(Q,{headers:$,handshakeTimeout:this.config.timeout||30000});V.on("open",()=>{this.log("WebSocket connection established"),this.websocket=V,this.connected=!0,this.initialize().then(()=>X()).catch((J)=>{let z=J instanceof Error?J.message:String(J);this.log(`Initialization failed: ${z}`),Z(J)})}),V.on("message",(J,z)=>{let Y=z?J.toString():J.toString();this.handleData(Y)}),V.on("error",(J)=>{if(this.log(`WebSocket error: ${J.message}`),!this.connected)Z(Error(`WebSocket connection failed: ${J.message}`))}),V.on("close",(J,z)=>{this.log(`WebSocket closed: code=${J}, reason=${z.toString()}`),this.connected=!1,this.websocket=null;for(let[Y,K]of this.pendingRequests)this.pendingRequests.delete(Y),K.reject(Error(`WebSocket closed: ${z.toString()}`))}),V.on("ping",()=>{V.pong()})})}async initialize(){let Q=await this.request("initialize",{protocolVersion:"2024-11-05",capabilities:{tools:{},resources:{},prompts:{}},clientInfo:{name:"coder",version:"0.1.0"}});this.log(`Initialized with: ${JSON.stringify(Q)}`),this.connected=!0,this.notify("notifications/initialized",{}),await this.loadTools()}async loadTools(){try{let Q=await this.request("tools/list",{});this.tools=Q.tools.map((X)=>({name:X.name,description:X.description,inputSchema:X.inputSchema})),this.log(`Loaded ${this.tools.length} tools`)}catch(Q){this.log(`Failed to load tools: ${Q}`)}}async callTool(Q,X){return{content:(await this.request("tools/call",{name:Q,arguments:X})).content.filter((V)=>V.type==="text").map((V)=>V.text||"").join(`
|
|
152
|
-
`)}}async request(Q,X){let Z=++this.requestId,$={jsonrpc:"2.0",id:Z,method:Q,params:X};return new Promise((V,J)=>{this.pendingRequests.set(Z,{resolve:V,reject:J});let z=JSON.stringify($);if(this.websocket&&this.websocket.readyState===z7.OPEN)this.websocket.send(z);else if(this.process?.stdin?.writable)this.process.stdin.write(z+`
|
|
153
|
-
`);else{this.pendingRequests.delete(Z),J(Error("No active connection to send request"));return}setTimeout(()=>{if(this.pendingRequests.has(Z))this.pendingRequests.delete(Z),J(Error(`Request timeout for ${Q}`))},this.config.timeout||120000)})}notify(Q,X){let $=JSON.stringify({jsonrpc:"2.0",method:Q,params:X});if(this.websocket&&this.websocket.readyState===z7.OPEN)this.websocket.send($);else if(this.process?.stdin?.writable)this.process.stdin.write($+`
|
|
154
|
-
`)}handleData(Q){this.buffer+=Q;let X=this.buffer.split(`
|
|
155
|
-
`);this.buffer=X.pop()||"";for(let Z of X){if(!Z.trim())continue;try{let $=JSON.parse(Z);if($.id!==void 0){let V=this.pendingRequests.get($.id);if(V)if(this.pendingRequests.delete($.id),$.error)V.reject(Error($.error.message));else V.resolve($.result)}}catch($){this.log(`Parse error: ${$}`)}}}async close(){if(this.websocket)this.websocket.close(),this.websocket=null;if(this.process)this.process.kill(),this.process=null;this.connected=!1}log(Q){this.onLog?.(`[MCP:${this.name}] ${Q}`)}}async function yZ(Q,X){let Z=new Map;for(let[$,V]of Object.entries(Q)){if(V.disabled)continue;let J=new Y7({name:$,config:V,onLog:X});try{await J.connect(),Z.set($,J)}catch(z){let Y=z instanceof Error?z.message:String(z);X?.(`[MCP:${$}] Failed to connect: ${Y}`)}}return Z}import{spawn as C8}from"child_process";class M8{hooks=new Map;timeout;constructor(Q=60000){this.timeout=Q}register(Q,X){if(!this.hooks.has(Q))this.hooks.set(Q,[]);this.hooks.get(Q)?.push(X)}registerAll(Q){for(let[X,Z]of Object.entries(Q))for(let $ of Z)this.register(X,$)}async execute(Q,X){let Z=this.hooks.get(Q);if(!Z||Z.length===0)return{decision:"allow"};let $={...X,event:Q,timestamp:Date.now()};for(let V of Z){if(V.enabled===!1)continue;let J=await this.executeHook(V,$);if(J.decision==="deny"||J.decision==="block")return J;if(J.modified_input)Object.assign(X,J.modified_input)}return{decision:"allow"}}async executeHook(Q,X){let Z=Q.timeout||this.timeout;try{return await new Promise((V,J)=>{let z=C8(Q.command,[],{shell:!0,stdio:["pipe","pipe","pipe"]}),Y="",K="";z.stdout?.on("data",(q)=>{Y+=q.toString()}),z.stderr?.on("data",(q)=>{K+=q.toString()}),z.on("close",(q)=>{if(q===0)try{let H=JSON.parse(Y);V(H)}catch{V({decision:"allow"})}else if(q===1)V({decision:"deny",reason:K||"Hook denied execution"});else if(q===2)V({decision:"block",reason:K||"Hook blocked execution"});else V({decision:"allow"})}),z.on("error",(q)=>{V({decision:"allow",reason:`Hook error: ${q.message}`})}),z.stdin?.write(JSON.stringify(X)),z.stdin?.end(),setTimeout(()=>{z.kill(),V({decision:"allow",reason:"Hook timeout"})},Z)})}catch($){return{decision:"allow",reason:`Hook execution failed: ${$ instanceof Error?$.message:String($)}`}}}getHooks(Q){return this.hooks.get(Q)||[]}clear(Q){if(Q)this.hooks.delete(Q);else this.hooks.clear()}}var uZ={validateWrite:{event:"PreToolUse",command:`node -e '
|
|
156
|
-
const input = JSON.parse(require("fs").readFileSync(0, "utf8"));
|
|
157
|
-
if (input.tool_name === "Write") {
|
|
158
|
-
const path = input.tool_input.file_path;
|
|
159
|
-
if (path.includes("..") || path.startsWith("/etc/")) {
|
|
160
|
-
console.log(JSON.stringify({ decision: "deny", reason: "Unsafe path" }));
|
|
161
|
-
process.exit(1);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
console.log(JSON.stringify({ decision: "allow" }));
|
|
165
|
-
'`,timeout:5000,enabled:!1},logToolUse:{event:"PostToolUse",command:`node -e '
|
|
166
|
-
const input = JSON.parse(require("fs").readFileSync(0, "utf8"));
|
|
167
|
-
console.error(\`[LOG] Tool: \${input.tool_name}\`);
|
|
168
|
-
console.log(JSON.stringify({ decision: "allow" }));
|
|
169
|
-
'`,timeout:5000,enabled:!1}},hZ={PreToolUse:"Before a tool is executed. Can modify input or deny execution.",PostToolUse:"After a tool successfully executes. Can process result.",PostToolUseFailure:"After a tool fails. Can handle error or retry.",Stop:"When the agent stops (end_turn, max_tokens, error).",UserPromptSubmit:"When user submits a prompt. Can modify or reject.",SessionStart:"When a new session starts.",SessionEnd:"When a session ends.",Notification:"When a notification is sent.",ConfigChange:"When configuration changes.",WorktreeCreate:"When a git worktree is created."},gZ={ALLOW:0,DENY:1,BLOCK:2};import{readFileSync as R8,existsSync as C9,readdirSync as P8}from"fs";import{join as N8}from"path";function D8(Q,X="project"){if(!C9(Q))return null;let Z=R8(Q,"utf-8"),$=Q.split("/").pop()?.replace(/\.md$/i,"")||"unknown",V=Z.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);if(!V)return{path:Q,name:$,description:"",prompt:Z.trim(),source:X};let J=V[1]??"",z=V[2]??"",Y=I8(J);return{path:Q,name:Y.name||$,description:Y.description||"",prompt:z.trim(),tools:Y.tools,model:Y.model,color:Y.color,source:X}}function I8(Q){let X={},Z=Q.split(`
|
|
170
|
-
`);for(let $ of Z){let V=$.match(/^(\w+):\s*(.*)$/);if(V){let J=V[1];if(!J)continue;let z=V[2]??"";if(z.startsWith("["))try{X[J]=JSON.parse(z)}catch{X[J]=z}else if(z==="true")X[J]=!0;else if(z==="false")X[J]=!1;else if(/^\d+$/.test(z))X[J]=parseInt(z,10);else if(/^\d+\.\d+$/.test(z))X[J]=parseFloat(z);else X[J]=z}}return X}class S8{skills=new Map;loadFromDirectory(Q,X="project"){if(!C9(Q))return 0;let Z=0,$=P8(Q);for(let V of $)if(V.endsWith(".md")){let J=D8(N8(Q,V),X);if(J)this.skills.set(J.name,J),Z++}return Z}get(Q){return this.skills.get(Q)}getAll(){return Array.from(this.skills.values())}has(Q){return this.skills.has(Q)}getNames(){return Array.from(this.skills.keys())}}function pZ(Q){return`
|
|
171
|
-
<skill-loading>
|
|
172
|
-
You are operating with the "${Q.name}" skill loaded.
|
|
173
|
-
|
|
174
|
-
${Q.description?`Description: ${Q.description}
|
|
175
|
-
`:""}
|
|
176
|
-
${Q.prompt}
|
|
177
|
-
</skill-loading>
|
|
178
|
-
`.trim()}var iZ=[{path:"built-in://commit",name:"commit",description:"Create a git commit with the staged changes",prompt:`Analyze the staged changes and create a git commit.
|
|
179
|
-
|
|
180
|
-
Steps:
|
|
181
|
-
1. Run \`git diff --staged\` to see staged changes
|
|
182
|
-
2. Run \`git log --oneline -5\` to understand commit message style
|
|
183
|
-
3. Create a commit message following conventional commits format
|
|
184
|
-
4. Include "Co-Authored-By: Claude <noreply@anthropic.com>" if applicable
|
|
185
|
-
5. Run \`git commit\` with the message`,tools:["Bash"],model:"sonnet",source:"built-in"},{path:"built-in://review-pr",name:"review-pr",description:"Review a pull request",prompt:`Review the current pull request and provide feedback.
|
|
186
|
-
|
|
187
|
-
Steps:
|
|
188
|
-
1. Use \`gh pr view\` to get PR details
|
|
189
|
-
2. Use \`gh pr diff\` to see the changes
|
|
190
|
-
3. Analyze the code for:
|
|
191
|
-
- Bugs and potential issues
|
|
192
|
-
- Code quality and style
|
|
193
|
-
- Test coverage
|
|
194
|
-
- Documentation
|
|
195
|
-
4. Provide constructive feedback
|
|
196
|
-
5. Approve or request changes as appropriate`,tools:["Bash"],model:"sonnet",source:"built-in"},{path:"built-in://mcp-builder",name:"mcp-builder",description:"Guide for creating MCP servers",prompt:`Help the user build MCP (Model Context Protocol) servers.
|
|
197
|
-
|
|
198
|
-
MCP servers enable LLMs to interact with external services through well-designed tools.
|
|
199
|
-
|
|
200
|
-
Key concepts:
|
|
201
|
-
1. Use FastMCP (Python) or MCP SDK (TypeScript)
|
|
202
|
-
2. Define tools with clear input schemas
|
|
203
|
-
3. Return structured content
|
|
204
|
-
4. Handle errors gracefully
|
|
205
|
-
|
|
206
|
-
Transport types:
|
|
207
|
-
- stdio: Local process communication
|
|
208
|
-
- HTTP: REST API with JSON-RPC
|
|
209
|
-
- SSE: Server-Sent Events for streaming
|
|
210
|
-
- WebSocket: Bidirectional communication`,tools:["Read","Write","Edit","Bash"],model:"sonnet",source:"built-in"},{path:"built-in://claude-hooks",name:"claude-hooks",description:"Guide for Claude Code hooks",prompt:`Help the user configure Claude Code hooks.
|
|
211
|
-
|
|
212
|
-
Hooks are user-defined shell commands that execute at specific points during Claude Code's lifecycle.
|
|
213
|
-
|
|
214
|
-
Available events:
|
|
215
|
-
- PreToolUse: Before a tool executes
|
|
216
|
-
- PostToolUse: After a tool succeeds
|
|
217
|
-
- PostToolUseFailure: After a tool fails
|
|
218
|
-
- Stop: When agent stops
|
|
219
|
-
- UserPromptSubmit: When user submits prompt
|
|
220
|
-
- SessionStart/SessionEnd: Session lifecycle
|
|
221
|
-
|
|
222
|
-
Exit codes:
|
|
223
|
-
- 0: Allow execution
|
|
224
|
-
- 1: Deny and show stderr
|
|
225
|
-
- 2: Block silently`,tools:["Read","Write","Edit"],model:"sonnet",source:"built-in"}];function nZ(Q){return Q.match(/^\/(\w+)(?:\s+(.*))?$/)?.[1]??null}function oZ(Q){return Q.match(/^\/\w+\s+(.*)$/)?.[1]??""}import{spawn as K7}from"child_process";import{mkdirSync as M9,rmSync as x8,existsSync as R9,readFileSync as T8}from"fs";import{join as Z6}from"path";class E8{teams=new Map;teammates=new Map;messageQueue=new Map;storagePath;constructor(Q="~/.claude/teams"){if(this.storagePath=Q.replace("~",process.env.HOME||""),!R9(this.storagePath))M9(this.storagePath,{recursive:!0});this.loadTeams()}createTeam(Q){let X={...Q,status:"active"};this.teams.set(Q.name,X);for(let Z of Q.teammates)this.teammates.set(Z.teammateId,Z);return this.persistTeam(X).catch((Z)=>{console.error(`Failed to persist team ${Q.name}:`,Z)}),X}getTeam(Q){return this.teams.get(Q)}listTeams(){return Array.from(this.teams.values())}deleteTeam(Q){let X=this.teams.get(Q);if(X){for(let $ of X.teammates)this.teammates.delete($.teammateId),this.messageQueue.delete($.teammateId);this.teams.delete(Q);let Z=Z6(this.storagePath,Q);try{x8(Z,{recursive:!0,force:!0})}catch($){console.error(`Failed to delete team directory ${Z}:`,$)}}}getTeammate(Q){return this.teammates.get(Q)}updateTeammateStatus(Q,X){let Z=this.teammates.get(Q);if(Z)Z.status=X}async spawnTeammate(Q,X={}){let{session:Z,workingDir:$=process.cwd()}=X;if(!process.env.TMUX)await this.spawnInTerminal(Q,{session:Z,workingDir:$});else await this.spawnInTmux(Q,{session:Z,workingDir:$});this.updateTeammateStatus(Q.teammateId,"in_progress")}async spawnInTerminal(Q,X){let Z=["bun","run","src/cli.ts","--teammate-mode","--agent-id",Q.teammateId,"--agent-name",Q.name,"--team-name",Q.teamName,"--agent-color",Q.color];if(Q.planModeRequired)Z.push("--permission-mode","plan");if(process.platform==="darwin"){let $=`
|
|
226
|
-
tell application "Terminal"
|
|
227
|
-
do script "cd ${X.workingDir} && ${Z.join(" ")}"
|
|
228
|
-
activate
|
|
229
|
-
end tell
|
|
230
|
-
`;K7("osascript",["-e",$])}else K7("xterm",["-e",Z.join(" ")])}async spawnInTmux(Q,X){let Z=X.session||process.env.TMUX?.split(",")[0]?.split(":")[0]||"claude";await this.tmuxCommand(["split-window","-t",Z,"-c",X.workingDir]);let $=await this.tmuxCommand(["display-message","-p","#{pane_id}"]);if($)Q.paneId=$.trim();let V=["bun","run","src/cli.ts","--teammate-mode","--agent-id",Q.teammateId,"--agent-name",Q.name,"--team-name",Q.teamName];await this.tmuxCommand(["send-keys","-t",Q.paneId||"",V.join(" "),"Enter"])}async tmuxCommand(Q){return new Promise((X)=>{let Z=K7("tmux",Q),$="";Z.stdout?.on("data",(V)=>{$+=V.toString()}),Z.on("close",()=>{X($)})})}broadcast(Q,X,Z){let $=this.teams.get(Q);if(!$)return;let V={type:"broadcast",from:Z||"system",content:X,timestamp:Date.now()};for(let J of $.teammates){if(Z&&J.teammateId===Z)continue;let z=this.messageQueue.get(J.teammateId)||[];z.push(V),this.messageQueue.set(J.teammateId,z)}}sendDirect(Q,X,Z){let $={type:"direct",from:X,to:Q,content:Z,timestamp:Date.now()},V=this.messageQueue.get(Q)||[];V.push($),this.messageQueue.set(Q,V)}getMessages(Q){let X=this.messageQueue.get(Q)||[];return this.messageQueue.delete(Q),X}hasMessages(Q){let X=this.messageQueue.get(Q);return X!==void 0&&X.length>0}peekMessages(Q){return this.messageQueue.get(Q)||[]}clearMessages(Q){this.messageQueue.delete(Q)}getMessageCount(Q){return this.messageQueue.get(Q)?.length||0}async persistTeam(Q){let X=Z6(this.storagePath,Q.name),Z=Z6(X,"config.json");if(!R9(X))M9(X,{recursive:!0});await Bun.write(Z6(X,".gitkeep"),"");let $={name:Q.name,description:Q.description,teammates:Q.teammates,taskListId:Q.taskListId,status:Q.status,coordination:Q.coordination,updatedAt:Date.now()};await Bun.write(Z,JSON.stringify($,null,2))}loadTeams(){let Q=new Bun.Glob("**/config.json");try{let X=Array.from(Q.scanSync(this.storagePath));for(let Z of X)try{let $=Z6(this.storagePath,Z);if(Bun.file($).size===0)continue;let z=T8($,"utf-8"),Y=JSON.parse(z);if(!Y.name||!Y.teammates||!Array.isArray(Y.teammates))continue;let K={name:Y.name,description:Y.description||"",teammates:Y.teammates,taskListId:Y.taskListId||"",status:Y.status||"active",coordination:Y.coordination||{dependencyOrder:[],communicationProtocol:"broadcast",taskAssignmentStrategy:"manual"}};this.teams.set(K.name,K);for(let q of K.teammates)this.teammates.set(q.teammateId,q)}catch($){}}catch(X){if(X.code!=="ENOENT");}}async persistAllTeams(){let Q=Array.from(this.teams.values()).map((X)=>this.persistTeam(X));await Promise.all(Q)}}var eZ={architect:(Q)=>({name:"architect",teamName:Q,color:"blue",prompt:`You are an architect on the ${Q} team.
|
|
231
|
-
Your role is to design and plan the technical architecture.
|
|
232
|
-
Focus on:
|
|
233
|
-
- System design and component relationships
|
|
234
|
-
- API contracts and interfaces
|
|
235
|
-
- Data models and schemas
|
|
236
|
-
- Trade-offs and design decisions`,planModeRequired:!0,status:"pending"}),implementer:(Q)=>({name:"implementer",teamName:Q,color:"green",prompt:`You are an implementer on the ${Q} team.
|
|
237
|
-
Your role is to write clean, working code based on the architecture.
|
|
238
|
-
Focus on:
|
|
239
|
-
- Implementing the designed architecture
|
|
240
|
-
- Writing tests
|
|
241
|
-
- Following coding standards
|
|
242
|
-
- Handling edge cases`,planModeRequired:!1,status:"pending"}),reviewer:(Q)=>({name:"reviewer",teamName:Q,color:"yellow",prompt:`You are a code reviewer on the ${Q} team.
|
|
243
|
-
Your role is to review code changes and provide feedback.
|
|
244
|
-
Focus on:
|
|
245
|
-
- Code quality and readability
|
|
246
|
-
- Potential bugs and issues
|
|
247
|
-
- Performance considerations
|
|
248
|
-
- Test coverage`,planModeRequired:!1,status:"pending"}),tester:(Q)=>({name:"tester",teamName:Q,color:"orange",prompt:`You are a tester on the ${Q} team.
|
|
249
|
-
Your role is to ensure features work correctly.
|
|
250
|
-
Focus on:
|
|
251
|
-
- Writing comprehensive tests
|
|
252
|
-
- Finding edge cases
|
|
253
|
-
- Verifying requirements
|
|
254
|
-
- Reporting bugs`,planModeRequired:!1,status:"pending"})};function k8(){return`teammate_${Date.now()}_${Math.random().toString(36).slice(2,8)}`}function Q2(Q){return{...Q,teammateId:k8(),status:"pending"}}
|
|
255
|
-
export{D6 as a,V6 as b,T9 as c,b8 as d,W7 as e,G7 as f,f8 as g,f9 as h,u9 as i,h9 as j,g9 as k,U7 as l,c9 as m,l9 as n,I6 as o,S6 as p,p8 as q,i8 as r,n8 as s,J6 as t,T6 as u,v7 as v,O7 as w,F5 as x,GX as y,u6 as z,jX as A,_X as B,UX as C,j0 as D,_0 as E,LX as F,z8 as G,Y8 as H,K8 as I,H8 as J,W8 as K,G8 as L,j8 as M,_8 as N,U8 as O,w8 as P,A8 as Q,B8 as R,L8 as S,F8 as T,v8 as U,xZ as V,Y7 as W,yZ as X,M8 as Y,uZ as Z,hZ as _,gZ as $,D8 as aa,S8 as ba,pZ as ca,iZ as da,nZ as ea,oZ as fa,E8 as ga,eZ as ha,k8 as ia,Q2 as ja};
|