Skip to content

knowledge-turso moves into objectstack: Apache-2.0, the platform embedder and splitter, listing, generations, the contract suite #37107

Description

@os-bob

maintainer · os-bob · session_012dn2AecKpLaYkUtNRiqtby

Filing gate: ③ maintainer-directed (topic child). Source: topic #37000 (phase 2, row 7 moved up from phase 3); maintainer 2026-11-24 「现在就调整」, with 「用fable评审,并分拆第二阶段的任务」; boundary cloud ADR-0119 D5 (objectstack-ai/cloud#4968: 「都放开源」). The phase-2 batch was reviewed by an independent Fable pass before filing.
Grading: area:ai · Feature · p2 (topic) · reach: every deployment not on PostgreSQL, including os dev · evidence: read.

维护者速读

  • 做什么:把 cloud 仓库里的 libSQL 向量存储 knowledge-turso 搬进 objectstack 开源,改用平台的嵌入器和切分器,补上「列出文档」和换模型时的新一代索引,跑和 pgvector 同一套契约测试。
  • 谁受益:本地开发(os dev 默认 SQLite)也能用中文向量检索,存在本地一个 libSQL 文件里;PostgreSQL 部署用 pgvector。托管云以后也用它(托管接入在阶段三第 14 行)。
  • 需要你做的:无。从 cloud 仓库删掉旧包是另一张 cloud 卡,这张落地后由维护者会话处理。

What

Source: cloud packages/knowledge-turso (origin/main): libSQL native vectors (F32_BLOB + DiskANN libsql_vector_idx); URL libsql://, file: or :memory:, or a client passed in; its own OpenAIEmbeddingProvider (src/embedding.ts); one table per source, knowledge_`` <source.id>ˋ ``, with chunk_id TEXT PRIMARY KEY (${documentId}#${idx}), document_id, source_record_id, content, title, metadata, embedding F32_BLOB(); its own chunker (chunkTarget`, 800).

  1. packages/plugins/knowledge-turso (new in objectstack). LICENSE is Apache-2.0 text (today the cloud package's LICENSE holds BSL 1.1 text while package.json and headers say Apache-2.0; ADR-0119 D5 settles it). Same package name @objectstack/knowledge-turso; the next version is published from objectstack.
  2. Embedder: drop src/embedding.ts; use EMBEDDER_SERVICE (Open edition: register EMBEDDER_SERVICE from the ai.embedder_* settings when the knowledge service is mounted #37094 registers it in the open edition) or a constructor embedder: IEmbedder.
  3. Chunks: drop its own chunker; take the service's chunks (service-knowledge: one service-layer splitter (whole / recursive / markdown, Chinese-aware), the chunk channel and the split key #37098) and declare that it accepts them.
  4. Layout changes the contract needs (today's layout has no hash, organization or generation):
  5. Fingerprint: the one ADR: knowledge platform boundary — the platform owns document assembly, sync and reconcile, structural split and record-level return; knowledge_source becomes a governed type #37001 defines, handed in by the service (same member knowledge-pgvector: an open vector store on PostgreSQL — tables, exact search, listing, chunks #37100 reads). Mismatch → "reindex needed", as in knowledge-pgvector: an open vector store on PostgreSQL — tables, exact search, listing, chunks #37100. A build (service-knowledge: a source that was never built gets built, and an operator can start a rebuild #37099's trigger) writes a new generation table; when the walk ends, service-knowledge: adapters list their documents; a complete reindex skips unchanged documents and purges the ones its source no longer has; one contract test suite #37096's purge reconciles, the generation becomes active, the old table is dropped. One builder per source (a lock row in the generation table, since libSQL has no advisory locks).
  6. Implements listDocuments (service-knowledge: adapters list their documents; a complete reindex skips unchanged documents and purges the ones its source no longer has; one contract test suite #37096). Runs the service-knowledge: adapters list their documents; a complete reindex skips unchanged documents and purges the ones its source no longer has; one contract test suite #37096 contract suite in CI on file: and :memory: libSQL (no special image); the PR confirms @libsql/client vector functions (vector32, vector_top_k) work on the CI runner.
  7. Default local location when the runtime mounts it (Open runtime: requires: ['knowledge'] mounts the knowledge service, and pgvector on PostgreSQL #37102): a libSQL file beside the dev database under .objectstack/data/, configurable.
  8. Docs: content/docs/protocol/knowledge.mdx adapter section, content/docs/ai/knowledge-rag.mdx.

Acceptance

Out of scope

Blocked-by: #37001, #37096, #37098, #37097 (organization member).
Parent: #37000. Reader: domain:server lane (packages/plugins/knowledge-*).
Dedupe: knowledge-turso 70 (open 12: this batch, #37000, #37001, #37106 — an evaluation of the dev default database, related, not a duplicate; none moves the package) · libsql vector 10 (open 5: #37106, #37001, seat posts).

Activity

  1. added theissue type on Nov 24, 2026
  2. added
    priority:p2
    area:ai
    on Nov 24, 2026
  3. os-bob commented on Nov 24, 2026

    @os-bob
    ContributorAuthor

    maintainer · os-bob · session_012dn2AecKpLaYkUtNRiqtby

    Input from the #37106 evaluation (PR #37120, measured 2026-11-24). It binds this card and #37102:

    • Own file, never the platform database file. With a libSQL vector index in a file, better-sqlite3 answered count(*) = 0 for a 200-row table, and integrity_check and VACUUM failed. Two engines writing one file in one process lost a row silently (WAL), or failed the commit with SQLITE_IOERR_DELETE_NOENT (delete mode). The turso store therefore opens its own libSQL file, never .objectstack/data/objectstack.db. Open runtime: requires: ['knowledge'] mounts the knowledge service, and pgvector on PostgreSQL #37102 must name a separate path.
    • Set WAL and a busy timeout on that file. In the measurement, libSQL on a file: URL with neither set lost 292 and 204 of 300 writes from a second process. It wrote about 10× slower than better-sqlite3, and about 4× slower once WAL was set.
    • Size and build time. 1,000 vectors of 1,536 dimensions grew a file from 8.2 MB to 329 MB, and the index build took 21.8 s. The docs should say so.
    • Windows on ARM. @libsql/win32-arm64-msvc does not exist on npm. On that platform the store must degrade with a clear error, like an unmounted adapter in Open runtime: requires: ['knowledge'] mounts the knowledge service, and pgvector on PostgreSQL #37102, not crash the boot.

    Generated by Claude Code

  4. objectstack-fleet commented on Nov 24, 2026

    @objectstack-fleet
    Contributor

    triage#1 · os-warren · session_01JQwxbZKP5YM48rWMWTS7wE

    Triage: first touch 2026-11-24T20:39Z

  5. added
    domain:server
    pm:blocked
    on Nov 24, 2026
  6. added
    pm:queue
    and removed
    pm:blocked
    on Nov 25, 2026
  7. objectstack-fleet commented on Nov 25, 2026

    @objectstack-fleet
    Contributor

    repo:cloud#1 · os-warren · session_01JQwxbW5anP6GDaVi5LKi2U

    Claim: PM loop round 2 (epic #37000 owner seat, card thread)
    Session: session_01JQwxbW5anP6GDaVi5LKi2U
    Thread session: session_01JQwxbaMuehXzctoWq7iRsV
    Account: os-warren
    Branch: claude/project-thread-463817
    Worktree: objectstack (the card thread's own checkout)
    Domain: domain:server
    Seat: repo:cloud#1
    File surface: packages/plugins/knowledge-turso/** (new), content/docs/protocol/knowledge.mdx and content/docs/ai/knowledge-rag.mdx (the adapter sections), .changeset/, plus workspace wiring a new package needs (lockfile, the generated package lists a gate demands), and the gate-forced provenance row '@objectstack/knowledge-turso': ['KNOWLEDGE_REBUILD_REQUIRED'] in packages/spec/src/api/error-code-ledger.zod.ts with its generated mirror content/docs/references/api/error-code-ledger.mdx (one row only, as #37100 did; amended 23:3xZ), and packages/services/service-settings/src/manifests/knowledge.manifest.ts with its test (the turso Test-connection hint and header list only, which this change makes false; amended 23:4xZ). CI wiring for the libSQL suite only if no existing step runs it; a .github/workflows/** edit makes the PR Tier H and is stated in the report (stop on breach; explain in the report)
    Container & model: L, mode:thread, model: default (dispatch-gates --tier: no path-derived mandate; floor sonnet · default opus · ceiling fable), effort: high
    Clause-②: yes
    Metadata-protocol: none
    Responsibility: n/a — not a defect card
    Thread-read: 7169771840
    Premise: holds (Blocked-by #37001, #37096, #37098, #37097 all closed; held for #37100, which merged as 9981f27 with the K8 item 8 members this card reads)
    Serial constraints cleared: #37308 (this seat, PR #37342, rebasing on main) adds AdapterSearchOptions.scope and implements.scope to the contract suite; whichever of the two lands second owes the other's suite cases. Mirror knowledge-pgvector's shape (generation table, fingerprint and recipe hash, coded refusals with remedy, docHash and headingPath on hits). Removing the package from the cloud repo is a cloud card after this lands (out of scope).

    Ownership: maintainer 2026-11-25 13:49Z, 「#4 只负责在手任务,你接手专题剩余任务」; unlocked when #37100 merged 23:25Z. Clause-② yes: a new published adapter package widens the public surface and owes a contract review at the ceiling tier before the queue.

  8. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 25, 2026
  9. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    Contributor

    repo:cloud#1 · os-warren · session_01JQwxbaMuehXzctoWq7iRsV
    os-dev-report

    {
      "issue": 37107,
      "status": "done",
      "branch": "claude/project-thread-463817",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/37388",
      "session": "session_01JQwxbaMuehXzctoWq7iRsV",
      "premise_still_valid": true,
      "summary": "@objectstack/knowledge-turso moves into packages/plugins/knowledge-turso (Apache-2.0, same name, fixed version group). It keeps passages and vectors in a libSQL database of its own (default file .objectstack/data/knowledge.db; a URL naming the platform's database file is refused), embeds with the kernel embedder, declares capabilities.chunks, and implements listDocuments, indexStatus, beginBuild/completeBuild with a generation table and one passage table per source and generation (knowledge_SOURCE_gN), refusing KNOWLEDGE_REBUILD_REQUIRED under another fingerprint; a cloud-release table is never served and is dropped by the first complete reindex. Search is an exact cosine scan with the organization and metadata filters before ranking (no DiskANN). A failed @libsql/client load or unopenable file registers an unavailable adapter (503) and boot continues. Claim amendments used: error-code ledger row, and the Turso Test-connection hint in knowledge.manifest.ts made true.",
      "tests": "pnpm --filter @objectstack/knowledge-turso test under the verify lock: Test Files 3 passed (3), Tests 103 passed (103) — contract suite with every implements member incl. generations on :memory: and file: (72/72), acceptance 24, plugin 7. service-settings knowledge.manifest.test.ts 25/25. typecheck (incl. check:test-typecheck) and build (check-dts-emitted 2/2) exit 0.",
      "gates": "node scripts/pm/dispatch-gates.mjs --ran at 56f3dc5e: 134 derived, 134 run, 0 UNRUN; 130 green. check:llms-txt red at 77, green at 78 after the llms.txt commit. NOT MEASURED (exit 3, prerequisite not met): check:dual-build-cjs-loads, check:published-readme-exports (need every workspace package built), check:skill-examples (needs client-react built), check-plugin-teardown-shape --self-test (needs unshallow clone; its scan passed). CI check-runs on PR #37388 pending at report time.",
      "dogfood_battery": "n/a — no ! in the PR title and no (narrowing) arm",
      "mcp_calls": "read-only: mcp__github__issue_read (card, comments)",
      "api_writes": "1 — fleet-write relay pr_create (PR #37388, assignee os-warren); this comment via post-stamped",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: cloud · packages/knowledge-turso in the cloud repo is now a duplicate; its removal is the cloud card #37107 names · noted, not filed",
        "carrier: #37102 · the runtime mount names the store path; defaultStoreUrl and PLATFORM_DATABASE_FILES are exported for it",
        "carrier: #37104 · the knowledge settings namespace (turso_url, turso_auth_token) is still read by no plugin; #37104 rewrites the manifest · noted, not filed",
        "carrier: #37308 · PR #37342 adds implements.scope; whichever lands second owes the other's suite cases"
      ]
    }

    Generated by Claude Code

  10. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    Contributor

    repo:cloud#1 · os-warren · session_01JQwxbaMuehXzctoWq7iRsV
    os-dev-report

    {
      "issue": 37107,
      "status": "done",
      "branch": "claude/project-thread-463817",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/37388",
      "session": "session_01JQwxbaMuehXzctoWq7iRsV",
      "premise_still_valid": true,
      "summary": "Rework round 1 at f073750a, on top of the merge of main (68654e1d, brings #37342) and the record scope (9c469ddf, mirrors knowledge-pgvector: terms ORed in the org-filtered WHERE, ids and field names bound, empty scope answers [] first; implements.scope true). M1: a table of the cloud releases is recognised by exactly its seven columns and an F32_BLOB vector; the generation table and any table the store did not make are never refused as legacy nor dropped; openGeneration remakes only a passage-shaped table and refuses any other under that name. S1: requestTimeoutMs bounds one turn of the per-client queue (default 10000 on a remote URL), 503 past it. S2: first generation made afresh and listDocuments-without-embedder 503 pinned. S3: builder-lock and install prose corrected; PR body re-pinned. Nits: platform-file refusal decodes and lower-cases, reads a bare-path OS_DATABASE_URL; source ids follow the spec pattern with no length cap, refusal coded VALIDATION_ERROR 400; search retry bounded; write recheck and scope scalar guard pinned. Nit 7 (exponent-form numbers in scope) left: fails closed, noted in the PR body.",
      "tests": "pnpm --filter @objectstack/knowledge-turso test under the verify lock at f073750a: Test Files 3 passed (3), Tests 135 passed (135), VERDICT command-exit 0 (contract 92 incl. scope on :memory: and file:, acceptance 36, plugin 7). typecheck, check:test-typecheck, build exit 0. Ablations, each restored: old legacy rule 4 red; openGeneration remaking a foreign table 2 red; fresh-table DROP 2 red; listDocuments compare-before-embedder 1 red; request bound 1 red; write-time recheck 2 red; scope scalar guard 2 red; scope WHERE 12 red.",
      "gates": "dispatch-gates --ran with exit codes at f073750a: 134 derived, 133 run exit 0, 1 NOT-MEASURED (check-plugin-teardown-shape --self-test, exit 3, shallow clone). CI check-runs at f073750a: 62 success, 9 skipped, 0 failed.",
      "dogfood_battery": "n/a — no ! in the PR title and no (narrowing) arm",
      "mcp_calls": "read-only: mcp__github__issue_read (card, comments)",
      "api_writes": "relay: pr_create #37388; issue_patch #37388 body (re-pinned to f073750a); this comment and the first report via post-stamped",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: cloud · packages/knowledge-turso in the cloud repo is now a duplicate; its removal is the cloud card #37107 names · noted, not filed",
        "carrier: #37102 · the runtime mount names the store path; defaultStoreUrl and PLATFORM_DATABASE_FILES are exported for it",
        "carrier: #37104 · the knowledge settings namespace (turso_url, turso_auth_token) is still read by no plugin; #37104 rewrites the manifest · noted, not filed"
      ]
    }

    Generated by Claude Code

  11. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    Contributor

    repo:cloud#1 · os-warren · session_01JQwxbaMuehXzctoWq7iRsV
    os-dev-report

    {
      "issue": 37107,
      "status": "done",
      "branch": "claude/project-thread-463817",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/37388",
      "session": "session_01JQwxbaMuehXzctoWq7iRsV",
      "premise_still_valid": true,
      "summary": "Rework round 2 at 796b204c (on f073750a). S4: requestTimeoutMs now bounds each request on its own through a bounded view of the client (statement, batch, opening a transaction, commit, rollback), not a whole queue turn; the queue stays keyed by the client as given. A write sends each document's statements as one tx.batch, so a 100-document page is ~100 requests. A request timing out inside a write is followed by a rollback, never a commit; only a commit that itself times out may land, and its remedy says so. The remedy names requestTimeoutMs. Nits: search's retry count moved to a private method; a foreign table under a generation name answers 503 with the table in remedy; the platform-file refusal compares the realpath and reads -wal/-shm/-journal as their database; pinned the vector-type half, the VALIDATION_ERROR code, the search retry bound and the remote default (requestBoundFor). Not done: the malformed file URL that ends the process inside the native client (steps not in hand; pre-existing), scope number reading (fails closed).",
      "tests": "pnpm --filter @objectstack/knowledge-turso test under the verify lock at 796b204c: Test Files 3 passed (3), Tests 143 passed (143), VERDICT command-exit 0. typecheck, check:test-typecheck, build exit 0. Ablations at this head, each restored: the f073750a whole-turn bound with the new tests, both request-bound cases red; commit instead of rollback after a timeout 1 red; vector-type half 2 red; VALIDATION_ERROR code 2 red; search retry bound 2 red; remote default 1 red; side-file reading 1 red.",
      "gates": "dispatch-gates --ran with exit codes at 796b204c: 134 derived, 133 run exit 0, 1 NOT-MEASURED (check-plugin-teardown-shape --self-test, exit 3, shallow clone). CI check-runs at 796b204c: 62 success, 9 skipped, 0 failed.",
      "dogfood_battery": "n/a — no ! in the PR title and no (narrowing) arm",
      "mcp_calls": "read-only: mcp__github__issue_read (card, comments)",
      "api_writes": "relay: pr_create #37388; issue_patch #37388 body (three times, last re-pinned to 796b204c); three report comments via post-stamped",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: cloud · packages/knowledge-turso in the cloud repo is now a duplicate; its removal is the cloud card #37107 names · noted, not filed",
        "carrier: #37102 · the runtime mount names the store path; defaultStoreUrl and PLATFORM_DATABASE_FILES are exported for it",
        "carrier: #37104 · the knowledge settings namespace (turso_url, turso_auth_token) is still read by no plugin; #37104 rewrites the manifest · noted, not filed"
      ]
    }

    Generated by Claude Code

  12. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    Contributor

    repo:cloud#1 · os-warren · session_01JQwxbW5anP6GDaVi5LKi2U

    ACCEPT → PR #37388 comment 7181689233 (round 3: L1 ACCEPT + contract review PASS at head 796b204; rounds 1 and 2 REWORK 7179839476, 7180860083). Not governed; 2922 changed lines; CI all green at that head; readied and auto-merge armed.

    Carried, not in this PR:

  13. removed
    pm:dispatched
    on Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:aidomain:serverpriority:p2

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions