refactor: consolidate duplicate utilities and improve code quality - #4
Closed
indrazm wants to merge 16 commits into
Closed
refactor: consolidate duplicate utilities and improve code quality#4indrazm wants to merge 16 commits into
indrazm wants to merge 16 commits into
Conversation
* feat: add Pinecone and Milvus vector store adapters Add @anvia/pinecone and @anvia/milvus packages following the existing adapter pattern (Chroma, PgVector, Qdrant). Both implement the VectorSearchIndex interface from @anvia/core with full filter translation, multi-embedding support, and asTool() integration. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> * refactor: split vector-stores into flat file modules Split each monolithic src/index.ts (220-364 lines) into focused modules: - types.ts (client interfaces, config types) - store.ts (*VectorStore class) - search-index.ts (*VectorIndex class) - filters.ts (VectorFilter translation) - helpers.ts (serialization, parsing, ID generation) - index.ts (barrel re-exports) Applied to all 5 packages: chroma, qdrant, pgvector, pinecone, milvus. Public API surface unchanged -- all exports preserved via barrel. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> * docs: add Pinecone and Milvus reference docs and changeset Add reference documentation for @anvia/pinecone and @anvia/milvus, register them in the reference coverage check, and create a minor changeset for both new packages. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> * test: add unit tests for Pinecone and Milvus vector stores Add test suites matching the existing pattern (Chroma, Qdrant, PgVector). Tests cover connect, upsert, search, filter translation, reserved metadata rejection, and empty embeddings rejection. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> --------- Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* chore: flatten package layout * docs: align package layout references
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* feat(studio): add multi-provider model config * feat(studio): show assistant loading indicator * chore: add studio multi-provider changeset * docs(studio): document model config types * docs(studio): add model provider config guide
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…ead patterns - Create compact() utility to replace 242 conditional spread patterns - Create type-guards.ts consolidating duplicate isJsonValue/isJsonObject/etc - Create http.ts with errorResponse, serializeError, parseJsonBody helpers - Create query.ts with parameterized parseLimit/parseAfter replacing 3 near-identical functions - Create config.ts extracting config-building functions from shared.ts - Gut shared.ts from 500 lines (27 exports, 5 concerns) to 170 lines (store resolution only) - Deduplicate traceSummary, formatJson, formatUnknown, cleanMetadata across modules - Remove duplicate isJsonValue in pipelines.ts (incorrectly allowed undefined) - Replace local parseSessionLogLimit/parseSessionLogAfter with unified query helpers - Net -399 lines across 25 modified + 5 new files Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
…ility - Create compact() utility in internal/compact.ts - Apply compact to 43 conditional spread patterns across 12 files - Agent module: request.ts, tool-execution.ts, hooks.ts, agent.ts, retrieval.ts - Evals module: outcome.ts, runner.ts - Pipeline module: graph.ts - Tool module: create-tool.ts, dynamic-tools.ts - Vector store and embeddings modules - All 205 tests pass Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
- Consolidate isStreamingCompletionModel: export from completion/create-completion.ts, re-export from agent/utils.ts - Consolidate extractRagText: remove duplicate from extractor/extractor.ts, import from agent/utils.ts - Consolidate isToolResultContentArray + serializeToolOutput: export from completion/types.ts, import from tool/tool.ts - Consolidate isRecord/isPlainRecord: create shared utility in internal/compact.ts, update skills/local.ts and mcp/result.ts - Split request.ts: extract types and helper functions to request-types.ts (878 -> 786 lines) - All 205 core tests pass, 71 studio tests pass Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
- Add patch changeset for @anvia/core and @anvia/studio - Document isStreamingCompletionModel in core completion reference - Document serializeToolResultOutput in core completion reference - Document traceSummary in studio traces reference Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Owner
Author
|
Closing - reopening against upstream |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Internal refactoring to improve code quality across
@anvia/coreand@anvia/studiopackages. No behavior changes - all 276 tests pass.Changes
@anvia/studio(1 commit):compact.ts,type-guards.ts,http.ts,query.ts,config.tscompact()utilityshared.tsfrom 500 lines to 170 lines (store resolution only)isJsonValue(3->1),isJsonObject(2->1),traceSummary(2->1),formatJson(2->1),cleanMetadata(2->1)@anvia/core(3 commits):internal/compact.tswithcompact()andisRecord()utilitiescompact()to 43 conditional spread patterns across 12 filesisStreamingCompletionModel- exported fromcompletion/create-completion.tsextractRagText- removed duplicate fromextractor/extractor.tsisToolResultContentArray+serializeToolOutput- exported fromcompletion/types.tsisRecord/isPlainRecord- shared utility ininternal/compact.tsrequest.ts(878 -> 786 lines) by extracting types and helpers torequest-types.tsTest Results
@anvia/core: 22 test files, 205 tests passed@anvia/studio: 3 test files, 71 tests passeddocsreference check: 603 exports, 0 undocumented