Repository navigation
feat(spec,service-knowledge)!: knowledge_source is a governed metadata type with its loader, its registry and two authoring guards - #37676
Conversation
… schema, tables, kit) Claude-Session: https://claude.ai/code/session_01Utp6CZe3KTAXogcUJuvYEx Co-authored-by: Claude <noreply@anthropic.com>
…d keys and defs, semantic entries), pins Claude-Session: https://claude.ai/code/session_01Utp6CZe3KTAXogcUJuvYEx Co-authored-by: Claude <noreply@anthropic.com>
…ackage, name) The knowledge service keeps its sources in a registry keyed by (package, name) and filled through two doors that parse with the one schema: the metadata loader (boot, a published knowledge_source change, a metadata reload) and registration in code, which takes the package-less slot and refuses a retired key with its prescription instead of converting it. A caller names a source by its face; a bare name resolves by ADR-0150 D3 and a name several sources answer to is refused 409. An index is keyed by the source's index key, so two packages' sources of one name share no document. A removed item is unregistered and its index dropped; the reap guard's object set follows the sources. The file/http arms, the '*' content member, indexDocument and deleteDocument are gone with their branches. Claude-Session: https://claude.ai/code/session_01Utp6CZe3KTAXogcUJuvYEx Co-authored-by: Claude <noreply@anthropic.com>
… write doors Guard one is a row in the existing per-type write capability table: a knowledge_source write through /meta (REST and the dispatcher) and through the MCP draft door needs manage_knowledge_sources beside manage_metadata. Guard two asks the knowledge service to admit an authored source for its author before it is saved: the author must themselves be able to search what the source would index. A verdict that cannot be reached refuses 503; over MCP the human is judged. Claude-Session: https://claude.ai/code/session_01Utp6CZe3KTAXogcUJuvYEx Co-authored-by: Claude <noreply@anthropic.com>
…e as the index key knowledge-memory, knowledge-pgvector and knowledge-turso remove every generation of a source, the one under construction included, and what they recorded about the index. An adapter reads the index key from ctx.source.name. os knowledge status prints the holding package and no source kind. Claude-Session: https://claude.ai/code/session_01Utp6CZe3KTAXogcUJuvYEx Co-authored-by: Claude <noreply@anthropic.com>
…edge service A deployment that holds knowledge_source items and mounts no knowledge service is valid and inert: one warn line names the items. The type joins the package-scoped read types and the namespace co-owner tests. Claude-Session: https://claude.ai/code/session_01Utp6CZe3KTAXogcUJuvYEx Co-authored-by: Claude <noreply@anthropic.com>
…, skills rows, changeset The showcase ships a task-notes source over the memory adapter. The protocol and RAG pages describe the type, its loader, who may author a source and one name per source. Generated references, the liveness ledger row and the changeset with its ADR-0087 registrations ride along. Claude-Session: https://claude.ai/code/session_01Utp6CZe3KTAXogcUJuvYEx Co-authored-by: Claude <noreply@anthropic.com>
The variant ledger and the empty-state registry drop the entries of the retired file and http source kinds; llms.txt counts one module fewer under ai; the platform checklist waives the new kind with what retires the waiver; the metadata form bundles carry the type's label in every locale. skills/objectstack-platform/SKILL.md keeps only the knowledgeSources row: the two comment trims that made room for it are reverted (ruling A on #32584 allows the row and nothing else). Claude-Session: https://claude.ai/code/session_01Utp6CZe3KTAXogcUJuvYEx Co-authored-by: Claude <noreply@anthropic.com>
…ases the gates ask for The system-context page keys the knowledge row to the symbols that hold the elevation reads now, the save admission included. Four edited suites pay their first load of a dynamically imported package at collection, and the showcase aliases the knowledge service and the in-memory store to source. Claude-Session: https://claude.ai/code/session_01Utp6CZe3KTAXogcUJuvYEx Co-authored-by: Claude <noreply@anthropic.com>
…-23bpce Conflicts: the migration registry template (main's wording of the two major-19 regions kept), the CLI knowledge test fixture, the pgvector adapter's search refusal and the knowledge service's reindex chain and unmounted-adapter refusal. Code and fixtures main added against the 18 source shape (id, contentFields, indexDocument) follow the 19 shape, and the RAG guide separates writing a source from wiring the plugins by hand. Claude-Session: https://claude.ai/code/session_01Utp6CZe3KTAXogcUJuvYEx Co-authored-by: Claude <noreply@anthropic.com>
…r 19, skills ceiling by the row's delta The spec package reads 19 on main, so the declared default of ai/KnowledgeSource:refresh moves from the major-18 rows to major 19, the only major that authorises it now. skills/objectstack-platform/SKILL.md: the ceiling moves 6151 -> 6156 for the knowledgeSources enumeration row alone (+20 priced bytes), under ruling A on #32584 and #32673 letter A. Nothing else in the file changes. Claude-Session: https://claude.ai/code/session_01Utp6CZe3KTAXogcUJuvYEx Co-authored-by: Claude <noreply@anthropic.com>
The teaching of knowledge_source in skills/objectstack-ai rides #37310. Claude-Session: https://claude.ai/code/session_01Utp6CZe3KTAXogcUJuvYEx Co-authored-by: Claude <noreply@anthropic.com>
… drop the embedding row from the protocol map The three conversions admitted with the type join the removal-version pin (every retired key refused from 19 on), and the protocol map no longer links the removed embedding module. Claude-Session: https://claude.ai/code/session_01Utp6CZe3KTAXogcUJuvYEx Co-authored-by: Claude <noreply@anthropic.com>
…-23bpce Major 19's conversion list stacks both sides: the permission conversion main landed and the knowledge source's three, each at its own order. Claude-Session: https://claude.ai/code/session_01Utp6CZe3KTAXogcUJuvYEx Co-authored-by: Claude <noreply@anthropic.com>
The authorable-surface baseline keeps the knowledge source's retired lines out and takes main's new skill key; api-surface, export-origins and the skills reference index are regenerated from the merged tree. Claude-Session: https://claude.ai/code/session_01Utp6CZe3KTAXogcUJuvYEx Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 12 package(s): 93 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 22 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 192 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 588995420552e436918b6ad16fddab388edb120e && git checkout 588995420552e436918b6ad16fddab388edb120e
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin ddc96d8a4280c69305dd541005cacfbe3e58f4c5 261dc7527bbb002633b5724a365f3e3e3be4f15a && git checkout -B drift-repro ddc96d8a4280c69305dd541005cacfbe3e58f4c5 && git merge --no-ff 261dc7527bbb002633b5724a365f3e3e3be4f15a
node scripts/docs-audit/affected-docs.mjs --json ddc96d8a4280c69305dd541005cacfbe3e58f4c5
|
Claude-Session: https://claude.ai/code/session_01Utp6CZe3KTAXogcUJuvYEx Co-authored-by: Claude <noreply@anthropic.com>
…orm-objects count the knowledge source Claude-Session: https://claude.ai/code/session_01Utp6CZe3KTAXogcUJuvYEx Co-authored-by: Claude <noreply@anthropic.com>
…edge source strings Claude-Session: https://claude.ai/code/session_01Utp6CZe3KTAXogcUJuvYEx Co-authored-by: Claude <noreply@anthropic.com>
… item 6 prescribes One row under AI (order 5, 高级), in the spelling of the ai_context row; the Studio menu placement test reads this table. Claude-Session: https://claude.ai/code/session_01Utp6CZe3KTAXogcUJuvYEx Co-authored-by: Claude <noreply@anthropic.com>
…s 120_000 budget (objectstack-ai#37708) <!-- claude-projects-attribution: {"github_login":"os-bill"} --> _Requested by **Bill** · [project thread](https://claude.ai/code/project/chan_016iMXWSZDzqWRWvWzdNo8wg?thread=cmsg_016iMXWSZDzqWRWvWzdNo8wg3zXREECfPtgrM8TPQaxn1v)_ Fixes objectstack-ai#37700 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户无感:只改了一份内部测试的等待上限,产品行为前后不变。 - 为什么做:知识库能力的一条新测试在主干定时全量构建里超时,把主干标红;本改动让它在繁忙的构建机上也有足够时间。 - 出错会怎样:最坏只是这条测试仍偶发超时,主干再红一次,可直接撤回,不影响任何用户。 - 要你做什么:无。 ## What changes `packages/verify/src/harness.required-providers.test.ts` only. The two cases in the `requires: ['knowledge']` describe that still ran on vitest's 5000 ms default now take the file's per-case `120_000`, which every other boot/import case in the file already carries. Each carries a comment with its measurement: - **an install without the optional libSQL store** (the failing case). It clears the module cache (`vi.resetModules()`) and `constructServedProviders` then re-imports the provider graph. Local: 1138 / 1358 / 1365 ms over three runs. The scheduled run 45888214247 (job 140145134703, Test Core 10/10) read this file's tests at 57.8 s, which is 52.8 s outside this case against 16.2 s locally, so 3.3x. 1365 ms x 3.3 = 4.5 s, which leaves no margin under 5000 ms. The case was killed at 5000 ms. - **a host that mounts the service itself**. The same `constructServedProviders` shape, and it had no timeout either. 111-114 ms in file order, 431 ms alone on a cold cache (`-t`). x 3.3 = 1.4 s cold. It is not failing today; it gets the same budget so the risk is covered the same way. The other three knowledge cases already carry `120_000`. I chose a per-case timeout over a shared boot (the objectstack-ai#28631 shape) because the slow case is not a repeated boot. Its cost is a module re-import that it causes on purpose, and nothing could share it. The file's own convention is a per-case `120_000`. Nothing is skipped. ## Tests <details><summary>File run on the final head, plus three earlier measurement runs</summary> ``` head fdf439c: pnpm --filter @objectstack/verify exec vitest run --maxWorkers=2 --reporter=verbose src/harness.required-providers.test.ts ✓ ... a host that mounts the service itself keeps its own, and the runtime adds no store 235ms ✓ ... an install without the optional libSQL store: ... says so once 1487ms Test Files 1 passed (1) Tests 15 passed (15) os-verify-lock: VERDICT command-exit 0 measurement runs (base 9476092, verbose): libSQL case 1138 / 1358 / 1365 ms; host case 114 / 113 / 111 ms; file tests 17.44 / 17.19 / 17.55 s; host case alone (-t) 431 ms pnpm --filter @objectstack/verify typecheck -> VERDICT command-exit 0 (check:test-typecheck: OK, the test layer compiles) ``` </details> ## Acceptance notes - `overlap-check`: `objectstack-ai#37676 (shares packages/verify/src/harness.required-providers.test.ts): merges cleanly`, `VERDICT clean exit 0`. The overlap is textual only. - The file's `test-budget: 28` header is out of date. The CI run above read the file at 57.8 s (including the 5 s timeout), and its own text says "the first CI reading after the knowledge boots re-measures it". This PR does not re-set the budget, because that is outside the card's acceptance. Noted here for the lane. - No changeset. The diff is a `*.test.ts` under `src/`. `@objectstack/verify` ships `dist`, `README.md` and `CHANGELOG.md`. After `pnpm --filter @objectstack/verify build`, grepping `dist` finds 0 hits for the case title, and the positive control `bootStack` is found (`dist/index.js`, `dist/index.cjs`). The PR carries `skip-changeset`. ## Verification Read first: the one hunk at the end of the knowledge describe (the libSQL case's closing `}, 120_000);` and its comment). Two-minute check: `pnpm --filter @objectstack/verify exec vitest run --reporter=verbose src/harness.required-providers.test.ts` should print 15 passed, with the libSQL case at about 1-1.5 s locally. The real proof is the next scheduled full run going green on Test Core 10/10. --- _Generated by [Claude Code](https://claude.ai/code/session_01Utp6Cb4BAjgQ43tqy1DvVJ)_ Co-authored-by: Claude <noreply@anthropic.com>
…ell was scoped by; a scope no read could filter by says so (objectstack-ai#37706) <!-- claude-projects-attribution: {"github_login":"os-sales"} --> _Requested by **Sales** · [project thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuDqyPrPQvkURDXnUDgkyFWB)_ Fixes objectstack-ai#36794 (PR-2 of 2; PR-1 objectstack-ai#37567 landed the spec reason and the importer) Clause-②: yes (widening) Metadata-protocol: none ## 维护者速读 - 导入向导在预检和完成页上,对“查找值属于另一个父记录”的情况显示专门的提示,例如 `"Design review" was found, but not under Project "Gemini"`。提示会用标签说出限定它的列和本行填的值,11 种界面语言都已翻译。 - 补上契约审核提出的一个漏洞:如果 `dependsOn` 指向一个引擎无法筛选的字段(比如公式),限定查询一次都没跑成。这种情况以前会被误报成“在别的父记录下”,现在照旧报“找不到记录”,提示语改为说明无法在这个范围内查找,需要给 `dependsOn` 换一列。 - 只影响导入失败行的显示文字和一种配置错误时的错误码,成功导入不受影响,没有新增可写的元数据键。整张 PR 可以直接撤回。 - 无。 ## What changes - **Import Wizard** (`ui/packages/plugin-grid/src/ImportWizard.tsx`): `formatDryRunError` gains `case 'reference_out_of_scope'`, rendered from the cell error's structured `scope`. Each entry is named by the importing object's field label (its api-name when it has none) with the cell the row gave it, joined in the order the server sent them by the pack's own separator (`grid.import.scopeSeparator`: `、` in ja and zh, `، ` in ar; review N3). The Wizard keys on the code and `scope` only and never parses the server sentence; a cell error with no `scope` falls through to the server's own sentence (already in the caller's locale), the same path an unknown code takes. `scope` is carried onto `ImportResult.errors` by both the synchronous import mapping and `jobResultToImportResult`, so the completion screen renders the same text as the dry-run panel. New keys `grid.import.referenceOutOfScope`, `grid.import.scopeEntry` and `grid.import.scopeSeparator` are in the Wizard's default dictionary and in all 11 locales under `ui/packages/i18n/src/locales/`. - **Review nit 2, a scope no read could filter by** (`packages/core/src/utils/import-runner.ts`, `import-coerce.ts`): the resolver records whether any scoped candidate read ran to an answer, and whether a read was refused by the engine's filter seam for the scope: `isScopeFilterRefusal`, the declared `code: 'INVALID_FIELD'` naming a scope field in `fields`, read off the refusal like `isScopeFieldDenial`, never its message. Only when no read answered and such a refusal was seen (the `dependsOn` `param` names a target field the engine cannot filter by, such as a `formula`) does it return `RefMatch.scopeUnqueryable`. A lookup whose reads are all refused for any other reason (no read grant on the target, a driver fault) keeps the plain miss and the plain sentence (contract review S1, 7204641031). That cell keeps `reference_not_found`, with no unscoped probe and no `scope`, and gets its own catalog sentence `import_reference_scope_unqueryable`, whose remedy names the target field the `dependsOn` entry filters by ("point that dependsOn entry at a stored field", review N1) (`packages/spec/src/system/validation-message.ts`, all four platform locales). **Chosen: the runtime answer, no lint.** A lint refusing such a `dependsOn` would refuse metadata that publishes today, which is a narrowing that needs its own card. Before this PR that cell answered `reference_out_of_scope` once the unscoped probe found the value, which claimed a fact the import never checked. - **Review nit 1**: `ImportRowResultSchema.errors` describe (`packages/spec/src/api/export.zod.ts`) and the runner's `ImportRowResult.errors` jsdoc now say a `reference_out_of_scope` element carries `scope`. Regenerated `content/docs/references/api/export.mdx`. - **Review nit 4**: `content/docs/api/error-catalog.mdx` now says `scope` names the row's own scoping columns and the cells the row gave them, not the parent's columns. - `content/docs/data-modeling/import-mappings.mdx`, scoped-lookup section: a `dependsOn` `param` naming a formula cannot scope the lookup, and the cell answers `reference_not_found` with the could-not-look-up sentence; any other refusal keeps the plain sentence. - Changeset: `@objectstack/spec`, `@objectstack/core`, `@object-ui/plugin-grid` and `@object-ui/i18n` patch. `Metadata-protocol: none`: no key enters `packages/spec/authorable-surface/*.json`, because `check:generated` moved only the references page. The new catalog key is message vocabulary, the same class as PR-1's `import_reference_out_of_scope`, which its claim also read as `none`. `Clause-②: yes (widening)`: a new catalog key a deployment can override, and a wire answer that only becomes more precise for a case no released version answered `reference_out_of_scope` for. ## Tests - **Review nit 3, a real engine and the real field guard** (`packages/qa/dogfood/test/import-reference-out-of-scope.dogfood.test.ts`): a booted stack with the real `SecurityPlugin`, ObjectQL, SQL driver and the REST import door, plus a fixture member whose permission set hides `oos_task.project`. The guard is shown live first: the member's filter on that field gets 403, the admin's gets 200. The pins: - Admin, a task of another project: `reference_out_of_scope` with `scope: [{ field: 'project', value: 'Gemini' }]`. The in-scope row resolves and stores the id. A value nobody has: `reference_not_found` with no `scope`. - Member, the same rows: `reference_not_found`, plain sentence, no `scope`, including the row whose task really is under its own project. - A `dependsOn` whose `param` is a formula: `reference_not_found` with the `import_reference_scope_unqueryable` sentence. - None of these reads the guard's reason across a package as a string. Each answer comes from the real seam. - Ablation (dogfood): with the `isScopeFieldDenial` branch disabled, the member pin goes red. With the `scopeUnqueryable` assignment disabled, the formula pin goes red (2 failed / 2 passed). Restored: 4 passed. - `packages/core/src/utils/import-runner-reference-master-scope.test.ts`: a new pin in which every scoped read is refused `INVALID_FIELD` naming the scope field. It answers `reference_not_found` with the new sentence, no `scope`, and no unscoped probe. Two pins for S1: every read refused `PERMISSION_DENIED` naming no field, and every read refused `INVALID_FIELD` naming a field outside the scope; both answer the plain sentence. - `packages/spec/src/system/validation-message.test.ts`: every locale of `import_reference_scope_unqueryable` interpolates `{{value}}` and `{{scope}}` and names `dependsOn`; the English render. - `ui/packages/plugin-grid/src/importDryRun.test.ts`: the new case names the scope column by its label and the row's cell; a multi-column scope names every column (one without a label by api-name), joined by the pack's separator; it is never rendered as "no matching record"; with no `scope`, the server sentence is shown minus the api-name prefix. `importAsyncPath.test.ts`: `jobResultToImportResult` carries `scope` onto the error. <details><summary>Local readings (tree 8b99fd1, on main fbcfdfb; round 2 head f9dcf30: core master-scope 19 passed, spec validation-message 45 passed, dogfood out-of-scope 4 passed, ui i18n + plugin-grid 428 files / 4822 passed, plugin-grid type-check and core tsc green)</summary> - `pnpm --filter @objectstack/spec check:generated --fix`: 1 stale (`content/docs/references/**`, the `errors` describe), green after; nothing under `packages/spec/authorable-surface/` moved. - `typecheck` core and spec: green. `type-check` `@object-ui/plugin-grid` and `@object-ui/i18n` (deps built): green. `lint` plugin-grid: 0 errors. - `pnpm --dir ui exec vitest run packages/i18n/ packages/plugin-grid/`: two i18n census pins moved with the new keys and were updated in this PR (`de-quote-pairing-3876`, 133 → 135 paired spans; `untranslated-identity-4376`, `grid.import.scopeEntry` allowlisted as a format string). After that: i18n 111 files / 2028 passed; plugin-grid files green (the first run's only 3 failures were those two i18n pins). - spec `src/system/` + `src/data/mapping.test.ts`: 80 files / 2841 passed. core `src/utils/`: 51 files / 1356 passed. - dogfood `import-reference-out-of-scope` + `import-reference-exposure`: 2 files / 15 passed (core built from this tree). - `node scripts/pm/overlap-check.mjs`: VERDICT clean exit 0 (main, objectstack-ai#37676, objectstack-ai#37667, objectstack-ai#37422). </details> ## Acceptance notes - The unfilterable-scope cell keeps the `reference_not_found` code, so the Wizard shows its generic "No matching record" text there. The precise sentence reaches API callers in the cell error's `message`. That case is an authoring mistake that a Wizard user cannot fix, and a code of its own would be a new `FieldErrorCode` member, which needs its own contract review. Left as it is. ## Verification Read first: `formatDryRunError` in `ImportWizard.tsx` (`case 'reference_out_of_scope'`), the resolver's `lookup` in `import-runner.ts` (`asked`, `scopeUnqueryable`), and `referenceNotFound` in `import-coerce.ts`. Two-minute check: `pnpm --dir ui exec vitest run packages/plugin-grid/src/importDryRun.test.ts -t "reference_out_of_scope"` runs 4 tests, all green. --- _Generated by [Claude Code](https://claude.ai/code/session_01L6bhgWgMUXf5juNBhN6rLX)_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01L6bhgWgMUXf5juNBhN6rLX <!-- signed: repo:objectstack#2 · os-sales · session_01L6bhgWgMUXf5juNBhN6rLX --> --------- Co-authored-by: Claude <noreply@anthropic.com>
… environment's default model (objectstack-ai#37697) <!-- claude-projects-attribution: {"github_login":"hotlong"} --> _Requested by **Jack** · [project thread](https://claude.ai/code/project/chan_01EF41AQooqveF2DGD8nqPzS?thread=cmsg_01EF41AQooqveF2DGD8nqPzS4Qk9xEo3NPMmxK8sJfyTfe)_ Fixes objectstack-ai#37686 Clause-②: yes (widening) Metadata-protocol: semantic Skills-docs: follow-up objectstack-ai#37711 ## 维护者速读 - 写 agent 元数据的人和 AI:模型块里可以不写模型名,只写温度等参数;不写就用部署的默认模型,写了照旧。没写供应商时也不再自动当成 openai。 - 属于「AI 模型档位」专题第一阶段,按你在决策卡上选的「框架允许省略 model」落地。 - 只放宽不收紧,旧 agent 全部照常解析,运行时行为不变;出问题可直接撤回这个 PR。 - 无。 ## What changes - `packages/spec/src/ai/agent.zod.ts`: `AIModelConfigSchema.model` goes from a required `z.string()` to `z.string().optional()`. Its description now says that an absent model name means the host's default model for the environment. The block stays strict (unknown keys refused); `temperature` still defaults to `0.7`. No sentinel value, no tier key (phase 2 of objectstack-ai/cloud#5055). - Same file, contract review S1 (seat amendment of the order's step 4): `provider` loses `.default('openai')` and becomes `.optional()`; key and enum unchanged. A block that names no model no longer parses to `provider: 'openai'`, which asserted a provider for a model the host picks. The default move is declared in `DEFAULT_CHANGES_BY_MAJOR` under `19` (`packages/spec/scripts/lib/default-changes.ts`) with its consumer-facing reason, and `authorable-defaults/ai.json` drops the line. No runtime reads an agent's `model.provider`, so no deployed agent changes behaviour. Not retired: enforce-or-remove for `provider` is objectstack-ai#37712. - `packages/spec/src/ai/agent.test.ts`: six new cases (temperature-only block parses with `model` undefined; an explicit name is carried as written; an unknown key is still refused as `unrecognized_keys`; a non-string name is still refused; a whole agent with `model: { temperature: 0.2 }` parses; a block with no `provider` parses without one, a written one is carried, an off-enum one is refused), and the minimal-config case now expects no `provider`. - `ui/packages/app-shell/src/views/metadata-admin/previews/AgentPreview.tsx` (contract review S2, file surface widened by the seat): the model pill showed only when `model.provider` was set, so a block naming a model and no provider lost the model name once the default was gone. It now shows when a model or a provider is written and reads `PROVIDER · MODEL`, `MODEL` or `PROVIDER`; a block that names neither shows no pill, so the environment default is not given a name. Two new cases in `AgentPreview.test.tsx`. - Generated: `content/docs/references/ai/agent.mdx` (`gen:docs`) and `packages/spec/authorable-defaults/ai.json` (written by the build). authorable-surface, api-surface, the JSON-schema manifest and the metadata-form translations needed no change: the key set is unchanged, and the translations carry only the `model.model` label. - `.changeset/37686-agent-model-name-optional.md`: `@objectstack/spec` minor and `@object-ui/app-shell` patch, with the three declaration lines; `semantic` because a default moved (it outranks `added`). Read first (by risk): `packages/spec/src/ai/agent.zod.ts` (the two contract hunks), `packages/spec/scripts/lib/default-changes.ts` (the declared default move), then the changeset. ## Tests All at head `b3238ea8`, run through `scripts/pm/os-verify-lock.sh` on a shared container. The spec readings were taken at `db5f0e7d`; the only later commit touches `ui/` and the changeset prose. - `pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2 src/ai/agent.test.ts` → Test Files 1 passed, Tests 70 passed. - `pnpm --dir ui exec vitest run packages/app-shell/src/views/metadata-admin/previews/AgentPreview.test.tsx packages/app-shell/src/views/metadata-admin/previews/AgentPreview.emptyCollection-8520.test.tsx` → Test Files 2 passed, Tests 24 passed. - Ablations (each fix committed first, the mutation made on disk, then restored from HEAD): without `model`'s `.optional()`, Tests 2 failed / 67 passed; with `provider`'s `.default('openai')` restored, Tests 3 failed / 67 passed; with the preview pill keyed on `provider` again, Tests 1 failed / 17 passed (the name-only case). The other new cases pin behaviour that holds either way. - `pnpm --filter @objectstack/spec test` → Test Files 903 passed (903), Tests 28557 passed, 1 todo. - `pnpm --filter @objectstack/spec typecheck` → exit 0 (includes `check:test-typecheck`, 52 files held in the ledger, unchanged). - `pnpm --filter @objectstack/spec build && pnpm --filter @objectstack/spec check:generated` → exit 0 after `gen:docs`; the build's default ratchet accepts the declared `ai/AIModelConfig:provider` move. - `@object-ui/app-shell` has no `typecheck` script; its types are `Type Check UI`'s, read from this PR's check-runs. <details><summary>Local gate families: 117 derived, 117 run, all exit 0</summary> `node scripts/pm/dispatch-gates.mjs --commands` derived 117 families for this change set at `b3238ea8` (the three new ones read `ui/`: `check-sdui-manifest` and its self-test, and `vitest run scripts/` under `ui/`); each was run and its exit code captured before any pipe, all 0. `--ran` reconciliation: "117 derived famil(ies) accounted for — 117 run, 0 NOT-MEASURED (a DERIVED zero — all 117 recorded an exit code and none of them is 3)". Families outside the derivation (repo-wide lint, UI lanes, Test Core's repo project) are CI's. </details> ## Acceptance notes - Premise re-checked on `origin/main` 6d106a1: the card's `Re-check:` grep answers 1 hit at `agent.zod.ts:38`. - Readers of an agent's `model.model` in this repo: `packages/spec/src/system/metadata-list-registry.ts` (list column; `valueAtPath` answers `undefined`, so the cell is empty for an agent with no model, which is the card's "empty/default" outcome); `AgentPreview.tsx` (its model pill, reworked here for S2, renders only what is written); tests only otherwise. None breaks on `undefined`. In cloud (read-only, `origin/main` 63427ae), `packages/service-ai/src/agent-runtime.ts:1028` assigns `options.model = agent.model.model`, so an absent name leaves `options.model` undefined there; how cloud resolves that to its default is the cloud card's (objectstack-ai/cloud#5055) after a pin move. - `provider`: declared, not enforced. No runtime in this repo reads an agent's `model.provider`, and in cloud `origin/main` 63427ae `agent-runtime.ts` reads only `model`, `temperature` and `maxTokens` from the agent's block (the `model.provider` read in `vercel-adapter.ts:391` is the AI SDK model object, not the agent config). Its default is dropped here (S1); keep-or-retire is objectstack-ai#37712. - Display (S2): the preview reads the raw draft, so a draft that wrote a model and no provider showed no pill even before this PR; the S2 fix shows its name either way. A parsed or stored block no longer carries an invented `openai`. - Skills docs: `skills/objectstack-ai/SKILL.md` "Model Configuration" still teaches `model` as a required free string with `provider` default `openai`, and cites `agent.zod.ts:36-40`; the `skills-tools-knowledge` eval expects "a free-string `model`". Follow-up objectstack-ai#37711. - Overlap: objectstack-ai#37676 also opens a `19` bucket in `default-changes.ts` (and touches `authorable-defaults/ai.json`); `main` merges cleanly here, the two PRs conflict textually there, and whichever lands second keeps both entries. ## Verification Two-minute check: `pnpm --filter @objectstack/spec exec vitest run src/ai/agent.test.ts` → 70 passed; revert the `model` `.optional()` and two of the new cases go red; restore the `provider` default and three go red. --- _Generated by [Claude Code](https://claude.ai/code/session_01Q4EjjQgJ62YaG4EAxNLuqP)_ <!-- signed: epic:objectstack-ai#5055#1 · hotlong · session_01Q4EjjQgJ62YaG4EAxNLuqP --> --------- Co-authored-by: Claude <noreply@anthropic.com>
…ependency ships no longer warns; the ADR-0150 D3 rule moves to metadata-core (objectstack-ai#37723) Fixes objectstack-ai#37609 Clause-②: yes (widening) Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:技能作者在应用的技能里引用一个由所依赖的应用包提供的资料包时,发布前的校验不再误报「资料包不存在」;真正不存在或未声明依赖的资料包照旧提示,并说明该怎么改。 - 为什么做:属于「AI 技能与资料包」专题的收尾,让校验工具和运行时用同一条规则判断技能指向哪个资料包。 - 出错会怎样:最坏情况是校验提示比运行时多报或少报一条警告,不影响运行时行为,也不拒绝任何配置;回退本改动即可恢复原状。 - 要你做什么:无。 ## What changes - **The ADR-0150 D3 rule moves to `@objectstack/metadata-core`.** `resolvePackageScopedHolders`, its holder source, refusal, `PackageScopedNameRefusedError` and vocabulary (`packages/core/src/package-scoped-resolution.ts`, which imports nothing) move with `git mv` to `packages/metadata-core/src/package-scoped-resolution.ts`, beside the closure walk it reads (`package-closure.ts`), together with its test file. metadata-core's index exports it. This follows the R2 precedent that moved the closure walk out of lint into metadata-core. No new package edge: metadata-core depends only on spec, and core, lint, objectql and metadata-protocol already depend on it (seat ruling 7205321128, route A). - **Core re-exports every name.** `packages/core/src/package-scoped-resolution.ts` is now one named re-export of the 33 names (20 values, 13 types) from `@objectstack/metadata-core`, so core's export set, every core caller (objectql, mcp `skill-prompts.ts`, cli `picklist-references.ts`, core's security catalog) and every `path#symbol` anchor into that file are unchanged. There is no second copy. - **`ai-skill-context-unknown` judges `context` by that rule** (`packages/lint/src/validate-ai-tool-references.ts`, `skillContextResolver`). Holders are the stack's own packs and the packs of the artifact's other `packages[]` bodies. The closure is `packageResolutionClosure` over those packages: declared dependencies, transitively, plus `sys`. The caller is the stack's `manifest.id`. This is the shape the CLI's per-package pass already hands each package (`packageBodyAsStack`), so `os validate` / `os build` / `os lint` give the answer the MCP skill prompt gives (`skillPromptRecordContext`): - a pack a declared dependency in the artifact ships: no warning (the false positive this card measured); - the stack's own pack: no warning, as before; - a pack no package in the artifact ships: the same warning and wording as before; - a pack only a sibling outside the closure ships: warns, naming the holder, with the hint to declare the dependency; - a pack two holders in reach ship: warns, naming both. Each verdict is one line of at most 200 characters. - Changeset: `@objectstack/metadata-core`, `@objectstack/core`, `@objectstack/lint`, all patch, with the two declaration lines. Read first, by risk: 1. `packages/core/src/package-scoped-resolution.ts`: the re-export must list every name the moved module exports; the identity pin holds the value set. 2. `packages/lint/src/validate-ai-tool-references.ts`, `skillContextResolver`: the holder set and closure handed to the rule. 3. `packages/metadata-core/src/package-scoped-resolution.ts`: only the placement header changed; the rest is a byte-for-byte move. ## Tests - `packages/core/src/package-scoped-resolution-reexport.test.ts` (new): each of the 20 values core re-exports is the same object (`toBe`) as metadata-core's, through the module and core's index. The value set equals the pre-move set. A refusal error built by one package is `instanceof` the other's class. - `packages/lint/src/validate-ai-tool-references.test.ts`, a new describe in the per-package stack shape: dependency pack 0, own-stack 0, truly unknown 1, non-dependency sibling 1, two holders in the closure 1, and the one-line bound. - The rule's own 100+ arm tests moved unchanged with the file into metadata-core. All suites below were run at `14b930039a`. <details><summary>Full suites of every touched package, and the rule's callers</summary> ```text @objectstack/metadata-core test exit 0 Test Files 28 passed (28) Tests 1104 passed (1104) @objectstack/metadata-core typecheck exit 0 @objectstack/core test exit 0 Test Files 158 passed (158) Tests 3777 passed (3777) @objectstack/core typecheck exit 0 (check:test-typecheck: OK) @objectstack/lint test exit 0 Test Files 239 passed (239) Tests 9718 passed (9718) @objectstack/lint typecheck exit 0 (check:test-typecheck: OK) @objectstack/mcp test exit 0 Test Files 87 passed (87) Tests 1589 passed (1589) @objectstack/objectql 7 package-scoped / bare-name files exit 0 Tests 1099 passed (1099) ``` cli `picklist-references.ts`: NOT MEASURED locally (its dependency closure is 71 packages); Test Core runs it. </details> <details><summary>Ablation: drop the closure argument</summary> `node scripts/ablation-replace.mjs --file packages/lint/src/validate-ai-tool-references.ts --anchor ' closureOf,' --replacement ' () => new Set...(),'`. The mutation hands the rule an empty closure. The lint suite imports the rule from `src`, so no dist leg is needed. ```text ablation-replace: anchor x1 -> x0 ablation-replace: blob bb3e3db -> abe67df5aa7f ablation-replace: ok mutation landed x a pack a declared dependency ships resolves: no warning Tests 1 failed | 42 passed (43) ablation-replace: blob after restore bb3e3db ablation-replace: blob at HEAD bb3e3db ``` Only the dependency pin goes red. The controls stay green. </details> <details><summary>Local gates (dispatch-gates --commands, 69 derived)</summary> 66 exit 0. Two exited 3 (PREREQUISITE NOT MET, so NOT MEASURED; CI builds them): `check:dual-build-cjs-loads` and `check:published-readme-exports`. `check:lean-entry-closure` first exited 3, then exited 0 after the objectql closure was built: "Admitted set held exactly (15 packages)". `check:adr-symbol-anchors` exit 0: "4243 anchors across 163 records resolve". `--ran` reconciliation: 69 derived, 69 run, 0 UNRUN. </details> ## Acceptance notes - Overlap: objectstack-ai#37676 adds 'knowledge_source' to the core file this PR moves; the second lander re-homes the entry into metadata-core (area decision, zone told) - Out of scope, not edited (docs/adr is fenced and governed): an ADR-0150 amendment note still names the pin path `packages/core/src/package-scoped-resolution.test.ts`, which this PR moves to `packages/metadata-core/src/`. The area seat carries it. - A dependency outside the artifact (installed from npm) ships packs `os validate` cannot read, so a `context` naming one still gets the hedged "unless a dependency ships it" warning. ## Verification `pnpm --filter @objectstack/metadata-core build && pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2 src/validate-ai-tool-references.test.ts`. Expect 43 passed, including "a pack a declared dependency ships resolves: no warning". --- _Generated by [Claude Code](https://claude.ai/code/session_01Utp6CbeF2saT6wUBV4E9uc)_ <!-- signed: repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc --> --------- Co-authored-by: Claude <noreply@anthropic.com>
… on the 10 s grid (objectstack-ai#37738) <!-- claude-projects-attribution: {"github_login":"os-elon-musk"} --> _Requested by **Elon** · [project thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DG44bgtJm8kWx4oK68re6GX)_ Fixes objectstack-ai#37710 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户无感:只改一个测试文件头上记的耗时预算数字,不影响任何功能。 - 属于测试耗时预算治理,替预算检查把一个过期数字改成实测值。 - 数字不准只会让慢测试预警失真;可直接撤回这一行。 - 无。 ## What changes Line 2 of `packages/verify/src/harness.required-providers.test.ts`: `test-budget: 28` becomes `test-budget: 70`, and the stale measurement narrative is replaced by the post-objectstack-ai#37708 CI reading. - Reading: scheduled CI run 45914939800, job Test Core (10/10) 140232535871, head 80519b5 (a descendant of the objectstack-ai#37708 merge 6b60f88); this file took 53747 ms. - Rule used (the gate's own text in `readTestBudget`): measured CI reading x 1.25 (`CEILING_HEADROOM`), rounded up to the next 10 s: 53.7 x 1.25 = 67.1, so 70. - The old line also lacked the `: ` after the CLASS; the gate's grammar is `SECONDS — CLASS: REASON`, which the new line satisfies (it already had the colon after the class text). - It is the only post-objectstack-ai#37708 reading of this file on main (the push run 45915335818 did not run it). ## Tests - `readTestBudget` on the edited file: `{ seconds: 70, cls: 'spawns the real producer once per single-cause fixture', line: 2 }`, no refusal (before: refused "28 s is not on the 10 s grid"). - `check-nul-bytes` exit 0; `check-issue-citations` exit 0; `overlap-check` VERDICT clean (objectstack-ai#37676 shares the file, merges cleanly). ## Acceptance notes - Test-only comment-line change, nothing published: `skip-changeset`. - The file's own vitest was not rerun locally: no code changed, and the reading comes from CI. ## Verification Run `node -e "import('./scripts/measure-test-shard-timings.mjs').then(m=>console.log(m.readTestBudget(require('fs').readFileSync('packages/verify/src/harness.required-providers.test.ts','utf8'),'f').seconds))"`; expect `70`. --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP <!-- signed: repo:objectstack#1 · os-elon-musk · session_016WV4cwPhGV4g9p1BGQaZbP --> Co-authored-by: Claude <noreply@anthropic.com>
… CONCURRENT_MODIFICATION 409 (objectstack-ai#37748) <!-- claude-projects-attribution: {"github_login":"os-elon-musk"} --> _Requested by **Elon** · [project thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DG44bgtJm8kWx4oK68re6GX)_ Fixes objectstack-ai#37597 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:知识库用 turso 存储时,重建期间一次检索连续三次撞上索引切换,调用方收到的错误从"服务不可用 503"改为"并发修改 409",与 pgvector 存储一致。 - 为什么做:让两种知识库存储对同一情况给出同一种可重试的错误(知识检索后续收口专题)。 - 出错会怎样:只影响这一种罕见的检索失败的错误码,正常检索结果不变;可直接撤回。 - 要你做什么:无。 ## What changes - `packages/plugins/knowledge-turso/src/turso-adapter.ts`: the search-exhaustion branch of `searchAttempt` (the active generation switched on each of `SEARCH_ATTEMPTS` = 3 attempts) now throws `{ code: 'CONCURRENT_MODIFICATION', status: 409 }` through a module-private `switchedDuringSearch` helper, instead of `notReady(...)` (`SERVICE_UNAVAILABLE` 503). This is the envelope pgvector answers for the same condition (`pgvector-adapter.ts`, the `SEARCH_ATTEMPTS` exhaustion in `search`): no `remedy`, no retryable flag, the code constant declared beside `SEARCH_ATTEMPTS` with pgvector's doc line. The message keeps the source name and the "retry it" instruction: `The knowledge search was not answered: its source's index was switched while it searched. The active generation of source 'X' changed 3 times during one search; retry it.` - Retry count, the happy path and every other answer are unchanged. No new export, no adapter-contract member (epic objectstack-ai#37000 ruling). `CONCURRENT_MODIFICATION` is already a standard code (`packages/spec/src/api/errors.zod.ts`), so no new code. - Changeset: `@objectstack/knowledge-turso` patch. ## Tests - `acceptance.test.ts`: the existing case "a search whose generation keeps being switched under it stops after three attempts" now pins `{ code: 'CONCURRENT_MODIFICATION', status: 409 }` and still pins `n === 3` (the retry count). It runs under both the `:memory:` and the `file:` URL suites. - Ablation: with the origin/main adapter restored on disk, the case is red in both suites (`- "code": "CONCURRENT_MODIFICATION"` / `+ "code": "SERVICE_UNAVAILABLE"`); restored from HEAD afterwards, tree clean. ## Acceptance notes - The two message lines of the exhaustion branch are left byte-identical on purpose: open PR objectstack-ai#37676 rewrites the next line (`opts.source.id` to `opts.source.name`), and touching only the `throw` line keeps the two branches textually mergeable (`overlap-check` exit 0 against objectstack-ai#37676). - turso's `upsert` exhaustion (`UPSERT_ATTEMPTS`) does not share this helper: it throws a bare `Error` with no `code`/`status`, exactly as pgvector's `upsert` exhaustion does. The two stores agree there, so there is no mismatch to note; left unchanged (out of the card). ## Verification - Two-minute check: `pnpm --filter @objectstack/knowledge-turso exec vitest run src/__tests__/acceptance.test.ts -t 'keeps being switched'` shows 2 passed (both suites). - Read first: the `searchAttempt` exhaustion branch and `switchedDuringSearch` in `turso-adapter.ts`. <details><summary>Local gate readings at f256b9b</summary> - Package: `pnpm --filter @objectstack/knowledge-turso test` (Test Files 3 passed, Tests 156 passed) and `typecheck` (tsc + check:test-typecheck OK), under the verify lock, VERDICT command-exit 0. - Derived families (`dispatch-gates --commands`, 66): 65 exit 0, including `check:error-status-conformance` ("every derivable runtime status is documented, and every documented status is reachable", no baseline rows needed). `check:dual-build-cjs-loads` exit 3 PREREQUISITE NOT MET (needs a full build): NOT MEASURED locally, CI runs it. `--ran` reconciliation: 66 accounted, 65 run, 1 NOT-MEASURED. - `overlap-check`: clean against origin/main and objectstack-ai#37676. - `check-nul-bytes`: OK. </details> --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP Co-authored-by: Claude <noreply@anthropic.com>
…efore each purge deletion (objectstack-ai#37750) <!-- claude-projects-attribution: {"github_login":"os-elon-musk"} --> _Requested by **Elon** · [project thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DG44bgtJm8kWx4oK68re6GX)_ Fixes objectstack-ai#37644 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户无感:集群里重建知识源时,排队中已被取消或已丢租约的构建不再开始建库,清理阶段丢了租约会在下一条删除前停下。 - 属于知识库检索专题,替多节点部署收掉向量库建库锁被白占的那一段。 - 出错时最坏是构建早停一步并如实记为租约丢失或超时,下次构建照常重来;可直接撤回本改动。 - 无。 ## What changes ADR-0161 K7 (builds and the builder lock). Two call sites in `packages/services/service-knowledge/src/knowledge-service.ts`, both inside `walkObjectSource`: 1. **Before `beginBuild`.** The walk now asks `fence?.stop()` before it calls the adapter's `beginBuild`. A build cancelled (`timed-out`) or lease-lost while its walk waited behind another walk of the same source used to call `beginBuild` once that walk ended. On pgvector that takes the builder lock, held until idle. Now it returns `ok: false` with `reindex of source 'ID' stopped before its build began, and nothing was written: STOP-MESSAGE`. The stop message is the fence's own, the same one the per-page, pre-purge and pre-completion halts carry. The record ends with its stop status (`timed-out` already finished by the race; `lease-lost` through the existing `fence.stop()` read in `rebuildSource`). 2. **Before each purge deletion.** The `serialize` hook handed to `purgeDocuments` now asks `fence?.stop()` once the candidate's turn on its record-sync chain comes, before the re-read and the delete. A stop rejects that candidate's task, so `purgeDocuments` ends early (its existing first-throw stop), and the walk answers `ok: false` with `walked every page, and stopped during its purge after N deletion(s): STOP-MESSAGE`. Nothing is completed. This also covers a build cancelled mid-purge: the purge that `fencedCall` stopped waiting on used to keep deleting in the background once its hung deletion answered. It now stops at the next candidate. No adapter-contract change (`packages/spec/src/contracts/**` untouched). `purgeDocuments`' input and the fence API are unchanged. The scheduled reconcile, which reuses `purgeDocuments` with no fence, behaves as before. ## Tests Four pins, added as a new top-level `describe` in the existing fence harness `src/__tests__/knowledge-build-fence.test.ts`: - a build cancelled while queued behind another walk never begins its build once that walk ends (`beginBuild` 0, record `timed-out`) - a build whose lease is lost while queued never begins its build, and ends `lease-lost` - a lease lost mid-purge stops before the next deletion and completes nothing (3 candidates, 1 removed, `purged: 1`) - a build cancelled mid-purge deletes nothing further once the deletion it stopped waiting on answers <details><summary>Premise on origin/main ce4d8c7: the 4 new pins red, the 14 existing ones green</summary> ``` × a build cancelled while queued behind another walk never begins its build once that walk ends × a build whose lease is lost while queued never begins its build, and ends lease-lost × a lease lost mid-purge stops before the next deletion and completes nothing × a build cancelled mid-purge deletes nothing further once the deletion it stopped waiting on answers AssertionError: expected 1 to be +0 (beginBuild called, both queued cases) AssertionError: expected [ Array(3) ] to deeply equal [ [ 'kb:gone1' ] ] AssertionError: expected [ [ 'kb:gone1' ], [ 'kb:gone2' ] ] to deeply equal [ [ 'kb:gone1' ] ] Tests 4 failed | 14 passed (18) ``` </details> <details><summary>Fix: package suite and typecheck green</summary> ``` pnpm --filter @objectstack/service-knowledge test Test Files 15 passed (15) · Tests 470 passed (470) pnpm --filter @objectstack/service-knowledge typecheck exit 0 (tsc --noEmit + check:test-typecheck) os-verify-lock: VERDICT command-exit 0 ``` </details> <details><summary>Ablations (scripts/ablation-replace.mjs; anchor hit 1 to 0, restored blob == HEAD each time)</summary> ``` A1 'if (unbegun !== undefined) {' -> 'if (false && unbegun !== undefined) {' x cancelled while queued · x lease lost while queued Tests 2 failed | 16 passed (18) A2 serialize: 'return halt === undefined ? task() : Promise.reject(...)' -> 'return task();' x lease lost mid-purge · x cancelled mid-purge Tests 2 failed | 16 passed (18) A3 'if (purgeHalt !== undefined) {' -> 'if (false && purgeHalt !== undefined) {' x lease lost mid-purge (message) Tests 1 failed | 17 passed (18) ablation-replace: ok restored: blob == HEAD (b33bdec) and `git diff HEAD` is empty ``` </details> ## Acceptance notes - The new pins go into the existing fence harness file as a top-level `describe`, not into a new file. AGENTS.md (ruling record 6583487846) says a new pin for a component that already has a shared harness file goes into that file. The dispatch had named a new file. - The fence's own stop message still reads "so it stopped before its next page" in the two new places, as it already does before the purge and the completion. It is reused as is, so no new message family is added. - The prose of `knowledge-build.ts`' header ("Before each page the walk asks the build's fence") is not edited. It stays true, and the walk's own jsdoc now names the two new points. ## Verification Read first, by risk: 1. `knowledge-service.ts`, the `serialize` hook in `walkObjectSource`: the stop rejects inside the chained task, so the record-sync chain's tail still settles. `chainAfter` swallows the rejection on the tail. 2. `knowledge-service.ts`, the `unbegun` check just above `beginBuild`. 3. `knowledge-build-fence.test.ts`, the new `describe`. Two-minute check: `pnpm --filter @objectstack/service-knowledge exec vitest run src/__tests__/knowledge-build-fence.test.ts`. Expect 18 passed. <details><summary>Local derived gate families at d88a72a: 69 exit 0, 1 NOT MEASURED</summary> ``` node scripts/pm/dispatch-gates.mjs --commands (3 paths vs merge base ce4d8c7): 70 families 69 :: exit 0 pnpm check:dual-build-cjs-loads :: exit 3, PREREQUISITE NOT MET (reads every package's dist/; only the package closure was built). NOT MEASURED locally. CI's Lint & Repo Gates carries it. dispatch-gates --ran: 70 derived famil(ies) accounted for, 69 run, 1 NOT-MEASURED (1 DERIVED from a recorded exit 3) node scripts/pm/overlap-check.mjs: VERDICT clean exit 0 (origin/main, and objectstack-ai#37676 merges cleanly) ``` Repo-wide scans (`pnpm lint`), `test:repo` and the full farm are left to CI. </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP --------- Co-authored-by: Claude <noreply@anthropic.com>
…above its measurement (objectstack-ai#37747) <!-- claude-projects-attribution: {"github_login":"os-elon-musk"} --> _Requested by **Elon** · [project thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DG44bgtJm8kWx4oK68re6GX)_ Fixes objectstack-ai#37630 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户无感:这是仓库内部的技能长度检查,发布给客户的技能文字一个字都没改。 - 为什么做:属于技能长度管控。以前文件变短后上限还停在原处,多出来的额度没人发现,后来的改动可以悄悄用掉;现在会直接报错,并给出该降到的数字。 - 出错会怎样:最坏是技能相关的 PR 被误拦,作者照提示把上限降到实测值即可;整个改动可直接撤回。 - 要你做的:无。 ## What changes `scripts/check-skills-token-ratchet.mjs` used to fail a row only when the measured tokens were over its ceiling. A row whose file later shrank passed and printed its headroom. On PR objectstack-ai#37442 that left a row 1 token above the merged measurement, and only the reviewer's arithmetic caught it. - **The per-row check** (`verdict()`) now fails a row whose ceiling is above its measurement. The message names the row, the measurement, the ceiling and the gap, and tells the author to lower the row to the measurement in the same PR. Lowering is the author's own act, so this message carries no `⛔ MAINTAINER-ONLY` token. The over-ceiling refusal is byte-for-byte unchanged. - **The header's shrink-only bullet** now says the PR that shrinks a file lowers its row to the new measurement in that PR. A row left above its measurement is red. - **37 CEILINGS rows are lowered to their measurement.** On `origin/main` ce4d8c7, 37 of the 61 authored rows sat above their measurement, 4813 tokens in all. The largest gaps were `objectstack-api/SKILL.md` (981), `objectstack-query/SKILL.md` (940) and `objectstack-data/rules/indexing.md` (746). Each row's number changes and gains a `-N to the measurement (was C)` note, and one block comment sits on the prose side of the CEILINGS doc comment (the placement note says to keep new prose there). No `skills/**` text changes and no ceiling is raised. ### Failure or warning **I chose failure.** Reasons: 1. With the 37 stale rows lowered, every row on main sits at its measurement, so a failure reds nothing that exists today. 2. A warning would be one more line in a log of 100-plus lines. A log line is how the 1-token gap on PR objectstack-ai#37442 got through. The card's failure mode is a reading nobody looks at, and a warning is still a reading nobody looks at. 3. The header already has the gate's rule: every path that moves a row pins it AT the measurement. Headroom left by a shrink is not budget. Failing on it makes that rule hold mechanically, just as failing over the ceiling does. 4. No header-documented reservation exists today. The header's one reservation is `pending10402` (headroom held for an approved PR), and its own record says it is spent ("`objectstack-data` measured 13817 against a 13817 ceiling … exactly zero"). So nothing needs an exemption. A future reservation of that kind would need this gate changed, and the header now says so. **How unchanged rows on main are treated:** they are lowered in this PR, not given a warning tier. Lowering is always legitimate under the header. Header lines that bound this change, quoted for the skills-lane reviewer: - Record 6139629628 item 2 (the A2′ stamp exclusion), as the header quotes it: "counts authored content only: the frontmatter `version:` line that the release bot rewrites is excluded from the count … ceilings stay shrink-only and the current headroom (0 and 1 tokens) stays as it is." I read this as bounding the A2′ re-pin, which lowered every stamped row by exactly 5 so that no file's headroom moved. I do not read it as protecting headroom against a later lowering. - The `strippedInternalIds` note in `CEILING_BASIS`: "That is the ratchet working as designed: shrink-only means a ceiling may be lowered to the measurement whenever one is taken, not merely by the size of the day's deletion." This is the authority for lowering all 37 rows in one PR. - The raise paths, all pinned at the measurement: ruling record 6513306068 ("may move the row by the measured remainder, pinned AT the measurement"), and ruling A on record 6819475461, made standing by record 6840575378 ("may raise that file's row by the row's own measured delta and by no more"). **Side effect for the reviewer:** in failure mode every count change to a skills file must edit its row. So two skills PRs that change one file's count now always conflict on that row; before, only raises did. This is the intended serialisation, because the merged measurement differs from both branches. It is still new load on skills PRs. **Overlap:** open draft PR objectstack-ai#36158 rewrites five of the lowered rows: `objectstack-data` `SKILL.md`, `rules/field-types.md` (together with the adjacent `rules/indexing.md`), `rules/relationships.md`, `rules/validation.md` and `references/examples-objects.md`. That PR already conflicts with main on its own skills files and re-measures those rows when it rebases. overlap-check: origin/main, objectstack-ai#37676 and objectstack-ai#37422 merge cleanly. ## Tests <details><summary>Self-test, gate, ablation and reverse reading (head d1295a6)</summary> - `node scripts/check-skills-token-ratchet.mjs --self-test`: exit 0, `✓ check-skills-token-ratchet self-test: 111 cases pass.` The roster grew 104 to 111, and the floor was raised to match. `under the ceiling -> green` became `under the ceiling -> red (a ceiling above its measurement)`, and the shrink-direction row now pins red-until-lowered. Seven new batteries: the red names the row, the measured count, the ceiling and the gap; it tells the author to lower the row; it is not the over-ceiling red (no `over by`, no authority token); one token above the measurement is red. Each new case reads the verdict and its text together. - `node scripts/check-skills-token-ratchet.mjs`: exit 0, `61 authored bundle file(s) within their ceilings`, and `ratcheted (authored) 199660 / 199660 (+0)`. On main it read `199660 / 204473 (-4813)`. - Ablation (`scripts/ablation-replace.mjs`, the new branch's `if` disabled, anchor x1 to x0): self-test exit 1, `9 failure(s)`, which is exactly the nine above-measurement batteries. After restore the blob matched HEAD and `git diff HEAD` was empty. - Reverse reading: main's CEILINGS judged by the new verdict, 37 of 61 rows red, gap 4813. </details> ## Acceptance notes - The card's acceptance asks the gate to report a row whose ceiling exceeds its measured tokens, naming the row, the measurement and the ceiling. It does that, as a failure; the choice is argued above for the reviewer. A test pins the new reading. The existing over-ceiling refusals are unchanged. - `skip-changeset`: the only file changed is a root `scripts/` gate in the private monorepo root package, so nothing ships. ## Verification <details><summary>Local gates (head d1295a6)</summary> - All 34 commands from `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` exited 0. Each exit code was captured before any pipe. They include `check-skills-token-ratchet` with its `--self-test`, `check:ratchet-remedy-authority`, `check:doc-authoring` and `check:nul-bytes`. - `--ran` reconciliation: `34 derived, 34 run, 0 NOT-MEASURED, 0 UNRUN`. - `check:pm-dispatch-gates` exited 0 on the previous head, ebc8fae. The last commit touches only ratchet self-test lines. - `check-published-list-mirrors` exited 0. - The control-byte self-scan found 0. </details> **Read first:** `verdict()`, the new below-ceiling branch (the one behaviour change). Then the header's "ratchet discipline" bullet. Then a sample of the lowered rows against the gate's printed counts. **Two-minute check:** run `node scripts/check-skills-token-ratchet.mjs`. Expect exit 0 and the line `ratcheted (authored) 199660 / 199660 (+0)`. Then raise any row by 1 locally and re-run. Expect a red that names that row, its measurement and the ceiling, ending in `Lower the row to N`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP --------- Co-authored-by: Claude <noreply@anthropic.com>
… "0 deleted, 4 failed" (objectstack-ai#37809) <!-- claude-projects-attribution: {"github_login":"os-sales"} --> _Requested by **Sales** · [project thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuDJAbBe3iTrFcF7GZrucZ32)_ Fixes objectstack-ai#37758 A list bulk Delete whose records were refused said only 「成功 0 条,失败 4 条」 ("0 deleted, 4 failed"). The server gives every refused record a readable, localized reason (a restrict delete says which child records still reference it), and the one-record Delete shows it; the batch summary dropped it. ## What changes - **`@object-ui/core` (`actions/recordDelete.ts`).** The bulk branch of `run` keeps each rejected result's reason. The summary toast keeps its count title (`objectActions.bulkDeletePartial`) and gains a description: - one line per distinct reason, in the order the records were handed in; - each line led by the names of the records that reason refused (the same ADR-0079 resolver the success toast uses), up to three names and then `+N`; - a reason whose records have no name reads alone (the title already counts them); - at most three reasons, then "And N more"; - an external datasource's refusal reads as the read-only sentence, as the one-record toast reads it; - a refusal with no message adds no line, so a batch with no reason at all keeps today's bare count toast. The one-record toast is unchanged. - **`@object-ui/i18n`.** Two keys in all 11 packs: `objectActions.bulkDeleteRefusedNamed` (`{{names}}: {{reason}}`, with each pack's own colon) and `objectActions.bulkDeleteMoreReasons`. The name/reason join is allowlisted in `untranslated-identity-4376` as a format string, as `detail.fieldChangeLabel` is. - **`@object-ui/plugin-view`.** The two keys join `ObjectView`'s `objectActions.*` fallback table. ## Decisions made here - **Grouped by the exact reason text, named by record.** The card's own restrict example carries each record's dependent count in its sentence ("referenced by 3 records" / "by 1 record"), so records rarely share a byte-identical reason. Naming the records under each reason answers "which", which the acceptance allows ("reason, then how many records or which"); records that do share a reason are one line. - **No counted noun in either new key.** "And {{more}} more" and the name list carry no plural noun, so no pack needs a CLDR plural family for them (`plural-categories-11432`). The option is `more`, not `count`, so i18next does not go looking for one. - **The description is joined with `\n`,** as `writeWarningToast` and `studioSaveBar` do. Each reason the server sends ends in its own punctuation. - **Not in this PR:** the related list's inline bulk-delete outcome line (`plugin-detail` `RelatedList.tsx`, `bulkDeleteOutcome`) has the same count-only shape, and a view-declared `operation: 'delete'` bulk action (the card's "also seen") was not measured. Both are for the seat to file or fold. ## Verification - `core/src/actions/__tests__/recordDelete.test.ts`: 6 new or changed cases, red on `main` and green here (6 red with `recordDelete.ts` reverted): an all-refused batch for one reason (names, `+1`), a mixed batch (two reasons, order kept, the deleted record not named), nameless records (reason alone), five reasons (three listed, "And 2 more"), an external-datasource refusal (read-only sentence), and the existing partial-failure case now with its description. Controls: refusals with no message keep the bare count with no description; the one-record refusal toast is unchanged. - `plugin-view` `ObjectView.gridDelete-10383`: the registered object-view bulk Delete's partial-failure pin now also asserts the refusal reason rides in the description. - `vitest` over `core/src/actions`, all `plugin-view` tests, `app-shell` `useObjectActions*` and all of `i18n` (1,867 passed, including key parity, plural categories and the untranslated-identity gate): green. `tsc -p tsconfig.test.json` for `core`: clean. `eslint` on the changed files: 0 errors. - `overlap-check`: exit 0 (objectstack-ai#37676 and objectstack-ai#37366 share the locale packs and merge cleanly). - Premise: static read on `main` cac93cc (the bulk branch reads no rejected `reason`), and the red tests above. Clause-②: no Metadata-protocol: none Skills-docs: none ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. (No spec change.) - [x] 2. Every name I added uses the casing for its kind. - [x] 3. No formatter ran; `eslint` on the changed files passes (the full `pnpm lint` runs in CI). - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. --- _Generated by [Claude Code](https://claude.ai/code/session_01L6bhgUuauSMJu1nVSQRQri)_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01L6bhgUuauSMJu1nVSQRQri Co-authored-by: Claude <noreply@anthropic.com>
…he deployment's AI settings choose the provider (objectstack-ai#37783) <!-- claude-projects-attribution: {"github_login":"os-sales"} --> _Requested by **Sales** · [project thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4Uu6xSMqJULJVMTrh5LMSQ4SD)_ Fixes objectstack-ai#37712 Clause-②: no (narrowing) Metadata-protocol: narrowed Skills-docs: follow-up objectstack-ai#37796 ## 维护者速读 - 是什么:agent 元数据里的 `model.provider`(openai / azure_openai / anthropic / local)从来没有运行时读取,按 ADR-0049「执行或移除」退役。供应商由部署的 AI 设置决定,agent 只写模型名。 - 影响:以后 agent 里写 `provider` 会报错,并提示删掉这一行;`os migrate meta --from 18 --write` 会自动删。18.x 默认写进去的 `provider: 'openai'` 会被静默剥掉,已构建、已存储的 agent 照常加载。元数据预览不再显示供应商标签。运行时行为不变。 - 要你做什么:无(座位已采纳退役路线,hold 记录 7206344767)。 ## What changes - **Schema** (`packages/spec/src/ai/agent.zod.ts`): `AIModelConfigSchema.provider` is a `retiredKey()` tombstone with the prescription, so writing it fails `tsc` (input type `never`) and the parse answers with the fix. The 18.x emitted default `provider: 'openai'` is accepted as inert residue and stripped (`acceptRetiredDefaultResidue`, the objectstack-ai#12840 rule for a retired defaulted key; same shape as `ViewSharingSchema`). Every other value meets the tombstone. - **ADR-0087 kit**: D2 conversion `agent-model-provider-removed` (`conversions/entries/19/`, step 19, `retiredFromLoadPath: true`, `retiredAfter: '18.6.0'`, lossless `stripKeys`); `RETIRED_KEYS_BY_MAJOR[19]` entry `ai/AIModelConfig:provider`; D3 semantic entry `agent-model-provider-retired` (relevance `agents`); one sentence in the step-19 rationale; JOIN row in `retired-key-removal-version.pin.test.ts`. - **Ledger**: `liveness/agent.json` `model` row note records the removal (a nested key has no row of its own). Evidence and `verifiedAt` unchanged: this session cannot read the cloud repository to re-verify it. - **Generated**: `authorable-surface/ai.json` (`[RETIRED]` row), `content/docs/references/ai/agent.mdx`. - **`DEFAULT_CHANGES_BY_MAJOR[19]`** (from objectstack-ai#37697): the reason no longer tells authors to write `provider: 'openai'`; it points at this retirement instead. - **Form**: the agent form's `model` help text no longer names a provider; the 11 locale bundles were regenerated (`en`) and hand-trimmed (the other ten drop the provider word only). - **UI** (`AgentPreview.tsx`): the preview shows the model name alone; a stale draft that still carries a provider never shows it. - **Docs and fixtures**: `content/docs/ai/agents.mdx` (table row + 4 examples), `getting-started/common-patterns.mdx`, `packages/spec/docs/MCP_GUIDE.md`, `docs/notes/crm-development-standards.mdx`, `os explain agent` text and example, `benchmark.bench.ts`, `metadata-validation-sweep.test.ts`, `agent.test.ts`. - **Pins**: `src/ai/agent-model-provider-retirement.test.ts`: refusal at every door (schema, `defineStack`), residue strip with a near-value control, `tsc` channel, D2 conversion on the stored-row seam and the boot door, idempotence, load-path retirement, registration, and a tree-scoped absence walk over the declared radius (added to `vitest.repo-tests.json`). - **Changeset**: `.changeset/37712-agent-model-provider-retired.md`, `@objectstack/spec` minor, BREAKING banner, FROM → TO table, ADR-0087 marker. ## Why ADR-0049 enforce-or-remove. Removal, not enforcement, because: 1. The enum does not match the deployment's providers. The deployment's list is `AI_PROVIDERS` in `packages/services/service-settings/src/manifests/ai-models.ts` (`gateway`, `openai`, `anthropic`, `google`, `deepseek`, `dashscope`, `cloudflare`, `siliconflow`, `openrouter`). `azure_openai` and `local` are not providers a deployment has, and most real ones cannot be written. Enforcing it would mean redesigning the key, not adding a reader. 2. objectstack-ai/cloud#5055 phase 1 resolves a model by its id among the providers the deployment turned on. The capability "pin an agent to a model" is `model.model`, which is live. 3. No reader in this repository (only the preview pill). Cloud side: the ledger's cross-repo row (cloud @cb8ee7ff) and the card's 11-26 read of cloud main; not re-verified here. ## Acceptance notes - **Decided in the thread (small things):** the residue stage is adopted. Every released 18.x toolchain wrote `provider: 'openai'` into each parsed `model` block, so refusing that value would refuse agents nobody wrote a provider for; the objectstack-ai#12840 rule names this case. Cost: an explicit `provider: 'openai'` in untyped JSON is stripped silently (`tsc` still refuses it in TypeScript). - **Overlap:** `overlap-check` against `origin/main` is clean. Against objectstack-ai#37676 there is one conflict in `packages/spec/src/conversions/registry.ts` (both insert a line at the head of the sorted `MAJOR_19_CONVERSIONS` list). It cannot be avoided by placement; whichever lands second keeps both lines sorted by identifier. The step-19 rationale sentence was placed so it does not conflict. - **Out of scope:** the ledger says `model.topP` has no reader either. `top_p` is a mainstream setting, so the fix is a reader in cloud's AI runtime (`carrier: cloud`, raised with the seat). - **Skills (follow-up objectstack-ai#37796):** `skills/objectstack-ai/SKILL.md:370` (`provider` table row) and `skills/objectstack-ai/evals/skills-tools-knowledge.json:17` (expected output names the enum). The tombstone keeps the identifier in `packages/`, so neither gate goes red on this PR; the skills card follows the retirement. - **Absence walk radius:** the tree-scoped absence walk covers the five roots `spec#test` already declares and excludes `ui/`; the `ui/` agent fixtures were cleaned by hand (commit 8655944). They are untyped objects, so tsc did not catch them either. ## Verification - ui fixtures: `automationPreviews.i18n-10862` and three more (`emptyCollection-8526`, `ResourceListPage.servedListColumns-36860`, `apps/console/src/preview-samples.ts`) stop writing `provider` (commit 8655944); those 5 files 121 passed, console preview-samples 47 passed. - `pnpm --filter @objectstack/spec build` then `check:generated`: 14/14 up to date. - Source audits: `check:empty-state`, `check:skill-examples`, `check:skill-served-sections`, `check:yaml-examples`, `check:template-manifests`, `check:variant-docs`, `check:error-code-provenance`, `check:duration-unit-keys`, `check:exported-any`, `check:dual-source-exports`, `check:entry-nameability`, `check:browser-reachable-entries`, `check:scripts-typecheck`, `check:llms-txt`: all exit 0. - `pnpm --filter @objectstack/spec typecheck` (tsc + scripts + test-typecheck): 0. - `@objectstack/spec` full vitest: 998 files, 30139 passed; the one failure on the first run (`retired-key-removal-version.pin` JOIN row) is fixed and that file re-run green. - `pnpm check:i18n`: all bundles in sync. `check:skill-identifier-liveness`, `check:doc-authoring`, `check:adr-0087-registration`, `check:empty-changeset`, `check:changeset-fixed`, `check:cross-package-test-inputs`, `check-changeset-no-major`: 0. - `packages/cli` `test/commands.test.ts` + `test/explain-rule-id.test.ts`: 64 passed. `packages/objectql` `metadata-validation-sweep.test.ts`: passed. `ui` `AgentPreview*`: 24 passed. - eslint on the new and changed source files: clean. ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. - [x] 2. Every name I added uses the casing for its kind. - [x] 3. No formatter ran; `pnpm lint` passes (changed files). - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. - [x] 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. - [x] 6. `packages/spec` touched: its generated artifacts are regenerated and committed. - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English (the 维护者速读 block is the maintainer's standing exception). - [x] The *Before Submitting* list in CONTRIBUTING.md is done. Session: session_01L6bhgTnm6d4W7ugSacDJ3j 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01L6bhgTnm6d4W7ugSacDJ3j <!-- signed: repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA --> --------- Co-authored-by: Claude <noreply@anthropic.com>
… spec's predicate (objectstack-ai#37835) <!-- claude-projects-attribution: {"github_login":"os-elon-musk"} --> _Requested by **Elon** · [project thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DLCo5F2y7fgbM8tstGoyyUn)_ Fixes objectstack-ai#37810 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户无感:引擎内部调用(钩子、流程)排序时判断「计算字段不能排序」,改为与 HTTP 数据接口读同一个来源,今天的结果完全不变。 - 属于排序闸门统一来源的收尾,替上一张排序闸门卡把引擎这一侧补齐,并改掉六处仍提旧集合名的注释。 - 出错的话只会是某种字段类型的排序被误拒或误放,一条测试会立刻变红;改动可以直接撤回。 - 无。 ## What changes - **The engine door reads the one source.** `assertOrderByIsMaterializable` (`packages/objectql/src/engine-top-level.ts`) judged "computed on read" with its own `type === 'formula'`. It now asks `isVirtualSearchField` from `@objectstack/spec/data`, the predicate the Data API door (`assertSortFieldsExist`, third verdict) and the sortability projection already read. `SEARCH_VIRTUAL_TYPES` is pinned to exactly `formula`, and `isVirtualSearchField` is true exactly for a string `type` in that set, so no verdict moves for any field, schema-valid or not. Code, status, `field`, `fields` and message are unchanged. - **A pin holds the two doors together.** `packages/objectql/src/engine-sort-door-agreement.test.ts`: for every member of `FieldType.options` it asks the engine door and the Data API door about the same sort over the same definition, and fails if they part. It copies no verdict table. A companion field declaring `sortable: false` tells the Data API door's third verdict (computed type, names the field alone) from its fourth (names the companion), the same device as the metadata-protocol agreement test. The engine door does not judge `sortable: false`, so the companion never moves its answer. A control asserts the table has both refused and accepted types. - **The ledger of other sites now lives beside the engine door.** The docblock gains a "ONE SOURCE" paragraph and "THE OTHER SITES" list: `fieldHasColumn` and `SqlDriver.createColumn` (driver-sql), `remote-transport.ts` (driver-turso), `planFormulaProjection` and `search-companion.ts` (objectql), `VIRTUAL_FIELD_TYPES` (plugin-audit). None of those sites changes. - **Comments that named the retired set.** `packages/lint/src/validate-sortable-fields.ts` (two places; the first pointed at a note that no longer exists and now points at the two doors' "ONE SOURCE" notes), `packages/drivers/driver-sql/src/sql-driver-external-unprovisioned-sort-anchor.test.ts` (two places), and the two `ui/packages/plugin-list` tests. Comment-only. - **Changeset:** `@objectstack/objectql` patch. ## Read first 1. `packages/objectql/src/engine-top-level.ts`, the `assertOrderByIsMaterializable` hunk: the one-line predicate swap is the only behaviour edit in the PR. 2. `packages/objectql/src/engine-sort-door-agreement.test.ts`: how the Data API door's third verdict is told from its fourth. 3. `packages/lint/src/validate-sortable-fields.ts`: the rewritten pointer near the top of the docblock. ## Two-minute check `pnpm --filter @objectstack/objectql exec vitest run src/engine-sort-door-agreement.test.ts` prints `Tests 50 passed (50)` (one control plus 49 field types). ## Tests All runs at head `4edfb2fd99`, through `scripts/pm/os-verify-lock.sh`, after building the `@objectstack/objectql` dependency closure. <details><summary>Package suites and typecheck (all green)</summary> ``` pnpm --filter @objectstack/objectql test Test Files 639 passed (639) Tests 14485 passed (14485) pnpm --filter @objectstack/objectql typecheck check:test-typecheck: OK, the test layer compiles under packages/objectql/tsconfig.test.json (debt file unchanged) pnpm --filter @objectstack/lint typecheck check:test-typecheck: OK pnpm --filter @objectstack/driver-sql exec vitest run src/sql-driver-external-unprovisioned-sort-anchor.test.ts Test Files 1 passed (1) Tests 12 passed (12) os-verify-lock: VERDICT command-exit 0 ``` </details> <details><summary>Ablation: the pin goes red the day the spec's set grows without the engine door</summary> The future case, staged on disk: `SEARCH_VIRTUAL_TYPES` in `packages/spec/src/data/search-fields.ts` widened to `formula` and `summary` with `scripts/ablation-replace.mjs` (anchor 1 to 0, blob changed), spec rebuilt, and `scripts/ablation-dist-preflight.mjs` found the widened set in 2 built files of `packages/spec/dist`. (Its tree reading answered exit 3 only because the source spells the set with single quotes and the build with double quotes; the dist reading, the one the suite consumes, passed.) ``` Leg A engine door reads isVirtualSearchField, spec set widened -> Tests 50 passed (50) Leg B engine door back to its formula literal, spec set widened -> Tests 1 failed | 49 passed (50) FAIL a `summary` field: the engine door refuses it exactly when the Data API door calls it computed - "engineCallsComputed": true, + "engineCallsComputed": false, Leg C formula literal, spec restored and rebuilt (preflight: widened set absent from all 614 built files) -> 50 passed Leg D this PR as committed, today's spec -> 50 passed ``` So Leg B is the drift the card describes: the Data API door refuses `summary` and the engine door lets it through. Leg A shows the change ends it, and Leg C shows the two are identical today. After restoring, both source files matched their HEAD blobs, `git status --porcelain` was empty and `git diff HEAD` was empty. </details> ## Acceptance notes - **One comment outside the claimed surface still names `UNMATERIALIZED_SORT_TYPES`.** `packages/metadata-protocol/src/protocol-query-validation.ts` around line 613, in the Data API door's own "ONE SOURCE" note: "This door used to carry a set of its own for the same fact (`UNMATERIALIZED_SORT_TYPES`, `formula` alone, retired here)". It is a history pointer, kept on purpose so a search for the old name lands on its replacement (contract record 7209730357, N4). The card's acceptance line reads "no comment outside CHANGELOG files", and the card's own list names the six comments edited here. The file is not in the claim, so it is left as it is and raised in the report. The shipped changeset `.changeset/37386-sort-door-reads-projection-predicate.md` does not name the set. - **The refusal text still says "A formula field is virtual".** Unchanged on purpose: no verdict and no message moves, and `query-expression-conformance.test.ts` pins the wording across doors. The day `SEARCH_VIRTUAL_TYPES` grows, that sentence needs the type name too. Noted, not filed. - **The driver-sql anchor test still asserts `not.toBe('formula')`.** `driver-sql` depends on `@objectstack/spec`, so it could ask `isVirtualSearchField` instead. The claim makes that file comment-only, so it is left alone. Noted, not filed. - **The pin calls the door function, not `ObjectQL.find`.** That keeps it free of an engine boot for 49 types. `query-expression-conformance.test.ts` already pins the wiring from `engine.find` / `engine.findOne` to this door. - **The `ui/` comment edits run no local test.** Comment-only. `Test UI` covers them in CI. ## Verification - `node scripts/pm/dispatch-gates.mjs --commands` (76 families for this diff) run at `4edfb2fd99`: 73 exit 0. `--ran` reconciliation: 76 of 76 accounted for. - NOT MEASURED, prerequisite missing in this container (CI runs all three): `node scripts/check-plugin-teardown-shape.mjs --self-test` (exit 3, its pinned fixture commit is out of reach of a shallow clone); `pnpm check:dual-build-cjs-loads` (exit 3, PREREQUISITE NOT MET: 80 packages have no `dist/`); `pnpm --dir ui exec vitest run scripts/` (one red case, `unit-registry-absence-collision.test.ts`, because `@objectstack/client` has no `dist/` here, so the files that import it could not be measured; this diff touches no `ui/` module). - `node scripts/check-platform-checklist.mjs --changed-from origin/main`: OK, 1 anchor judged, 0 lost. - `node scripts/pm/overlap-check.mjs`: clean against `origin/main` `9b50fedbfa` and the two open PRs that share `engine-top-level.ts` (objectstack-ai#37676, objectstack-ai#37366). - Dogfood: not run. The title has no `!` and there is no `(narrowing)` arm. --- _Generated by [Claude Code](https://claude.ai/code/session_016WV4cxBECSPtHxQMZDHSie)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
…st's language (objectstack-ai#37845) <!-- claude-projects-attribution: {"github_login":"os-sales"} --> _Requested by **Sales** · [project thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuPE7uyDAJyqjwwMzomWv5ff)_ Fixes objectstack-ai#37811 Clause-②: yes (widening) Metadata-protocol: none Skills-docs: none (no page under `skills/**` quotes these 501 sentences or their headers) ## 维护者速读 - 用户能看到什么变化:服务没装好或功能没实现时,平台返回的 501 提示(认证、i18n、MCP、元数据、软件包、自动化、启用开关、权限集复制、安全建议重新打开、共享链接)现在按请求的语言显示中文、日文或西班牙文,并带 `Vary: Accept-Language` 响应头。英文句子、状态码和错误码都不变。 - 为什么做:objectstack-ai#37721 和 objectstack-ai#37737 只本地化了几个自有接口的 501,其余接口的 501 对所有人都是固定英文。 - 出错会怎样:只影响服务缺失时的 501 提示文字和一个响应头;最坏情况是某句翻译不准,英文和行为都不变。 - 有两处 501 保留英文,理由写在下面。 ## What changes - **Catalog**, `packages/spec/src/system/operation-message.ts`: 37 new keys, all in `en`, `zh-CN`, `ja-JP` and `es-ES`. 31 of them are sentences, one per fixed-English `501`. The other 6 are `catalog_activation_noun_*`, the activation door's nouns, rendered in the same locale. The English of each sentence is byte-identical to the sentence its door answered before. `{{member}}`, `{{table}}`, `{{name}}` and `{{packageId}}` stay untranslated code, table, item and package names. The Japanese says `自動化`, as objectstack-ai#37737 aligned. A jsdoc paragraph names the keys and how they are read. - **Doors**, `packages/runtime/src/domains/`: every one of these `501`s now answers through `catalogNotImplemented` (`own-door-bridge.ts`, objectstack-ai#37737), which reads the request's top `Accept-Language` tag and adds `Vary: Accept-Language`: - `auth.ts`: 1 - `i18n.ts`: 1 - `mcp.ts`: 2 (`/mcp` and the skill door) - `meta.ts`: 5 (layered read, conditional save, save, draft listing, stored migration) - `packages.ts`: 8 - `automation.ts`: 11 (5 connector credential and connection legs, which name the missing member, plus flow clone, resume, cancel, restore, screen lookup and run list) - `actions.ts`: 1 - `catalog-activation.ts`: 1 (on/off sentences, with the localized noun) - `permission-set-clone.ts`: 2 - `security.ts`: 1 - `share-links.ts`: 1 The four `actions.ts`, `catalog-activation.ts` and `permission-set-clone.ts` sites were found when the premise was re-measured; neither the card nor the seat note listed them. The clone landing's `501` is thrown from `resolveDefaultCloneLanding`. It now carries its catalog key, and the door's catch answers it in the request's language. Its English stays the error's message. - **Review N2 of PR objectstack-ai#37813**: the `requestLocaleOf` jsdoc now says the four non-bridge families, and now these modules, reach it through `catalogNotImplemented`. The four gate comments for `approvals.ts`, `automation-hooks.ts`, `comments.ts` and `webhooks.ts` in `scripts/check-route-envelope.mjs` now say their `501`s go through it. No gate count changes. - **Pins**: - Each door with an existing `501` test gains a `[objectstack-ai#37811]` block beside it, which asserts byte-identical English with no header, the catalog's Japanese under `ja-JP`, and the `Vary`. These are the run lifecycle, connector credential and connection (with the member named), screen read, catalog and action activation, packages and `/meta` probes, permission-set clone and `/i18n` tests. - `domain-501-language-37811.test.ts` pins the doors that had no `501` fixture: `/auth`, `/mcp`, the `/meta` layered read, conditional save and save, `/share-links`, the `/security` reopen, and the `/automation` run list, resume and flow clone. - The same file adds a source walk: no domain module except the two builders contains `deps.error(…, 501)`, so a new fixed-English `501` fails there. - `operation-message.test.ts` pins that each of the 37 keys is translated in every locale (not an English echo) and keeps exactly the English placeholders. - **Changeset**: `@objectstack/runtime` and `@objectstack/spec` patch. Small calls made here (no card): - **Kept English: `capabilityUnavailable`** (`unavailable.ts`, ten call sites in `ai.ts`, `automation.ts`, `notifications.ts` and `ui.ts`). Its sentence is `serviceUnavailableMessage(slot)`, the same remedy discovery reports as `services.<slot>.message`. By contract the two are the same bytes, so a caller who hits the wall gets the fix that discovery lists. Discovery is English, so localizing this `501` alone would split the two. Localizing both is a discovery-protocol change and out of this card's scope. The answer carries no `Vary`, because its text does not vary. - **Kept English: the MCP resume door's `501`** (`mcp.ts`, `resumeDoorError`). It is thrown into the resume tool's error mapping, not answered as an HTTP `501` envelope, and the calling agent reads it beside that door's other refusals, which are English. - **Not localized: `meta.ts`'s `errorFromThrown(e, 501)`**. It forwards the metadata service's own thrown message, so the sentence is not the door's. - **The activation noun is translated through its own key**, so the zh, ja and es sentences carry no English noun. The on/off verb is two keys (`_on`, `_off`), because the verb does not interpolate across languages. ## Why Card objectstack-ai#37811 is item 5 of objectstack-ai#37737, split out by the seat. Comment 7210862044 adds the `capabilityUnavailable`, `share-links.ts` and `security.ts` sites and review N2 of PR objectstack-ai#37813. ## Verification Head `372155638`, plus `5e4ea0904` (the clone landing's `501` is caught around `resolveDefaultCloneLanding` alone, so the save catch keeps its main-branch form and the durability-degradation log-level guard passes: red on `372155638`, exit 0 on `5e4ea0904` locally; `permission-set-clone.test.ts` 55/55, `tsc` exit 0). CI on `5e4ea0904`: 58 success, 11 skipped, none failed: - `packages/runtime`: `vitest run src/domains`, 243 files, 7130 passed, 4 skipped (head `a30533a43`; the follow-up head only adds a module-top `import '@objectstack/metadata'` to five edited tests, and those five re-ran 103/103). - `packages/spec`: `src/system/operation-message.test.ts` 98/98. - `tsc --noEmit -p packages/runtime`: exit 0. `eslint` on `packages/runtime/src/domains/*.ts` and the catalog files: exit 0. - `node scripts/check-route-envelope.mjs`: exit 0. `check:changeset-fixed`, `check:test-source-alias`: exit 0. - `node scripts/pm/overlap-check.mjs`: clean (shares `meta.ts` and `packages.ts` with objectstack-ai#37676, merges cleanly). - The card's claim comment 7211371658 was corrected in place to the fixed `Claim:` / `Branch:` spelling that `check:closing-target-claim` reads. Locally, the gate passes against this PR's context. ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic (catalog strings and comments only). - [x] 2. Every name I added uses the casing for its kind. - [x] 3. No formatter ran; lint passes. - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. - [x] 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. - [x] 6. `packages/spec` touched: no generated artifact depends on these strings or comments. - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English. - [x] The *Before Submitting* list in CONTRIBUTING.md is done. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01L6bhgUpnvPnJ1hR74pUrVj <!-- signed: repo:objectstack#2 · os-sales · session_01L6bhgUpnvPnJ1hR74pUrVj --> --------- Co-authored-by: Claude <noreply@anthropic.com>
…versation, drawer closed there (objectstack-ai#37889) <!-- claude-projects-attribution: {"github_login":"os-elon-musk"} --> _Requested by **Elon** · [project thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9D71daFMSfEFsgPq1ECrMYCy)_ Fixes objectstack-ai#37788 Clause-②: no Metadata-protocol: none ## 维护者速读 - 是什么:平台通用的「AI 问询」页面上线。应用在菜单里放一个 `ai:chat` 入口(按应用现有的首页规则:没声明 landing 时,电脑上放第一位就是首页;手机上应用首页是菜单),进来先看到应用配置的欢迎语、大输入框和推荐问题;提问后同一页变成对话,刷新能恢复。 - 为什么:落地 ADR-0057 修订 A4(objectstack-ai#37825 已合)。以前这个入口会显示「组件未注册」;现在有页面,而且这一页上右上角机器人隐藏、快捷键无效,不会出现两个对话。 - 出错会怎样:只影响菜单里放了 `ai:chat` 的应用;其他页面抽屉照旧。没开 AI 或没席位的人看到现有的「AI 助手不可用」页。 - 要你做的:无,区内复审后交座位。 ## What changes The `ai:chat` component ref (`AI_CHAT_COMPONENT_REF`, `@objectstack/spec/ui`) gets its page, per ui ADR-0057 Amendment A4 as merged in objectstack-ai#37825. - **`console/ai/AppAskPage.tsx`** (new, +370) — the page, registered lazily in `services/builtinComponents.tsx` (`registerAppComponent` + `lazyPage`, so it stays out of the eager closure; the console build's declared-lazy check passes). Home state: title, subtitle, placeholder and up to four suggestions from the entry's `params`, read through `AiChatNavParamsSchema`; a key the entry omits falls back to neutral platform copy, and nothing is read from the URL. A static badge, 「Answers prefer this app」. Enter sends, Shift+Enter and IME composition do not. The first question turns the same page into the conversation: the existing `ChatPane` (header hidden) on the `ask` agent, a maker included, bound to the app's package (`activeAppPackageId`), under the conversation key `app:PKG:ask`. The first message is held and replayed by the pane's existing deferred-first-send path, so the conversation row is created on first send. - **`?c=ID`** — once the conversation exists the address carries it (`replace`), so a reload restores it. A `?c=` the page did not create is checked with the existing `GET /conversations/:id`: one whose `metadata.activePackageId` is not this app's package, or one that is not the caller's (403/404), opens the home state and is removed from the address; nothing of it is drawn. 「New conversation」 in the page header returns to the home state. - **`console/ai/appAskPageModel.ts`** (new, +128) — the rules without React: finding the app's `ai:chat` entry (navigation, then `areas[].navigation`, through `children`), reading its copy (a record the schema refuses is read as declaring nothing, with one console warning), the conversation key, the create metadata, and the belongs-to-this-app test. - **`hooks/useChatConversation.ts`** — an optional `createMetadata`; the first-send create sends `{ metadata }` when it is set. Only the page sets it (`{ activePackageId: PKG }`); every other caller still sends `{}`. `ServerConversation` gains the `metadata` the GET contract already returns. - **Drawer rule, `layout/**`** — `isAppAskPagePath` (`consoleRoutePaths.ts`) names the page's route; `ConsoleLayout` passes `askPageActive` to `useConsoleChatDock`. While it holds: the drawer renders closed (the stored preference is untouched and comes back off the page), `open()` and the assistant bus are inert, the Ctrl/Cmd+Shift+I effect is not bound, and `AssistantTopBarButton` returns `null` (`ChatDockControl.askPageActive`). A build hand-off still opens the drawer: `open()` with a handoff or a build-agent target passes (`opensBesideAskPage`), and the drawer stays open until it is collapsed or the user leaves the page. On a phone, arriving on the page with the sheet stored open collapses it, so the next page does not bring it back (the sheet already closes on any move away, objectstack-ai#37556); the desktop rail keeps its stored state. - **`@object-ui/i18n`** — one key, `console.ai.askPage.scopeBadge`, in all 11 packs. The other strings reuse existing keys (`console.ai.empty.ask.*`, `console.ai.askAnything`, `console.ai.submit`, `console.ai.newConversation`). - One changeset (`@object-ui/app-shell` and `@object-ui/i18n`, patch). Not touched: `AiChatPage.tsx`, `ChatbotEnhanced.tsx`, `ui/docs/adr/**`, `packages/spec/src`. ## Tests - `console/ai/__tests__/AppAskPage-37788.test.tsx` (11) — the real page, the real `useChatConversation` over a stubbed `fetch`, the real router and registry; stand-ins for the agent catalog, the AI gate, app metadata, `ChatPane` and `AiUnavailable`. It covers: the registry entry; declared copy; fallback copy; no copy from the URL; a suggestion asks it (pane on `ask`, bound to the package, the create body `{ metadata: { activePackageId } }`, the address gains `?c=`); a maker gets `ask`; a reload restores from `?c=`; another app's conversation opens the home state and leaves the address; a 403 opens the home state; New conversation; and the unavailable state. - `console/ai/__tests__/appAskPageModel.test.ts` — finding the entry, copy and fallback, the warning on a refused record, the key, belongs-to-this-app, and `isAppAskPagePath` agreeing with `componentRefToUrlSegments(AI_CHAT_COMPONENT_REF)`. - `layout/__tests__/useConsoleChatDock.phoneCollapseOnNavigate-37556.test.tsx` (+7, real dock + control provider + top-bar button): the drawer is closed on the page and back off it; the robot is hidden on the page only; the toggle chord and `ask` opens are inert on the page; control: the chord works off it; a build open still opens the drawer; on a phone, a sheet open on arrival is closed by the page and stays closed on the next page; on a phone, a build hand-off still opens the sheet. - `layout/__tests__/ConsoleLayout.askPageHidesEntry-37788.test.tsx` (new, 2): through the real `ConsoleLayout` wiring, the entry is not drawn on the `ai:chat` route and is back on another; a drawer open elsewhere is closed on the route and comes back after it. - `hooks/__tests__/useChatConversation.test.tsx` (+2): `createMetadata` reaches the create body; the drawer's create is still `{}`. - Ablations: with `AssistantTopBarButton`'s `askPageActive` return removed, "the robot is hidden on the page only" fails; with the phone-collapse branch disabled, the phone case fails (1 failed / 15 passed); with `ConsoleLayout`'s `askPageActive` set to `false`, both wiring cases fail. Restored, all pass. ## Acceptance notes - **Item 10, `context.surface`: not tagged, and why.** A cheap hook does exist: `ChatPane` takes `surfaceContext` and sends it as `context.surface`, and the spec's `pillar` is a free advisory string (`packages/spec/src/contracts/ai-service.ts`, `surfaceContext`). It is left out because the shape is cloud#1610's, and cloud's agent route sanitizes it field by field (`ui/packages/app-shell/src/layout/chatSurfaceContext.ts`, module doc). Which `pillar` value that sanitizer keeps cannot be read from here: the cloud repository is out of this seat's reach. So the page sends no value that cloud might drop, and the console invents no new vocabulary. Evals can still split these turns: every conversation the page creates carries `metadata.activePackageId`, which only this page sets. Once cloud names a value, tagging is a one-prop change on `ChatPane`. - **Location-state hand-offs.** A `/ai…` address with handoff state that lands on the page does not open the drawer. Only `open()` with a build target or a handoff does. - **Phone root** is out of scope, as the ADR names it. - **The entry stays hidden after a hand-off opens the drawer on the page.** That is A4's rule: on the page the triggers are hidden or inert. The drawer closes with its own control, and reopening it there would put a second conversation on the page. - **L1 nits not taken in this delta**, to keep it to the dock hook, the tests, the changeset and this body. They are: a transient error on the `?c=` check is read as foreign; the check fetches the full conversation to read `metadata`; an app with no `_packageId` gets no message; duplicate suggestions share a React key. Each one touches `AppAskPage.tsx`. - **Beyond the order's file list:** the 11 locale packs (one key), the model module `appAskPageModel.ts`, and four files under `layout/**` (`consoleRoutePaths.ts`, `chatDockControl.tsx`, `AssistantTopBarButton.tsx`, `ConsoleLayout.tsx`). ui AGENTS asks for docs updates (README, `content/docs/frontend`); those are outside this PR's surface and are left for a follow-up. - **Overlap:** objectstack-ai#37885 (Ask AI entry button) rewrites `AssistantTopBarButton.tsx`, so the two PRs conflict textually there. The conflict is one early return plus a doc line: `if (control?.askPageActive) return null;` goes at the top of the rewritten component. With objectstack-ai#37885, the entry also appears in page headers, and this return hides it on the page too. Whichever PR lands second rebases. With `origin/main` and objectstack-ai#37676 this branch merges cleanly. ## Verification - At `df8d6f75`: `pnpm exec vitest run` of the AppAskPage, dock, the two ConsoleLayout and the model/conversation test files: all green (AppAskPage 11/11, dock 16/16, ConsoleLayout wiring 2/2, robot 2/2). `app-shell` type-check, both programs: exit 0. eslint on the changed files: 0 errors. - The derived gates (`dispatch-gates --ran`: 41 of 41 run), plus the i18n keys, drift, dead-keys, all-locales parity, product-neutral ratchet, eslint on the changed files and `check:new-line-citations`: all exit 0 (re-read after the L1 delta: the changeset gates, `check:test-source-alias`, cross-package test inputs, the timer probe, ceremony text, the role word and new-line citations, all exit 0). `check:test-source-alias` first flagged that the two edited test files reach `AiChatPage`'s lazy `import('@object-ui/plugin-grid')`; fixed by loading it at module top, as the gate prescribes. - Full `pnpm build`: exit 0. - **Browser** (showcase app, `pnpm dev --fresh`, console on Vite): an `ai:chat` entry was injected first in `showcase_app`'s navigation through a Playwright route on `/api/v1/meta/app`, with no source edit. `/api/v1/ai/**` was stubbed, since OSS has no AI. Results: - The home state draws the declared copy, the badge and four suggestions. - `?c=conv-1` restores the conversation (user question plus a markdown answer) with 「New conversation」 in the header. - The top-bar Ask AI entry counts 0 on the page and 1 on the Capability Map page. - Screenshots, at 1440×900 @2x, of the home state and the restored conversation, are kept with the project. The relay cannot upload images. Both were viewed at L1 (comment 7215194705). --- _Generated by [Claude Code](https://claude.ai/code/session_016WV4czF5gqc48r9LUsmRpw)_ <!-- signed: repo:objectstack#1 · os-elon-musk · session_016WV4czF5gqc48r9LUsmRpw --> --------- Co-authored-by: Claude <noreply@anthropic.com>
…mes table (objectstack-ai#37927) <!-- claude-projects-attribution: {"github_login":"os-tesla"} --> _Requested by **Tesla** · [project thread](https://claude.ai/code/project/chan_01AXsQkLFKRdQCqQ3RTr6Jao?thread=cmsg_01AXsQkLFKRdQCqQ3RTr6JaoTeY72VoWMktEtuwWvY1yGw)_ Fixes objectstack-ai#37685 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:没有。只是把已经上线的做法写进 Studio 的设计文档:组织级(不属于任何软件包)没有「概览」页,它的待发布变更和发布入口是左栏那一行「变更 N」。 - 为什么做:App Studio 改版专题的一处记账,避免以后有人照文档把这一行删掉。 - 出错会怎样:只改文档,不影响运行;不对可直接撤回。 - 要你做什么:审阅并合并这条设计文档修改(受管面,需你亲手合并)。 ## What changes One file, `docs/adr/0084-application-builder-information-architecture.md`, +3 lines, nothing removed: - One row in the homes table of `#amendment-2026-11-26-homes` ("Where the top bar's controls go"), directly under the pending-changes row: on the package-less `~org` scope, which draws no 概览 Overview, the pending-changes button and Publish live in a 变更 Changes row with its count in the left column (`StudioTopLeft.tsx#StudioScopePendingRow`), drawn only while that scope has something pending; it opens the existing changes sheet, which holds Publish. Its "By" column reads `not ruled`. - One dated mark under that table, in the ADR's own `*(Amended 2026-11-27, card objectstack-ai#37685: …)*` form: why the row exists (the pick sends Changes + Publish to 概览, `~org` has none), that it was built first by the top-bar removal (objectstack-ai#37456, PR objectstack-ai#37579) and is recorded after the fact as that change's contract review asked (comment 7202356468, finding S3), and that no other row changes. Not in this PR: the seat's widening comment also asked to turn the type → group table's `datasource` row into a no-row entry. That half is withdrawn (claim comment 7217220011): `studioMenuPlacement.test.ts` ties each table row to the code's placement list, so the row moves with the code card that removes the menu row, as objectstack-ai#37564 did. ## Why ADR-0084's 2026-11-26 amendment sends Changes + Publish to 概览's Pending tab. The package-less scope has no 概览, so the shipped code gave it a row of its own, and the ADR did not record that home. A later reader following the ADR could remove the row. ## Tests Read at `origin/main` `73d5e347`, the code the row is written from: - `ui/packages/app-shell/src/views/studio-design/StudioTopLeft.tsx:84` `StudioScopePendingRow`: a button labelled `engine.studio.changes` (en "Changes", zh 变更) with a count pill; drawn under the package row (:169) and as an icon on the rail (:160). - `ui/packages/app-shell/src/views/studio-design/StudioSurfaceFrame.tsx:210-219`: passed only when `packageId === null && !allScope && shownPendingCount > 0`, so on `~org` alone and only while something is pending; it opens the changes sheet (`DraftChangesPanel`, :243-256) with Publish. Local gates on head `062fc62c`, exit codes captured before any pipe: <details><summary>ADR gates</summary> - `node scripts/check-adr-symbol-anchors.mjs` → 0 (4475 anchors across 164 records resolve; both new symbol anchors resolve as declarations) - `node scripts/check-adr-links.mjs` → 0 (1263 relative links resolve) - `node scripts/check-adr-anchors.mjs` → 0 - `node scripts/check-nul-bytes.mjs` → 0 - ADR index `--check` → 0 (drafter's run) - The pin test's row regex (`ADR_ROW` in `studioMenuPlacement.test.ts`) matches 33 lines before and after the edit, the same rows byte for byte; the new lines match 0 times. </details> NOT MEASURED locally: `studioMenuPlacement.test.ts` itself and the doc-authoring families (no `node_modules` in this container). CI runs them; the regex reading above is why the pin test is expected green. ## Acceptance notes - Noted, not filed (carrier: the code card that rewrites the `datasource` row of the same table): the dated notes under the type → group table still read "33 entries" and "AI 4", while the table now has 34 rows and AI 5; the `knowledge_source` row (added by objectstack-ai#37676) cites item 6, which names only `ai_context`, and carries no dated mark. - Left for the seat: the Status line and the section's Refs line do not name objectstack-ai#37685 (as with objectstack-ai#37564 and objectstack-ai#37360, recorded only in their in-place marks); the row's retirement (with Studio's `~org` entry) is not written, since no ruling says it. ## Verification Read first: the new row under the pending-changes row in `#amendment-2026-11-26-homes`, then the dated mark under the table. Two-minute check: `node scripts/check-adr-symbol-anchors.mjs` prints the green line; open Studio on `~org` with a pending flow draft and see the Changes row in the left column open the changes sheet with Publish. ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. (not touched) - [x] 2. Every name I added uses the casing for its kind. (none added) - [x] 3. No formatter ran; `pnpm lint` passes. (CI) - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. - [x] 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. (`docs/adr/**` does not publish: `skip-changeset`) - [x] 6. `packages/spec` touched: its generated artifacts are regenerated and committed. (not touched) - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English. (the 速读 block is the maintainer's Chinese channel) 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01L9qibzqYghcpTQ2yaJPJbE --- _Generated by [Claude Code](https://claude.ai/code/session_01L9qibzqYghcpTQ2yaJPJbE)_ Co-authored-by: Claude <noreply@anthropic.com>
Requested by Bill · project thread
Fixes #37304
Clause-②: yes (narrowing)
Metadata-protocol: narrowed
Skills-docs: follow-up #37310
维护者速读
What changes
New metadata type:
knowledge_source. Registered in the metadata type registry with the one schemaKnowledgeSourceSchema; a stack carries its sources in the new top-level collectionknowledgeSources(*.knowledge-source.tsor.yml). An item can be created and changed at run time (Studio, MCP) and takes no environment overlay. Studio's menu lists the type under AI, and ADR-0084's type table carries its row.New platform capability:
manage_knowledge_sources. Platform administrators hold it by default. Nothing else grants it.idbecomesname,source.contentFieldsbecomessource.content, a non-empty list of field names;'*'is refused with the instruction to list the fields, and an empty-string member is refused too (it names no field).embedding,vectorStore,adapterConfig,refresh.cronand thefile/httpsource kinds are retired with their ADR-0087 entries (three conversions, six retired keys, six retired defs, four semantic entries on protocol 19).os migrate meta --from 18lists every edit and--writeapplies the ones it can prove.service-knowledge,knowledge-source-loader.ts).KnowledgeServicePluginreads the published items when it starts and follows the type while it runs: an added source is registered and built when a build is due; a changed one is registered again (a changedwhereormetadataFieldsrebuilds inside the generation, a changedcontentorsplitbuilds a new one); a removed one is unregistered and its index dropped. The reap guard's object set follows the sources.knowledge-source-registry.ts), under the maintainer's rulings on this card (record 7192063608, forks 6 and 4d, both A). A source is held by(package, name). A source registered in code belongs to no package; it shares one slot with an environment-authored item of the same name, and the second of the two to arrive is refused409 RESOURCE_CONFLICT, naming both doors. A package's source of the same name is a second source. Code names a source by its face: the bare name for the package-less one,NAMESPACE-NAMEfor a package's; a bare name several sources answer to is refused409, naming the candidates.searchhits carry the face assourceId. NoIKnowledgeServicesignature changes for addressing.IKnowledgeAdapter.dropSource?(ctx), implemented byknowledge-memory,knowledge-pgvectorandknowledge-turso; the contract suite (@objectstack/service-knowledge/testing) takesimplements.dropSource. An adapter reads the source's index key fromctx.source.name(it wasctx.source.id): the bare name for a package-less source, so an existing index is found under the same key and nothing is rebuilt.knowledge_sourcethrough/meta(REST and the dispatcher: save, publish, rollback, delete) and through the MCP draft door needsmanage_knowledge_sourcesbesidemanage_metadata:403 PERMISSION_DENIEDnaming the capability,401for an anonymous caller. It is one row in the existing per-type tableMETA_TYPE_WRITE_CAPABILITIES(packages/rest/src/meta-item-read-gate.ts), so the three doors that already ask that table ask it for this type too. The package doors ask it as well (maintainer's ruling A, record 7207325373 on knowledge_source: admit the governed metadata type with its loader — registry, stack collection, ADR-0087 renames and retirements, the two authoring guards, one name per source #37304): each of the twelve doors that write an existing package (enable, disable, publish, publish-drafts, discard-drafts, the commit revert, rollback, revert, adopt-orphans, duplicate, the manifest update, delete) refuses a caller without the capability403when the package holds a knowledge source: an item, a pending draft, or, for the commit revert and the rollback, a commit that touched one. A package that holds none is written as before; a holding that cannot be read refuses503. Two doors are not asked, see Acceptance notes.search, a system object withoutenable.aiReadable, or a field the author may not query refuses the save403, naming the object or the field; a verdict that cannot be reached refuses503. The fields a source'swherereads are judged with the fields it serves, at save and at search. A knowledge service that is registered and cannot be resolved refuses the save503at every door (REST, the dispatcher, MCP). The duplicate door admits each knowledge source it would copy for the caller before anything is copied, and refuses the whole copy when one is refused. Over MCP the human is judged.IKnowledgeService.indexDocumentanddeleteDocumentare removed with thefile/httpbranches that served them.@objectstack/spec/ai. Theembeddingmodule:EmbeddingModelSchema,VectorStoreSchema,VectorStoreProviderSchemaand the typesEmbeddingModel,VectorStore,VectorStoreProvider(the knowledge source was their only composer). The retired source kinds:FileKnowledgeSourceSchema,HttpKnowledgeSourceSchema,KnowledgeSourceKindSchemaand the typesFileKnowledgeSource,HttpKnowledgeSource,KnowledgeSourceKind. The changeset lists the same twelve.packages/objectql). A deployment that holdsknowledge_sourceitems and mounts no knowledge service says so once at boot, at warn, naming the items; it is not a boot refusal.os knowledge statusprints the package that holds a source and no longer a source kind.examples/app-showcaseshipsshowcase_task_notes(objectshowcase_task, adaptermemory) and mounts the knowledge service and the memory store.content/docs/protocol/knowledge.mdxandcontent/docs/ai/knowledge-rag.mdxdescribe the type, the loader, who may author a source, and one name per source; the generated references follow.knowledgeSourcesjoins the top-level key list inskills/objectstack-platform/SKILL.md.skills/objectstack-ai/SKILL.md's compiledsupportKbexample changes two keys (idtoname,contentFieldstocontent) because the old spelling is now refused at parse. Teaching the type (prose, tables, evals) rides skills/objectstack-ai and the MCP authoring contract teach knowledge_source as metadata: name, an explicit content list, no wildcard, the retired keys, and a create seed #37310.scripts/check-skills-token-ratchet.mjs):skills/objectstack-platform/SKILL.mdwas at zero headroom (24603 priced bytes, 6151 tokens, after feat(core): requires knowledge mounts the knowledge service and one vector store #37442's row); theknowledgeSourcesrow adds 20 bytes, so the priced text is 24623 bytes, 6156 tokens, and the ceiling moves 6151 to 6156, pinned at the measurement. Nothing else in the file is cut and nothing rides along.skills/objectstack-ai/SKILL.mdstays at 6799 tokens under its ceiling of 6801.defineStack()top-level key, or a live member of a schema symbol bound to a registered exhaustive skills section, carries the matching skills enumeration row in the same PR. Only that row; prose, examples and evals still go to the skills sub-card."Tests
packages/spec/src/ai/knowledge-source.test.ts: the strict schema,'*'refused, an empty-string member refused (andminLength: 1in the JSON Schema), every retired key answered with its prescription.packages/services/service-knowledge/src/__tests__/knowledge-source-registry.test.ts(new): the slot rules above, both orders of arrival at each door, face resolution and the409with its candidates..../knowledge-source-loader.test.ts(new): boot read, add, change (each of the two rebuild arms), remove withdropSource, an adapter withoutdropSource, the reap guard following the sources..../knowledge-source-admission.test.ts: each refusal of guard two and its fail-closed503; the fieldswherereads (keys,$and/$or/$not,{ $field }comparands) judged at save and at search.dropSource: trueinknowledge-memoryandknowledge-turso;knowledge-pgvectordeclares it incontract.live-postgres.test.ts(see Remaining).packages/rest/src/meta-type-write-capability.test.ts: every write shape of aknowledge_sourcefor a caller withmanage_metadataalone, withmanage_platform_settings, and with a record grant:403 PERMISSION_DENIED, store unchanged, no protocol call; a holder of both saves, publishes, rolls back and resets; the capability withoutmanage_metadatais refused by the door's own admission.packages/rest/src/meta-write-door-capability-enumeration.test.ts,packages/runtime/src/domains/meta-save-capability-gate.test.ts,packages/runtime/src/domains/mcp-authoring.test.ts: guard two at REST, the dispatcher and the MCP save door (the human is judged); on a real kernel, a knowledge service whose factory throws answers503at the dispatcher and at MCP, and one never registered is not asked.packages/runtime/src/domains/meta-type-write-capability-parity.test.ts: REST and the dispatcher answer the same for the new row.packages/runtime/src/domains/packages-knowledge-source-gate.test.ts(new): each of the twelve package doors refuses amanage_metadata-only caller when the package holds a source (item or draft) and the writer never runs; a holder goes on with no listing read; a package with none answers as before; a listing that throws refuses503; the engine's own call is not asked; the commit revert and the rollback read the timeline; the duplicate door's admission of each copied source; a host with no metadata store holds none; the install door and the ensure-customization door are not asked.packages/runtime/src/domains/packages-ensure-customization.test.ts: a base that holds a knowledge source (a registered item and a stored row) gets a pair that holds none, and the door writes one manifest and no row.packages/objectql/src/knowledge-source-unserved.test.ts(new): the boot notice.packages/metadata-core/src/knowledge-source-save-admission.test.ts(new): the admission seam.Acceptance notes
skills/**and declares a narrowing.manage_knowledge_sourcesbesidemanage_metadata, platform administrators only); and ruling A of 2026-11-27 (record 7207325373): every write door of an existing package asks the capability when the package holds a knowledge source, and install stays unasked. The ADR-0150 rows ride ADR-0150: record the maintainer's ruling on #37304 addendum points 4 and 6 (code-registered knowledge sources) #37545. One ADR line is edited here, with the zone's approval (claim comment 7203310811 on knowledge_source: admit the governed metadata type with its loader — registry, stack collection, ADR-0087 renames and retirements, the two authoring guards, one name per source #37304, amended by 7204020473): ADR-0084's type table gains theknowledge_sourcerow its item 6 prescribes for a type registered after the ruling (AI,ai, 5, 高级), spelled as theai_contextrow is. Nothing else underdocs/adr/**changes.protocol.onMetadataMutation(a save, a publish, a delete, a revert) plus themetadata:reloadedhook (a package published, installed or removed, a dev reload), notmetadataService.subscribe. After either it reads the published set again and reconciles, so a missed event is repaired by the next one.POST /packages): a package's source arrives by that door's own admission, as the ruling leaves it. The ensure-customization door (POST /packages/:id/ensure-customization): it writes nothing of the base and creates an empty pair, so it creates, changes and removes no knowledge source; the seat confirmed this reading on the condition that the pair holds no source, whichpackages-ensure-customization.test.tspins.sys_metadataobject) reads as holding none, by the same rule the protocol's overlay reads use; any other failed read refuses503.manage_metadata.409at the call that names it (resolveSourceRef), listing the candidates; both sources register. Where the host cannot place a package's namespace, the package's face is its bare name, and that name answers409for both sources until the package is placed.409for a bare name two packages hold: 0. The package-less row under a name a package holds: 0. The tree holds one knowledge source,showcase_task_notes(examples/app-showcase/src/ai/task-notes.knowledge-source.ts), and no first-party code registers one through the plugin door.KnowledgeIndexStatusEntry.kindis removed with the source kinds;packageIdis added.registered …and namesindexDocument/deleteDocumentin prose: they are runtime-interface members with no metadata form, and the compiler reports each call (TS2339).knowledge_sourcerows on a kernel that does not hydrate from its database; it registers nothing (plugin.integration.test.tspins the permitted reads and now names this one).dropSourceand a concurrent build in another process: the drop retires the active and the building generation in one transaction but does not hold the builder lock across it, so a build already running in another process could still write its generation afterwards. Not changed here; it is a candidate follow-up.requires: ['knowledge'](feat(core): requires knowledge mounts the knowledge service and one vector store #37442): the token mounts a libSQL or pgvector store, which needs a configured embedder, and the demo runs on the in-memory store with none. A host that mounts the service itself keeps its own, as feat(core): requires knowledge mounts the knowledge service and one vector store #37442 specifies.mainthree times (no rebase). The first merge (at45ed022b) followed feat(core): requires knowledge mounts the knowledge service and one vector store #37442, fix(service-knowledge): a build that loses its lease stops at the next page, and a stalled build is cancelled #37570 and fix(cli): os knowledge rebuild and status give the right answer behind a load balancer #37578: four textual conflicts (the migration registry template, the CLI knowledge test fixture, the pgvector adapter's search refusal, the knowledge service's reindex chain and unmounted-adapter refusal). Code and fixtures those PRs wrote against the 18 source shape follow the 19 shape here:source.idissource.name,contentFieldsiscontent,reportUnmountedAdaptersnames a source by its face, and the unmounted-adapter index test callsreindexSourcenow thatindexDocumentis gone. The second merge (atc2bfa3ef7) was forced by a conflict:mainhad gained its own protocol 19 conversion (permission-view-all-fields-beside-record-bypass), so the conversion registry, the migration registry template and the retired-key pin now carry both sets, sorted as the registry sorts them;packages/spec/authorable-surface/ai.jsonwas merged three ways by hand so that this PR's removals andmain's newai/Skill:contextboth stand; every generated spec surface was regenerated afterwards. The third merge (at8b9b9d235) was forced by fix(lint,metadata-core): a skill's context naming a pack a declared dependency ships no longer warns; the ADR-0150 D3 rule moves to metadata-core #37723, which moved the ADR-0150 D3 rule intopackages/metadata-core/src/package-scoped-resolution.ts:core's file is taken frommain(a re-export) and theknowledge_sourcerow with its comment sits inmetadata-core'sPACKAGE_SCOPED_TYPES;default-changes.tskeeps both protocol 19 entries (main'sai/AIModelConfig:providerand this PR'sai/KnowledgeSource:refresh); the Studio menu placement pin takesmain's move ofpositionand keeps this PR's row. The merge is its own commit andpackages/spec/authorable-defaults/ai.jsonwas regenerated in the next one (737f44341).ai/KnowledgeSource:refreshsits under major 19 indefault-changes.ts(no parsed value changes: the published JSON Schema now states the{}the parser always applied).packages/metadata), the tier list (packages/metadata-protocol), the type-label counts (packages/platform-objects), four golden grant lists (packages/plugins/plugin-security), and the generatedzh-Hantlocale. Each gained the one entry; no product code changed for them. The suites of those packages and the workspace type check now run locally as well (see Verification).45ed21271(comment 7206413701) read PASS with findings, and the seat ordered a rework (7206423476). This head answers it: authoring guards cover more doors and more of what a source reads (the package doors, the duplicate door, the fieldswherereads, the service lookup at the dispatcher and at MCP), thecontentmember refuses the empty string, the changeset lists the twelve removed exports, and this body is corrected on the face collision and states the narrowing counts. The findings' detail is with the seat. Two nits are carried by cards the zone files under knowledge_source: admit the governed metadata type with its loader — registry, stack collection, ADR-0087 renames and retirements, the two authoring guards, one name per source #37304 (ADR-0084 prose; tombstone wording for code-door registrants).packages-publish-drafts-request-conformance.test.ts: the real-protocol case's caller also holdsmanage_knowledge_sources(its engine is one nothing may touch; the case pins the protocol's own order). Assertions unchanged.packages-publish-drafts-probe-caller-context.test.ts: the protocol double gains agetMetaItemsPerPackagestub beside itsgetMetaItemsstub. Assertions unchanged.package-state-host-store.test.ts(a kernel with no driver) anddomains/error-passthrough.test.ts(a protocol double that throws from every member): the caller also holdsmanage_knowledge_sources. Assertions unchanged.packages-ensure-customization.test.ts, "duplicate: 400 before a row is read": the measure changes. The door now reads the source package's knowledge sources to admit them before the copy runs, so the case counts the reads made insideprotocol.duplicatePackage(still 0) instead of every engine read; it also asserts the copy was entered once.mainitself merges cleanly): feat(spec)!: form is a metadata type of its own, and the form doors read a form over both types #37422 (the generated references andscripts/check-skills-token-ratchet.mjs: whichever lands second re-measures the row), refactor(spec)!: rename the Studio helper defineForm to defineMetadataForm and its modules to *.metadata-form.ts #37366 (packages/spec/export-origins/ai.json). Whichever of each pair lands second mergesmain.Verification
First files to read, by risk:
packages/services/service-knowledge/src/knowledge-source-registry.ts: the slot and face rules.packages/services/service-knowledge/src/knowledge-source-loader.ts: what each metadata event does to an index.packages/rest/src/meta-item-read-gate.ts(META_TYPE_WRITE_CAPABILITIES) andpackages/metadata-core/src/knowledge-source-save-admission.ts: the two guards.packages/runtime/src/domains/packages.ts(refuseKnowledgeSourcePackageWrite,refuseDuplicatedKnowledgeSources): the guards at the package doors.Two-minute check:
pnpm --filter @objectstack/service-knowledge exec vitest run --maxWorkers=2 src/__tests__/knowledge-source-registry.test.ts src/__tests__/knowledge-source-loader.test.ts.Head
cf128e59f(review round 1). Verified so far on this head, locally, every heavy run underscripts/pm/os-verify-lock.sh: build exit 0;@objectstack/runtimefull suite exit 0 (657 files, 13676 passed, 25 skipped);@objectstack/metadata-coreand@objectstack/coreexit 0;tsc --noEmitonpackages/runtimeexit 0. Running now on the same head, and written here when they end: the other package suites, the workspace type check, the derived gates, the full dogfood battery and the ablations. CI on this head is in progress. The previous head's readings (45ed21271: 62 check runs green, 185 gates, the dogfood battery, six ablations) are in the os-dev report, comment 7206197293 on #37304.Skills readings (the diff touches
skills/**)skills/objectstack-platform/SKILL.mdskills/objectstack-ai/SKILL.mdSKILL.mdfiles togetherskills/objectstack-ai/references/_index.mdis generator-owned (53 lines to 52: the embedding module's row leaves, the knowledge source's row is reworded) and is measured, not ratcheted. "Before" ismainat the third merge (8b9b9d235), read with the same script; the bundle's before figure is this tree's reading less the row's 5 tokens.Remaining
45ed21271..cf128e59f), then the seat's hand-off.knowledge-pgvector'sdropSourcecontract cases have not run anywhere yet: there is no pgvector in the build container, and the job with a PostgreSQL service does not run onpull_request. Their first run is the merge queue.Human Minimum
packages/specholds no runtime logic.pnpm lintpasses.main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_01Utp6CZe3KTAXogcUJuvYEx