Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .changeset/37143-ai-context-studio-form.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
'@objectstack/spec': patch
'@objectstack/platform-objects': patch
'@object-ui/app-shell': patch
'@object-ui/i18n': patch
---

feat(studio): author context packs (`ai_context`) in Studio — a form for the type, and a related-lists block that picks each list's columns from its own child object

Clause-②: yes (widening) — one new public export, `aiContextForm` from `@objectstack/spec/ai`, and `/meta/types` now serves a form for `ai_context`; no key is added to what a pack may hold
Metadata-protocol: none

ADR-0160 D1, clause 2 (runtime authoring). A context pack can now be created and edited in Studio like a skill: Studio's metadata editor lays it out with the new `aiContextForm` (`@objectstack/spec/ai`, registered in `METADATA_FORM_REGISTRY` as `ai_context`), and saving goes through the metadata API, where the pack's author defects are reported at save as before.

- **Root object and its fields.** The root is picked from the object catalog; `fields` is the generic field picker scoped to that root (`field-multi`, `dependsOn: 'object'`); `body.field` is a single field picker over the root's fields.
- **Related lists.** `related` uses the `related-list-entries` block. Under a pack, whose entries are `{ object, field?, fields? }`, the block offers every reference field of a served object that points at the root (a self-reference and each of a child's several links included) and writes the pick as `{ object, field }`; each entry's columns are picked from that child object's fields. It stops adding at the schema's bounds (3 lists, 10 columns), and an emptied list or column set removes its key. A stored entry the catalog shows no link for is kept and marked; the save-time report judges it. The object form's `relatedLists` keeps its chip face unchanged: the block tells the two apart by the entry schema it is handed.
- **An emptied picker removes its key.** In Studio's metadata editor, removing the last chip of a field list whose schema has `minItems: 1` (a pack's `fields`) now removes the key instead of writing `[]`, and a composite left with no value while its schema requires a key that has no default (a pack's `body` after choosing "None") is removed instead of written as `{ field: '' }`; a composite whose required keys all carry a default (a view's `pagination`, `selection`) keeps `{}`; both were drafts the save refused with no way back in the form. A cleared sub-field of any composite drops its key, as a cleared top-level field already did.
- **The related-lists block waits for the object list.** While the object list loads, or after it failed, no stored entry is marked as unlinked and the add picker says it is loading or could not load.
- No key is added to `AiContextSchema`, and nothing a pack may hold changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3161,6 +3161,46 @@ export const arMetadataForms: NonNullable<TranslationData['metadataForms']> = {
}
},
ai_context: {
label: "حزمة سياق الذكاء الاصطناعي"
label: "حزمة سياق الذكاء الاصطناعي",
sections: {
basics: {
label: "Basics",
description: "The pack's identity and the object whose records it reads."
},
material: {
label: "Material",
description: "What of the record is handed to the model. Each picker offers the fields of the root object, or of the related list's own object."
}
},
fields: {
name: {
label: "Name",
helpText: "Unique identifier (snake_case). A skill's context key and the get_record_context tool name the pack by it."
},
label: {
label: "Label",
helpText: "Display name, the header of the tool answer. A pack has no description: write its purpose here."
},
object: {
label: "Root object",
helpText: "The root object: the pack reads one record of it."
},
fields: {
label: "Fields",
helpText: "The root object's fields handed to the model, in order (at most 30). A lookup among them is answered with the name of the record it points at."
},
related: {
label: "Related lists",
helpText: "Child lists that point at the record, one level deep (at most 3). Each list names its child object, the reference field that points at the root, and the columns read for each row (at most 10); with no columns a row is read by its name."
},
body: {
label: "Body",
helpText: "The one long-text field read as the record's body."
},
"body.field": {
label: "Body field",
helpText: "A long-text field of the root object (textarea, markdown, html, richtext). Any other field is reported when the pack is saved, and the pack then carries no body."
}
}
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,24 @@
*/

export const arGeneratedSourceHashes: Readonly<Record<string, string>> = {
"metadataForms.ai_context.fields.body.field.helpText": "e25b48c15258b83d",
"metadataForms.ai_context.fields.body.field.label": "1b880a5fad37e8a3",
"metadataForms.ai_context.fields.body.helpText": "48e8d6e37b041d39",
"metadataForms.ai_context.fields.body.label": "d1753a024d6a9bed",
"metadataForms.ai_context.fields.fields.helpText": "b6f210cfc6f2f162",
"metadataForms.ai_context.fields.fields.label": "f316ec6025047133",
"metadataForms.ai_context.fields.label.helpText": "a7560b638d2146e7",
"metadataForms.ai_context.fields.label.label": "c680364257b11569",
"metadataForms.ai_context.fields.name.helpText": "41ef86776bba4abf",
"metadataForms.ai_context.fields.name.label": "5274417ff1ccaf01",
"metadataForms.ai_context.fields.object.helpText": "d785b8445fac8dfe",
"metadataForms.ai_context.fields.object.label": "d465a03c4dfc1d33",
"metadataForms.ai_context.fields.related.helpText": "135e19ad08da41fd",
"metadataForms.ai_context.fields.related.label": "32c91f670a44397f",
"metadataForms.ai_context.sections.basics.description": "4d638a6cd36c7175",
"metadataForms.ai_context.sections.basics.label": "55562f900da68c5d",
"metadataForms.ai_context.sections.material.description": "b8d9cf447db8cfe1",
"metadataForms.ai_context.sections.material.label": "11b295666d0c7917",
"metadataForms.dashboard.fields.dateRange.allowCustomRange.helpText": "1cdc93f55eefade7",
"metadataForms.dashboard.fields.dateRange.allowCustomRange.label": "a1fb0e1cf5fe5d8e",
"metadataForms.dashboard.fields.dateRange.defaultRange.helpText": "afff2187966a112f",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -813,16 +813,18 @@ describe('#19403 round 7 — the population, DERIVED from the registry and a sha

it('the BARE predicate splits that population, and is read off the SHAPE not a name list', () => {
// Lit.
expect(BARE_TYPES.length).toBe(16);
expect(PANEL_TYPES.length).toBe(17);
// 16 / 17 → 15 / 18: `ai_context` gained its form (ADR-0160 D1 clause 2,
// #37143), so it is a panel type now.
expect(BARE_TYPES.length).toBe(15);
expect(PANEL_TYPES.length).toBe(18);
expect(BARE_TYPES.length + PANEL_TYPES.length).toBe(REGISTRY_TYPES.length);
for (const type of ['seed', 'mapping', 'api', 'doc', 'book', 'capability', 'picklist', 'sharing_rule', 'queue', 'assignment_rule', 'object_extension', 'ai_context']) {
for (const type of ['seed', 'mapping', 'api', 'doc', 'book', 'capability', 'picklist', 'sharing_rule', 'queue', 'assignment_rule', 'object_extension']) {
expect(BARE_TYPES, `${type} is bare`).toContain(type);
}
for (const type of AUTHORED_BARE_TYPES) expect(BARE_TYPES, `${type} is bare`).toContain(type);
// 27 leaves: sixteen labels, and a description on the eleven that carry one.
expect(BARE_LEAVES.length).toBe(27);
expect(BARE_LEAVES.filter((l) => l.prop === 'label').length).toBe(16);
// 26 leaves: fifteen labels, and a description on the eleven that carry one.
expect(BARE_LEAVES.length).toBe(26);
expect(BARE_LEAVES.filter((l) => l.prop === 'label').length).toBe(15);
expect(BARE_LEAVES.filter((l) => l.prop === 'description').length).toBe(11);
expect(BARE_LEAVES.every((l) => ['label', 'description'].includes(l.prop))).toBe(true);
});
Expand Down Expand Up @@ -904,13 +906,13 @@ describe('#19403 round 7 — the population, DERIVED from the registry and a sha
expect(flagged.length).toBe(BARE_LEAVES.length);
});

it('⭐ this class is now DONE — zero of its 27 leaves echoes in all three locales', () => {
it('⭐ this class is now DONE — zero of its 26 leaves echoes in all three locales', () => {
const echoing = BARE_LEAVES.filter((l) =>
TRANSLATED_LOCALES.every(([, forms]) => forms[l.type]?.[l.prop] === l.en),
);
expect(echoing.map((l) => `${l.type}.${l.prop}`)).toEqual([]);
// Lit — and it really walked the class, which a zero alone would not show.
expect(BARE_LEAVES.length).toBe(27);
expect(BARE_LEAVES.length).toBe(26);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3161,6 +3161,46 @@ export const deMetadataForms: NonNullable<TranslationData['metadataForms']> = {
}
},
ai_context: {
label: "KI-Kontextpaket"
label: "KI-Kontextpaket",
sections: {
basics: {
label: "Basics",
description: "The pack's identity and the object whose records it reads."
},
material: {
label: "Material",
description: "What of the record is handed to the model. Each picker offers the fields of the root object, or of the related list's own object."
}
},
fields: {
name: {
label: "Name",
helpText: "Unique identifier (snake_case). A skill's context key and the get_record_context tool name the pack by it."
},
label: {
label: "Label",
helpText: "Display name, the header of the tool answer. A pack has no description: write its purpose here."
},
object: {
label: "Root object",
helpText: "The root object: the pack reads one record of it."
},
fields: {
label: "Fields",
helpText: "The root object's fields handed to the model, in order (at most 30). A lookup among them is answered with the name of the record it points at."
},
related: {
label: "Related lists",
helpText: "Child lists that point at the record, one level deep (at most 3). Each list names its child object, the reference field that points at the root, and the columns read for each row (at most 10); with no columns a row is read by its name."
},
body: {
label: "Body",
helpText: "The one long-text field read as the record's body."
},
"body.field": {
label: "Body field",
helpText: "A long-text field of the root object (textarea, markdown, html, richtext). Any other field is reported when the pack is saved, and the pack then carries no body."
}
}
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,24 @@ export const deGeneratedSourceHashes: Readonly<Record<string, string>> = {
"metadataForms.action.fields.refusals.status.label": "64a420165247654b",
"metadataForms.agent.fields.avatar.label": "0f06369995b69b8b",
"metadataForms.agent.fields.name.label": "5274417ff1ccaf01",
"metadataForms.ai_context.fields.body.field.helpText": "e25b48c15258b83d",
"metadataForms.ai_context.fields.body.field.label": "1b880a5fad37e8a3",
"metadataForms.ai_context.fields.body.helpText": "48e8d6e37b041d39",
"metadataForms.ai_context.fields.body.label": "d1753a024d6a9bed",
"metadataForms.ai_context.fields.fields.helpText": "b6f210cfc6f2f162",
"metadataForms.ai_context.fields.fields.label": "f316ec6025047133",
"metadataForms.ai_context.fields.label.helpText": "a7560b638d2146e7",
"metadataForms.ai_context.fields.label.label": "c680364257b11569",
"metadataForms.ai_context.fields.name.helpText": "41ef86776bba4abf",
"metadataForms.ai_context.fields.name.label": "5274417ff1ccaf01",
"metadataForms.ai_context.fields.object.helpText": "d785b8445fac8dfe",
"metadataForms.ai_context.fields.object.label": "d465a03c4dfc1d33",
"metadataForms.ai_context.fields.related.helpText": "135e19ad08da41fd",
"metadataForms.ai_context.fields.related.label": "32c91f670a44397f",
"metadataForms.ai_context.sections.basics.description": "4d638a6cd36c7175",
"metadataForms.ai_context.sections.basics.label": "55562f900da68c5d",
"metadataForms.ai_context.sections.material.description": "b8d9cf447db8cfe1",
"metadataForms.ai_context.sections.material.label": "11b295666d0c7917",
"metadataForms.api.fields.name.label": "5274417ff1ccaf01",
"metadataForms.app.fields.branding.label": "ec6e391065514b64",
"metadataForms.app.fields.name.label": "5274417ff1ccaf01",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3161,6 +3161,46 @@ export const enMetadataForms: NonNullable<TranslationData['metadataForms']> = {
}
},
ai_context: {
label: "AI Context Pack"
label: "AI Context Pack",
sections: {
basics: {
label: "Basics",
description: "The pack's identity and the object whose records it reads."
},
material: {
label: "Material",
description: "What of the record is handed to the model. Each picker offers the fields of the root object, or of the related list's own object."
}
},
fields: {
name: {
label: "Name",
helpText: "Unique identifier (snake_case). A skill's context key and the get_record_context tool name the pack by it."
},
label: {
label: "Label",
helpText: "Display name, the header of the tool answer. A pack has no description: write its purpose here."
},
object: {
label: "Root object",
helpText: "The root object: the pack reads one record of it."
},
fields: {
label: "Fields",
helpText: "The root object's fields handed to the model, in order (at most 30). A lookup among them is answered with the name of the record it points at."
},
related: {
label: "Related lists",
helpText: "Child lists that point at the record, one level deep (at most 3). Each list names its child object, the reference field that points at the root, and the columns read for each row (at most 10); with no columns a row is read by its name."
},
body: {
label: "Body",
helpText: "The one long-text field read as the record's body."
},
"body.field": {
label: "Body field",
helpText: "A long-text field of the root object (textarea, markdown, html, richtext). Any other field is reported when the pack is saved, and the pack then carries no body."
}
}
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -3161,6 +3161,46 @@ export const esESMetadataForms: NonNullable<TranslationData['metadataForms']> =
}
},
ai_context: {
label: "Paquete de contexto de IA"
label: "Paquete de contexto de IA",
sections: {
basics: {
label: "Datos básicos",
description: "La identidad del paquete y el objeto cuyos registros lee."
},
material: {
label: "Contenido",
description: "Qué parte del registro se entrega al modelo. Cada selector ofrece los campos del objeto raíz, o del objeto propio de la lista relacionada."
}
},
fields: {
name: {
label: "Nombre",
helpText: "Identificador único (snake_case). La clave context de una habilidad y la herramienta get_record_context nombran el paquete con él."
},
label: {
label: "Etiqueta",
helpText: "Nombre visible, el encabezado de la respuesta de la herramienta. Un paquete no tiene descripción: escriba aquí su propósito."
},
object: {
label: "Objeto raíz",
helpText: "El objeto raíz: el paquete lee un registro de él."
},
fields: {
label: "Campos",
helpText: "Los campos del objeto raíz que se entregan al modelo, en orden (como máximo 30). Una búsqueda entre ellos se responde con el nombre del registro al que apunta."
},
related: {
label: "Listas relacionadas",
helpText: "Listas hijas que apuntan al registro, un solo nivel (como máximo 3). Cada lista indica su objeto hijo, el campo de referencia que apunta a la raíz y las columnas que se leen en cada fila (como máximo 10); sin columnas, cada fila se lee por su nombre."
},
body: {
label: "Cuerpo",
helpText: "El único campo de texto largo que se lee como cuerpo del registro."
},
"body.field": {
label: "Campo del cuerpo",
helpText: "Un campo de texto largo del objeto raíz (textarea, markdown, html, richtext). Cualquier otro campo se informa al guardar el paquete, y entonces el paquete no lleva cuerpo."
}
}
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -3161,6 +3161,46 @@ export const frMetadataForms: NonNullable<TranslationData['metadataForms']> = {
}
},
ai_context: {
label: "Pack de contexte IA"
label: "Pack de contexte IA",
sections: {
basics: {
label: "Basics",
description: "The pack's identity and the object whose records it reads."
},
material: {
label: "Material",
description: "What of the record is handed to the model. Each picker offers the fields of the root object, or of the related list's own object."
}
},
fields: {
name: {
label: "Name",
helpText: "Unique identifier (snake_case). A skill's context key and the get_record_context tool name the pack by it."
},
label: {
label: "Label",
helpText: "Display name, the header of the tool answer. A pack has no description: write its purpose here."
},
object: {
label: "Root object",
helpText: "The root object: the pack reads one record of it."
},
fields: {
label: "Fields",
helpText: "The root object's fields handed to the model, in order (at most 30). A lookup among them is answered with the name of the record it points at."
},
related: {
label: "Related lists",
helpText: "Child lists that point at the record, one level deep (at most 3). Each list names its child object, the reference field that points at the root, and the columns read for each row (at most 10); with no columns a row is read by its name."
},
body: {
label: "Body",
helpText: "The one long-text field read as the record's body."
},
"body.field": {
label: "Body field",
helpText: "A long-text field of the root object (textarea, markdown, html, richtext). Any other field is reported when the pack is saved, and the pack then carries no body."
}
}
}
};
Loading
Loading