Don't load the provider SDKs when @chatcops/core is imported
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 75/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- node.js, typescript
- Domínio
- backend, developer-experience
Direção de pesquisa
Read packages/core/src/index.ts, packages/core/src/providers/index.ts, and packages/core/package.json, then trace how the build emits package entry points and tests are run. Remove the provider classes from the main exports, add typed subpath exports and the regression test described in the issue, and update the changeset. Done when the main entry does not statically load provider SDKs, all three subpaths work, and the stated checks pass.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
createProvider loads each provider's SDK with a dynamic import() (packages/core/src/providers/base.ts, lines 10 to 27), so only the one you use should load. But packages/core/src/index.ts, line 51, and packages/core/src/providers/index.ts, lines 12 to 14, also re-export ClaudeProvider, OpenAIProvider and GeminiProvider directly. That's a static import of all three SDKs, so importing anything from @chatcops/core (even FAQKnowledgeSource) loads @anthropic-ai/sdk, openai and @google/genai. That costs startup time on every serverless cold start.
What to do
- Stop re-exporting the three provider classes from
packages/core/src/index.tsandpackages/core/src/providers/index.ts. - Make them importable from subpaths instead:
@chatcops/core/providers/claude,/openaiand/gemini. Add them toexportsinpackages/core/package.jsonwithtypesandimport, the same shape as".". - Leave the SDKs in
dependencies. Making them optional is a separate decision. - Add a test that fails if the main entry loads an SDK again. One way: after the build, read
dist/index.js, follow its staticimport ... from './x.js'statements (notimport()) throughdist, and check that none of the reached files import one of the three SDK packages. - Mention the moved classes in the changeset. Nothing in our docs imports them, but someone's code might.
Where to look
packages/core/src/index.ts,packages/core/src/providers/index.ts,packages/core/package.jsonpnpm publint(in CI) checks the newexportsentries
Acceptance criteria
-
import { FAQKnowledgeSource } from '@chatcops/core'loads no provider SDK, and the new test proves it (and fails if you put the re-export back; say in the PR that you tried) -
import { ClaudeProvider } from '@chatcops/core/providers/claude'works, with types -
createProviderworks as before for all three types -
pnpm publintpasses - Changeset for
@chatcops/core(minor, with the move noted) -
pnpm test:coverageandpnpm lintpass
Want to work on this? Comment below and I'll assign it to you. Please take one issue at a time, branch off dev, and open your PR against dev with Closes #<this issue number>. Setup notes (pnpm, build before test) are in CONTRIBUTING.md.
- Linguagem predominante
- TypeScript
- Estrelas
- 13
- Forks
- 7
- Merge médio
- 4h 11min
- PRs com merge (30d)
- 122
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de codercops/chatcops
-
enhancement hacktoberfest help wanted server
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
Mantenedores costumam responder em até 1 dia
-
Document the pre-chat formTalvez já em andamento @masyarakatai assumiu há 5 dias. Abertadocumentation good first issue hacktoberfest widget
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
codercops/chatcops#70 · 3 comentários · 1 responsável ·
Mantenedores costumam responder em até 1 dia
-
enhancement hacktoberfest help wanted server
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 25/100
Mantenedores costumam responder em até 1 dia
-
Create @chatcops/store-redis for Upstash and other Redis clientsTalvez já em andamento @bhushan4work assumiu há 1 dia. Abertaenhancement hacktoberfest help wanted server
codercops/chatcops#248 · 2 comentários · 1 responsável ·
Mantenedores costumam responder em até 1 dia
-
Create @chatcops/store-sqlite, a store for single-server setupsTalvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Abertaenhancement hacktoberfest help wanted server
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 35/100
Mantenedores costumam responder em até 1 dia
Todas as issues de codercops/chatcops
Issues semelhantes
-
ready-for-agent
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
xavxyz/bei-shan-lin-shui#57 ·
Mantenedores costumam responder em até 1 dia
-
[BUG] rag: sentence content can cross the reported sentence boundariesTalvez já em andamento @LJK-ikun assumiu hoje. Abertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
Mantenedores costumam responder em até 1 dia
-
bug needs-triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
Mantenedores costumam responder em até 1 dia
-
README: the Resource URI Schemas example's file://documents/* pattern only matches that literal URIAberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 88/100
platformatic/mcp#361 ·
Mantenedores costumam responder em até 1 dia
-
最近文档这个弹窗,左右宽度没有最小宽度限制Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
siyuan-note/siyuan#20799 · 7 comentários ·
Mantenedores costumam responder em até 1 dia