Skip to content

Commit 03e8ce4

Browse files
committed
Merge remote-tracking branch 'origin/main' into claude/issue-35142-concurrent-update-409
2 parents 70f270f + 99a0e4f commit 03e8ce4

40 files changed

Lines changed: 2617 additions & 259 deletions
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
'@objectstack/runtime': patch
3+
---
4+
5+
feat(runtime): the open MCP server lists metadata and pending drafts for an OAuth client with `metadata:write` whose user holds `manage_metadata`
6+
7+
Clause-②: yes (widening)
8+
Metadata-protocol: none
9+
10+
An AI client connected over MCP with an OAuth token that carries `metadata:write` now gets three read tools on a self-hosted runtime, the first half of the open draft door (design `docs/design/mcp-local-first-door.md`, Design A):
11+
12+
- `list_metadata_items({ type, state? })` lists one metadata type's items as summaries (name, label, package). A pending draft is listed in place of its published version and marked `draft: true`; `state: "active"` lists the published items only, `state: "draft"` the pending drafts only. A type the platform does not declare is refused with `400 INVALID_REQUEST`, as the `/meta` list refuses it.
13+
- `get_metadata_item({ type, name, state? })` reads one item's full definition: the pending draft where one exists, unless `state` selects the draft or the published version. An item that does not exist answers `404 RESOURCE_NOT_FOUND`.
14+
- `list_drafts({ package? })` lists the pending drafts, optionally for one package.
15+
16+
The tools are served only where both halves hold: the token consents (`metadata:write`) and the user the token was issued to holds `manage_metadata` in the organization the token bound. The user's capability is read from their own grants on each request, because an OAuth agent's envelope carries no system permission without `actions:execute`. A token whose user lacks the capability is listed none of the three tools, and a call that reaches them anyway is refused `403 PERMISSION_DENIED`. A token without `metadata:write`, an API key and a session see none of them, as before. When the user's grants cannot be read, the tools are not served on that request and the runtime logs one warning.
17+
18+
The reads withhold what every `/meta` door withholds from that user, judged by the same read gates with the user as the caller: a dashboard, a list view or an app whose `requiredPermissions` the user does not hold, and a book or doc outside their audience, are refused `403 PERMISSION_DENIED` by `get_metadata_item` and left out of `list_metadata_items`. Before either gate, both reads ask the type-level read admission every `/meta` read asks: a metadata type the user may not read is refused `403 PERMISSION_DENIED` on both, whatever its spelling or `state`. Holding `manage_metadata` does not lift these refusals. A gate that cannot evaluate refuses the read.
19+
20+
The read tools are named `list_metadata_items` and `get_metadata_item`, not `list_metadata` and `get_metadata`, because `list_metadata` is a hosted platform tool. Nothing here writes: saving and discarding drafts, and the publish verdict a save answers with, come in a later change.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
docs(skills): the sections served to MCP clients show their examples as JSON, and a check pins their headings
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
A client that builds through MCP writes JSON, and the sections of `objectstack-data`, `objectstack-ui` and `objectstack-automation` that the hosted MCP door serves showed their examples in TypeScript. Those sections now give each example as JSON, with one line on how a TypeScript project wraps the same literal:
11+
12+
- `objectstack-data`: the object in Object Definition, the `state_machine` rule in State Machine Validation, and the `summary` field and the permission set in Roll-up Summaries. Field Type Selection names the `{ dialect: 'cel', source }` envelope beside the TypeScript tag.
13+
- `objectstack-ui`: the write-button action in Actions.
14+
- `objectstack-automation`: the `notify` node (its key notes are a list under the block), the `script` and `update_record` pair in Valid-but-silently-wrong, the whole approval flow in Approvals (Flow Nodes), and the start node and window filter of the time-relative trigger, beside its TypeScript flow.
15+
16+
The other served sections are prose and tables and read the same to both kinds of client; three of them drop a TypeScript-only phrase.
17+
18+
Every JSON block in a served section is parsed and validated against the spec schema for its kind in CI, and a renamed, removed or duplicated heading of a served section now fails there.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
'@objectstack/skills': patch
3+
'@objectstack/mcp': patch
4+
---
5+
6+
docs(skills): the `objectstack-ask` skill follows `list_datasets` `nextStep` and cites `query_dataset` `sourceLine` as given, before `provenance`
7+
8+
Clause-②: no
9+
Metadata-protocol: none
10+
11+
The `objectstack-ask` skill, and the page at `GET /mcp/skill` that is generated from it, now tell a connected client two things. Under the step 2 decision table: when the `list_datasets` answer has `nextStep`, follow its `decision` and `note`. In step 3's citation bullet: cite the `query_dataset` answer's `sourceLine` as given, and build the source from `provenance` only when the answer has no `sourceLine`. Both members are answered by servers whose dataset tools fill them; a server that does not answer them leaves the skill's existing steps in force, with the `provenance` citation as before. When a `nextStep` note says to answer one measure and to ask about a word that has only candidates, the skill says to do both and to use none of that word's candidates until the user answers; the question-alone rule (no tool call until the user answers) covers a reply that only asks.
12+
13+
Two sentences that restated another line of the same skill are removed: the fallback row's "and say in the answer that no governed metric was used" (step 4 opens every fallback answer with that line) and "no figure" in the paragraph under the table (its next sentence says the same). The `candidates` row also drops "one or several", which its own right cell states. `packages/mcp/src/ask-skill.generated.ts` is regenerated from the skill; no code path changes.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
'@object-ui/core': patch
3+
'@object-ui/plugin-grid': patch
4+
'@object-ui/components': patch
5+
---
6+
7+
fix(ui): grouping headers and the filter value picker name a lookup by its target's `nameField`, and the empty group is translated
8+
9+
Clause-②: yes (widening)
10+
Metadata-protocol: none
11+
12+
A lookup with no `displayField` is now named by the target object's declared `nameField`, the default the spec states for `displayField` ("the referenced object's name/title"). This is the same title the lookup's grid cell and the record header already show. Before, three places guessed a `name`, `label` or `title` key, and showed the raw record id when the target had none, for example a target titled by an autonumber such as `DEAL-2026-0001`:
13+
14+
- **Group headers of a list grouped by the lookup**, both server-grouped and client-grouped.
15+
- **Filter builder value picker options** for the lookup, and the chip of the chosen value.
16+
17+
An explicit `displayField` on the lookup still wins. Grouping and filtering stay keyed by record id, so two records with the same title stay separate groups and separate options. The picker reads the target object's definition once per picker. The ObjectStack adapter serves later reads of it from its metadata cache.
18+
19+
The group of rows with no value now reads the grid's own empty-value string (`grid.empty`, for example "Empty" in English and "空" in Chinese) instead of the untranslated `(empty)`. It keeps its place in the group order: first when ascending and last when descending.
20+
21+
`@object-ui/core` adds `referencedRecordTitle(targetDef, record, displayField?)` to its public entry, a new export. It gives the title of a referenced record using the lookup's `displayField`, then the record-title ladder of `getRecordDisplayName`, and returns `undefined` instead of the `Record #<id>` floor.

‎.github/workflows/lint.yml‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5336,6 +5336,16 @@ jobs:
53365336
continue-on-error: true
53375337
run: pnpm --filter @objectstack/spec check:skill-refs
53385338

5339+
# Rationale: `packages/spec/scripts/check-skill-served-sections.ts` header.
5340+
# The hosted MCP door reads 24 sections of the published skills by exact
5341+
# heading text; a rename, removal or duplicate fails that product at
5342+
# start. Also holds every JSON example in those sections to the spec.
5343+
# Reads packages/spec/src via tsx and needs no build, as its neighbours.
5344+
- name: Check the skill sections served to MCP clients keep their headings and valid JSON
5345+
id: check-the-skill-sections-served-to-mcp-clients
5346+
continue-on-error: true
5347+
run: pnpm --filter @objectstack/spec check:skill-served-sections
5348+
53395349
# Rationale: `scripts/check-skill-frame-sync.mjs` header (#5130, #5451, #5799).
53405350
- name: Check the decision frame is in sync across its four copies
53415351
id: check-the-decision-frame-is-in-sync-across

‎docs/design/mcp-local-first-door.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ Tools, registered by a new open registry behind `metadata:write`, each checking
7979
| `delete_metadata_draft({ type, name })` | Discards a pending draft | |
8080
| `list_drafts({ package? })` | Pending drafts with their verdicts | The review queue, as the client sees it |
8181

82+
> **Note (2026-11-17):** the two read tools are named `list_metadata_items` and `get_metadata_item`, because `list_metadata` is a cloud platform tool (`packages/spec/src/system/constants/platform-tool-names.ts:97`) and the open registry must not collide with it (seat ruling D3 on #34766, 2026-11-17).
83+
8284
- No publish tool, no `force`: a draft executes nothing, and the destructive-change confirmation stays at the human publish.
8385
- `initialize` instructions and discovery state `Authoring contract: @objectstack/spec <version>` and the install line for `@objectstack/skills@<version>`.
8486
- The open runtime serves `GET /api/v1/discovery/restriction-profile` (mount what the CLI already reads).

‎packages/mcp/src/ask-skill.generated.ts‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,16 @@ export const ASK_SKILL_DATA_LOOP: string = [
4242
'| Each word for a thing measured matches exactly one measure | Compute: step 3. Two words with one measure each ("营收和赢单率") are two metrics, not a choice: compute both, with one `query_dataset` per dataset. |',
4343
'| One word matches several measures, in one dataset or in two | Ask the user which one they mean. List each candidate\'s label, its dataset\'s label and its description. Do not pick one. |',
4444
'| Only a dimension matches | That is a grouping ("by stage"), not a number. You still need a measure match; without one, ask which number is meant. |',
45-
'| A word matches nothing, and `candidates` lists members for it, one or several | Ask the user which one they mean, listing each candidate\'s label, its dataset\'s label and its description; with one candidate, ask whether it is the one meant. Do not pick one. |',
46-
'| No match and no candidates for the word for a thing measured | Step 4, and say in the answer that no governed metric was used. |',
45+
'| A word matches nothing, and `candidates` lists members for it | Ask the user which one they mean, listing each candidate\'s label, its dataset\'s label and its description; with one candidate, ask whether it is the one meant. Do not pick one. |',
46+
'| No match and no candidates for the word for a thing measured | Step 4. |',
4747
'| `membersWithheld: true` on a dataset | Say that it has members (measures or groupings) you may not read; the metric asked for may be among them. Do not say the metric does not exist. |',
4848
'',
49-
'When you ask, the reply is the question alone: no figure, and no tool call',
50-
'until the user answers. State no figure of your own in it (no count, total',
49+
'When the answer has `nextStep`, follow its `decision` and `note`. If `note`',
50+
'says to answer one measure and ask about a word, do both; use none of that',
51+
'word\'s candidates until the user answers.',
52+
'',
53+
'When you only ask, the reply is the question alone: no tool call until the user',
54+
'answers. State no figure of your own in it (no count, total',
5155
'or option number): name each option by its label in a bullet, and quote its',
5256
'description as written. Ask only about matches or candidates for words the user',
5357
'wrote; when their word matched nothing and has no candidates, go to step 4',
@@ -60,8 +64,9 @@ export const ASK_SKILL_DATA_LOOP: string = [
6064
' `selection.dimensions` take the names `list_datasets` gave;',
6165
' `selection.runtimeFilter` filters; `selection.dateGranularity` buckets a date',
6266
' dimension for a trend; `selection.order` and `selection.limit` rank.',
63-
'- Cite the source from the answer\'s `provenance` (the dataset\'s label and each',
64-
' measure\'s label, as in 「指标:营收(数据集:销售分析)」), not from memory.',
67+
'- Cite the answer\'s `sourceLine` as given; without one, build the source from',
68+
' `provenance` (the dataset\'s label and each measure\'s label, as in',
69+
' 「指标:营收(数据集:销售分析)」), not from memory.',
6570
'- Use the measure\'s `description` to say what the number includes and excludes.',
6671
'- `truncated: true`: more rows existed than came back. Say the result is',
6772
' partial. A `warning` on the answer narrows what you were allowed to read:',

‎packages/mcp/src/skill-md-surface-guard.test.ts‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,3 +207,29 @@ describe('SKILL.md ↔ native tool surface drift guard', () => {
207207
expect(taughtButUnregistered, `the Build section teaches a tool this grant does not register: ${taughtButUnregistered.join(', ')}`).toEqual([]);
208208
});
209209
});
210+
211+
/**
212+
* [#34766] The open draft door's read tools, named as the runtime registry
213+
* names them (`OPEN_AUTHORING_READ_TOOL_NAMES` in
214+
* `@objectstack/runtime`, `src/domains/mcp-authoring.ts`; this package cannot
215+
* import it). The SDK refuses a second registration under a name already on
216+
* the server by throwing, so a collision with any native tool would fail
217+
* every `metadata:write` request the open runtime serves.
218+
*/
219+
const OPEN_DRAFT_DOOR_READ_TOOLS = ['list_metadata_items', 'get_metadata_item', 'list_drafts'];
220+
221+
describe('[#34766] the open draft door\'s read tools collide with no native tool', () => {
222+
it('registers beside the full native surface under every scope', async () => {
223+
const native = await listRegisteredToolNames({ grantedScopes: EVERY_SCOPE });
224+
for (const name of OPEN_DRAFT_DOOR_READ_TOOLS) expect(native, name).not.toContain(name);
225+
226+
const registry: McpAuthoringToolRegistry = {
227+
getAll: () => OPEN_DRAFT_DOOR_READ_TOOLS.map((name) => ({ name, description: name, parameters: { type: 'object', properties: {} } })),
228+
async execute(toolCall): Promise<ToolExecutionResult> {
229+
return { type: 'tool-result', toolCallId: toolCall.toolCallId, toolName: toolCall.toolName, output: { type: 'text', value: '' } } as ToolExecutionResult;
230+
},
231+
};
232+
const withDoor = await listRegisteredToolNames({ grantedScopes: EVERY_SCOPE, registry });
233+
expect(withDoor.sort()).toEqual([...native, ...OPEN_DRAFT_DOOR_READ_TOOLS].sort());
234+
});
235+
});

0 commit comments

Comments
 (0)