Skip to content

Commit 23fc3e2

Browse files
authored
docs(ui,protocol): document the six variants that only ever got name-checked (#4244)
Follow-up to the #4177 variant/doc gate, using the signal it produced. That gate passes a variant if the page contains either `<disc>: '<variant>'` or a bare `` `variant` ``, and its header says plainly that the second form is loose: a pass means the page says the word, not that it documents the thing. Six variants were passing on the loose form alone — the gate's own "weak pass" list, and a precise worklist. apps.mdx enumerated nine navigation item types but only documented six. `report`, `action` and `component` shared one sentence — "the spec also defines …" — while the other six each had a section with an example. They now have their own, and the intro no longer implies a second tier of half-supported types. The `action` section earns its place: `actionName` lives inside a nested `actionDef` block, not at the top level, which is exactly the shape a reader guesses wrong. Both it and `component` note which sub-object stays OPEN by design (`actionDef.params`, `component.params`) — the sibling contract owns those, and after #4165 everything around them is strict. knowledge.mdx had a table naming `object` / `file` / `http` and no example of any, so the per-kind keys (`contentFields` vs `prefix` vs `urls`) appeared nowhere. Added one example each. Every example was parsed against the real schema before committing — NavigationItemSchema and KnowledgeSourceKindSchema, six for six. Writing docs from memory is how the region example in #4218 ended up using an `id` key that does not exist. Anchored-form coverage for these two unions: 9/12 → 12/12. Carries an empty changeset. The first push asserted a docs-only PR needs none; Check Changeset disagreed and named the fix — an empty changeset is the repo's way for work that releases nothing, and 72 of them already exist. Refs #4001, #4177
1 parent f1f40b4 commit 23fc3e2

3 files changed

Lines changed: 79 additions & 1 deletion

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
---
3+
4+
docs(ui,protocol): document the six navigation / knowledge-source variants that the #4177 variant/doc gate was only ever name-checking. `apps.mdx` enumerated nine navigation item types but gave `report`, `action` and `component` a single shared sentence instead of sections; `knowledge.mdx` named `object` / `file` / `http` in a table with no example of any, leaving the per-kind keys undocumented. Each example was parsed against the real schema (`NavigationItemSchema`, `KnowledgeSourceKindSchema`) before landing. Documentation only; releases nothing.

content/docs/protocol/knowledge.mdx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,34 @@ Three source kinds:
119119
| `file` | A folder in `IStorageService` | Onboarded PDFs, uploads |
120120
| `http` | A list of remote URLs | External docs, RSS, sitemaps |
121121

122+
`kind` is the discriminator, and each kind carries its own keys — a key from one
123+
kind is rejected on another:
124+
125+
```typescript
126+
// object — content comes from the named fields of each matching record
127+
source: {
128+
kind: 'object',
129+
object: 'kb_article',
130+
contentFields: ['title', 'body'], // at least one, required
131+
metadataFields: ['category', 'author'], // optional, carried onto the document
132+
where: { status: 'published' }, // optional ObjectQL filter
133+
}
134+
135+
// file — every object under a storage prefix
136+
source: {
137+
kind: 'file',
138+
prefix: 'knowledge/handbook/',
139+
mimeTypes: ['application/pdf', 'text/markdown'], // optional; omit to take all
140+
}
141+
142+
// http — an explicit URL list (each must be a valid URL)
143+
source: {
144+
kind: 'http',
145+
urls: ['https://docs.example.com/guide', 'https://docs.example.com/faq'],
146+
userAgent: 'ObjectStack-KnowledgeBot/1.0', // optional
147+
}
148+
```
149+
122150
Every source binds to a named **adapter id** (e.g. `'ragflow'`,
123151
`'memory'`). The adapter id is resolved at runtime by the plugin that
124152
registers itself with that name. Adapter config (endpoint, dataset id,

content/docs/ui/apps.mdx

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ const crmApp = {
5757

5858
## Navigation Items
5959

60-
The navigation tree supports nine item types, combined to create rich menu structures. The most common are shown below (`object`, `dashboard`, `page`, `url`, `group`, `separator`); the spec also defines `report`, `action`, and `component` items.
60+
The navigation tree supports nine item types, combined to create rich menu structures: `object`, `dashboard`, `page`, `url`, `report`, `action`, `component`, `group` and `separator`. Each is documented below.
61+
62+
`type` is the discriminator: a value outside that list is rejected with the full
63+
set of valid ones, and every other key is checked against the branch you picked
64+
rather than against all nine.
6165

6266
### Object Navigation
6367

@@ -121,6 +125,48 @@ Groups items into collapsible sections with children:
121125
}
122126
```
123127

128+
### Report Navigation
129+
130+
Links to a saved report:
131+
132+
```typescript
133+
{ id: 'nav_pipeline', type: 'report', label: 'Pipeline Report', reportName: 'sales_pipeline', icon: 'file-bar-chart' }
134+
```
135+
136+
### Action Navigation
137+
138+
Runs an action instead of navigating to a surface. The reference lives in a
139+
nested `actionDef` block — `actionName` is **not** a top-level key on the item:
140+
141+
```typescript
142+
{
143+
id: 'nav_import',
144+
type: 'action',
145+
label: 'Import Records',
146+
icon: 'upload',
147+
actionDef: {
148+
actionName: 'bulk_import',
149+
params: { objectName: 'account', mode: 'upsert' },
150+
},
151+
}
152+
```
153+
154+
`actionDef` accepts only `actionName` and `params`. `params` itself is **open by
155+
design** — the action owns its own parameter contract, so the app schema does
156+
not validate what goes inside it.
157+
158+
### Component Navigation
159+
160+
Renders a registered component. `componentRef` is a component-registry key, not
161+
a file path:
162+
163+
```typescript
164+
{ id: 'nav_directory', type: 'component', label: 'Directory', componentRef: 'metadata:directory', icon: 'contact' }
165+
```
166+
167+
`params` is handed to the component as props and is **open by design** — the
168+
props are the component's own contract.
169+
124170
### Separator
125171

126172
A visual divider in the navigation list. It renders no target and carries no

0 commit comments

Comments
 (0)