dimcode 0.0.65-beta.0 → 0.0.65

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.
Files changed (42) hide show
  1. package/README.md +451 -0
  2. package/cli.mjs +99 -0
  3. package/dist/aihubmix.json +1 -0
  4. package/dist/anthropic.json +1 -0
  5. package/dist/ark-code.json +1 -0
  6. package/dist/bailian-coding-plan.json +1 -0
  7. package/dist/cli.mjs +1250 -0
  8. package/dist/custom-provider.json +1 -0
  9. package/dist/deepseek.json +1 -0
  10. package/dist/google.json +1 -0
  11. package/dist/kimi-for-coding.json +1 -0
  12. package/dist/lm-studio.json +1 -0
  13. package/dist/minimax-cn-coding-plan.json +1 -0
  14. package/dist/minimax-cn.json +1 -0
  15. package/dist/minimax-coding-plan.json +1 -0
  16. package/dist/minimax.json +1 -0
  17. package/dist/models/aihubmix.json +1 -0
  18. package/dist/models/custom-provider.json +1 -0
  19. package/dist/models/openrouter.json +1 -0
  20. package/dist/models/siliconflow-com.json +1 -0
  21. package/dist/models/siliconflow.json +1 -0
  22. package/dist/models/zenmux.json +1 -0
  23. package/dist/moonshot-ai.json +1 -0
  24. package/dist/moonshot.json +1 -0
  25. package/dist/next-api-oauth.json +1 -0
  26. package/dist/ollama.json +1 -0
  27. package/dist/openai.json +1 -0
  28. package/dist/openrouter.json +1 -0
  29. package/dist/ppinfra.json +1 -0
  30. package/dist/siliconflow-com.json +1 -0
  31. package/dist/siliconflow.json +1 -0
  32. package/dist/xai.json +1 -0
  33. package/dist/xiaomi-token-plan-cn.json +1 -0
  34. package/dist/zai-coding-plan.json +1 -0
  35. package/dist/zai.json +1 -0
  36. package/dist/zenmux.json +1 -0
  37. package/dist/zhipuai-coding-plan.json +1 -0
  38. package/dist/zhipuai.json +1 -0
  39. package/icon.png +0 -0
  40. package/package.json +69 -12
  41. package/bin/dim.mjs +0 -180
  42. package/dist/ink.mjs +0 -1313
@@ -0,0 +1 @@
1
+ {"id":"siliconflow","name":"SiliconFlow","api":"https://api.siliconflow.cn/v1","modelsFile":"models/siliconflow.json","defaultModelId":"inclusionAI/Ring-flash-2.0"}
package/dist/xai.json ADDED
@@ -0,0 +1 @@
1
+ {"id":"xai","name":"xAI","api":"https://api.x.ai/v1","adapter":"openai","models":[{"id":"grok-3-latest","name":"Grok 3 Latest","family":"grok","attachment":false,"reasoning":{"supported":false},"tool_call":true,"temperature":true,"knowledge":"2024-11","release_date":"2025-02-17","last_updated":"2025-02-17","modalities":{"input":["text"],"output":["text"]},"open_weights":false,"cost":{"input":3,"output":15,"cache_read":0.75},"limit":{"context":131072,"output":8192},"display_name":"Grok 3 Latest","type":"chat"},{"id":"grok-2-latest","name":"Grok 2 Latest","family":"grok","attachment":false,"reasoning":{"supported":false},"tool_call":true,"temperature":true,"knowledge":"2024-08","release_date":"2024-08-20","last_updated":"2024-12-12","modalities":{"input":["text"],"output":["text"]},"open_weights":false,"cost":{"input":2,"output":10,"cache_read":2},"limit":{"context":131072,"output":8192},"display_name":"Grok 2 Latest","type":"chat"},{"id":"grok-3-mini-fast-latest","name":"Grok 3 Mini Fast Latest","family":"grok","attachment":false,"reasoning":{"supported":true,"default":true},"tool_call":true,"temperature":true,"knowledge":"2024-11","release_date":"2025-02-17","last_updated":"2025-02-17","modalities":{"input":["text"],"output":["text"]},"open_weights":false,"cost":{"input":0.6,"output":4,"reasoning":4,"cache_read":0.15},"limit":{"context":131072,"output":8192},"display_name":"Grok 3 Mini Fast Latest","type":"chat"},{"id":"grok-2-vision","name":"Grok 2 Vision","family":"grok","attachment":true,"reasoning":{"supported":false},"tool_call":true,"temperature":true,"knowledge":"2024-08","release_date":"2024-08-20","last_updated":"2024-08-20","modalities":{"input":["text","image"],"output":["text"]},"open_weights":false,"cost":{"input":2,"output":10,"cache_read":2},"limit":{"context":8192,"output":4096},"display_name":"Grok 2 Vision","type":"chat"},{"id":"grok-4.20-multi-agent-0309","name":"Grok 4.20 Multi-Agent","family":"grok","attachment":true,"reasoning":{"supported":true,"default":true},"tool_call":false,"temperature":true,"release_date":"2026-03-09","last_updated":"2026-03-09","modalities":{"input":["text","image"],"output":["text"]},"open_weights":false,"cost":{"input":2,"output":6,"cache_read":0.2,"context_over_200k":{"input":4,"output":12,"cache_read":0.4}},"limit":{"context":2000000,"output":30000},"display_name":"Grok 4.20 Multi-Agent","extra_capabilities":{"reasoning":{"supported":true}},"type":"chat"},{"id":"grok-4-fast-non-reasoning","name":"Grok 4 Fast (Non-Reasoning)","family":"grok","attachment":true,"reasoning":{"supported":false},"tool_call":true,"temperature":true,"knowledge":"2025-07","release_date":"2025-09-19","last_updated":"2025-09-19","modalities":{"input":["text","image"],"output":["text"]},"open_weights":false,"cost":{"input":0.2,"output":0.5,"cache_read":0.05},"limit":{"context":2000000,"output":30000},"display_name":"Grok 4 Fast (Non-Reasoning)","type":"chat"},{"id":"grok-3-fast","name":"Grok 3 Fast","family":"grok","attachment":false,"reasoning":{"supported":false},"tool_call":true,"temperature":true,"knowledge":"2024-11","release_date":"2025-02-17","last_updated":"2025-02-17","modalities":{"input":["text"],"output":["text"]},"open_weights":false,"cost":{"input":5,"output":25,"cache_read":1.25},"limit":{"context":131072,"output":8192},"display_name":"Grok 3 Fast","type":"chat"},{"id":"grok-4.20-0309-non-reasoning","name":"Grok 4.20 (Non-Reasoning)","family":"grok","attachment":true,"reasoning":{"supported":false},"tool_call":true,"temperature":true,"release_date":"2026-03-09","last_updated":"2026-03-09","modalities":{"input":["text","image"],"output":["text"]},"open_weights":false,"cost":{"input":2,"output":6,"cache_read":0.2,"context_over_200k":{"input":4,"output":12,"cache_read":0.4}},"limit":{"context":2000000,"output":30000},"display_name":"Grok 4.20 (Non-Reasoning)","type":"chat"},{"id":"grok-vision-beta","name":"Grok Vision Beta","family":"grok-vision","attachment":true,"reasoning":{"supported":false},"tool_call":true,"temperature":true,"knowledge":"2024-08","release_date":"2024-11-01","last_updated":"2024-11-01","modalities":{"input":["text","image"],"output":["text"]},"open_weights":false,"cost":{"input":5,"output":15,"cache_read":5},"limit":{"context":8192,"output":4096},"display_name":"Grok Vision Beta","type":"chat"},{"id":"grok-3-mini","name":"Grok 3 Mini","family":"grok","attachment":false,"reasoning":{"supported":true,"default":true},"tool_call":true,"temperature":true,"knowledge":"2024-11","release_date":"2025-02-17","last_updated":"2025-02-17","modalities":{"input":["text"],"output":["text"]},"open_weights":false,"cost":{"input":0.3,"output":0.5,"reasoning":0.5,"cache_read":0.075},"limit":{"context":131072,"output":8192},"display_name":"Grok 3 Mini","type":"chat"},{"id":"grok-4-1-fast-non-reasoning","name":"Grok 4.1 Fast (Non-Reasoning)","family":"grok","attachment":true,"reasoning":{"supported":false},"tool_call":true,"temperature":true,"knowledge":"2025-07","release_date":"2025-11-19","last_updated":"2025-11-19","modalities":{"input":["text","image"],"output":["text"]},"open_weights":false,"cost":{"input":0.2,"output":0.5,"cache_read":0.05},"limit":{"context":2000000,"output":30000},"display_name":"Grok 4.1 Fast (Non-Reasoning)","type":"chat"},{"id":"grok-4.20-0309-reasoning","name":"Grok 4.20 (Reasoning)","family":"grok","attachment":true,"reasoning":{"supported":true,"default":true},"tool_call":true,"temperature":true,"release_date":"2026-03-09","last_updated":"2026-03-09","modalities":{"input":["text","image"],"output":["text"]},"open_weights":false,"cost":{"input":2,"output":6,"cache_read":0.2,"context_over_200k":{"input":4,"output":12,"cache_read":0.4}},"limit":{"context":2000000,"output":30000},"display_name":"Grok 4.20 (Reasoning)","type":"chat"},{"id":"grok-beta","name":"Grok Beta","family":"grok-beta","attachment":false,"reasoning":{"supported":false},"tool_call":true,"temperature":true,"knowledge":"2024-08","release_date":"2024-11-01","last_updated":"2024-11-01","modalities":{"input":["text"],"output":["text"]},"open_weights":false,"cost":{"input":5,"output":15,"cache_read":5},"limit":{"context":131072,"output":4096},"display_name":"Grok Beta","type":"chat"},{"id":"grok-2-1212","name":"Grok 2 1212","family":"grok","attachment":false,"reasoning":{"supported":false},"tool_call":true,"temperature":true,"knowledge":"2024-08","release_date":"2024-12-12","last_updated":"2024-12-12","modalities":{"input":["text"],"output":["text"]},"open_weights":false,"cost":{"input":2,"output":10,"cache_read":2},"limit":{"context":120000,"output":100000},"display_name":"Grok 2 1212","search":{"supported":false},"type":"chat"},{"id":"grok-code-fast-1","name":"Grok Code Fast 1","family":"grok","attachment":false,"reasoning":{"supported":true,"default":true},"tool_call":true,"temperature":true,"knowledge":"2023-10","release_date":"2025-08-28","last_updated":"2025-08-28","modalities":{"input":["text"],"output":["text"]},"open_weights":false,"cost":{"input":0.2,"output":1.5,"cache_read":0.02},"limit":{"context":256000,"output":10000},"display_name":"Grok Code Fast 1","extra_capabilities":{"reasoning":{"supported":true}},"type":"chat"},{"id":"grok-3","name":"Grok 3","family":"grok","attachment":false,"reasoning":{"supported":false},"tool_call":true,"temperature":true,"knowledge":"2024-11","release_date":"2025-02-17","last_updated":"2025-02-17","modalities":{"input":["text"],"output":["text"]},"open_weights":false,"cost":{"input":3,"output":15,"cache_read":0.75},"limit":{"context":131072,"output":8192},"display_name":"Grok 3","type":"chat"},{"id":"grok-4","name":"Grok 4","family":"grok","attachment":false,"reasoning":{"supported":true,"default":true},"tool_call":true,"temperature":true,"knowledge":"2025-07","release_date":"2025-07-09","last_updated":"2025-07-09","modalities":{"input":["text"],"output":["text"]},"open_weights":false,"cost":{"input":3,"output":15,"reasoning":15,"cache_read":0.75},"limit":{"context":256000,"output":64000},"display_name":"Grok 4","extra_capabilities":{"reasoning":{"supported":true}},"type":"chat"},{"id":"grok-2-vision-1212","name":"Grok 2 Vision 1212","family":"grok","attachment":false,"reasoning":{"supported":false},"tool_call":false,"temperature":true,"knowledge":"2024-08","release_date":"2024-08-20","last_updated":"2024-12-12","modalities":{"input":["text","image"],"output":["text"]},"open_weights":false,"cost":{"input":2,"output":10,"cache_read":2},"limit":{"context":32000,"output":32000},"display_name":"Grok 2 Vision 1212","search":{"supported":false},"type":"chat"},{"id":"grok-3-fast-latest","name":"Grok 3 Fast Latest","family":"grok","attachment":false,"reasoning":{"supported":false},"tool_call":true,"temperature":true,"knowledge":"2024-11","release_date":"2025-02-17","last_updated":"2025-02-17","modalities":{"input":["text"],"output":["text"]},"open_weights":false,"cost":{"input":5,"output":25,"cache_read":1.25},"limit":{"context":131072,"output":8192},"display_name":"Grok 3 Fast Latest","type":"chat"},{"id":"grok-4-fast","name":"Grok 4 Fast","family":"grok","attachment":true,"reasoning":{"supported":true,"default":true},"tool_call":true,"temperature":true,"knowledge":"2025-07","release_date":"2025-09-19","last_updated":"2025-09-19","modalities":{"input":["text","image"],"output":["text"]},"open_weights":false,"cost":{"input":0.2,"output":0.5,"cache_read":0.05},"limit":{"context":2000000,"output":30000},"display_name":"Grok 4 Fast","type":"chat"},{"id":"grok-3-mini-latest","name":"Grok 3 Mini Latest","family":"grok","attachment":false,"reasoning":{"supported":true,"default":true},"tool_call":true,"temperature":true,"knowledge":"2024-11","release_date":"2025-02-17","last_updated":"2025-02-17","modalities":{"input":["text"],"output":["text"]},"open_weights":false,"cost":{"input":0.3,"output":0.5,"reasoning":0.5,"cache_read":0.075},"limit":{"context":131072,"output":8192},"display_name":"Grok 3 Mini Latest","type":"chat"},{"id":"grok-2","name":"Grok 2","family":"grok","attachment":false,"reasoning":{"supported":false},"tool_call":true,"temperature":true,"knowledge":"2024-08","release_date":"2024-08-20","last_updated":"2024-08-20","modalities":{"input":["text"],"output":["text"]},"open_weights":false,"cost":{"input":2,"output":10,"cache_read":2},"limit":{"context":131072,"output":8192},"display_name":"Grok 2","type":"chat"},{"id":"grok-4-1-fast","name":"Grok 4.1 Fast","family":"grok","attachment":true,"reasoning":{"supported":true,"default":true},"tool_call":true,"temperature":true,"knowledge":"2025-07","release_date":"2025-11-19","last_updated":"2025-11-19","modalities":{"input":["text","image"],"output":["text"]},"open_weights":false,"cost":{"input":0.2,"output":0.5,"cache_read":0.05},"limit":{"context":2000000,"output":30000},"display_name":"Grok 4.1 Fast","type":"chat"},{"id":"grok-3-mini-fast","name":"Grok 3 Mini Fast","family":"grok","attachment":false,"reasoning":{"supported":true,"default":true},"tool_call":true,"temperature":true,"knowledge":"2024-11","release_date":"2025-02-17","last_updated":"2025-02-17","modalities":{"input":["text"],"output":["text"]},"open_weights":false,"cost":{"input":0.6,"output":4,"reasoning":4,"cache_read":0.15},"limit":{"context":131072,"output":8192},"display_name":"Grok 3 Mini Fast","type":"chat"},{"id":"grok-2-vision-latest","name":"Grok 2 Vision Latest","family":"grok","attachment":true,"reasoning":{"supported":false},"tool_call":true,"temperature":true,"knowledge":"2024-08","release_date":"2024-08-20","last_updated":"2024-12-12","modalities":{"input":["text","image"],"output":["text"]},"open_weights":false,"cost":{"input":2,"output":10,"cache_read":2},"limit":{"context":8192,"output":4096},"display_name":"Grok 2 Vision Latest","type":"chat"},{"id":"grok-3-mini-fast-beta","name":"Grok 3 Mini Fast Beta","display_name":"Grok 3 Mini Fast Beta","temperature":true,"attachment":false,"tool_call":true,"modalities":{"input":["text"],"output":["text"]},"limit":{"context":120000,"output":100000},"reasoning":{"supported":true,"effort":"low","default":true},"search":{"supported":false},"type":"chat"},{"id":"grok-3-mini-beta","name":"Grok 3 Mini Beta","display_name":"Grok 3 Mini Beta","temperature":true,"attachment":false,"tool_call":true,"modalities":{"input":["text"],"output":["text"]},"limit":{"context":120000,"output":100000},"reasoning":{"supported":true,"effort":"low","default":true},"search":{"supported":false},"type":"chat"},{"id":"grok-3-fast-beta","name":"Grok 3 Fast Beta","display_name":"Grok 3 Fast Beta","temperature":true,"attachment":false,"tool_call":true,"modalities":{"input":["text"],"output":["text"]},"limit":{"context":120000,"output":100000},"reasoning":{"supported":false},"search":{"supported":false},"type":"chat"},{"id":"grok-2-image-1212","name":"Grok 2 Image 1212","display_name":"Grok 2 Image 1212","temperature":true,"attachment":false,"tool_call":false,"modalities":{"input":["text","image"],"output":["text"]},"limit":{"context":130000,"output":100000},"reasoning":{"supported":false},"search":{"supported":false},"type":"chat"},{"id":"grok-3-beta","name":"Grok 3 Beta","display_name":"Grok 3 Beta","temperature":true,"attachment":false,"tool_call":true,"modalities":{"input":["text"],"output":["text"]},"limit":{"context":120000,"output":100000},"reasoning":{"supported":false},"search":{"supported":false},"type":"chat"}],"defaultModelId":"grok-3-mini-fast-latest"}
@@ -0,0 +1 @@
1
+ {"id":"xiaomi-token-plan-cn","api":"https://token-plan-cn.xiaomimimo.com/v1","name":"Xiaomi Token Plan (China)","display_name":"Xiaomi Token Plan (China)","doc":"https://platform.xiaomimimo.com/#/docs","adapter":"openai","models":[{"id":"mimo-v2.5-pro","name":"MiMo-V2.5-Pro","family":"mimo-v2.5-pro","attachment":true,"reasoning":{"supported":true,"default":true},"tool_call":true,"interleaved":{"field":"reasoning_content"},"temperature":true,"knowledge":"2024-12","release_date":"2026-04-22","last_updated":"2026-04-22","modalities":{"input":["text"],"output":["text"]},"open_weights":true,"cost":{"input":0,"output":0,"cache_read":0},"limit":{"context":1000000,"output":128000},"display_name":"MiMo-V2.5-Pro","type":"chat","extra_capabilities":{"reasoning":{"supported":true,"interleaved":true,"summaries":true,"visibility":"summary","continuation":["thinking_blocks"]}}},{"id":"mimo-v2.5","name":"MiMo-V2.5","family":"mimo-v2.5","attachment":true,"reasoning":{"supported":true,"default":true},"tool_call":true,"interleaved":{"field":"reasoning_content"},"temperature":true,"knowledge":"2024-12","release_date":"2026-04-22","last_updated":"2026-04-22","modalities":{"input":["text","image","audio","video","pdf"],"output":["text"]},"open_weights":true,"cost":{"input":0,"output":0,"cache_read":0},"limit":{"context":1000000,"output":128000},"display_name":"MiMo-V2.5","type":"chat","extra_capabilities":{"reasoning":{"supported":true,"interleaved":true,"summaries":true,"visibility":"summary","continuation":["thinking_blocks"]}}},{"id":"mimo-v2-omni","name":"MiMo-V2-Omni","family":"mimo","attachment":true,"reasoning":{"supported":true,"default":true},"tool_call":true,"interleaved":{"field":"reasoning_content"},"temperature":true,"knowledge":"2024-12","release_date":"2026-03-18","last_updated":"2026-03-18","modalities":{"input":["text","image","audio","video","pdf"],"output":["text"]},"open_weights":true,"cost":{"input":0,"output":0,"cache_read":0},"limit":{"context":256000,"output":128000},"display_name":"MiMo-V2-Omni","type":"chat","extra_capabilities":{"reasoning":{"supported":true,"interleaved":true,"summaries":true,"visibility":"summary","continuation":["thinking_blocks"]}}},{"id":"mimo-v2-pro","name":"MiMo-V2-Pro","family":"mimo","attachment":true,"reasoning":{"supported":true,"default":true},"tool_call":true,"interleaved":{"field":"reasoning_content"},"temperature":true,"knowledge":"2024-12","release_date":"2026-03-18","last_updated":"2026-03-18","modalities":{"input":["text"],"output":["text"]},"open_weights":true,"cost":{"input":0,"output":0,"cache_read":0},"limit":{"context":1000000,"output":128000},"display_name":"MiMo-V2-Pro","type":"chat","extra_capabilities":{"reasoning":{"supported":true,"interleaved":true,"summaries":true,"visibility":"summary","continuation":["thinking_blocks"]}}},{"id":"mimo-v2-tts","name":"MiMo-V2-TTS","family":"mimo","attachment":false,"reasoning":{"supported":false},"tool_call":false,"release_date":"2026-03-18","last_updated":"2026-03-18","modalities":{"input":["text"],"output":["audio"]},"open_weights":true,"cost":{"input":0,"output":0},"limit":{"context":8000,"output":16000},"display_name":"MiMo-V2-TTS","type":"chat"}],"defaultModelId":"mimo-v2.5-pro"}
@@ -0,0 +1 @@
1
+ {"id":"zai-coding-plan","api":"https://api.z.ai/api/coding/paas/v4","name":"Z.AI Coding Plan","models":[{"id":"glm-4.7","name":"GLM-4.7","family":"glm","attachment":false,"reasoning":{"supported":true,"default":true},"tool_call":true,"interleaved":{"field":"reasoning_content"},"temperature":true,"knowledge":"2025-04","release_date":"2025-12-22","last_updated":"2025-12-22","modalities":{"input":["text"],"output":["text"]},"open_weights":true,"cost":{"input":0,"output":0,"cache_read":0,"cache_write":0},"limit":{"context":204800,"output":131072},"display_name":"GLM-4.7","type":"chat","extra_capabilities":{"reasoning":{"supported":true,"interleaved":true,"summaries":true,"visibility":"summary","continuation":["thinking_blocks"]}}},{"id":"glm-5.1","name":"GLM-5.1","family":"glm","attachment":false,"reasoning":{"supported":true,"default":true},"tool_call":true,"interleaved":{"field":"reasoning_content"},"structured_output":true,"temperature":true,"release_date":"2026-03-27","last_updated":"2026-03-27","modalities":{"input":["text"],"output":["text"]},"open_weights":false,"cost":{"input":0,"output":0,"cache_read":0,"cache_write":0},"limit":{"context":200000,"output":131072},"display_name":"GLM-5.1","type":"chat","extra_capabilities":{"reasoning":{"supported":true,"continuation":["thinking_blocks"],"interleaved":true,"summaries":true,"visibility":"summary"}}},{"id":"glm-4.5-air","name":"GLM-4.5-Air","family":"glm-air","attachment":false,"reasoning":{"supported":true,"default":true},"tool_call":true,"temperature":true,"knowledge":"2025-04","release_date":"2025-07-28","last_updated":"2025-07-28","modalities":{"input":["text"],"output":["text"]},"open_weights":true,"cost":{"input":0,"output":0,"cache_read":0,"cache_write":0},"limit":{"context":131072,"output":98304},"display_name":"GLM-4.5-Air","type":"chat"},{"id":"glm-5-turbo","name":"GLM-5-Turbo","family":"glm","attachment":false,"reasoning":{"supported":true,"default":true},"tool_call":true,"interleaved":{"field":"reasoning_content"},"structured_output":true,"temperature":true,"release_date":"2026-03-16","last_updated":"2026-03-16","modalities":{"input":["text"],"output":["text"]},"open_weights":false,"cost":{"input":0,"output":0,"cache_read":0,"cache_write":0},"limit":{"context":200000,"output":131072},"display_name":"GLM-5-Turbo","type":"chat","extra_capabilities":{"reasoning":{"supported":true,"continuation":["thinking_blocks"],"interleaved":true,"summaries":true,"visibility":"summary"}}}],"defaultModelId":"glm-4.7"}
package/dist/zai.json ADDED
@@ -0,0 +1 @@
1
+ {"id":"zai","name":"Z.AI","api":"https://api.z.ai/api/paas/v4","models":[{"id":"glm-5","name":"GLM-5","family":"glm","attachment":false,"reasoning":{"supported":true,"default":true},"tool_call":true,"interleaved":{"field":"reasoning_content"},"temperature":true,"release_date":"2026-02-11","last_updated":"2026-02-11","modalities":{"input":["text"],"output":["text"]},"open_weights":true,"cost":{"input":1,"output":3.2,"cache_read":0.2,"cache_write":0},"limit":{"context":204800,"output":131072},"display_name":"GLM-5","type":"chat","extra_capabilities":{"reasoning":{"supported":true,"interleaved":true,"summaries":true,"visibility":"summary","continuation":["thinking_blocks"]}}},{"id":"glm-4.7","name":"GLM-4.7","family":"glm","attachment":false,"reasoning":{"supported":true,"default":true},"tool_call":true,"interleaved":{"field":"reasoning_content"},"temperature":true,"knowledge":"2025-04","release_date":"2025-12-22","last_updated":"2025-12-22","modalities":{"input":["text"],"output":["text"]},"open_weights":true,"cost":{"input":0.6,"output":2.2,"cache_read":0.11,"cache_write":0},"limit":{"context":204800,"output":131072},"display_name":"GLM-4.7","type":"chat","extra_capabilities":{"reasoning":{"supported":true,"interleaved":true,"summaries":true,"visibility":"summary","continuation":["thinking_blocks"]}}},{"id":"glm-4.7-flashx","name":"GLM-4.7-FlashX","family":"glm-flash","attachment":false,"reasoning":{"supported":true,"default":true},"tool_call":true,"temperature":true,"knowledge":"2025-04","release_date":"2026-01-19","last_updated":"2026-01-19","modalities":{"input":["text"],"output":["text"]},"open_weights":true,"cost":{"input":0.07,"output":0.4,"cache_read":0.01,"cache_write":0},"limit":{"context":200000,"output":131072},"display_name":"GLM-4.7-FlashX","type":"chat"},{"id":"glm-4.6","name":"GLM-4.6","family":"glm","attachment":false,"reasoning":{"supported":true,"default":true},"tool_call":true,"temperature":true,"knowledge":"2025-04","release_date":"2025-09-30","last_updated":"2025-09-30","modalities":{"input":["text"],"output":["text"]},"open_weights":true,"cost":{"input":0.6,"output":2.2,"cache_read":0.11,"cache_write":0},"limit":{"context":204800,"output":131072},"display_name":"GLM-4.6","type":"chat","extra_capabilities":{"reasoning":{"supported":true}}},{"id":"glm-5.1","name":"GLM-5.1","family":"glm","attachment":false,"reasoning":{"supported":true,"default":true},"tool_call":true,"interleaved":{"field":"reasoning_content"},"structured_output":true,"temperature":true,"release_date":"2026-03-27","last_updated":"2026-03-27","modalities":{"input":["text"],"output":["text"]},"open_weights":false,"cost":{"input":1.4,"output":4.4,"cache_read":0.26,"cache_write":0},"limit":{"context":200000,"output":131072},"display_name":"GLM-5.1","type":"chat","extra_capabilities":{"reasoning":{"supported":true,"continuation":["thinking_blocks"],"interleaved":true,"summaries":true,"visibility":"summary"}}},{"id":"glm-4.5-flash","name":"GLM-4.5-Flash","family":"glm-flash","attachment":false,"reasoning":{"supported":true,"default":true},"tool_call":true,"temperature":true,"knowledge":"2025-04","release_date":"2025-07-28","last_updated":"2025-07-28","modalities":{"input":["text"],"output":["text"]},"open_weights":true,"cost":{"input":0,"output":0,"cache_read":0,"cache_write":0},"limit":{"context":131072,"output":98304},"display_name":"GLM-4.5-Flash","type":"chat"},{"id":"glm-4.6v","name":"GLM-4.6V","family":"glm","attachment":true,"reasoning":{"supported":true,"default":true},"tool_call":true,"temperature":true,"knowledge":"2025-04","release_date":"2025-12-08","last_updated":"2025-12-08","modalities":{"input":["text","image","video"],"output":["text"]},"open_weights":true,"cost":{"input":0.3,"output":0.9},"limit":{"context":128000,"output":32768},"display_name":"GLM-4.6V","type":"chat"},{"id":"glm-4.5-air","name":"GLM-4.5-Air","family":"glm-air","attachment":false,"reasoning":{"supported":true,"default":true},"tool_call":true,"temperature":true,"knowledge":"2025-04","release_date":"2025-07-28","last_updated":"2025-07-28","modalities":{"input":["text"],"output":["text"]},"open_weights":true,"cost":{"input":0.2,"output":1.1,"cache_read":0.03,"cache_write":0},"limit":{"context":131072,"output":98304},"display_name":"GLM-4.5-Air","type":"chat"},{"id":"glm-4.5v","name":"GLM-4.5V","family":"glm","attachment":true,"reasoning":{"supported":true,"default":true},"tool_call":true,"temperature":true,"knowledge":"2025-04","release_date":"2025-08-11","last_updated":"2025-08-11","modalities":{"input":["text","image","video"],"output":["text"]},"open_weights":true,"cost":{"input":0.6,"output":1.8},"limit":{"context":64000,"output":16384},"display_name":"GLM-4.5V","type":"chat"},{"id":"glm-4.7-flash","name":"GLM-4.7-Flash","family":"glm-flash","attachment":false,"reasoning":{"supported":true,"default":true},"tool_call":true,"temperature":true,"knowledge":"2025-04","release_date":"2026-01-19","last_updated":"2026-01-19","modalities":{"input":["text"],"output":["text"]},"open_weights":true,"cost":{"input":0,"output":0,"cache_read":0,"cache_write":0},"limit":{"context":200000,"output":131072},"display_name":"GLM-4.7-Flash","type":"chat","extra_capabilities":{"reasoning":{"supported":true}}},{"id":"glm-5v-turbo","name":"glm-5v-turbo","family":"glm","attachment":true,"reasoning":{"supported":true,"default":true},"tool_call":true,"interleaved":{"field":"reasoning_content"},"temperature":true,"release_date":"2026-04-01","last_updated":"2026-04-01","modalities":{"input":["text","image","video","pdf"],"output":["text"]},"open_weights":false,"cost":{"input":1.2,"output":4,"cache_read":0.24,"cache_write":0},"limit":{"context":200000,"output":131072},"display_name":"glm-5v-turbo","type":"chat","extra_capabilities":{"reasoning":{"supported":true,"interleaved":true,"summaries":true,"visibility":"summary","continuation":["thinking_blocks"]}}},{"id":"glm-5-turbo","name":"GLM-5-Turbo","family":"glm","attachment":false,"reasoning":{"supported":true,"default":true},"tool_call":true,"interleaved":{"field":"reasoning_content"},"structured_output":true,"temperature":true,"release_date":"2026-03-16","last_updated":"2026-03-16","modalities":{"input":["text"],"output":["text"]},"open_weights":false,"cost":{"input":1.2,"output":4,"cache_read":0.24,"cache_write":0},"limit":{"context":200000,"output":131072},"display_name":"GLM-5-Turbo","type":"chat","extra_capabilities":{"reasoning":{"supported":true,"continuation":["thinking_blocks"],"interleaved":true,"summaries":true,"visibility":"summary"}}},{"id":"glm-4.5","name":"GLM-4.5","family":"glm","attachment":false,"reasoning":{"supported":true,"default":true},"tool_call":true,"temperature":true,"knowledge":"2025-04","release_date":"2025-07-28","last_updated":"2025-07-28","modalities":{"input":["text"],"output":["text"]},"open_weights":true,"cost":{"input":0.6,"output":2.2,"cache_read":0.11,"cache_write":0},"limit":{"context":131072,"output":98304},"display_name":"GLM-4.5","type":"chat"}],"defaultModelId":"glm-5"}
@@ -0,0 +1 @@
1
+ {"id":"zenmux","name":"ZenMux","api":"https://zenmux.ai/api/v1/","adapter":"openai","modelsFile":"models/zenmux.json","defaultModelId":"anthropic/claude-haiku-4.5"}
@@ -0,0 +1 @@
1
+ {"id":"zhipuai-coding-plan","name":"ZhipuAI Coding Plan","api":"https://open.bigmodel.cn/api/coding/paas/v4","models":[{"id":"glm-5.1","name":"GLM-5.1","family":"glm","attachment":false,"reasoning":{"supported":true,"default":true},"tool_call":true,"interleaved":{"field":"reasoning_content"},"structured_output":true,"temperature":true,"release_date":"2026-03-27","last_updated":"2026-03-27","modalities":{"input":["text"],"output":["text"]},"open_weights":false,"cost":{"input":0,"output":0,"cache_read":0,"cache_write":0},"limit":{"context":200000,"output":131072},"display_name":"GLM-5.1","type":"chat","extra_capabilities":{"reasoning":{"supported":true,"continuation":["thinking_blocks"],"interleaved":true,"summaries":true,"visibility":"summary"}}},{"id":"glm-5-turbo","name":"GLM-5-Turbo","family":"glm","attachment":false,"reasoning":{"supported":true,"default":true},"tool_call":true,"interleaved":{"field":"reasoning_content"},"structured_output":true,"temperature":true,"release_date":"2026-03-16","last_updated":"2026-03-16","modalities":{"input":["text"],"output":["text"]},"open_weights":false,"cost":{"input":0,"output":0,"cache_read":0,"cache_write":0},"limit":{"context":200000,"output":131072},"display_name":"GLM-5-Turbo","type":"chat","extra_capabilities":{"reasoning":{"supported":true,"continuation":["thinking_blocks"],"interleaved":true,"summaries":true,"visibility":"summary"}}},{"id":"glm-4.5-air","name":"GLM-4.5-Air","family":"glm-air","attachment":false,"reasoning":{"supported":true,"default":true},"tool_call":true,"temperature":true,"knowledge":"2025-04","release_date":"2025-07-28","last_updated":"2025-07-28","modalities":{"input":["text"],"output":["text"]},"open_weights":true,"cost":{"input":0,"output":0,"cache_read":0,"cache_write":0},"limit":{"context":131072,"output":98304},"display_name":"GLM-4.5-Air","type":"chat"},{"id":"glm-4.7","name":"GLM-4.7","family":"glm","attachment":false,"reasoning":{"supported":true,"default":true},"tool_call":true,"interleaved":{"field":"reasoning_content"},"temperature":true,"knowledge":"2025-04","release_date":"2025-12-22","last_updated":"2025-12-22","modalities":{"input":["text"],"output":["text"]},"open_weights":true,"cost":{"input":0,"output":0,"cache_read":0,"cache_write":0},"limit":{"context":204800,"output":131072},"display_name":"GLM-4.7","type":"chat","extra_capabilities":{"reasoning":{"supported":true,"interleaved":true,"summaries":true,"visibility":"summary","continuation":["thinking_blocks"]}}}],"defaultModelId":"glm-5.1"}
@@ -0,0 +1 @@
1
+ {"id":"zhipuai","name":"ZhipuAI","api":"https://open.bigmodel.cn/api/paas/v4/","models":[{"id":"glm-5","name":"GLM-5","family":"glm","attachment":false,"reasoning":{"supported":true,"default":true},"tool_call":true,"interleaved":{"field":"reasoning_content"},"temperature":true,"release_date":"2026-02-11","last_updated":"2026-02-11","modalities":{"input":["text"],"output":["text"]},"open_weights":true,"cost":{"input":1,"output":3.2,"cache_read":0.2,"cache_write":0},"limit":{"context":204800,"output":131072},"display_name":"GLM-5","type":"chat","extra_capabilities":{"reasoning":{"supported":true,"interleaved":true,"summaries":true,"visibility":"summary","continuation":["thinking_blocks"]}}},{"id":"glm-5.1","name":"GLM-5.1","family":"glm","attachment":false,"reasoning":{"supported":true,"default":true},"tool_call":true,"interleaved":{"field":"reasoning_content"},"structured_output":true,"temperature":true,"release_date":"2026-03-27","last_updated":"2026-03-27","modalities":{"input":["text"],"output":["text"]},"open_weights":false,"cost":{"input":6,"output":24,"cache_read":1.3,"cache_write":0},"limit":{"context":200000,"output":131072},"display_name":"GLM-5.1","type":"chat","extra_capabilities":{"reasoning":{"supported":true,"continuation":["thinking_blocks"],"interleaved":true,"summaries":true,"visibility":"summary"}}},{"id":"glm-5v-turbo","name":"glm-5v-turbo","family":"glm","attachment":true,"reasoning":{"supported":true,"default":true},"tool_call":true,"interleaved":{"field":"reasoning_content"},"temperature":true,"release_date":"2026-04-01","last_updated":"2026-04-01","modalities":{"input":["text","image","video","pdf"],"output":["text"]},"open_weights":false,"cost":{"input":5,"output":22,"cache_read":1.2,"cache_write":0},"limit":{"context":200000,"output":131072},"display_name":"glm-5v-turbo","type":"chat","extra_capabilities":{"reasoning":{"supported":true,"interleaved":true,"summaries":true,"visibility":"summary","continuation":["thinking_blocks"]}}},{"id":"glm-4.5","name":"GLM-4.5","family":"glm","attachment":false,"reasoning":{"supported":true,"default":true},"tool_call":true,"temperature":true,"knowledge":"2025-04","release_date":"2025-07-28","last_updated":"2025-07-28","modalities":{"input":["text"],"output":["text"]},"open_weights":true,"cost":{"input":0.6,"output":2.2,"cache_read":0.11,"cache_write":0},"limit":{"context":131072,"output":98304},"display_name":"GLM-4.5","type":"chat"},{"id":"glm-4.7-flash","name":"GLM-4.7-Flash","family":"glm-flash","attachment":false,"reasoning":{"supported":true,"default":true},"tool_call":true,"temperature":true,"knowledge":"2025-04","release_date":"2026-01-19","last_updated":"2026-01-19","modalities":{"input":["text"],"output":["text"]},"open_weights":true,"cost":{"input":0,"output":0,"cache_read":0,"cache_write":0},"limit":{"context":200000,"output":131072},"display_name":"GLM-4.7-Flash","type":"chat","extra_capabilities":{"reasoning":{"supported":true}}},{"id":"glm-4.5v","name":"GLM-4.5V","family":"glm","attachment":true,"reasoning":{"supported":true,"default":true},"tool_call":true,"temperature":true,"knowledge":"2025-04","release_date":"2025-08-11","last_updated":"2025-08-11","modalities":{"input":["text","image","video"],"output":["text"]},"open_weights":true,"cost":{"input":0.6,"output":1.8},"limit":{"context":64000,"output":16384},"display_name":"GLM-4.5V","type":"chat"},{"id":"glm-4.5-air","name":"GLM-4.5-Air","family":"glm-air","attachment":false,"reasoning":{"supported":true,"default":true},"tool_call":true,"temperature":true,"knowledge":"2025-04","release_date":"2025-07-28","last_updated":"2025-07-28","modalities":{"input":["text"],"output":["text"]},"open_weights":true,"cost":{"input":0.2,"output":1.1,"cache_read":0.03,"cache_write":0},"limit":{"context":131072,"output":98304},"display_name":"GLM-4.5-Air","type":"chat"},{"id":"glm-4.6v","name":"GLM-4.6V","family":"glm","attachment":true,"reasoning":{"supported":true,"default":true},"tool_call":true,"temperature":true,"knowledge":"2025-04","release_date":"2025-12-08","last_updated":"2025-12-08","modalities":{"input":["text","image","video"],"output":["text"]},"open_weights":true,"cost":{"input":0.3,"output":0.9},"limit":{"context":128000,"output":32768},"display_name":"GLM-4.6V","type":"chat"},{"id":"glm-4.5-flash","name":"GLM-4.5-Flash","family":"glm-flash","attachment":false,"reasoning":{"supported":true,"default":true},"tool_call":true,"temperature":true,"knowledge":"2025-04","release_date":"2025-07-28","last_updated":"2025-07-28","modalities":{"input":["text"],"output":["text"]},"open_weights":true,"cost":{"input":0,"output":0,"cache_read":0,"cache_write":0},"limit":{"context":131072,"output":98304},"display_name":"GLM-4.5-Flash","type":"chat"},{"id":"glm-4.6","name":"GLM-4.6","family":"glm","attachment":false,"reasoning":{"supported":true,"default":true},"tool_call":true,"temperature":true,"knowledge":"2025-04","release_date":"2025-09-30","last_updated":"2025-09-30","modalities":{"input":["text"],"output":["text"]},"open_weights":true,"cost":{"input":0.6,"output":2.2,"cache_read":0.11,"cache_write":0},"limit":{"context":204800,"output":131072},"display_name":"GLM-4.6","type":"chat","extra_capabilities":{"reasoning":{"supported":true}}},{"id":"glm-4.7-flashx","name":"GLM-4.7-FlashX","family":"glm-flash","attachment":false,"reasoning":{"supported":true,"default":true},"tool_call":true,"temperature":true,"knowledge":"2025-04","release_date":"2026-01-19","last_updated":"2026-01-19","modalities":{"input":["text"],"output":["text"]},"open_weights":true,"cost":{"input":0.07,"output":0.4,"cache_read":0.01,"cache_write":0},"limit":{"context":200000,"output":131072},"display_name":"GLM-4.7-FlashX","type":"chat"},{"id":"glm-4.7","name":"GLM-4.7","family":"glm","attachment":false,"reasoning":{"supported":true,"default":true},"tool_call":true,"interleaved":{"field":"reasoning_content"},"temperature":true,"knowledge":"2025-04","release_date":"2025-12-22","last_updated":"2025-12-22","modalities":{"input":["text"],"output":["text"]},"open_weights":true,"cost":{"input":0.6,"output":2.2,"cache_read":0.11,"cache_write":0},"limit":{"context":204800,"output":131072},"display_name":"GLM-4.7","type":"chat","extra_capabilities":{"reasoning":{"supported":true,"interleaved":true,"summaries":true,"visibility":"summary","continuation":["thinking_blocks"]}}}],"defaultModelId":"glm-5"}
package/icon.png ADDED
Binary file
package/package.json CHANGED
@@ -1,21 +1,78 @@
1
1
  {
2
2
  "name": "dimcode",
3
- "version": "0.0.65-beta.0",
4
- "description": "AI coding agent CLI and terminal coding assistant with an interactive TUI (beta channel)",
5
3
  "type": "module",
4
+ "version": "0.0.65",
5
+ "description": "AI coding agent CLI and terminal coding assistant with an interactive TUI",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/index.d.ts",
9
+ "import": "./dist/index.js"
10
+ },
11
+ "./cli": {
12
+ "types": "./dist/cli.d.ts",
13
+ "import": "./dist/cli.js"
14
+ }
15
+ },
16
+ "imports": {
17
+ "#cli/*": "./src/*"
18
+ },
19
+ "main": "./dist/index.js",
20
+ "types": "./dist/index.d.ts",
6
21
  "bin": {
7
- "dim": "./bin/dim.mjs",
8
- "dimcode": "./bin/dim.mjs"
22
+ "dim": "./cli.mjs",
23
+ "dimcode": "./cli.mjs"
9
24
  },
10
25
  "files": [
11
- "bin",
12
- "dist"
26
+ "assets",
27
+ "cli.mjs",
28
+ "dist",
29
+ "icon.png"
13
30
  ],
14
- "optionalDependencies": {
15
- "dimcode-darwin-arm64": "0.0.65-beta.0",
16
- "dimcode-darwin-x64": "0.0.65-beta.0",
17
- "dimcode-linux-arm64": "0.0.65-beta.0",
18
- "dimcode-linux-x64": "0.0.65-beta.0",
19
- "dimcode-windows-x64": "0.0.65-beta.0"
31
+ "scripts": {
32
+ "build": "bun run build.mjs",
33
+ "build:npm": "bun run build-npm.mjs",
34
+ "build:binary": "bun run build.mjs --binary",
35
+ "build:binary:macos": "bun run build.mjs --binary --target=bun-darwin-arm64",
36
+ "build:binary:macos-x64": "bun run build.mjs --binary --target=bun-darwin-x64",
37
+ "build:binary:linux": "bun run build.mjs --binary --target=bun-linux-x64",
38
+ "build:binary:linux-arm64": "bun run build.mjs --binary --target=bun-linux-arm64",
39
+ "build:binary:windows": "bun run build.mjs --binary --target=bun-windows-x64",
40
+ "typecheck": "node ../../scripts/check-public-agent-imports.mjs ./src && tsc --noEmit",
41
+ "cli": "bun scripts/cli-watch.mjs",
42
+ "cli:run": "esno src/cli.ts",
43
+ "cli:run:node": "node --enable-source-maps --import tsx src/cli.ts",
44
+ "bench:scroll": "bun scripts/scroll-benchmark.ts",
45
+ "bench:layout": "bun scripts/layout-benchmark.ts",
46
+ "bench:stdout": "bun scripts/stdout-benchmark.ts",
47
+ "test": "bun test --preload ./test/setup.ts",
48
+ "smoke": "bun run build && bun dist/cli.mjs --help",
49
+ "lint": "eslint src/**/*.ts",
50
+ "lint:fix": "eslint src/**/*.ts --fix",
51
+ "prepack": "bun run build",
52
+ "fix-package": "bun run fix-package.mjs",
53
+ "restore-package": "bun run restore-package.mjs",
54
+ "release": "bumpp --commit --no-verify --no-tag --no-push && bun run build && bun publish",
55
+ "release:npm": "bumpp --commit --no-verify --no-tag --no-push && bun run build:npm && npm publish"
56
+ },
57
+ "dependencies": {
58
+ "cross-spawn": "^7.0.6",
59
+ "nanoid": "^5.1.7",
60
+ "node-notifier": "^10.0.1",
61
+ "semver": "^7.7.4",
62
+ "shiki": "^3.23.0",
63
+ "undici": "^6.21.0",
64
+ "vue": "^3.5.30"
65
+ },
66
+ "devDependencies": {
67
+ "@simon_he/vue-tui": "0.0.7",
68
+ "@types/node": "^18.19.130",
69
+ "@types/node-notifier": "^8.0.5",
70
+ "@types/semver": "^7.7.1",
71
+ "chokidar": "^4.0.3",
72
+ "happy-dom": "^17.6.3",
73
+ "bun-types": "latest",
74
+ "tsdown": "^0.20.3",
75
+ "typescript": "^5.9.3",
76
+ "vitest": "^4.1.0"
20
77
  }
21
78
  }
package/bin/dim.mjs DELETED
@@ -1,180 +0,0 @@
1
- #!/usr/bin/env node
2
- import childProcess from 'node:child_process'
3
- import fs from 'node:fs'
4
- import os from 'node:os'
5
- import path from 'node:path'
6
- import process from 'node:process'
7
- import { fileURLToPath, pathToFileURL } from 'node:url'
8
-
9
- const __filename = fileURLToPath(import.meta.url)
10
- const __dirname = path.dirname(__filename)
11
- const isWindows = os.platform() === 'win32'
12
-
13
- let wrapperVersion = ''
14
- try {
15
- const pkg = JSON.parse(
16
- fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf8'),
17
- )
18
- wrapperVersion = pkg.version || ''
19
- }
20
- catch {}
21
-
22
- const wrapperDir = path.join(__dirname, '..').replace(/\\/g, '/').toLowerCase()
23
- const wrapperPm
24
- = wrapperDir.includes('.bun/') || wrapperDir.includes('bun/install/')
25
- ? 'bun'
26
- : 'npm'
27
-
28
- const args = process.argv.slice(2)
29
- const routing = resolveRouting(args)
30
-
31
- if (routing.target === 'opentui') {
32
- runOpentui(routing.forwardArgs)
33
- }
34
- else {
35
- await runInk()
36
- }
37
-
38
- function resolveRouting(argv) {
39
- // Explicit `dim ink ...` forces the Ink TUI fallback.
40
- if (argv[0] === 'ink')
41
- return { target: 'ink', forwardArgs: argv.slice(1) }
42
- // Explicit `dim opentui ...` also routes to the opentui binary
43
- // (kept for symmetry; opentui is the default).
44
- if (argv[0] === 'opentui')
45
- return { target: 'opentui', forwardArgs: argv.slice(1) }
46
-
47
- // Default: everything goes to the opentui binary.
48
- return { target: 'opentui', forwardArgs: argv }
49
- }
50
-
51
- async function runInk() {
52
- const inkEntry = path.join(__dirname, '..', 'dist', 'ink.mjs')
53
- if (!fs.existsSync(inkEntry)) {
54
- console.error('[dim] Ink bundle missing: ' + inkEntry)
55
- console.error('[dim] Try reinstalling dimcode@beta.')
56
- process.exit(1)
57
- }
58
- // Inner CLI's DEFAULT_PACKAGE_NAME is already 'dimcode', so no override
59
- // needed. Pass wrapper version through for diagnostics.
60
- process.env.DIMCODE_NPM_PACKAGE = 'dimcode'
61
- process.env.DIMCODE_NPM_PACKAGE_MANAGER = wrapperPm
62
- if (wrapperVersion)
63
- process.env.DIMCODE_NPM_PACKAGE_VERSION = wrapperVersion
64
- try {
65
- await import(pathToFileURL(inkEntry).href)
66
- }
67
- catch (err) {
68
- console.error('[dim] Failed to start Ink TUI:')
69
- console.error(err)
70
- process.exit(1)
71
- }
72
- }
73
-
74
- function runOpentui(restArgs) {
75
- const envPath = process.env.DIMCODE_BIN_PATH
76
- if (envPath) {
77
- if (!fs.existsSync(envPath)) {
78
- console.error(
79
- '[dim] DIMCODE_BIN_PATH is set but file not found: ' + envPath,
80
- )
81
- process.exit(1)
82
- }
83
- spawnBinary(envPath, restArgs)
84
- return
85
- }
86
-
87
- const scriptPath = fs.realpathSync(__filename)
88
- const scriptDir = path.dirname(scriptPath)
89
-
90
- const platformMap = { darwin: 'darwin', linux: 'linux', win32: 'windows' }
91
- const archMap = { x64: 'x64', arm64: 'arm64' }
92
- const platform = platformMap[os.platform()] || os.platform()
93
- const arch = archMap[os.arch()] || os.arch()
94
- const base = 'dimcode-' + platform + '-' + arch
95
- const binary = platform === 'windows' ? 'dimcode.exe' : 'dimcode'
96
-
97
- if (process.env.DIMCODE_DEBUG) {
98
- console.error('[dim] Wrapper version: ' + wrapperVersion)
99
- console.error('[dim] Platform: ' + platform + ' Arch: ' + arch)
100
- console.error('[dim] Looking for package: ' + base)
101
- console.error('[dim] Script dir: ' + scriptDir)
102
- }
103
-
104
- const resolved = findBinary(scriptDir, base, binary)
105
- if (!resolved) {
106
- console.error(
107
- '[dim] Could not find the opentui binary for your platform.\n'
108
- + '\n'
109
- + ' Platform: ' + os.platform() + ' (' + platform + ')\n'
110
- + ' Arch: ' + os.arch() + ' (' + arch + ')\n'
111
- + ' Expected: ' + base + '/bin/' + binary + '\n'
112
- + ' Searched: ' + scriptDir + ' (and parent directories)\n'
113
- + '\n'
114
- + 'Try uninstalling and reinstalling the beta channel:\n'
115
- + ' npm uninstall -g dimcode && npm install -g dimcode@beta\n',
116
- )
117
- process.exit(1)
118
- }
119
-
120
- if (process.env.DIMCODE_DEBUG)
121
- console.error('[dim] Resolved binary: ' + resolved)
122
-
123
- spawnBinary(resolved, restArgs)
124
- }
125
-
126
- function findBinary(startDir, base, binary) {
127
- let current = startDir
128
- for (;;) {
129
- const modules = path.join(current, 'node_modules')
130
- if (fs.existsSync(modules)) {
131
- const candidate = path.join(modules, base, 'bin', binary)
132
- if (fs.existsSync(candidate))
133
- return candidate
134
- }
135
- const parent = path.dirname(current)
136
- if (parent === current)
137
- return
138
- current = parent
139
- }
140
- }
141
-
142
- function spawnBinary(target, forwardedArgs) {
143
- const env = {
144
- ...process.env,
145
- DIMCODE_NPM_PACKAGE: 'dimcode',
146
- DIMCODE_NPM_PACKAGE_MANAGER: wrapperPm,
147
- DIMCODE_NPM_PACKAGE_ROOT: path.resolve(__dirname, '..'),
148
- }
149
- if (wrapperVersion)
150
- env.DIMCODE_NPM_PACKAGE_VERSION = wrapperVersion
151
-
152
- const result = childProcess.spawnSync(target, forwardedArgs, {
153
- stdio: 'inherit',
154
- cwd: process.cwd(),
155
- env,
156
- windowsHide: false,
157
- })
158
- if (result.error) {
159
- console.error(
160
- '[dim] Failed to start opentui binary: ' + result.error.message,
161
- )
162
- if (isWindows) {
163
- console.error('[dim] Binary path: ' + target)
164
- if (result.error.code === 'ENOENT') {
165
- console.error(
166
- '[dim] The binary file was not found. Try reinstalling:',
167
- )
168
- console.error(
169
- ' npm uninstall -g dimcode && npm install -g dimcode@beta',
170
- )
171
- }
172
- }
173
- process.exit(1)
174
- }
175
- if (result.status !== 0 && result.status !== null) {
176
- if (process.env.DIMCODE_DEBUG)
177
- console.error('[dim] Binary exited with code: ' + result.status)
178
- }
179
- process.exit(typeof result.status === 'number' ? result.status : 0)
180
- }