Skip to content

Commit e0057ca

Browse files
committed
Merge origin/main (#38470) into claude/project-thread-caiyo5
The held check #38470 put in processRecordSync moves into resolveRecordSync, right after the message is read, so the per-message and batch paths both complete a held service's messages as not-synced without calling a store. Adds the batch-path held test. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5mC8eA4qtKSweeF7wd
2 parents cbd4c8a + 91fc398 commit e0057ca

68 files changed

Lines changed: 3154 additions & 595 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
docs(skills): the objectstack-platform entry file becomes a router
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
`skills/objectstack-platform/SKILL.md` goes from 24.7 KB to 9.0 KB (421 lines to 105). It now holds three things: four first checks (the installed `@objectstack/spec` version, what the project already has, the contract, `os validate`), the traps that pass `os validate` and then fail at run time, and a table that says which file to open for the task at hand. No rule's teaching changes. Text moved, and this entry says where it went. The skill's files are 2.1 KB smaller together (107.5 KB to 105.5 KB).
11+
12+
**What the entry keeps.** Five traps: no driver in `plugins:`, an installed package is customized from its paired `.custom` package, who owns the HTTP server (`createHonoApp` or `HonoServerPlugin`), `manifest.engines.protocol`, and `manifest.namespace`. Then the full list of `defineStack()` top-level keys with the rule that an undeclared key is refused, the `requires:` provider table with the three rules that bite most often, and `Seed Data` (the three import modes; a seed cannot create a person, `demoStaff` does).
13+
14+
**What left, and where it is now.**
15+
16+
- `references/bootstrap.md` now also holds `Strict Validation` (`#strict-validation`), the manifest notes the entry's two traps do not repeat (`#manifest`), `Project Structure Conventions`, what the `blank` template scaffolds (under `#scaffolding-command`), `Runtime Boot Sequence` (`#runtime-boot-sequence`), the `requires:` tokens that have no provider row and the remaining rules (`#requires-in-detail`), `onEnable`, `Customizing an installed package` in full (`#customizing-an-installed-package`), and `demoStaff` with its example (`#demo-accounts--demostaff-vs-devlogins`).
17+
- `references/operations.md` now also holds `Driver Selection Guide` (`#driver-selection-guide`), when to construct `DriverPlugin` yourself (`#wiring-a-driver-yourself`), `HTTP Layer (Hono)` (`#http-layer-hono`), and the note that `os compile` writes `dist/objectstack.json`.
18+
- Anchors that no longer exist in `SKILL.md`: `#definestack--the-core-configuration` (now `#definestack-keys`), `#full-configuration-reference`, `#strict-validation`, `#compile-artifact-and-runtime-metadata-boundary`, `#manifest-reference`, `#the-app--platform-boundary`, `#the-template`, `#project-structure-conventions`, `#naming-conventions`, `#driver-selection-guide`, `#wiring-a-driver--you-usually-do-not`, `#http-layer-hono`, `#usage-pattern-hono`, `#architecture`, `#runtime-boot-sequence`, `#onenable--where-an-app-binds-runtime-code`, `#demo-accounts--demostaff-vs-devlogins`, `#references`. `#requires--which-service-plugins-boot` and `#seed-data` still do.
19+
20+
**Not carried over, because another file already says it.** The `App / Platform Boundary` section (objectstack-project owns that decision; `references/bootstrap.md#app-or-platform` keeps the two sentences it does not have), the naming-convention table (objectstack-data's naming rules), the annotated manifest example (every key is in `kernel/manifest.zod.ts`, which the entry's third check points at; the barrel example in `references/bootstrap.md` now shows `engines`), the Hono usage snippet, and the closing list of the other files (the routing table replaces it). In `references/plugin-development.md`, the `Plugin` interface block and the hook example are now one pointer each to `rules/plugin-lifecycle.md` and `references/plugin-hooks.md`, which carry the same text.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'@objectstack/service-settings': patch
3+
---
4+
5+
fix(service-settings): the Knowledge page names `chunk_target` for what it is, the longest passage
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
The Knowledge settings page labelled `knowledge.chunk_target` **Target chunk size**, while its help text, and the splitter that reads it, treat it as a maximum: no passage is longer, and many are shorter (under the `markdown` split, a section that fits is one passage of whatever length it has). The label now reads **Longest passage (characters)**, and the help text adds that passages can be shorter, in every locale the page ships (en, zh-CN, zh-Hant, ja-JP, ko, de, es-ES, fr, pt-BR, ru, ar). Earlier notes that name **Target chunk size** (the splitter, the knowledge skill) mean this same setting under its old label. The key, its default (800), its bounds and what reads it are unchanged.
11+
12+
What to do: nothing. A script or seed that writes `knowledge.chunk_target` keeps working.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
'@objectstack/service-knowledge': minor
3+
'@objectstack/core': patch
4+
'@objectstack/mcp': patch
5+
'@objectstack/spec': patch
6+
---
7+
8+
feat(service-knowledge)!: a knowledge service the runtime mounts holds its sources without an embedder or its deployment store
9+
10+
Clause-②: no (narrowing)
11+
Metadata-protocol: narrowed
12+
13+
<!-- adr-0087: registered knowledge-service-held-without-embedder-or-store -->
14+
15+
**BREAKING** for a self-hosted deployment whose knowledge service the runtime mounts (the stack declares `requires: ['knowledge']` or ships a `knowledgeSources` entry) and which, at boot, has no embedder or no deployment knowledge store mounted. Such a deployment used to start its boot build, record sync and reconcile job, list `search_knowledge` on MCP, and answer every build and search with an error from a stand-in embedder; a source on a store the application registered was built and searched with no embedder saved. Mounted is not enabled now (ADR-0161 K8, the dated note on item 12): the service is enabled by configuration, read once at `kernel:bootstrapped`, and without both halves every source is held, whichever store it names.
16+
17+
- **`@objectstack/service-knowledge`.** `KnowledgeServicePlugin` takes `runtimeComposed: { declared }`. When set, the plugin reads the embedder and the deployment store at `kernel:bootstrapped`; without both, `KnowledgeService` holds every source: loaded and listed, never built, synced, reconciled or searched. It hands out no `search_knowledge` definition while the reading is pending or held; `search`, `rebuildSource` and `reindexSource` answer `503` with code `SERVICE_UNAVAILABLE` and a message naming the missing half and the fix; a dropped source keeps its index and no store is called. No lifecycle reap guard registers until the reading is enabled, so a retention sweep deletes rows on time. The boot logs one line: info when only a shipped source mounted the service and nothing was saved, warn when the stack declares `requires: ['knowledge']`, a saved embedder provider builds nothing (a provider saved without its key), or the store is missing. Never a boot refusal.
18+
- **`@objectstack/core`.** The capability composition passes `runtimeComposed: { declared }` with the knowledge service's deployment adapter; `declared` is true only when the stack lists `knowledge` in `requires`.
19+
- **`@objectstack/mcp`.** The stdio transport registers `search_knowledge` at `kernel:listening`, after the reading, only when the service hands out its definition; clients are told by `notifications/tools/list_changed`. A held service is never listed on either transport.
20+
- **`@objectstack/spec`.** The upgrade guide carries the `knowledge-service-held-without-embedder-or-store` entry.
21+
22+
Unchanged: a knowledge service a host mounts itself (`KnowledgeServicePlugin` in `plugins[]`, no `runtimeComposed`) boots, builds and serves as before; a deployment with both halves builds, syncs and serves as before; stored sources are not rewritten or refused.
23+
24+
## FROM → TO
25+
26+
- A deployment with knowledge sources and no embedder → save an embedder provider on the AI settings page (or register an `embedder` service from a plugin), then restart.
27+
- A deployment whose boot says its knowledge store is not mounted → mount that store, then restart.
28+
- An application whose own store embeds without the kernel's embedder → mount `KnowledgeServicePlugin` itself in `plugins[]`.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
'@objectstack/service-knowledge': patch
3+
---
4+
5+
refactor(service-knowledge)!: `SPLIT_ALGORITHM_VERSION` is retired — the index fingerprint reads the split version per strategy
6+
7+
Clause-②: no (narrowing)
8+
Metadata-protocol: none
9+
10+
<!-- adr-0087: not-required (runtime-export-retired @objectstack/service-knowledge#SPLIT_ALGORITHM_VERSION) the retired operand is a numeric constant of the package's published entry that no runtime code reads; no packages/spec schema, no registered node type, no ADR-0087 conversion surface and no stored shape names it, so there is nothing for `objectstack migrate meta` to rewrite, and a host still importing it is told by its own compiler -->
11+
12+
**BREAKING** for a host that imports `SPLIT_ALGORITHM_VERSION` from `@objectstack/service-knowledge`. It leaves at once, with no alias. The index fingerprint (ADR-0161 K7) stopped reading it when the split version became per strategy: each strategy (`whole`, `recursive`, `markdown`) carries its own version inside the splitter, and the fingerprint reads the version of the source's resolved strategy. The constant changed nothing a host could observe, and bumping it rebuilt nothing.
13+
14+
This retirement replaces the earlier note in this same release that `SPLIT_ALGORITHM_VERSION` keeps its name and its value: it is removed.
15+
16+
No fingerprint changes and no index is rebuilt when this lands.
17+
18+
## What leaves, and what to write instead
19+
20+
| FROM | TO |
21+
|:--|:--|
22+
| `SPLIT_ALGORITHM_VERSION` | delete the import from `@objectstack/service-knowledge`; to tell whether a stored index is current, compare its fingerprint with `computeIndexFingerprint` or `indexExpectation`, which read the per-strategy version |
23+
24+
What to do: delete the import where a host has one. Nothing else.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
'@objectstack/knowledge-turso': patch
3+
'@objectstack/knowledge-pgvector': patch
4+
'@objectstack/service-knowledge': patch
5+
---
6+
7+
fix(knowledge): the keyword leg of hybrid search ranks passages for a Chinese, Japanese or Korean question written without spaces
8+
9+
Clause-②: yes (widening)
10+
Metadata-protocol: none
11+
12+
Before, the keyword leg split a query only at white space and punctuation, so an unspaced question such as 「出差住宿费2000元以下需要审批吗」 was one term. A passage matched only if it held the whole question, so the keyword leg ranked nothing and hybrid search answered from the vector leg alone.
13+
14+
Now `keywordTerms` in `@objectstack/knowledge-turso` and `@objectstack/knowledge-pgvector` (one rule, kept identical) cuts a run of Han, kana or Hangul inside a term into overlapping pieces of three characters and of two. A run of two characters is one piece, and a run of one is dropped. Figures and codes next to a run stay whole terms (`2000`, `X-200`). Latin-script queries get exactly the terms they had before. The cap stays at 16 terms, filled in this order: figures, codes and words; then pieces of three characters and runs of two; then pieces of two characters. Each piece is matched as before: a piece of three characters through the libSQL trigram index or `ILIKE`, a piece of two through `LIKE` / `ILIKE`. The per-term inverse document frequency weights pieces that most passages hold low. Nothing changes in the index or the fingerprint, and no reindex is needed. On PostgreSQL, a substring term without a cased letter (a Han, kana or Hangul piece, a figure) is now matched by `LIKE` instead of `ILIKE`. Case folding could find nothing more for such a term, and `LIKE` returns the same rankings at a fraction of the cost.
15+
16+
`@objectstack/service-knowledge/testing`: `KnowledgeAdapterContractOptions.implements` gains an optional `keywordLeg` member (absent means `false`). When an adapter declares it, the shared contract suite asks an unspaced question and expects the passage holding the question's figure and exception words to be ranked. Existing callers need no change.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@objectstack/service-knowledge': patch
3+
---
4+
5+
fix(service-knowledge): a build's start onto a source's existing sync-state row is recorded without a false error
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
Every boot that built a knowledge source logged `[knowledge] the start of the build of source '…' was not recorded` at error, after the engine's `Insert operation failed … UNIQUE constraint failed: sys_knowledge_sync_state.id` warning, although the row was written. An operator rebuild failed the same way. The start was written by the row's id alone, which the engine runs as a by-id update answering the record, not a count; the record read as "no row changed", and the fallback insert hit the primary key.
11+
12+
The start is now written by id and read by the by-id answer: the record means the row was updated, and `RECORD_NOT_FOUND` means there is no row yet, so it is inserted. A build start onto an existing row is one update and logs nothing; onto no row it is one insert. The once-per-process sync-state error report is no longer spent on this, so a real sync-state write failure is reported again.
13+
14+
Nothing to change in an app or its configuration.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
'@objectstack/service-knowledge': patch
3+
---
4+
5+
fix(service-knowledge): the knowledge-source save door names an absent object or field as such
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
Saving a `knowledge_source` whose `source.object` names no object, or whose `source.content` /
11+
`source.metadataFields` names no field of its object, is now refused `400 VALIDATION_ERROR` with the rule
12+
`os validate` reports: `knowledge-source-object-unknown` or `knowledge-source-field-unknown`. The refusal names
13+
the object, and the field. Before, the same save was answered `503 SERVICE_UNAVAILABLE` ("could not be judged ...
14+
try again") for an absent object, `403` "is a system object that does not opt into AI reads" for an absent `sys_`
15+
object, and `403` "you may not query field ... hidden from you" for an absent field. With no security service, it
16+
was admitted.
17+
18+
The check reads only the object's registered definition. `id` and the system columns the registry injects count
19+
as fields of the object. Every door that asks it admits only a `manage_metadata` holder, and that caller is already
20+
served every object definition whole. So for an object or a field that exists, every refusal stays as it was: a
21+
hidden field, a system object without `enable.aiReadable`, a disabled package, a security service that cannot
22+
answer, and a registry that throws. The fields a `where` reads are not checked for existence, as in `os validate`.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
docs(skills): `objectstack-ai` teaches that a `markdown` section that fits `maxChars` is one passage
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
`skills/objectstack-ai` § Knowledge Sources (RAG), the **Splitting (`split`)** block now follows the splitter:
11+
12+
- The `markdown` bullet says that a section that fits `maxChars` together with its heading path is one passage, and that a section that does not fit is cut as `recursive` cuts.
13+
- The `minChars` sentence says that pieces shorter than `minChars` are merged in `recursive` text and in a `markdown` section that does not fit, and that a section that fits stays whole whatever `minChars` is. An author no longer sets `minChars` equal to `maxChars` to keep a short clause, or a table with its note, in one passage.
14+
- The block's last sentence said that a changed `split` re-splits a document only when it next changes. That was wrong. It now says that changing `split` rebuilds the source's whole index, and that the source's searches are refused until the rebuild finishes.
15+
16+
Cut in the same block, with no fact dropped: "For documents with headings" (the bullet's "one section per heading" says it), "once `split` is written" (the signature and the omitted-`split` clause say it) "never truncated" (the `whole` bullet's "removed from the index and reported" says it) and the "and refused" of "Retired and refused" (the `400 UNKNOWN_KEY` and the parse error beside it say it).
17+
18+
The same block names the `knowledge.chunk_target` setting by its settings-page label "Longest passage", the label that setting takes in this release.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
'@objectstack/mcp': patch
3+
'@objectstack/runtime': patch
4+
---
5+
6+
feat(mcp): a `search_package_docs` answer with no hit lists the manual pages the caller may read, so the agent can pick one by its title
7+
8+
Clause-②: yes (widening)
9+
Metadata-protocol: none
10+
11+
The manual search matches words, not meanings: a user's paraphrase of a word the manual uses ("潜在客户" for a manual that says "线索") found nothing, and the agent then said the manuals do not cover it. Now an answer with no hit also carries two optional members:
12+
13+
- `contents`: the pages this connection may read, within `package` when it was sent, each as the address a hit carries (`name` and `title`; `package`, `book` and `url` where the page has a package), with no excerpt. The order is the Console's: manuals in display order (authored ones first, then each package's implicit manual), and each manual's pages in the order its tree lists them. Titles and manual names are in the request's locale, as `read_package_doc` serves them.
14+
- `contentsTruncated`: `true` when more readable pages exist than the 50 `contents` lists (`PACKAGE_DOC_CONTENTS_MAX_ENTRIES`); send `package` to narrow.
15+
16+
The list is built from the same docs-audience read the search uses (ADR-0046 §6.7), so a page the caller cannot read adds no entry, no count and no flag. An answer with a hit is unchanged and carries neither member. The tool's description and the server's `initialize` answer-order rule (`packageDocAnswerRule`) now say to read the page whose title fits the question, and only when none fits to say the manuals do not cover it. No embedder is used and no manual text leaves the deployment.
17+
18+
For a host implementing `McpDataBridge.searchPackageDocs` itself: the tool layer now passes `{ maxResults, maxContents }`; a member that ignores `maxContents` keeps working and answers no `contents`. The runtime's own member caps `contents` at the same 50 when a caller sends no `maxContents`, so the list is never uncapped.

0 commit comments

Comments
 (0)