tarsk 0.4.4 → 0.4.6
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/dist/index.js +447375 -37
- package/package.json +2 -2
- package/dist/agent/agent.error-utils.d.ts +0 -14
- package/dist/agent/agent.error-utils.js +0 -52
- package/dist/agent/agent.event-transformer.d.ts +0 -55
- package/dist/agent/agent.event-transformer.js +0 -175
- package/dist/agent/agent.executor.d.ts +0 -26
- package/dist/agent/agent.executor.js +0 -286
- package/dist/agent/agent.model-resolver.d.ts +0 -22
- package/dist/agent/agent.model-resolver.js +0 -67
- package/dist/agent/agent.process-manager.d.ts +0 -57
- package/dist/agent/agent.process-manager.js +0 -262
- package/dist/agent/agent.processing-state-manager.d.ts +0 -74
- package/dist/agent/agent.processing-state-manager.js +0 -87
- package/dist/agent/agent.prompt-loader.d.ts +0 -16
- package/dist/agent/agent.prompt-loader.js +0 -227
- package/dist/agent/agent.subagent-executor.d.ts +0 -35
- package/dist/agent/agent.subagent-executor.js +0 -135
- package/dist/bun/index.d.ts +0 -2
- package/dist/bun/index.js +0 -165
- package/dist/cli.d.ts +0 -3
- package/dist/cli.js +0 -22
- package/dist/core/crypto.d.ts +0 -29
- package/dist/core/crypto.js +0 -166
- package/dist/core/dev-server-cache.d.ts +0 -46
- package/dist/core/dev-server-cache.js +0 -59
- package/dist/core/env-manager.d.ts +0 -3
- package/dist/core/env-manager.js +0 -60
- package/dist/core/error-responses.d.ts +0 -61
- package/dist/core/error-responses.js +0 -64
- package/dist/core/logger.d.ts +0 -10
- package/dist/core/logger.js +0 -47
- package/dist/core/paths.d.ts +0 -22
- package/dist/core/paths.js +0 -26
- package/dist/core/random-words.d.ts +0 -18
- package/dist/core/random-words.js +0 -135
- package/dist/core/response-builder.d.ts +0 -50
- package/dist/core/response-builder.js +0 -56
- package/dist/core/route-helpers.d.ts +0 -47
- package/dist/core/route-helpers.js +0 -54
- package/dist/core/run-command-detector.d.ts +0 -26
- package/dist/core/run-command-detector.js +0 -98
- package/dist/core/stream-helper.d.ts +0 -44
- package/dist/core/stream-helper.js +0 -50
- package/dist/core/utils.d.ts +0 -43
- package/dist/core/utils.js +0 -113
- package/dist/core/validation.d.ts +0 -10
- package/dist/core/validation.js +0 -20
- package/dist/database/database.d.ts +0 -40
- package/dist/database/database.encryption.d.ts +0 -33
- package/dist/database/database.encryption.js +0 -62
- package/dist/database/database.js +0 -480
- package/dist/database/database.state.d.ts +0 -52
- package/dist/database/database.state.js +0 -119
- package/dist/database/database.test-utils.d.ts +0 -22
- package/dist/database/database.test-utils.js +0 -39
- package/dist/database/database.types.d.ts +0 -3
- package/dist/database/database.types.js +0 -2
- package/dist/features/agents/agents.manager.d.ts +0 -24
- package/dist/features/agents/agents.manager.js +0 -200
- package/dist/features/ask-user/ask-user.routes.d.ts +0 -9
- package/dist/features/ask-user/ask-user.routes.js +0 -35
- package/dist/features/chat/chat-delete.route.d.ts +0 -15
- package/dist/features/chat/chat-delete.route.js +0 -36
- package/dist/features/chat/chat-post.route.d.ts +0 -11
- package/dist/features/chat/chat-post.route.js +0 -270
- package/dist/features/chat/chat-stop.route.d.ts +0 -21
- package/dist/features/chat/chat-stop.route.js +0 -22
- package/dist/features/chat/chat-subscribe.route.d.ts +0 -9
- package/dist/features/chat/chat-subscribe.route.js +0 -71
- package/dist/features/chat/chat.routes.d.ts +0 -22
- package/dist/features/chat/chat.routes.js +0 -29
- package/dist/features/conversations/conversations-delete.route.d.ts +0 -16
- package/dist/features/conversations/conversations-delete.route.js +0 -34
- package/dist/features/conversations/conversations-get-all.route.d.ts +0 -16
- package/dist/features/conversations/conversations-get-all.route.js +0 -39
- package/dist/features/conversations/conversations-get-by-id.route.d.ts +0 -16
- package/dist/features/conversations/conversations-get-by-id.route.js +0 -38
- package/dist/features/conversations/conversations-get-deleted.route.d.ts +0 -15
- package/dist/features/conversations/conversations-get-deleted.route.js +0 -34
- package/dist/features/conversations/conversations-get-messages.route.d.ts +0 -16
- package/dist/features/conversations/conversations-get-messages.route.js +0 -49
- package/dist/features/conversations/conversations.content.d.ts +0 -28
- package/dist/features/conversations/conversations.content.js +0 -142
- package/dist/features/conversations/conversations.database.d.ts +0 -108
- package/dist/features/conversations/conversations.database.js +0 -373
- package/dist/features/conversations/conversations.manager.d.ts +0 -130
- package/dist/features/conversations/conversations.manager.js +0 -162
- package/dist/features/conversations/conversations.routes.d.ts +0 -21
- package/dist/features/conversations/conversations.routes.js +0 -38
- package/dist/features/conversations/token-usage.route.d.ts +0 -41
- package/dist/features/conversations/token-usage.route.js +0 -419
- package/dist/features/git/git-commit.route.d.ts +0 -12
- package/dist/features/git/git-commit.route.js +0 -39
- package/dist/features/git/git-create-branch.route.d.ts +0 -28
- package/dist/features/git/git-create-branch.route.js +0 -119
- package/dist/features/git/git-create-pr.route.d.ts +0 -13
- package/dist/features/git/git-create-pr.route.js +0 -50
- package/dist/features/git/git-create-repo.route.d.ts +0 -14
- package/dist/features/git/git-create-repo.route.js +0 -108
- package/dist/features/git/git-diff.route.d.ts +0 -30
- package/dist/features/git/git-diff.route.js +0 -189
- package/dist/features/git/git-fetch.route.d.ts +0 -12
- package/dist/features/git/git-fetch.route.js +0 -31
- package/dist/features/git/git-generate-commit-message.route.d.ts +0 -12
- package/dist/features/git/git-generate-commit-message.route.js +0 -76
- package/dist/features/git/git-generate-pr-info.route.d.ts +0 -13
- package/dist/features/git/git-generate-pr-info.route.js +0 -147
- package/dist/features/git/git-github-status.route.d.ts +0 -16
- package/dist/features/git/git-github-status.route.js +0 -68
- package/dist/features/git/git-log.route.d.ts +0 -17
- package/dist/features/git/git-log.route.js +0 -33
- package/dist/features/git/git-pr-status.route.d.ts +0 -15
- package/dist/features/git/git-pr-status.route.js +0 -33
- package/dist/features/git/git-pull.route.d.ts +0 -12
- package/dist/features/git/git-pull.route.js +0 -35
- package/dist/features/git/git-push.route.d.ts +0 -12
- package/dist/features/git/git-push.route.js +0 -46
- package/dist/features/git/git-status-cache.database.d.ts +0 -7
- package/dist/features/git/git-status-cache.database.js +0 -53
- package/dist/features/git/git-status.route.d.ts +0 -15
- package/dist/features/git/git-status.route.js +0 -62
- package/dist/features/git/git-sync-branch.route.d.ts +0 -4
- package/dist/features/git/git-sync-branch.route.js +0 -208
- package/dist/features/git/git-unified-status.route.d.ts +0 -30
- package/dist/features/git/git-unified-status.route.js +0 -165
- package/dist/features/git/git-username.route.d.ts +0 -3
- package/dist/features/git/git-username.route.js +0 -24
- package/dist/features/git/git.manager.d.ts +0 -139
- package/dist/features/git/git.manager.js +0 -352
- package/dist/features/git/git.routes.d.ts +0 -4
- package/dist/features/git/git.routes.js +0 -116
- package/dist/features/git/git.utils.d.ts +0 -82
- package/dist/features/git/git.utils.js +0 -1040
- package/dist/features/mcp/mcp.config.d.ts +0 -27
- package/dist/features/mcp/mcp.config.js +0 -148
- package/dist/features/mcp/mcp.manager.d.ts +0 -61
- package/dist/features/mcp/mcp.manager.js +0 -254
- package/dist/features/mcp/mcp.popular.json +0 -103
- package/dist/features/mcp/mcp.routes.d.ts +0 -13
- package/dist/features/mcp/mcp.routes.js +0 -159
- package/dist/features/mcp/mcp.types.d.ts +0 -80
- package/dist/features/mcp/mcp.types.js +0 -8
- package/dist/features/metadata/metadata.manager.d.ts +0 -126
- package/dist/features/metadata/metadata.manager.js +0 -423
- package/dist/features/models/model-info-aihubmix.d.ts +0 -25
- package/dist/features/models/model-info-aihubmix.js +0 -117
- package/dist/features/models/model-info-openrouter.d.ts +0 -25
- package/dist/features/models/model-info-openrouter.js +0 -104
- package/dist/features/models/model-info.d.ts +0 -37
- package/dist/features/models/model-info.js +0 -39
- package/dist/features/models/models-catalog.d.ts +0 -49
- package/dist/features/models/models-catalog.js +0 -80
- package/dist/features/models/models-catalog.route.d.ts +0 -43
- package/dist/features/models/models-catalog.route.js +0 -15
- package/dist/features/models/models-get-available.route.d.ts +0 -36
- package/dist/features/models/models-get-available.route.js +0 -66
- package/dist/features/models/models-get-enabled.route.d.ts +0 -33
- package/dist/features/models/models-get-enabled.route.js +0 -45
- package/dist/features/models/models-get-model-info.route.d.ts +0 -31
- package/dist/features/models/models-get-model-info.route.js +0 -84
- package/dist/features/models/models-model-disable.route.d.ts +0 -15
- package/dist/features/models/models-model-disable.route.js +0 -20
- package/dist/features/models/models-model-enable.route.d.ts +0 -13
- package/dist/features/models/models-model-enable.route.js +0 -20
- package/dist/features/models/models-provider-refresh.route.d.ts +0 -17
- package/dist/features/models/models-provider-refresh.route.js +0 -20
- package/dist/features/models/models.manager.d.ts +0 -58
- package/dist/features/models/models.manager.js +0 -138
- package/dist/features/models/models.routes.d.ts +0 -18
- package/dist/features/models/models.routes.js +0 -83
- package/dist/features/models/open-router-models.d.ts +0 -38
- package/dist/features/models/open-router-models.js +0 -73
- package/dist/features/models/openai-models.d.ts +0 -63
- package/dist/features/models/openai-models.js +0 -150
- package/dist/features/onboarding/onboarding-get-git-check.route.d.ts +0 -11
- package/dist/features/onboarding/onboarding-get-git-check.route.js +0 -28
- package/dist/features/onboarding/onboarding-get-status.route.d.ts +0 -12
- package/dist/features/onboarding/onboarding-get-status.route.js +0 -15
- package/dist/features/onboarding/onboarding-post-complete.route.d.ts +0 -12
- package/dist/features/onboarding/onboarding-post-complete.route.js +0 -15
- package/dist/features/onboarding/onboarding-post-reset.route.d.ts +0 -12
- package/dist/features/onboarding/onboarding-post-reset.route.js +0 -15
- package/dist/features/onboarding/onboarding.routes.d.ts +0 -18
- package/dist/features/onboarding/onboarding.routes.js +0 -28
- package/dist/features/project-todos/project-todos.database.d.ts +0 -38
- package/dist/features/project-todos/project-todos.database.js +0 -91
- package/dist/features/project-todos/project-todos.routes.d.ts +0 -4
- package/dist/features/project-todos/project-todos.routes.js +0 -94
- package/dist/features/projects/projects-ai-files.route.d.ts +0 -148
- package/dist/features/projects/projects-ai-files.route.js +0 -425
- package/dist/features/projects/projects-commands.route.d.ts +0 -27
- package/dist/features/projects/projects-commands.route.js +0 -39
- package/dist/features/projects/projects-create.route.d.ts +0 -19
- package/dist/features/projects/projects-create.route.js +0 -37
- package/dist/features/projects/projects-delete.route.d.ts +0 -24
- package/dist/features/projects/projects-delete.route.js +0 -34
- package/dist/features/projects/projects-get.route.d.ts +0 -47
- package/dist/features/projects/projects-get.route.js +0 -36
- package/dist/features/projects/projects-list.route.d.ts +0 -58
- package/dist/features/projects/projects-list.route.js +0 -59
- package/dist/features/projects/projects-open-folder.route.d.ts +0 -10
- package/dist/features/projects/projects-open-folder.route.js +0 -11
- package/dist/features/projects/projects-open.route.d.ts +0 -26
- package/dist/features/projects/projects-open.route.js +0 -49
- package/dist/features/projects/projects-package-scripts.route.d.ts +0 -15
- package/dist/features/projects/projects-package-scripts.route.js +0 -96
- package/dist/features/projects/projects-run-command.route.d.ts +0 -8
- package/dist/features/projects/projects-run-command.route.js +0 -21
- package/dist/features/projects/projects-run.route.d.ts +0 -51
- package/dist/features/projects/projects-run.route.js +0 -74
- package/dist/features/projects/projects-update.route.d.ts +0 -24
- package/dist/features/projects/projects-update.route.js +0 -81
- package/dist/features/projects/projects.creator.d.ts +0 -33
- package/dist/features/projects/projects.creator.js +0 -555
- package/dist/features/projects/projects.database.d.ts +0 -61
- package/dist/features/projects/projects.database.js +0 -212
- package/dist/features/projects/projects.manager.d.ts +0 -291
- package/dist/features/projects/projects.manager.js +0 -426
- package/dist/features/projects/projects.open-with.d.ts +0 -27
- package/dist/features/projects/projects.open-with.js +0 -156
- package/dist/features/projects/projects.routes.d.ts +0 -20
- package/dist/features/projects/projects.routes.js +0 -255
- package/dist/features/projects/terminal-session-manager.d.ts +0 -55
- package/dist/features/projects/terminal-session-manager.js +0 -90
- package/dist/features/providers/provider-resolver.d.ts +0 -13
- package/dist/features/providers/provider-resolver.js +0 -22
- package/dist/features/providers/providers-get-credits.route.d.ts +0 -15
- package/dist/features/providers/providers-get-credits.route.js +0 -51
- package/dist/features/providers/providers-get.route.d.ts +0 -16
- package/dist/features/providers/providers-get.route.js +0 -32
- package/dist/features/providers/providers-open-external.route.d.ts +0 -15
- package/dist/features/providers/providers-open-external.route.js +0 -49
- package/dist/features/providers/providers-post-bulk-keys.route.d.ts +0 -14
- package/dist/features/providers/providers-post-bulk-keys.route.js +0 -31
- package/dist/features/providers/providers-post-keys.route.d.ts +0 -14
- package/dist/features/providers/providers-post-keys.route.js +0 -25
- package/dist/features/providers/providers.routes.d.ts +0 -19
- package/dist/features/providers/providers.routes.js +0 -31
- package/dist/features/rules/rules-post.route.d.ts +0 -43
- package/dist/features/rules/rules-post.route.js +0 -89
- package/dist/features/rules/rules.manager.d.ts +0 -36
- package/dist/features/rules/rules.manager.js +0 -203
- package/dist/features/rules/rules.routes.d.ts +0 -12
- package/dist/features/rules/rules.routes.js +0 -13
- package/dist/features/run/run-get-running.route.d.ts +0 -15
- package/dist/features/run/run-get-running.route.js +0 -21
- package/dist/features/run/run-post-start.route.d.ts +0 -8
- package/dist/features/run/run-post-start.route.js +0 -21
- package/dist/features/run/run-post-stop.route.d.ts +0 -15
- package/dist/features/run/run-post-stop.route.js +0 -24
- package/dist/features/run/run-post-suggest.route.d.ts +0 -15
- package/dist/features/run/run-post-suggest.route.js +0 -21
- package/dist/features/run/run-put-command.route.d.ts +0 -15
- package/dist/features/run/run-put-command.route.js +0 -24
- package/dist/features/run/run.routes.d.ts +0 -19
- package/dist/features/run/run.routes.js +0 -31
- package/dist/features/scaffold/index.d.ts +0 -7
- package/dist/features/scaffold/index.js +0 -5
- package/dist/features/scaffold/scaffold-get-templates.route.d.ts +0 -27
- package/dist/features/scaffold/scaffold-get-templates.route.js +0 -17
- package/dist/features/scaffold/scaffold-post.route.d.ts +0 -8
- package/dist/features/scaffold/scaffold-post.route.js +0 -30
- package/dist/features/scaffold/scaffold.routes.d.ts +0 -10
- package/dist/features/scaffold/scaffold.routes.js +0 -16
- package/dist/features/scaffold/scaffold.runner.d.ts +0 -48
- package/dist/features/scaffold/scaffold.runner.js +0 -475
- package/dist/features/scaffold/scaffold.types.d.ts +0 -26
- package/dist/features/scaffold/scaffold.types.js +0 -5
- package/dist/features/skills/skills.activation.d.ts +0 -31
- package/dist/features/skills/skills.activation.js +0 -155
- package/dist/features/skills/skills.manager.d.ts +0 -35
- package/dist/features/skills/skills.manager.js +0 -251
- package/dist/features/slash-commands/slash-commands-delete.route.d.ts +0 -23
- package/dist/features/slash-commands/slash-commands-delete.route.js +0 -36
- package/dist/features/slash-commands/slash-commands-get.route.d.ts +0 -53
- package/dist/features/slash-commands/slash-commands-get.route.js +0 -54
- package/dist/features/slash-commands/slash-commands-post.route.d.ts +0 -39
- package/dist/features/slash-commands/slash-commands-post.route.js +0 -70
- package/dist/features/slash-commands/slash-commands-put.route.d.ts +0 -23
- package/dist/features/slash-commands/slash-commands-put.route.js +0 -36
- package/dist/features/slash-commands/slash-commands.manager.d.ts +0 -46
- package/dist/features/slash-commands/slash-commands.manager.js +0 -265
- package/dist/features/slash-commands/slash-commands.routes.d.ts +0 -13
- package/dist/features/slash-commands/slash-commands.routes.js +0 -20
- package/dist/features/threads/threads-ai-files.route.d.ts +0 -153
- package/dist/features/threads/threads-ai-files.route.js +0 -287
- package/dist/features/threads/threads-conversation-folder-path.route.d.ts +0 -14
- package/dist/features/threads/threads-conversation-folder-path.route.js +0 -23
- package/dist/features/threads/threads-create.route.d.ts +0 -22
- package/dist/features/threads/threads-create.route.js +0 -60
- package/dist/features/threads/threads-delete.route.d.ts +0 -25
- package/dist/features/threads/threads-delete.route.js +0 -35
- package/dist/features/threads/threads-files.route.d.ts +0 -15
- package/dist/features/threads/threads-files.route.js +0 -20
- package/dist/features/threads/threads-fix-comments.route.d.ts +0 -26
- package/dist/features/threads/threads-fix-comments.route.js +0 -45
- package/dist/features/threads/threads-get.route.d.ts +0 -30
- package/dist/features/threads/threads-get.route.js +0 -38
- package/dist/features/threads/threads-list.route.d.ts +0 -56
- package/dist/features/threads/threads-list.route.js +0 -58
- package/dist/features/threads/threads-messages.route.d.ts +0 -28
- package/dist/features/threads/threads-messages.route.js +0 -110
- package/dist/features/threads/threads-open.route.d.ts +0 -26
- package/dist/features/threads/threads-open.route.js +0 -62
- package/dist/features/threads/threads-select.route.d.ts +0 -25
- package/dist/features/threads/threads-select.route.js +0 -35
- package/dist/features/threads/threads-update.route.d.ts +0 -15
- package/dist/features/threads/threads-update.route.js +0 -30
- package/dist/features/threads/threads.database.d.ts +0 -68
- package/dist/features/threads/threads.database.js +0 -215
- package/dist/features/threads/threads.manager.d.ts +0 -204
- package/dist/features/threads/threads.manager.js +0 -505
- package/dist/features/threads/threads.routes.d.ts +0 -20
- package/dist/features/threads/threads.routes.js +0 -230
- package/dist/features/todos/todos.database.d.ts +0 -14
- package/dist/features/todos/todos.database.js +0 -31
- package/dist/features/updates/updates.routes.d.ts +0 -13
- package/dist/features/updates/updates.routes.js +0 -40
- package/dist/index.d.ts +0 -3
- package/dist/project-analyzer.d.ts +0 -26
- package/dist/project-analyzer.js +0 -307
- package/dist/server.d.ts +0 -12
- package/dist/server.js +0 -142
- package/dist/tools/agent-tool.d.ts +0 -49
- package/dist/tools/agent-tool.js +0 -131
- package/dist/tools/ask-user.d.ts +0 -25
- package/dist/tools/ask-user.js +0 -74
- package/dist/tools/ast-grep.d.ts +0 -28
- package/dist/tools/ast-grep.js +0 -273
- package/dist/tools/bash.d.ts +0 -33
- package/dist/tools/bash.js +0 -186
- package/dist/tools/edit-diff.d.ts +0 -24
- package/dist/tools/edit-diff.js +0 -136
- package/dist/tools/edit.d.ts +0 -28
- package/dist/tools/edit.js +0 -78
- package/dist/tools/find.d.ts +0 -31
- package/dist/tools/find.js +0 -117
- package/dist/tools/grep.d.ts +0 -37
- package/dist/tools/grep.js +0 -231
- package/dist/tools/index.d.ts +0 -93
- package/dist/tools/index.js +0 -110
- package/dist/tools/ls.d.ts +0 -31
- package/dist/tools/ls.js +0 -108
- package/dist/tools/mcp-tools.d.ts +0 -31
- package/dist/tools/mcp-tools.js +0 -59
- package/dist/tools/path-utils.d.ts +0 -14
- package/dist/tools/path-utils.js +0 -87
- package/dist/tools/read.d.ts +0 -27
- package/dist/tools/read.js +0 -86
- package/dist/tools/resolve-bin.d.ts +0 -5
- package/dist/tools/resolve-bin.js +0 -28
- package/dist/tools/shell.d.ts +0 -7
- package/dist/tools/shell.js +0 -143
- package/dist/tools/skill-reference-tool.d.ts +0 -30
- package/dist/tools/skill-reference-tool.js +0 -171
- package/dist/tools/skill-tool.d.ts +0 -33
- package/dist/tools/skill-tool.js +0 -213
- package/dist/tools/todo.d.ts +0 -20
- package/dist/tools/todo.js +0 -168
- package/dist/tools/tool-helpers.d.ts +0 -78
- package/dist/tools/tool-helpers.js +0 -109
- package/dist/tools/truncate.d.ts +0 -31
- package/dist/tools/truncate.js +0 -164
- package/dist/tools/write.d.ts +0 -21
- package/dist/tools/write.js +0 -65
|
@@ -1,255 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Project routes for the REST API
|
|
3
|
-
*
|
|
4
|
-
* Handles all project-related operations:
|
|
5
|
-
* - POST /api/projects - Create a new project
|
|
6
|
-
* - GET /api/projects - List all projects
|
|
7
|
-
* - GET /api/projects/:id - Get project details
|
|
8
|
-
* - DELETE /api/projects/:id - Delete a project
|
|
9
|
-
*/
|
|
10
|
-
import { Hono } from "hono";
|
|
11
|
-
import { handleCreateProject } from "./projects-create.route.js";
|
|
12
|
-
import { handleOpenFolderProject } from "./projects-open-folder.route.js";
|
|
13
|
-
import { handleListProjects } from "./projects-list.route.js";
|
|
14
|
-
import { handleGetProject } from "./projects-get.route.js";
|
|
15
|
-
import { handleDeleteProject } from "./projects-delete.route.js";
|
|
16
|
-
import { handleOpenProject } from "./projects-open.route.js";
|
|
17
|
-
import { handleUpdateProject } from "./projects-update.route.js";
|
|
18
|
-
import { handleSaveCommand, handleDeleteCommand } from "./projects-commands.route.js";
|
|
19
|
-
import { handleRunCommand } from "./projects-run-command.route.js";
|
|
20
|
-
import { handleStartRun, handleSuggestRun, handleStopRun, handleCheckRunning, } from "./projects-run.route.js";
|
|
21
|
-
import { handleGetPackageScripts } from "./projects-package-scripts.route.js";
|
|
22
|
-
import { handleGetAIFiles, handleGetAIFile, handleSaveAIFile, handleDeleteAIFile, handleCreateSkill, } from "./projects-ai-files.route.js";
|
|
23
|
-
/**
|
|
24
|
-
* Creates project routes
|
|
25
|
-
* @param projectManager - The ProjectManager instance
|
|
26
|
-
* @param threadManager - The ThreadManager instance
|
|
27
|
-
* @returns Hono router with project routes
|
|
28
|
-
*/
|
|
29
|
-
export function createProjectRoutes(projectManager, threadManager) {
|
|
30
|
-
const router = new Hono();
|
|
31
|
-
/**
|
|
32
|
-
* POST /api/projects
|
|
33
|
-
* Create a new project from a git URL
|
|
34
|
-
*
|
|
35
|
-
* Request body:
|
|
36
|
-
* {
|
|
37
|
-
* "gitUrl": "https://github.com/user/repo.git"
|
|
38
|
-
* }
|
|
39
|
-
*
|
|
40
|
-
* Response: Newline-delimited JSON stream of ProjectEvent objects
|
|
41
|
-
*
|
|
42
|
-
* Requirements:
|
|
43
|
-
* - 6.2 - THE App SHALL send a POST request with the git URL to the CLI
|
|
44
|
-
* - 8.2 - THE CLI SHALL support streaming responses to the client
|
|
45
|
-
*/
|
|
46
|
-
router.post("/", async (c) => {
|
|
47
|
-
return handleCreateProject(c, projectManager);
|
|
48
|
-
});
|
|
49
|
-
/**
|
|
50
|
-
* POST /api/projects/open-folder
|
|
51
|
-
* Create a new project by selecting a local folder via native OS dialog
|
|
52
|
-
*
|
|
53
|
-
* Response: Newline-delimited JSON stream of ProjectEvent objects
|
|
54
|
-
*/
|
|
55
|
-
router.post("/open-folder", async (c) => {
|
|
56
|
-
return handleOpenFolderProject(c, projectManager);
|
|
57
|
-
});
|
|
58
|
-
/**
|
|
59
|
-
* GET /api/projects
|
|
60
|
-
* List all projects with expanded threads
|
|
61
|
-
*
|
|
62
|
-
* Response:
|
|
63
|
-
* [
|
|
64
|
-
* {
|
|
65
|
-
* "projectId": "uuid",
|
|
66
|
-
* "gitUrl": "https://github.com/user/repo.git",
|
|
67
|
-
* "projectPath": "/path/to/project",
|
|
68
|
-
* "threads": [
|
|
69
|
-
* {
|
|
70
|
-
* "threadId": "uuid",
|
|
71
|
-
* "title": "thread-title",
|
|
72
|
-
* "path": "/path/to/thread",
|
|
73
|
-
* "isSelected": false
|
|
74
|
-
* }
|
|
75
|
-
* ]
|
|
76
|
-
* }
|
|
77
|
-
* ]
|
|
78
|
-
*
|
|
79
|
-
* Requirements:
|
|
80
|
-
* - 6.2 - THE CLI SHALL expose REST API endpoints for Project operations
|
|
81
|
-
*/
|
|
82
|
-
router.get("/", async (c) => {
|
|
83
|
-
return handleListProjects(c, projectManager, threadManager);
|
|
84
|
-
});
|
|
85
|
-
/**
|
|
86
|
-
* GET /api/projects/:id
|
|
87
|
-
* Get project details by ID
|
|
88
|
-
*
|
|
89
|
-
* Response:
|
|
90
|
-
* {
|
|
91
|
-
* "id": "uuid",
|
|
92
|
-
* "name": "project-name",
|
|
93
|
-
* "gitUrl": "https://github.com/user/repo.git",
|
|
94
|
-
* "path": "/path/to/project",
|
|
95
|
-
* "createdAt": "2024-01-01T00:00:00Z",
|
|
96
|
-
* "threads": ["thread-id-1", "thread-id-2"]
|
|
97
|
-
* }
|
|
98
|
-
*
|
|
99
|
-
* Requirements:
|
|
100
|
-
* - 6.2 - THE CLI SHALL expose REST API endpoints for Project operations
|
|
101
|
-
*/
|
|
102
|
-
router.get("/:id", async (c) => {
|
|
103
|
-
return handleGetProject(c, projectManager);
|
|
104
|
-
});
|
|
105
|
-
/**
|
|
106
|
-
* DELETE /api/projects/:id
|
|
107
|
-
* Delete a project and all its threads
|
|
108
|
-
*
|
|
109
|
-
* Response:
|
|
110
|
-
* {
|
|
111
|
-
* "success": true,
|
|
112
|
-
* "message": "Project deleted successfully"
|
|
113
|
-
* }
|
|
114
|
-
*
|
|
115
|
-
* Requirements:
|
|
116
|
-
* - 6.2 - THE CLI SHALL expose REST API endpoints for Project operations
|
|
117
|
-
*/
|
|
118
|
-
router.delete("/:id", async (c) => {
|
|
119
|
-
return handleDeleteProject(c, projectManager);
|
|
120
|
-
});
|
|
121
|
-
/**
|
|
122
|
-
* POST /api/projects/:id/open
|
|
123
|
-
* Open a project in the specified program
|
|
124
|
-
*
|
|
125
|
-
* Request body:
|
|
126
|
-
* {
|
|
127
|
-
* "program": "VS Code" | "Cursor" | "Windsurf" | "Xcode" | "Android Studio" | "Kiro"
|
|
128
|
-
* }
|
|
129
|
-
*
|
|
130
|
-
* Response:
|
|
131
|
-
* {
|
|
132
|
-
* "success": true,
|
|
133
|
-
* "message": "Project opened in VS Code"
|
|
134
|
-
* }
|
|
135
|
-
*/
|
|
136
|
-
router.post("/:id/open", async (c) => {
|
|
137
|
-
return handleOpenProject(c, projectManager);
|
|
138
|
-
});
|
|
139
|
-
/**
|
|
140
|
-
* PUT /api/projects/:id
|
|
141
|
-
* Update project properties (unified endpoint)
|
|
142
|
-
*
|
|
143
|
-
* Request body (all fields optional):
|
|
144
|
-
* {
|
|
145
|
-
* "program": "VS Code" | "Cursor" | "Windsurf" | "Xcode" | "Android Studio" | "Kiro",
|
|
146
|
-
* "setupScript": "npm install" | null,
|
|
147
|
-
* "name": "new-project-name",
|
|
148
|
-
* "runCommand": "npm run dev" | null,
|
|
149
|
-
* "commitMethod": "pull-request" | "direct",
|
|
150
|
-
* "runNow": boolean (optional) - if true, run the setup script in the first thread
|
|
151
|
-
* }
|
|
152
|
-
*
|
|
153
|
-
* Response:
|
|
154
|
-
* {
|
|
155
|
-
* "success": true,
|
|
156
|
-
* "message": "Project updated"
|
|
157
|
-
* }
|
|
158
|
-
*/
|
|
159
|
-
router.put("/:id", async (c) => {
|
|
160
|
-
return handleUpdateProject(c, projectManager);
|
|
161
|
-
});
|
|
162
|
-
/**
|
|
163
|
-
* POST /api/projects/:id/commands
|
|
164
|
-
* Add or update a command for a project
|
|
165
|
-
*/
|
|
166
|
-
router.post("/:id/commands", async (c) => {
|
|
167
|
-
return handleSaveCommand(c, projectManager);
|
|
168
|
-
});
|
|
169
|
-
/**
|
|
170
|
-
* DELETE /api/projects/:id/commands/:commandId
|
|
171
|
-
* Delete a command from a project
|
|
172
|
-
*/
|
|
173
|
-
router.delete("/:id/commands/:commandId", async (c) => {
|
|
174
|
-
return handleDeleteCommand(c, projectManager);
|
|
175
|
-
});
|
|
176
|
-
/**
|
|
177
|
-
* POST /api/projects/:projectId/threads/:threadId/commands/run
|
|
178
|
-
* Run a command in a thread's directory
|
|
179
|
-
*/
|
|
180
|
-
router.post("/:projectId/threads/:threadId/commands/run", async (c) => {
|
|
181
|
-
return handleRunCommand(c, projectManager);
|
|
182
|
-
});
|
|
183
|
-
/**
|
|
184
|
-
* POST /api/projects/:id/run
|
|
185
|
-
* Start the dev server process for a project
|
|
186
|
-
*/
|
|
187
|
-
router.post("/:id/run", async (c) => {
|
|
188
|
-
return handleStartRun(c, projectManager);
|
|
189
|
-
});
|
|
190
|
-
/**
|
|
191
|
-
* POST /api/projects/:id/run-suggest
|
|
192
|
-
* Suggest a run command for a project based on package.json
|
|
193
|
-
*/
|
|
194
|
-
router.post("/:id/run-suggest", async (c) => {
|
|
195
|
-
return handleSuggestRun(c, projectManager);
|
|
196
|
-
});
|
|
197
|
-
/**
|
|
198
|
-
* POST /api/projects/:id/stop
|
|
199
|
-
* Stop the dev server process for a project
|
|
200
|
-
*/
|
|
201
|
-
router.post("/:id/stop", async (c) => {
|
|
202
|
-
return handleStopRun(c, projectManager);
|
|
203
|
-
});
|
|
204
|
-
/**
|
|
205
|
-
* GET /api/projects/:id/running
|
|
206
|
-
* Check if a dev server process is running for a project
|
|
207
|
-
*/
|
|
208
|
-
router.get("/:id/running", async (c) => {
|
|
209
|
-
return handleCheckRunning(c, projectManager);
|
|
210
|
-
});
|
|
211
|
-
/**
|
|
212
|
-
* GET /api/projects/:id/package-scripts
|
|
213
|
-
* Get available npm scripts from package.json files in the project
|
|
214
|
-
*/
|
|
215
|
-
router.get("/:id/package-scripts", async (c) => {
|
|
216
|
-
return handleGetPackageScripts(c, projectManager);
|
|
217
|
-
});
|
|
218
|
-
/**
|
|
219
|
-
* GET /api/projects/:id/ai-files
|
|
220
|
-
* List AI-related files (skills, rules, commands, markdown files)
|
|
221
|
-
*/
|
|
222
|
-
router.get("/:id/ai-files", async (c) => {
|
|
223
|
-
return handleGetAIFiles(c, projectManager);
|
|
224
|
-
});
|
|
225
|
-
/**
|
|
226
|
-
* GET /api/projects/:id/ai-file?path=...
|
|
227
|
-
* Read the content of an AI-related file
|
|
228
|
-
*/
|
|
229
|
-
router.get("/:id/ai-file", async (c) => {
|
|
230
|
-
return handleGetAIFile(c, projectManager);
|
|
231
|
-
});
|
|
232
|
-
/**
|
|
233
|
-
* PUT /api/projects/:id/ai-file
|
|
234
|
-
* Save the content of an AI-related file
|
|
235
|
-
*/
|
|
236
|
-
router.put("/:id/ai-file", async (c) => {
|
|
237
|
-
return handleSaveAIFile(c, projectManager);
|
|
238
|
-
});
|
|
239
|
-
/**
|
|
240
|
-
* DELETE /api/projects/:id/ai-file?path=...
|
|
241
|
-
* Delete a file or folder
|
|
242
|
-
*/
|
|
243
|
-
router.delete("/:id/ai-file", async (c) => {
|
|
244
|
-
return handleDeleteAIFile(c, projectManager);
|
|
245
|
-
});
|
|
246
|
-
/**
|
|
247
|
-
* POST /api/projects/:id/ai-files/skill
|
|
248
|
-
* Create a new skill with SKILL.md
|
|
249
|
-
*/
|
|
250
|
-
router.post("/:id/ai-files/skill", async (c) => {
|
|
251
|
-
return handleCreateSkill(c, projectManager);
|
|
252
|
-
});
|
|
253
|
-
return router;
|
|
254
|
-
}
|
|
255
|
-
//# sourceMappingURL=projects.routes.js.map
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TerminalSessionManager manages working directory state for terminal sessions
|
|
3
|
-
*
|
|
4
|
-
* This manager is responsible for:
|
|
5
|
-
* - Maintaining working directory state per thread
|
|
6
|
-
* - Tracking current working directory between command executions
|
|
7
|
-
* - Providing session isolation for different threads
|
|
8
|
-
*/
|
|
9
|
-
export interface TerminalSession {
|
|
10
|
-
threadId: string;
|
|
11
|
-
currentWorkingDirectory: string;
|
|
12
|
-
baseDirectory: string;
|
|
13
|
-
}
|
|
14
|
-
export declare class TerminalSessionManager {
|
|
15
|
-
private sessions;
|
|
16
|
-
/**
|
|
17
|
-
* Get or create a terminal session for a thread
|
|
18
|
-
* @param threadId - The thread ID
|
|
19
|
-
* @param baseDirectory - The base directory for the thread
|
|
20
|
-
* @returns The terminal session
|
|
21
|
-
*/
|
|
22
|
-
getOrCreateSession(threadId: string, baseDirectory: string): TerminalSession;
|
|
23
|
-
/**
|
|
24
|
-
* Get the current working directory for a thread
|
|
25
|
-
* @param threadId - The thread ID
|
|
26
|
-
* @returns The current working directory or null if no session exists
|
|
27
|
-
*/
|
|
28
|
-
getCurrentWorkingDirectory(threadId: string): string | null;
|
|
29
|
-
/**
|
|
30
|
-
* Update the working directory for a thread session
|
|
31
|
-
* @param threadId - The thread ID
|
|
32
|
-
* @param newWorkingDirectory - The new working directory
|
|
33
|
-
*/
|
|
34
|
-
updateWorkingDirectory(threadId: string, newWorkingDirectory: string): void;
|
|
35
|
-
/**
|
|
36
|
-
* Reset a thread's session to its base directory
|
|
37
|
-
* @param threadId - The thread ID
|
|
38
|
-
*/
|
|
39
|
-
resetSession(threadId: string): void;
|
|
40
|
-
/**
|
|
41
|
-
* Remove a terminal session (cleanup)
|
|
42
|
-
* @param threadId - The thread ID
|
|
43
|
-
*/
|
|
44
|
-
removeSession(threadId: string): void;
|
|
45
|
-
/**
|
|
46
|
-
* Clear all sessions (useful for cleanup or testing)
|
|
47
|
-
*/
|
|
48
|
-
clearAllSessions(): void;
|
|
49
|
-
/**
|
|
50
|
-
* Get all active sessions (useful for debugging)
|
|
51
|
-
* @returns Array of all active sessions
|
|
52
|
-
*/
|
|
53
|
-
getAllSessions(): TerminalSession[];
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=terminal-session-manager.d.ts.map
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TerminalSessionManager manages working directory state for terminal sessions
|
|
3
|
-
*
|
|
4
|
-
* This manager is responsible for:
|
|
5
|
-
* - Maintaining working directory state per thread
|
|
6
|
-
* - Tracking current working directory between command executions
|
|
7
|
-
* - Providing session isolation for different threads
|
|
8
|
-
*/
|
|
9
|
-
import { realpathSync } from "fs";
|
|
10
|
-
export class TerminalSessionManager {
|
|
11
|
-
sessions = new Map();
|
|
12
|
-
/**
|
|
13
|
-
* Get or create a terminal session for a thread
|
|
14
|
-
* @param threadId - The thread ID
|
|
15
|
-
* @param baseDirectory - The base directory for the thread
|
|
16
|
-
* @returns The terminal session
|
|
17
|
-
*/
|
|
18
|
-
getOrCreateSession(threadId, baseDirectory) {
|
|
19
|
-
let session = this.sessions.get(threadId);
|
|
20
|
-
if (!session) {
|
|
21
|
-
// Create a new session starting at the base directory
|
|
22
|
-
session = {
|
|
23
|
-
threadId,
|
|
24
|
-
currentWorkingDirectory: realpathSync(baseDirectory),
|
|
25
|
-
baseDirectory: realpathSync(baseDirectory),
|
|
26
|
-
};
|
|
27
|
-
this.sessions.set(threadId, session);
|
|
28
|
-
}
|
|
29
|
-
return session;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Get the current working directory for a thread
|
|
33
|
-
* @param threadId - The thread ID
|
|
34
|
-
* @returns The current working directory or null if no session exists
|
|
35
|
-
*/
|
|
36
|
-
getCurrentWorkingDirectory(threadId) {
|
|
37
|
-
const session = this.sessions.get(threadId);
|
|
38
|
-
return session ? session.currentWorkingDirectory : null;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Update the working directory for a thread session
|
|
42
|
-
* @param threadId - The thread ID
|
|
43
|
-
* @param newWorkingDirectory - The new working directory
|
|
44
|
-
*/
|
|
45
|
-
updateWorkingDirectory(threadId, newWorkingDirectory) {
|
|
46
|
-
const session = this.sessions.get(threadId);
|
|
47
|
-
if (session) {
|
|
48
|
-
try {
|
|
49
|
-
// Resolve to real path to handle symlinks and relative paths
|
|
50
|
-
const realPath = realpathSync(newWorkingDirectory);
|
|
51
|
-
session.currentWorkingDirectory = realPath;
|
|
52
|
-
}
|
|
53
|
-
catch {
|
|
54
|
-
// If realpath fails, use the path as-is
|
|
55
|
-
session.currentWorkingDirectory = newWorkingDirectory;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Reset a thread's session to its base directory
|
|
61
|
-
* @param threadId - The thread ID
|
|
62
|
-
*/
|
|
63
|
-
resetSession(threadId) {
|
|
64
|
-
const session = this.sessions.get(threadId);
|
|
65
|
-
if (session) {
|
|
66
|
-
session.currentWorkingDirectory = session.baseDirectory;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Remove a terminal session (cleanup)
|
|
71
|
-
* @param threadId - The thread ID
|
|
72
|
-
*/
|
|
73
|
-
removeSession(threadId) {
|
|
74
|
-
this.sessions.delete(threadId);
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Clear all sessions (useful for cleanup or testing)
|
|
78
|
-
*/
|
|
79
|
-
clearAllSessions() {
|
|
80
|
-
this.sessions.clear();
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Get all active sessions (useful for debugging)
|
|
84
|
-
* @returns Array of all active sessions
|
|
85
|
-
*/
|
|
86
|
-
getAllSessions() {
|
|
87
|
-
return Array.from(this.sessions.values());
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
//# sourceMappingURL=terminal-session-manager.js.map
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { type CatalogProvider } from "../models/models-catalog.js";
|
|
2
|
-
export interface ResolvedProvider extends CatalogProvider {
|
|
3
|
-
apiKey?: string;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* Resolve a provider's full config from catalog data.
|
|
7
|
-
*/
|
|
8
|
-
export declare function resolveProviderConfig(providerName: string): Promise<ResolvedProvider | null>;
|
|
9
|
-
/**
|
|
10
|
-
* Find the keyName for a provider from catalog data.
|
|
11
|
-
*/
|
|
12
|
-
export declare function resolveProviderKeyName(providerName: string): Promise<string>;
|
|
13
|
-
//# sourceMappingURL=provider-resolver.d.ts.map
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { getCatalogProvider } from "../models/models-catalog.js";
|
|
2
|
-
/**
|
|
3
|
-
* Resolve a provider's full config from catalog data.
|
|
4
|
-
*/
|
|
5
|
-
export async function resolveProviderConfig(providerName) {
|
|
6
|
-
const slug = providerName.toLowerCase();
|
|
7
|
-
const catalogProvider = await getCatalogProvider(slug);
|
|
8
|
-
if (!catalogProvider)
|
|
9
|
-
return null;
|
|
10
|
-
return catalogProvider;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Find the keyName for a provider from catalog data.
|
|
14
|
-
*/
|
|
15
|
-
export async function resolveProviderKeyName(providerName) {
|
|
16
|
-
const slug = providerName.toLowerCase();
|
|
17
|
-
const catalogProvider = await getCatalogProvider(slug);
|
|
18
|
-
if (catalogProvider?.env?.[0])
|
|
19
|
-
return catalogProvider.env[0];
|
|
20
|
-
return "";
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=provider-resolver.js.map
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GET /api/providers/:name/credits
|
|
3
|
-
* Get current balance for a provider
|
|
4
|
-
*/
|
|
5
|
-
import type { Context } from "hono";
|
|
6
|
-
import type { MetadataManager } from "../metadata/metadata.manager.js";
|
|
7
|
-
export declare function getProviderCredits(c: Context, metadataManager: MetadataManager): Promise<(Response & import("hono").TypedResponse<{
|
|
8
|
-
balance: number | null;
|
|
9
|
-
status: string;
|
|
10
|
-
reason?: string | undefined;
|
|
11
|
-
}, import("hono/utils/http-status").ContentfulStatusCode, "json">) | (Response & import("hono").TypedResponse<{
|
|
12
|
-
balance: null;
|
|
13
|
-
status: string;
|
|
14
|
-
}, import("hono/utils/http-status").ContentfulStatusCode, "json">)>;
|
|
15
|
-
//# sourceMappingURL=providers-get-credits.route.d.ts.map
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GET /api/providers/:name/credits
|
|
3
|
-
* Get current balance for a provider
|
|
4
|
-
*/
|
|
5
|
-
import { getCatalogProvider } from "../models/models-catalog.js";
|
|
6
|
-
import { getOpenRouterCredits } from "../models/model-info-openrouter.js";
|
|
7
|
-
import { getAIHubMixCredits } from "../models/model-info-aihubmix.js";
|
|
8
|
-
import { readEnvFile } from "../../core/env-manager.js";
|
|
9
|
-
export async function getProviderCredits(c, metadataManager) {
|
|
10
|
-
const name = c.req.param("name");
|
|
11
|
-
if (name.toLowerCase() === "openrouter") {
|
|
12
|
-
try {
|
|
13
|
-
const keys = await metadataManager.getProviderKeys();
|
|
14
|
-
const envFileKeys = await readEnvFile();
|
|
15
|
-
const provider = await getCatalogProvider("openrouter");
|
|
16
|
-
const apiKey = keys["OpenRouter"] ||
|
|
17
|
-
(provider?.env && provider.env.length > 0
|
|
18
|
-
? envFileKeys[provider.env[0]] || process.env[provider.env[0]]
|
|
19
|
-
: "");
|
|
20
|
-
if (!apiKey) {
|
|
21
|
-
return c.json({ balance: null, status: "unknown", reason: "No API key" });
|
|
22
|
-
}
|
|
23
|
-
const credits = await getOpenRouterCredits(apiKey);
|
|
24
|
-
return c.json(credits);
|
|
25
|
-
}
|
|
26
|
-
catch (error) {
|
|
27
|
-
return c.json({ balance: null, status: "unknown", reason: String(error) });
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
if (name.toLowerCase() === "aihubmix" || name.toLowerCase() === "aihub") {
|
|
31
|
-
try {
|
|
32
|
-
const keys = await metadataManager.getProviderKeys();
|
|
33
|
-
const envFileKeys = await readEnvFile();
|
|
34
|
-
const provider = await getCatalogProvider("aihubmix");
|
|
35
|
-
const apiKey = keys["AIHubMix"] ||
|
|
36
|
-
(provider?.env && provider.env.length > 0
|
|
37
|
-
? envFileKeys[provider.env[0]] || process.env[provider.env[0]]
|
|
38
|
-
: "");
|
|
39
|
-
if (!apiKey) {
|
|
40
|
-
return c.json({ balance: null, status: "unknown", reason: "No API key" });
|
|
41
|
-
}
|
|
42
|
-
const credits = await getAIHubMixCredits(apiKey);
|
|
43
|
-
return c.json(credits);
|
|
44
|
-
}
|
|
45
|
-
catch (error) {
|
|
46
|
-
return c.json({ balance: null, status: "unknown", reason: String(error) });
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return c.json({ balance: null, status: "unknown" });
|
|
50
|
-
}
|
|
51
|
-
//# sourceMappingURL=providers-get-credits.route.js.map
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GET /api/providers
|
|
3
|
-
* Get all providers with their stored API keys from catalog data.
|
|
4
|
-
*/
|
|
5
|
-
import type { Context } from "hono";
|
|
6
|
-
import type { MetadataManager } from "../metadata/metadata.manager.js";
|
|
7
|
-
export declare function getProviders(c: Context, metadataManager: MetadataManager): Promise<Response & import("hono").TypedResponse<{
|
|
8
|
-
name: string;
|
|
9
|
-
slug: string;
|
|
10
|
-
url: string;
|
|
11
|
-
keyName: string;
|
|
12
|
-
authType: "APIKey";
|
|
13
|
-
api: string;
|
|
14
|
-
apiKey: string;
|
|
15
|
-
}[], import("hono/utils/http-status").ContentfulStatusCode, "json">>;
|
|
16
|
-
//# sourceMappingURL=providers-get.route.d.ts.map
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GET /api/providers
|
|
3
|
-
* Get all providers with their stored API keys from catalog data.
|
|
4
|
-
*/
|
|
5
|
-
import { readEnvFile } from "../../core/env-manager.js";
|
|
6
|
-
import { getModelsCatalog } from "../models/models-catalog.js";
|
|
7
|
-
export async function getProviders(c, metadataManager) {
|
|
8
|
-
const keys = await metadataManager.getProviderKeys();
|
|
9
|
-
const envFileKeys = await readEnvFile();
|
|
10
|
-
const catalog = await getModelsCatalog();
|
|
11
|
-
const providersWithKeys = [];
|
|
12
|
-
// Process all catalog providers
|
|
13
|
-
if (catalog) {
|
|
14
|
-
for (const [catalogId, catalogProvider] of Object.entries(catalog)) {
|
|
15
|
-
const keyName = catalogProvider.env?.[0] || "";
|
|
16
|
-
const envFileKey = keyName ? envFileKeys[keyName] : "";
|
|
17
|
-
const processEnvKey = keyName ? process.env[keyName] : "";
|
|
18
|
-
const storedKey = keys[catalogProvider.name] || keys[catalogId];
|
|
19
|
-
providersWithKeys.push({
|
|
20
|
-
name: catalogProvider.name ?? catalogId,
|
|
21
|
-
slug: catalogId,
|
|
22
|
-
url: catalogProvider.doc ?? "",
|
|
23
|
-
keyName,
|
|
24
|
-
authType: "APIKey",
|
|
25
|
-
api: catalogProvider.api ?? "",
|
|
26
|
-
apiKey: storedKey ?? envFileKey ?? processEnvKey ?? "",
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
return c.json(providersWithKeys);
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=providers-get.route.js.map
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* POST /api/providers/open-external
|
|
3
|
-
* Opens an external URL using the system's default browser
|
|
4
|
-
*/
|
|
5
|
-
import type { Context } from "hono";
|
|
6
|
-
export declare function openExternalUrl(c: Context): Promise<(Response & import("hono").TypedResponse<{
|
|
7
|
-
error: string;
|
|
8
|
-
}, 400, "json">) | (Response & import("hono").TypedResponse<{
|
|
9
|
-
success: true;
|
|
10
|
-
}, import("hono/utils/http-status").ContentfulStatusCode, "json">) | (Response & import("hono").TypedResponse<{
|
|
11
|
-
error: string;
|
|
12
|
-
}, 501, "json">) | (Response & import("hono").TypedResponse<{
|
|
13
|
-
error: string;
|
|
14
|
-
}, 500, "json">)>;
|
|
15
|
-
//# sourceMappingURL=providers-open-external.route.d.ts.map
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* POST /api/providers/open-external
|
|
3
|
-
* Opens an external URL using the system's default browser
|
|
4
|
-
*/
|
|
5
|
-
let Utils = null;
|
|
6
|
-
let utilsLoaded = false;
|
|
7
|
-
// Lazy load Utils from electrobun (optional - may not be available in pure server mode)
|
|
8
|
-
async function loadUtils() {
|
|
9
|
-
if (utilsLoaded)
|
|
10
|
-
return;
|
|
11
|
-
utilsLoaded = true;
|
|
12
|
-
try {
|
|
13
|
-
const electrobun = await import("electrobun/bun");
|
|
14
|
-
Utils = electrobun.Utils;
|
|
15
|
-
}
|
|
16
|
-
catch {
|
|
17
|
-
// electrobun not available in pure server mode - that's OK
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
export async function openExternalUrl(c) {
|
|
21
|
-
try {
|
|
22
|
-
await loadUtils();
|
|
23
|
-
const { url } = await c.req.json();
|
|
24
|
-
if (!url || typeof url !== "string") {
|
|
25
|
-
return c.json({ error: "URL is required and must be a string" }, 400);
|
|
26
|
-
}
|
|
27
|
-
// Validate URL format
|
|
28
|
-
try {
|
|
29
|
-
new URL(url);
|
|
30
|
-
}
|
|
31
|
-
catch {
|
|
32
|
-
return c.json({ error: "Invalid URL format" }, 400);
|
|
33
|
-
}
|
|
34
|
-
// Open the URL in the system's default browser (only available in desktop mode)
|
|
35
|
-
if (Utils) {
|
|
36
|
-
await Utils.openExternal(url);
|
|
37
|
-
return c.json({ success: true });
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
console.error(`External URL opening not available in server mode: ${url}`);
|
|
41
|
-
return c.json({ error: "External URL opening not available in server mode" }, 501);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
catch (error) {
|
|
45
|
-
console.error("Failed to open external URL:", error);
|
|
46
|
-
return c.json({ error: "Failed to open URL" }, 500);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
//# sourceMappingURL=providers-open-external.route.js.map
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* POST /api/providers/bulk-keys
|
|
3
|
-
* Save all provider API keys at once
|
|
4
|
-
*/
|
|
5
|
-
import type { Context } from "hono";
|
|
6
|
-
import type { MetadataManager } from "../metadata/metadata.manager.js";
|
|
7
|
-
export declare function postProviderBulkKeys(c: Context, metadataManager: MetadataManager): Promise<(Response & import("hono").TypedResponse<{
|
|
8
|
-
error: string;
|
|
9
|
-
}, 400, "json">) | (Response & import("hono").TypedResponse<{
|
|
10
|
-
success: true;
|
|
11
|
-
}, import("hono/utils/http-status").ContentfulStatusCode, "json">) | (Response & import("hono").TypedResponse<{
|
|
12
|
-
error: string;
|
|
13
|
-
}, 500, "json">)>;
|
|
14
|
-
//# sourceMappingURL=providers-post-bulk-keys.route.d.ts.map
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* POST /api/providers/bulk-keys
|
|
3
|
-
* Save all provider API keys at once
|
|
4
|
-
*/
|
|
5
|
-
import { updateEnvFile } from "../../core/env-manager.js";
|
|
6
|
-
import { resolveProviderKeyName } from "./provider-resolver.js";
|
|
7
|
-
export async function postProviderBulkKeys(c, metadataManager) {
|
|
8
|
-
try {
|
|
9
|
-
const { keys } = await c.req.json(); // keys is Record<string, string> where key is providerName
|
|
10
|
-
if (!keys || typeof keys !== "object") {
|
|
11
|
-
return c.json({ error: "keys object is required" }, 400);
|
|
12
|
-
}
|
|
13
|
-
await metadataManager.saveAllProviderKeys(keys);
|
|
14
|
-
// Also update .env for all providers that have a keyName (from catalog or hardcoded)
|
|
15
|
-
const envUpdates = {};
|
|
16
|
-
for (const [providerName, apiKey] of Object.entries(keys)) {
|
|
17
|
-
const keyName = await resolveProviderKeyName(providerName);
|
|
18
|
-
if (keyName) {
|
|
19
|
-
envUpdates[keyName] = apiKey;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
if (Object.keys(envUpdates).length > 0) {
|
|
23
|
-
await updateEnvFile(envUpdates);
|
|
24
|
-
}
|
|
25
|
-
return c.json({ success: true });
|
|
26
|
-
}
|
|
27
|
-
catch (error) {
|
|
28
|
-
return c.json({ error: `Failed to save bulk provider keys: ${String(error)}` }, 500);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=providers-post-bulk-keys.route.js.map
|