feat(knowledge_base): add archestra_knowledge_base resource - #96
Open
priyanshu0x wants to merge 1 commit into
Open
priyanshu0x wants to merge 1 commit into
priyanshu0x wants to merge 1 commit into
Conversation
Models the org-scoped knowledge base entity backing
POST/GET/PUT/DELETE on /api/knowledge-bases. Documents are grouped
inside a knowledge base and exposed to agents via the agent's
knowledge_base_ids attribute.
The merge-patch (RFC 7396) wire body covers both Create and Update —
both endpoints declare every body field optional (Create accepts
`name` required + `description` optional; Update accepts both as
optional, with `description: z.string().nullable().optional()` so
omitting it from config sends an explicit null and clears the
backend field).
Schema:
- `name` Required, `LengthAtLeast(1)` mirroring the backend's
`z.string().min(1)` (no upper bound — the underlying `text`
column has none).
- `description` Optional, nullable round-trip preserved.
- `status`, `created_at`, `updated_at` Computed; `status` is
backend-managed (UpdateKnowledgeBaseSchema picks it but the
PUT route's body schema does not, so user-side mutation is
not surfaced).
`mapKnowledgeBaseResponse` is shared across the Get/Create/Update
JSON200 payloads — they're structurally identical anonymous
structs (Go's type-identity rule treats `openapi_types.UUID` as
the same as `uuid.UUID` via type alias).
Tests cover Create + Read + Update + Import, idempotent re-apply
(ExpectEmptyPlan pin against Read-side state drift), nullable
description clear, and `name = ""` plan-time rejection.
Un-excludes the `Knowledge Bases` OpenAPI tag in oapi-config.yaml
and regenerates internal/client. Bring-up-order guide updated.
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.
Closes #95.
Summary
archestra_knowledge_base(CRUD + Import) mapping toPOST/GET/PUT/DELETE /api/knowledge-bases.Knowledge BasesOpenAPI tag inoapi-config.yamland regeneratesinternal/client/archestra_client.go.basic/completeexample modules to demonstrate the new resource.Design notes
AttrSpectable for both Create and Update. Both endpoints declare every body field optional (Create:namerequired +descriptionoptional; Update: both optional withdescription: z.string().nullable().optional()), so a plan-null ondescriptionsends an explicitnulland the backend clears the field.namevalidated withLengthAtLeast(1)to mirror the backend'sz.string().min(1). No upper bound — the underlyingtextcolumn has none.mapKnowledgeBaseResponseis shared acrossGet/Create/UpdateJSON200 payloads — they are structurally identical anonymous structs (openapi_types.UUIDis a type alias ofuuid.UUID, so Go's type-identity rule holds).statusis Computed-only —UpdateKnowledgeBaseSchemapicks it but the PUT body schema does not, so it is purely backend-managed (defaults toactive).KnownIntentionallySkippedcoversorganizationIdonly; the API key authenticates the org and surfacing the field would create a phantom diff against the resource's implicit scoping.