innocode 1.0.0 → 1.0.229
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/LICENSE +21 -0
- package/package.json +17 -118
- package/AGENTS.md +0 -27
- package/Dockerfile +0 -18
- package/README.md +0 -15
- package/bunfig.toml +0 -5
- package/parsers-config.ts +0 -253
- package/script/build.ts +0 -198
- package/script/publish.ts +0 -186
- package/script/schema.ts +0 -47
- package/script/seed-e2e.ts +0 -50
- package/src/acp/README.md +0 -164
- package/src/acp/agent.ts +0 -1676
- package/src/acp/session.ts +0 -117
- package/src/acp/types.ts +0 -23
- package/src/agent/agent.ts +0 -338
- package/src/agent/generate.txt +0 -75
- package/src/agent/prompt/compaction.txt +0 -14
- package/src/agent/prompt/explore.txt +0 -18
- package/src/agent/prompt/summary.txt +0 -11
- package/src/agent/prompt/title.txt +0 -44
- package/src/auth/index.ts +0 -70
- package/src/bun/index.ts +0 -137
- package/src/bun/registry.ts +0 -48
- package/src/bus/bus-event.ts +0 -43
- package/src/bus/global.ts +0 -10
- package/src/bus/index.ts +0 -105
- package/src/cli/bootstrap.ts +0 -17
- package/src/cli/cmd/acp.ts +0 -70
- package/src/cli/cmd/agent.ts +0 -257
- package/src/cli/cmd/auth.ts +0 -400
- package/src/cli/cmd/cmd.ts +0 -7
- package/src/cli/cmd/debug/agent.ts +0 -167
- package/src/cli/cmd/debug/config.ts +0 -16
- package/src/cli/cmd/debug/file.ts +0 -97
- package/src/cli/cmd/debug/index.ts +0 -48
- package/src/cli/cmd/debug/lsp.ts +0 -52
- package/src/cli/cmd/debug/ripgrep.ts +0 -87
- package/src/cli/cmd/debug/scrap.ts +0 -16
- package/src/cli/cmd/debug/skill.ts +0 -16
- package/src/cli/cmd/debug/snapshot.ts +0 -52
- package/src/cli/cmd/export.ts +0 -88
- package/src/cli/cmd/generate.ts +0 -38
- package/src/cli/cmd/github.ts +0 -1540
- package/src/cli/cmd/import.ts +0 -147
- package/src/cli/cmd/mcp.ts +0 -765
- package/src/cli/cmd/models.ts +0 -77
- package/src/cli/cmd/pr.ts +0 -113
- package/src/cli/cmd/run.ts +0 -598
- package/src/cli/cmd/serve.ts +0 -20
- package/src/cli/cmd/session.ts +0 -135
- package/src/cli/cmd/stats.ts +0 -426
- package/src/cli/cmd/tui/app.tsx +0 -812
- package/src/cli/cmd/tui/attach.ts +0 -60
- package/src/cli/cmd/tui/component/border.tsx +0 -21
- package/src/cli/cmd/tui/component/dialog-agent.tsx +0 -31
- package/src/cli/cmd/tui/component/dialog-command.tsx +0 -148
- package/src/cli/cmd/tui/component/dialog-mcp.tsx +0 -86
- package/src/cli/cmd/tui/component/dialog-model.tsx +0 -165
- package/src/cli/cmd/tui/component/dialog-provider.tsx +0 -243
- package/src/cli/cmd/tui/component/dialog-session-list.tsx +0 -108
- package/src/cli/cmd/tui/component/dialog-session-rename.tsx +0 -31
- package/src/cli/cmd/tui/component/dialog-skill.tsx +0 -36
- package/src/cli/cmd/tui/component/dialog-stash.tsx +0 -87
- package/src/cli/cmd/tui/component/dialog-status.tsx +0 -167
- package/src/cli/cmd/tui/component/dialog-tag.tsx +0 -44
- package/src/cli/cmd/tui/component/dialog-theme-list.tsx +0 -50
- package/src/cli/cmd/tui/component/logo.tsx +0 -85
- package/src/cli/cmd/tui/component/prompt/autocomplete.tsx +0 -666
- package/src/cli/cmd/tui/component/prompt/frecency.tsx +0 -89
- package/src/cli/cmd/tui/component/prompt/history.tsx +0 -108
- package/src/cli/cmd/tui/component/prompt/index.tsx +0 -1153
- package/src/cli/cmd/tui/component/prompt/stash.tsx +0 -101
- package/src/cli/cmd/tui/component/spinner.tsx +0 -24
- package/src/cli/cmd/tui/component/textarea-keybindings.ts +0 -73
- package/src/cli/cmd/tui/component/tips.tsx +0 -153
- package/src/cli/cmd/tui/component/todo-item.tsx +0 -32
- package/src/cli/cmd/tui/context/args.tsx +0 -15
- package/src/cli/cmd/tui/context/directory.ts +0 -13
- package/src/cli/cmd/tui/context/exit.tsx +0 -54
- package/src/cli/cmd/tui/context/helper.tsx +0 -25
- package/src/cli/cmd/tui/context/keybind.tsx +0 -100
- package/src/cli/cmd/tui/context/kv.tsx +0 -52
- package/src/cli/cmd/tui/context/local.tsx +0 -409
- package/src/cli/cmd/tui/context/prompt.tsx +0 -18
- package/src/cli/cmd/tui/context/route.tsx +0 -46
- package/src/cli/cmd/tui/context/sdk.tsx +0 -101
- package/src/cli/cmd/tui/context/sync.tsx +0 -470
- package/src/cli/cmd/tui/context/theme/aura.json +0 -69
- package/src/cli/cmd/tui/context/theme/ayu.json +0 -80
- package/src/cli/cmd/tui/context/theme/carbonfox.json +0 -248
- package/src/cli/cmd/tui/context/theme/catppuccin-frappe.json +0 -233
- package/src/cli/cmd/tui/context/theme/catppuccin-macchiato.json +0 -233
- package/src/cli/cmd/tui/context/theme/catppuccin.json +0 -112
- package/src/cli/cmd/tui/context/theme/cobalt2.json +0 -228
- package/src/cli/cmd/tui/context/theme/cursor.json +0 -249
- package/src/cli/cmd/tui/context/theme/dracula.json +0 -219
- package/src/cli/cmd/tui/context/theme/everforest.json +0 -241
- package/src/cli/cmd/tui/context/theme/flexoki.json +0 -237
- package/src/cli/cmd/tui/context/theme/github.json +0 -233
- package/src/cli/cmd/tui/context/theme/gruvbox.json +0 -242
- package/src/cli/cmd/tui/context/theme/innocode.json +0 -245
- package/src/cli/cmd/tui/context/theme/kanagawa.json +0 -77
- package/src/cli/cmd/tui/context/theme/lucent-orng.json +0 -237
- package/src/cli/cmd/tui/context/theme/material.json +0 -235
- package/src/cli/cmd/tui/context/theme/matrix.json +0 -77
- package/src/cli/cmd/tui/context/theme/mercury.json +0 -252
- package/src/cli/cmd/tui/context/theme/monokai.json +0 -221
- package/src/cli/cmd/tui/context/theme/nightowl.json +0 -221
- package/src/cli/cmd/tui/context/theme/nord.json +0 -223
- package/src/cli/cmd/tui/context/theme/one-dark.json +0 -84
- package/src/cli/cmd/tui/context/theme/orng.json +0 -249
- package/src/cli/cmd/tui/context/theme/osaka-jade.json +0 -93
- package/src/cli/cmd/tui/context/theme/palenight.json +0 -222
- package/src/cli/cmd/tui/context/theme/rosepine.json +0 -234
- package/src/cli/cmd/tui/context/theme/solarized.json +0 -223
- package/src/cli/cmd/tui/context/theme/synthwave84.json +0 -226
- package/src/cli/cmd/tui/context/theme/tokyonight.json +0 -243
- package/src/cli/cmd/tui/context/theme/vercel.json +0 -245
- package/src/cli/cmd/tui/context/theme/vesper.json +0 -218
- package/src/cli/cmd/tui/context/theme/zenburn.json +0 -223
- package/src/cli/cmd/tui/context/theme.tsx +0 -1154
- package/src/cli/cmd/tui/event.ts +0 -48
- package/src/cli/cmd/tui/routes/home.tsx +0 -145
- package/src/cli/cmd/tui/routes/session/dialog-fork-from-timeline.tsx +0 -64
- package/src/cli/cmd/tui/routes/session/dialog-message.tsx +0 -109
- package/src/cli/cmd/tui/routes/session/dialog-subagent.tsx +0 -26
- package/src/cli/cmd/tui/routes/session/dialog-timeline.tsx +0 -47
- package/src/cli/cmd/tui/routes/session/footer.tsx +0 -91
- package/src/cli/cmd/tui/routes/session/header.tsx +0 -135
- package/src/cli/cmd/tui/routes/session/index.tsx +0 -2139
- package/src/cli/cmd/tui/routes/session/permission.tsx +0 -508
- package/src/cli/cmd/tui/routes/session/question.tsx +0 -466
- package/src/cli/cmd/tui/routes/session/sidebar.tsx +0 -313
- package/src/cli/cmd/tui/thread.ts +0 -188
- package/src/cli/cmd/tui/ui/dialog-alert.tsx +0 -59
- package/src/cli/cmd/tui/ui/dialog-confirm.tsx +0 -85
- package/src/cli/cmd/tui/ui/dialog-export-options.tsx +0 -207
- package/src/cli/cmd/tui/ui/dialog-help.tsx +0 -40
- package/src/cli/cmd/tui/ui/dialog-prompt.tsx +0 -80
- package/src/cli/cmd/tui/ui/dialog-select.tsx +0 -401
- package/src/cli/cmd/tui/ui/dialog.tsx +0 -167
- package/src/cli/cmd/tui/ui/link.tsx +0 -28
- package/src/cli/cmd/tui/ui/spinner.ts +0 -368
- package/src/cli/cmd/tui/ui/toast.tsx +0 -100
- package/src/cli/cmd/tui/util/clipboard.ts +0 -159
- package/src/cli/cmd/tui/util/editor.ts +0 -32
- package/src/cli/cmd/tui/util/signal.ts +0 -7
- package/src/cli/cmd/tui/util/terminal.ts +0 -114
- package/src/cli/cmd/tui/util/transcript.ts +0 -98
- package/src/cli/cmd/tui/win32.ts +0 -129
- package/src/cli/cmd/tui/worker.ts +0 -152
- package/src/cli/cmd/uninstall.ts +0 -363
- package/src/cli/cmd/upgrade.ts +0 -73
- package/src/cli/cmd/web.ts +0 -81
- package/src/cli/error.ts +0 -57
- package/src/cli/logo.ts +0 -6
- package/src/cli/network.ts +0 -60
- package/src/cli/ui.ts +0 -113
- package/src/cli/upgrade.ts +0 -25
- package/src/command/index.ts +0 -150
- package/src/command/template/initialize.txt +0 -10
- package/src/command/template/review.txt +0 -101
- package/src/config/config.ts +0 -1517
- package/src/config/markdown.ts +0 -98
- package/src/env/index.ts +0 -28
- package/src/file/ignore.ts +0 -83
- package/src/file/index.ts +0 -583
- package/src/file/ripgrep.ts +0 -375
- package/src/file/time.ts +0 -69
- package/src/file/watcher.ts +0 -127
- package/src/flag/flag.ts +0 -148
- package/src/format/formatter.ts +0 -366
- package/src/format/index.ts +0 -137
- package/src/global/index.ts +0 -80
- package/src/id/id.ts +0 -83
- package/src/ide/index.ts +0 -76
- package/src/index.ts +0 -160
- package/src/installation/index.ts +0 -268
- package/src/lsp/client.ts +0 -252
- package/src/lsp/index.ts +0 -485
- package/src/lsp/language.ts +0 -119
- package/src/lsp/server.ts +0 -2046
- package/src/mcp/auth.ts +0 -132
- package/src/mcp/index.ts +0 -937
- package/src/mcp/oauth-callback.ts +0 -200
- package/src/mcp/oauth-provider.ts +0 -154
- package/src/patch/index.ts +0 -680
- package/src/permission/arity.ts +0 -163
- package/src/permission/index.ts +0 -210
- package/src/permission/next.ts +0 -280
- package/src/plugin/codex.ts +0 -624
- package/src/plugin/copilot.ts +0 -327
- package/src/plugin/index.ts +0 -138
- package/src/project/bootstrap.ts +0 -35
- package/src/project/instance.ts +0 -114
- package/src/project/project.ts +0 -371
- package/src/project/state.ts +0 -70
- package/src/project/vcs.ts +0 -76
- package/src/provider/auth.ts +0 -147
- package/src/provider/error.ts +0 -189
- package/src/provider/models.ts +0 -133
- package/src/provider/provider.ts +0 -1370
- package/src/provider/sdk/copilot/README.md +0 -5
- package/src/provider/sdk/copilot/chat/convert-to-openai-compatible-chat-messages.ts +0 -164
- package/src/provider/sdk/copilot/chat/get-response-metadata.ts +0 -15
- package/src/provider/sdk/copilot/chat/map-openai-compatible-finish-reason.ts +0 -17
- package/src/provider/sdk/copilot/chat/openai-compatible-api-types.ts +0 -64
- package/src/provider/sdk/copilot/chat/openai-compatible-chat-language-model.ts +0 -780
- package/src/provider/sdk/copilot/chat/openai-compatible-chat-options.ts +0 -28
- package/src/provider/sdk/copilot/chat/openai-compatible-metadata-extractor.ts +0 -44
- package/src/provider/sdk/copilot/chat/openai-compatible-prepare-tools.ts +0 -87
- package/src/provider/sdk/copilot/copilot-provider.ts +0 -100
- package/src/provider/sdk/copilot/index.ts +0 -2
- package/src/provider/sdk/copilot/openai-compatible-error.ts +0 -27
- package/src/provider/sdk/copilot/responses/convert-to-openai-responses-input.ts +0 -303
- package/src/provider/sdk/copilot/responses/map-openai-responses-finish-reason.ts +0 -22
- package/src/provider/sdk/copilot/responses/openai-config.ts +0 -18
- package/src/provider/sdk/copilot/responses/openai-error.ts +0 -22
- package/src/provider/sdk/copilot/responses/openai-responses-api-types.ts +0 -207
- package/src/provider/sdk/copilot/responses/openai-responses-language-model.ts +0 -1732
- package/src/provider/sdk/copilot/responses/openai-responses-prepare-tools.ts +0 -177
- package/src/provider/sdk/copilot/responses/openai-responses-settings.ts +0 -1
- package/src/provider/sdk/copilot/responses/tool/code-interpreter.ts +0 -88
- package/src/provider/sdk/copilot/responses/tool/file-search.ts +0 -128
- package/src/provider/sdk/copilot/responses/tool/image-generation.ts +0 -115
- package/src/provider/sdk/copilot/responses/tool/local-shell.ts +0 -65
- package/src/provider/sdk/copilot/responses/tool/web-search-preview.ts +0 -104
- package/src/provider/sdk/copilot/responses/tool/web-search.ts +0 -103
- package/src/provider/transform.ts +0 -806
- package/src/pty/index.ts +0 -286
- package/src/question/index.ts +0 -171
- package/src/scheduler/index.ts +0 -61
- package/src/server/error.ts +0 -36
- package/src/server/event.ts +0 -7
- package/src/server/mdns.ts +0 -60
- package/src/server/routes/config.ts +0 -92
- package/src/server/routes/experimental.ts +0 -208
- package/src/server/routes/file.ts +0 -197
- package/src/server/routes/global.ts +0 -183
- package/src/server/routes/mcp.ts +0 -225
- package/src/server/routes/permission.ts +0 -68
- package/src/server/routes/project.ts +0 -82
- package/src/server/routes/provider.ts +0 -179
- package/src/server/routes/pty.ts +0 -176
- package/src/server/routes/question.ts +0 -98
- package/src/server/routes/session.ts +0 -939
- package/src/server/routes/tui.ts +0 -379
- package/src/server/server.ts +0 -621
- package/src/session/compaction.ts +0 -261
- package/src/session/index.ts +0 -543
- package/src/session/instruction.ts +0 -197
- package/src/session/llm.ts +0 -283
- package/src/session/message-v2.ts +0 -841
- package/src/session/message.ts +0 -189
- package/src/session/processor.ts +0 -410
- package/src/session/prompt/anthropic-20250930.txt +0 -166
- package/src/session/prompt/anthropic.txt +0 -105
- package/src/session/prompt/beast.txt +0 -147
- package/src/session/prompt/build-switch.txt +0 -5
- package/src/session/prompt/codex_header.txt +0 -79
- package/src/session/prompt/copilot-gpt-5.txt +0 -143
- package/src/session/prompt/gemini.txt +0 -155
- package/src/session/prompt/max-steps.txt +0 -16
- package/src/session/prompt/plan-reminder-anthropic.txt +0 -67
- package/src/session/prompt/plan.txt +0 -26
- package/src/session/prompt/qwen.txt +0 -109
- package/src/session/prompt/trinity.txt +0 -97
- package/src/session/prompt.ts +0 -1964
- package/src/session/retry.ts +0 -101
- package/src/session/revert.ts +0 -121
- package/src/session/status.ts +0 -76
- package/src/session/summary.ts +0 -203
- package/src/session/system.ts +0 -54
- package/src/session/todo.ts +0 -37
- package/src/share/share-next.ts +0 -200
- package/src/share/share.ts +0 -92
- package/src/shell/shell.ts +0 -67
- package/src/skill/discovery.ts +0 -97
- package/src/skill/index.ts +0 -1
- package/src/skill/skill.ts +0 -188
- package/src/snapshot/index.ts +0 -255
- package/src/storage/storage.ts +0 -227
- package/src/tool/apply_patch.ts +0 -281
- package/src/tool/apply_patch.txt +0 -33
- package/src/tool/bash.ts +0 -269
- package/src/tool/bash.txt +0 -115
- package/src/tool/batch.ts +0 -175
- package/src/tool/batch.txt +0 -24
- package/src/tool/codesearch.ts +0 -132
- package/src/tool/codesearch.txt +0 -12
- package/src/tool/edit.ts +0 -655
- package/src/tool/edit.txt +0 -10
- package/src/tool/external-directory.ts +0 -32
- package/src/tool/glob.ts +0 -80
- package/src/tool/glob.txt +0 -6
- package/src/tool/grep.ts +0 -150
- package/src/tool/grep.txt +0 -8
- package/src/tool/invalid.ts +0 -17
- package/src/tool/ls.ts +0 -121
- package/src/tool/ls.txt +0 -1
- package/src/tool/lsp.ts +0 -96
- package/src/tool/lsp.txt +0 -19
- package/src/tool/multiedit.ts +0 -46
- package/src/tool/multiedit.txt +0 -41
- package/src/tool/plan-enter.txt +0 -14
- package/src/tool/plan-exit.txt +0 -13
- package/src/tool/plan.ts +0 -130
- package/src/tool/question.ts +0 -33
- package/src/tool/question.txt +0 -10
- package/src/tool/read.ts +0 -261
- package/src/tool/read.txt +0 -14
- package/src/tool/registry.ts +0 -160
- package/src/tool/skill.ts +0 -123
- package/src/tool/task.ts +0 -165
- package/src/tool/task.txt +0 -60
- package/src/tool/todo.ts +0 -53
- package/src/tool/todoread.txt +0 -14
- package/src/tool/todowrite.txt +0 -167
- package/src/tool/tool.ts +0 -89
- package/src/tool/truncation.ts +0 -106
- package/src/tool/webfetch.ts +0 -186
- package/src/tool/webfetch.txt +0 -13
- package/src/tool/websearch.ts +0 -150
- package/src/tool/websearch.txt +0 -14
- package/src/tool/write.ts +0 -85
- package/src/tool/write.txt +0 -8
- package/src/util/abort.ts +0 -35
- package/src/util/archive.ts +0 -16
- package/src/util/color.ts +0 -19
- package/src/util/context.ts +0 -25
- package/src/util/defer.ts +0 -12
- package/src/util/eventloop.ts +0 -20
- package/src/util/filesystem.ts +0 -93
- package/src/util/fn.ts +0 -11
- package/src/util/format.ts +0 -20
- package/src/util/iife.ts +0 -3
- package/src/util/keybind.ts +0 -103
- package/src/util/lazy.ts +0 -18
- package/src/util/locale.ts +0 -81
- package/src/util/lock.ts +0 -98
- package/src/util/log.ts +0 -180
- package/src/util/proxied.ts +0 -3
- package/src/util/queue.ts +0 -32
- package/src/util/rpc.ts +0 -66
- package/src/util/scrap.ts +0 -10
- package/src/util/signal.ts +0 -12
- package/src/util/timeout.ts +0 -14
- package/src/util/token.ts +0 -7
- package/src/util/wildcard.ts +0 -56
- package/src/worktree/index.ts +0 -612
- package/sst-env.d.ts +0 -9
- package/test/acp/agent-interface.test.ts +0 -51
- package/test/acp/event-subscription.test.ts +0 -436
- package/test/agent/agent.test.ts +0 -675
- package/test/bun.test.ts +0 -53
- package/test/cli/github-action.test.ts +0 -161
- package/test/cli/github-remote.test.ts +0 -80
- package/test/cli/import.test.ts +0 -38
- package/test/cli/tui/transcript.test.ts +0 -322
- package/test/config/agent-color.test.ts +0 -71
- package/test/config/config.test.ts +0 -1802
- package/test/config/fixtures/empty-frontmatter.md +0 -4
- package/test/config/fixtures/frontmatter.md +0 -28
- package/test/config/fixtures/markdown-header.md +0 -11
- package/test/config/fixtures/no-frontmatter.md +0 -1
- package/test/config/fixtures/weird-model-id.md +0 -13
- package/test/config/markdown.test.ts +0 -228
- package/test/file/ignore.test.ts +0 -10
- package/test/file/path-traversal.test.ts +0 -198
- package/test/file/ripgrep.test.ts +0 -39
- package/test/fixture/fixture.ts +0 -45
- package/test/fixture/lsp/fake-lsp-server.js +0 -77
- package/test/ide/ide.test.ts +0 -82
- package/test/keybind.test.ts +0 -421
- package/test/lsp/client.test.ts +0 -95
- package/test/mcp/headers.test.ts +0 -153
- package/test/mcp/oauth-browser.test.ts +0 -249
- package/test/memory/abort-leak.test.ts +0 -136
- package/test/patch/patch.test.ts +0 -348
- package/test/permission/arity.test.ts +0 -33
- package/test/permission/next.test.ts +0 -690
- package/test/permission-task.test.ts +0 -319
- package/test/plugin/auth-override.test.ts +0 -44
- package/test/plugin/codex.test.ts +0 -123
- package/test/preload.ts +0 -63
- package/test/project/project.test.ts +0 -120
- package/test/provider/amazon-bedrock.test.ts +0 -445
- package/test/provider/copilot/convert-to-copilot-messages.test.ts +0 -523
- package/test/provider/copilot/copilot-chat-model.test.ts +0 -592
- package/test/provider/gitlab-duo.test.ts +0 -262
- package/test/provider/provider.test.ts +0 -2129
- package/test/provider/transform.test.ts +0 -1928
- package/test/question/question.test.ts +0 -300
- package/test/scheduler.test.ts +0 -73
- package/test/server/session-list.test.ts +0 -39
- package/test/server/session-select.test.ts +0 -78
- package/test/session/compaction.test.ts +0 -423
- package/test/session/instruction.test.ts +0 -170
- package/test/session/llm.test.ts +0 -667
- package/test/session/message-v2.test.ts +0 -924
- package/test/session/prompt-missing-file.test.ts +0 -53
- package/test/session/prompt-special-chars.test.ts +0 -56
- package/test/session/prompt-variant.test.ts +0 -68
- package/test/session/retry.test.ts +0 -188
- package/test/session/revert-compact.test.ts +0 -285
- package/test/session/session.test.ts +0 -71
- package/test/session/structured-output-integration.test.ts +0 -233
- package/test/session/structured-output.test.ts +0 -385
- package/test/skill/discovery.test.ts +0 -60
- package/test/skill/skill.test.ts +0 -388
- package/test/snapshot/snapshot.test.ts +0 -1040
- package/test/tool/__snapshots__/tool.test.ts.snap +0 -9
- package/test/tool/apply_patch.test.ts +0 -559
- package/test/tool/bash.test.ts +0 -399
- package/test/tool/external-directory.test.ts +0 -127
- package/test/tool/fixtures/large-image.png +0 -0
- package/test/tool/fixtures/models-api.json +0 -38413
- package/test/tool/grep.test.ts +0 -110
- package/test/tool/question.test.ts +0 -107
- package/test/tool/read.test.ts +0 -421
- package/test/tool/registry.test.ts +0 -122
- package/test/tool/skill.test.ts +0 -112
- package/test/tool/truncation.test.ts +0 -159
- package/test/util/filesystem.test.ts +0 -39
- package/test/util/format.test.ts +0 -59
- package/test/util/iife.test.ts +0 -36
- package/test/util/lazy.test.ts +0 -50
- package/test/util/lock.test.ts +0 -72
- package/test/util/timeout.test.ts +0 -21
- package/test/util/wildcard.test.ts +0 -75
- package/tsconfig.json +0 -16
- /package/{script/postinstall.mjs → postinstall.mjs} +0 -0
package/src/provider/error.ts
DELETED
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
import { APICallError } from "ai"
|
|
2
|
-
import { STATUS_CODES } from "http"
|
|
3
|
-
import { iife } from "@/util/iife"
|
|
4
|
-
|
|
5
|
-
export namespace ProviderError {
|
|
6
|
-
// Adapted from overflow detection patterns in:
|
|
7
|
-
// https://github.com/badlogic/pi-mono/blob/main/packages/ai/src/utils/overflow.ts
|
|
8
|
-
const OVERFLOW_PATTERNS = [
|
|
9
|
-
/prompt is too long/i, // Anthropic
|
|
10
|
-
/input is too long for requested model/i, // Amazon Bedrock
|
|
11
|
-
/exceeds the context window/i, // OpenAI (Completions + Responses API message text)
|
|
12
|
-
/input token count.*exceeds the maximum/i, // Google (Gemini)
|
|
13
|
-
/maximum prompt length is \d+/i, // xAI (Grok)
|
|
14
|
-
/reduce the length of the messages/i, // Groq
|
|
15
|
-
/maximum context length is \d+ tokens/i, // OpenRouter, DeepSeek
|
|
16
|
-
/exceeds the limit of \d+/i, // GitHub Copilot
|
|
17
|
-
/exceeds the available context size/i, // llama.cpp server
|
|
18
|
-
/greater than the context length/i, // LM Studio
|
|
19
|
-
/context window exceeds limit/i, // MiniMax
|
|
20
|
-
/exceeded model token limit/i, // Kimi For Coding, Moonshot
|
|
21
|
-
/context[_ ]length[_ ]exceeded/i, // Generic fallback
|
|
22
|
-
]
|
|
23
|
-
|
|
24
|
-
function isOpenAiErrorRetryable(e: APICallError) {
|
|
25
|
-
const status = e.statusCode
|
|
26
|
-
if (!status) return e.isRetryable
|
|
27
|
-
// openai sometimes returns 404 for models that are actually available
|
|
28
|
-
return status === 404 || e.isRetryable
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Providers not reliably handled in this function:
|
|
32
|
-
// - z.ai: can accept overflow silently (needs token-count/context-window checks)
|
|
33
|
-
function isOverflow(message: string) {
|
|
34
|
-
if (OVERFLOW_PATTERNS.some((p) => p.test(message))) return true
|
|
35
|
-
|
|
36
|
-
// Providers/status patterns handled outside of regex list:
|
|
37
|
-
// - Cerebras: often returns "400 (no body)" / "413 (no body)"
|
|
38
|
-
// - Mistral: often returns "400 (no body)" / "413 (no body)"
|
|
39
|
-
return /^4(00|13)\s*(status code)?\s*\(no body\)/i.test(message)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function error(providerID: string, error: APICallError) {
|
|
43
|
-
if (providerID.includes("github-copilot") && error.statusCode === 403) {
|
|
44
|
-
return "Please reauthenticate with the copilot provider to ensure your credentials work properly with InnoCode."
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return error.message
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function message(providerID: string, e: APICallError) {
|
|
51
|
-
return iife(() => {
|
|
52
|
-
const msg = e.message
|
|
53
|
-
if (msg === "") {
|
|
54
|
-
if (e.responseBody) return e.responseBody
|
|
55
|
-
if (e.statusCode) {
|
|
56
|
-
const err = STATUS_CODES[e.statusCode]
|
|
57
|
-
if (err) return err
|
|
58
|
-
}
|
|
59
|
-
return "Unknown error"
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const transformed = error(providerID, e)
|
|
63
|
-
if (transformed !== msg) {
|
|
64
|
-
return transformed
|
|
65
|
-
}
|
|
66
|
-
if (!e.responseBody || (e.statusCode && msg !== STATUS_CODES[e.statusCode])) {
|
|
67
|
-
return msg
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
try {
|
|
71
|
-
const body = JSON.parse(e.responseBody)
|
|
72
|
-
// try to extract common error message fields
|
|
73
|
-
const errMsg = body.message || body.error || body.error?.message
|
|
74
|
-
if (errMsg && typeof errMsg === "string") {
|
|
75
|
-
return `${msg}: ${errMsg}`
|
|
76
|
-
}
|
|
77
|
-
} catch {}
|
|
78
|
-
|
|
79
|
-
return `${msg}: ${e.responseBody}`
|
|
80
|
-
}).trim()
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function json(input: unknown) {
|
|
84
|
-
if (typeof input === "string") {
|
|
85
|
-
try {
|
|
86
|
-
const result = JSON.parse(input)
|
|
87
|
-
if (result && typeof result === "object") return result
|
|
88
|
-
return undefined
|
|
89
|
-
} catch {
|
|
90
|
-
return undefined
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
if (typeof input === "object" && input !== null) {
|
|
94
|
-
return input
|
|
95
|
-
}
|
|
96
|
-
return undefined
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export type ParsedStreamError =
|
|
100
|
-
| {
|
|
101
|
-
type: "context_overflow"
|
|
102
|
-
message: string
|
|
103
|
-
responseBody: string
|
|
104
|
-
}
|
|
105
|
-
| {
|
|
106
|
-
type: "api_error"
|
|
107
|
-
message: string
|
|
108
|
-
isRetryable: false
|
|
109
|
-
responseBody: string
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export function parseStreamError(input: unknown): ParsedStreamError | undefined {
|
|
113
|
-
const body = json(input)
|
|
114
|
-
if (!body) return
|
|
115
|
-
|
|
116
|
-
const responseBody = JSON.stringify(body)
|
|
117
|
-
if (body.type !== "error") return
|
|
118
|
-
|
|
119
|
-
switch (body?.error?.code) {
|
|
120
|
-
case "context_length_exceeded":
|
|
121
|
-
return {
|
|
122
|
-
type: "context_overflow",
|
|
123
|
-
message: "Input exceeds context window of this model",
|
|
124
|
-
responseBody,
|
|
125
|
-
}
|
|
126
|
-
case "insufficient_quota":
|
|
127
|
-
return {
|
|
128
|
-
type: "api_error",
|
|
129
|
-
message: "Quota exceeded. Check your plan and billing details.",
|
|
130
|
-
isRetryable: false,
|
|
131
|
-
responseBody,
|
|
132
|
-
}
|
|
133
|
-
case "usage_not_included":
|
|
134
|
-
return {
|
|
135
|
-
type: "api_error",
|
|
136
|
-
message: "To use Codex with your ChatGPT plan, upgrade to Plus: https://chatgpt.com/explore/plus.",
|
|
137
|
-
isRetryable: false,
|
|
138
|
-
responseBody,
|
|
139
|
-
}
|
|
140
|
-
case "invalid_prompt":
|
|
141
|
-
return {
|
|
142
|
-
type: "api_error",
|
|
143
|
-
message: typeof body?.error?.message === "string" ? body?.error?.message : "Invalid prompt.",
|
|
144
|
-
isRetryable: false,
|
|
145
|
-
responseBody,
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
export type ParsedAPICallError =
|
|
151
|
-
| {
|
|
152
|
-
type: "context_overflow"
|
|
153
|
-
message: string
|
|
154
|
-
responseBody?: string
|
|
155
|
-
}
|
|
156
|
-
| {
|
|
157
|
-
type: "api_error"
|
|
158
|
-
message: string
|
|
159
|
-
statusCode?: number
|
|
160
|
-
isRetryable: boolean
|
|
161
|
-
responseHeaders?: Record<string, string>
|
|
162
|
-
responseBody?: string
|
|
163
|
-
metadata?: Record<string, string>
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
export function parseAPICallError(input: { providerID: string; error: APICallError }): ParsedAPICallError {
|
|
167
|
-
const m = message(input.providerID, input.error)
|
|
168
|
-
if (isOverflow(m)) {
|
|
169
|
-
return {
|
|
170
|
-
type: "context_overflow",
|
|
171
|
-
message: m,
|
|
172
|
-
responseBody: input.error.responseBody,
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
const metadata = input.error.url ? { url: input.error.url } : undefined
|
|
177
|
-
return {
|
|
178
|
-
type: "api_error",
|
|
179
|
-
message: m,
|
|
180
|
-
statusCode: input.error.statusCode,
|
|
181
|
-
isRetryable: input.providerID.startsWith("openai")
|
|
182
|
-
? isOpenAiErrorRetryable(input.error)
|
|
183
|
-
: input.error.isRetryable,
|
|
184
|
-
responseHeaders: input.error.responseHeaders,
|
|
185
|
-
responseBody: input.error.responseBody,
|
|
186
|
-
metadata,
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}
|
package/src/provider/models.ts
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { Global } from "../global"
|
|
2
|
-
import { Log } from "../util/log"
|
|
3
|
-
import path from "path"
|
|
4
|
-
import z from "zod"
|
|
5
|
-
import { Installation } from "../installation"
|
|
6
|
-
import { Flag } from "../flag/flag"
|
|
7
|
-
import { lazy } from "@/util/lazy"
|
|
8
|
-
|
|
9
|
-
// Try to import bundled snapshot (generated at build time)
|
|
10
|
-
// Falls back to undefined in dev mode when snapshot doesn't exist
|
|
11
|
-
/* @ts-ignore */
|
|
12
|
-
|
|
13
|
-
export namespace ModelsDev {
|
|
14
|
-
const log = Log.create({ service: "models.dev" })
|
|
15
|
-
const filepath = path.join(Global.Path.cache, "models.json")
|
|
16
|
-
|
|
17
|
-
export const Model = z.object({
|
|
18
|
-
id: z.string(),
|
|
19
|
-
name: z.string(),
|
|
20
|
-
family: z.string().optional(),
|
|
21
|
-
release_date: z.string(),
|
|
22
|
-
attachment: z.boolean(),
|
|
23
|
-
reasoning: z.boolean(),
|
|
24
|
-
temperature: z.boolean(),
|
|
25
|
-
tool_call: z.boolean(),
|
|
26
|
-
interleaved: z
|
|
27
|
-
.union([
|
|
28
|
-
z.literal(true),
|
|
29
|
-
z
|
|
30
|
-
.object({
|
|
31
|
-
field: z.enum(["reasoning_content", "reasoning_details"]),
|
|
32
|
-
})
|
|
33
|
-
.strict(),
|
|
34
|
-
])
|
|
35
|
-
.optional(),
|
|
36
|
-
cost: z
|
|
37
|
-
.object({
|
|
38
|
-
input: z.number(),
|
|
39
|
-
output: z.number(),
|
|
40
|
-
cache_read: z.number().optional(),
|
|
41
|
-
cache_write: z.number().optional(),
|
|
42
|
-
context_over_200k: z
|
|
43
|
-
.object({
|
|
44
|
-
input: z.number(),
|
|
45
|
-
output: z.number(),
|
|
46
|
-
cache_read: z.number().optional(),
|
|
47
|
-
cache_write: z.number().optional(),
|
|
48
|
-
})
|
|
49
|
-
.optional(),
|
|
50
|
-
})
|
|
51
|
-
.optional(),
|
|
52
|
-
limit: z.object({
|
|
53
|
-
context: z.number(),
|
|
54
|
-
input: z.number().optional(),
|
|
55
|
-
output: z.number(),
|
|
56
|
-
}),
|
|
57
|
-
modalities: z
|
|
58
|
-
.object({
|
|
59
|
-
input: z.array(z.enum(["text", "audio", "image", "video", "pdf"])),
|
|
60
|
-
output: z.array(z.enum(["text", "audio", "image", "video", "pdf"])),
|
|
61
|
-
})
|
|
62
|
-
.optional(),
|
|
63
|
-
experimental: z.boolean().optional(),
|
|
64
|
-
status: z.enum(["alpha", "beta", "deprecated"]).optional(),
|
|
65
|
-
options: z.record(z.string(), z.any()),
|
|
66
|
-
headers: z.record(z.string(), z.string()).optional(),
|
|
67
|
-
provider: z.object({ npm: z.string(), api: z.string() }).optional(),
|
|
68
|
-
variants: z.record(z.string(), z.record(z.string(), z.any())).optional(),
|
|
69
|
-
})
|
|
70
|
-
export type Model = z.infer<typeof Model>
|
|
71
|
-
|
|
72
|
-
export const Provider = z.object({
|
|
73
|
-
api: z.string().optional(),
|
|
74
|
-
name: z.string(),
|
|
75
|
-
env: z.array(z.string()),
|
|
76
|
-
id: z.string(),
|
|
77
|
-
npm: z.string().optional(),
|
|
78
|
-
models: z.record(z.string(), Model),
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
export type Provider = z.infer<typeof Provider>
|
|
82
|
-
|
|
83
|
-
function url() {
|
|
84
|
-
return Flag.OPENCODE_MODELS_URL || "https://models.dev"
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export const Data = lazy(async () => {
|
|
88
|
-
const file = Bun.file(Flag.OPENCODE_MODELS_PATH ?? filepath)
|
|
89
|
-
const result = await file.json().catch(() => {})
|
|
90
|
-
if (result) return result
|
|
91
|
-
// @ts-ignore
|
|
92
|
-
const snapshot = await import("./models-snapshot")
|
|
93
|
-
.then((m) => m.snapshot as Record<string, unknown>)
|
|
94
|
-
.catch(() => undefined)
|
|
95
|
-
if (snapshot) return snapshot
|
|
96
|
-
if (Flag.OPENCODE_DISABLE_MODELS_FETCH) return {}
|
|
97
|
-
const json = await fetch(`${url()}/api.json`).then((x) => x.text())
|
|
98
|
-
return JSON.parse(json)
|
|
99
|
-
})
|
|
100
|
-
|
|
101
|
-
export async function get() {
|
|
102
|
-
const result = await Data()
|
|
103
|
-
return result as Record<string, Provider>
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export async function refresh() {
|
|
107
|
-
const file = Bun.file(filepath)
|
|
108
|
-
const result = await fetch(`${url()}/api.json`, {
|
|
109
|
-
headers: {
|
|
110
|
-
"User-Agent": Installation.USER_AGENT,
|
|
111
|
-
},
|
|
112
|
-
signal: AbortSignal.timeout(10 * 1000),
|
|
113
|
-
}).catch((e) => {
|
|
114
|
-
log.error("Failed to fetch models.dev", {
|
|
115
|
-
error: e,
|
|
116
|
-
})
|
|
117
|
-
})
|
|
118
|
-
if (result && result.ok) {
|
|
119
|
-
await Bun.write(file, await result.text())
|
|
120
|
-
ModelsDev.Data.reset()
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
if (!Flag.OPENCODE_DISABLE_MODELS_FETCH) {
|
|
126
|
-
ModelsDev.refresh()
|
|
127
|
-
setInterval(
|
|
128
|
-
async () => {
|
|
129
|
-
await ModelsDev.refresh()
|
|
130
|
-
},
|
|
131
|
-
60 * 1000 * 60,
|
|
132
|
-
).unref()
|
|
133
|
-
}
|