From deab4861796c15164db35a3dc3c9698727314fb4 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 28 Nov 2026 08:51:42 +0000 Subject: [PATCH 1/9] feat(spec): a metadata form for knowledge_source (WIP) Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP Co-authored-by: Claude --- packages/spec/src/ai/index.ts | 1 + .../ai/knowledge-source.metadata-form.test.ts | 107 ++++++++++++++++ .../src/ai/knowledge-source.metadata-form.ts | 116 ++++++++++++++++++ .../spec/src/system/metadata-form-registry.ts | 4 +- 4 files changed, 227 insertions(+), 1 deletion(-) create mode 100644 packages/spec/src/ai/knowledge-source.metadata-form.test.ts create mode 100644 packages/spec/src/ai/knowledge-source.metadata-form.ts diff --git a/packages/spec/src/ai/index.ts b/packages/spec/src/ai/index.ts index 68aec45f063..4c371be2f7b 100644 --- a/packages/spec/src/ai/index.ts +++ b/packages/spec/src/ai/index.ts @@ -36,6 +36,7 @@ export { toolForm } from './tool.metadata-form'; export * from './skill.zod'; export { skillForm } from './skill.metadata-form'; export { aiContextForm } from './ai-context.metadata-form'; +export { knowledgeSourceForm } from './knowledge-source.metadata-form'; export * from './conversation.zod'; export * from './model-registry.zod'; export * from './usage.zod'; diff --git a/packages/spec/src/ai/knowledge-source.metadata-form.test.ts b/packages/spec/src/ai/knowledge-source.metadata-form.test.ts new file mode 100644 index 00000000000..1a4e8cd43ff --- /dev/null +++ b/packages/spec/src/ai/knowledge-source.metadata-form.test.ts @@ -0,0 +1,107 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * The knowledge source form (`knowledge_source`, ADR-0161 K4 clause 2, K5, + * K10): registered for Studio's generic metadata editor, every field picker + * scoped by the source's own object, the egress note beside `content`, and no + * control for a key v1 does not carry. That the form names only keys + * `KnowledgeSourceSchema` accepts, and offers every one, is the registry-wide + * reconciliation in `system/metadata-form-zod-reconciliation.test.ts`. + */ + +import { describe, it, expect } from 'vitest'; + +import { knowledgeSourceForm } from './knowledge-source.metadata-form'; +import { KnowledgeSourceSchema } from './knowledge-source.zod'; +import { METADATA_FORM_REGISTRY } from '../system/metadata-form-registry'; + +type Row = { + field: string; + widget?: string; + type?: string; + dependsOn?: string; + required?: boolean; + helpText?: string; + options?: Array<{ value: string }>; + fields?: Row[]; +}; + +const top = (): Row[] => (knowledgeSourceForm.sections ?? []).flatMap((s) => (s.fields ?? []) as Row[]); +const row = (field: string) => top().find((r) => r.field === field); +const sourceRow = (field: string) => row('source')?.fields?.find((r) => r.field === field); + +/** Every dotted path the form offers, composites walked. */ +function offeredPaths(rows: Row[] = top(), prefix = ''): string[] { + return rows.flatMap((r) => [`${prefix}${r.field}`, ...offeredPaths(r.fields ?? [], `${prefix}${r.field}.`)]); +} + +describe('knowledge_source form (ADR-0161 K4 clause 2)', () => { + it('is the registry\'s form for the type', () => { + expect(METADATA_FORM_REGISTRY.knowledge_source).toBe(knowledgeSourceForm); + }); + + it('requires the identity rows, and offers `adapter` as optional free text', () => { + expect(row('name')).toMatchObject({ required: true }); + expect(row('label')).toMatchObject({ required: true }); + const adapter = row('adapter'); + expect(adapter).toMatchObject({ type: 'text' }); + expect(adapter?.required).toBeUndefined(); + expect(adapter?.helpText).toMatch(/blank for the deployment's store/i); + }); + + it('picks the object from the catalog, and scopes every field picker by that object', () => { + expect(row('source')).toMatchObject({ type: 'composite' }); + expect(sourceRow('object')).toMatchObject({ widget: 'ref:object', required: true }); + expect(sourceRow('content')).toMatchObject({ widget: 'field-multi', dependsOn: 'object', required: true }); + expect(sourceRow('metadataFields')).toMatchObject({ widget: 'field-multi', dependsOn: 'object' }); + }); + + it('offers the one kind, `object`, and every split strategy the schema accepts', () => { + expect(sourceRow('kind')?.options?.map((o) => o.value)).toEqual(['object']); + const strategy = sourceRow('split')?.fields?.find((r) => r.field === 'strategy'); + expect(strategy?.options?.map((o) => o.value)).toEqual(['whole', 'recursive', 'markdown']); + }); + + it('edits `where` as an ObjectQL filter object (the JSON editor), not as a view rule list', () => { + // `filter-builder` writes `[{ field, operator, value }]`; `where` is a record, which refuses a list. + expect(sourceRow('where')).toMatchObject({ widget: 'json' }); + expect(KnowledgeSourceSchema.safeParse({ + name: 'a', label: 'A', source: { kind: 'object', object: 'task', content: ['title'], where: [{ field: 'status', operator: 'equals', value: 'open' }] }, + }).success).toBe(false); + }); + + it('says beside `content` that its fields are sent to the embedding provider on the first build, billed and kept', () => { + const help = sourceRow('content')?.helpText ?? ''; + expect(help).toMatch(/egress/i); + expect(help).toMatch(/first build/); + expect(help).toMatch(/embedding provider/); + expect(help).toMatch(/bills/); + expect(help).toMatch(/kept in an index/); + }); + + it('offers no control for a key v1 does not carry', () => { + const paths = offeredPaths(); + for (const retired of ['id', 'embedding', 'vectorStore', 'adapterConfig', 'refresh.cron', 'source.contentFields']) { + expect(paths, retired).not.toContain(retired); + } + }); + + it('every value the form can write parses with KnowledgeSourceSchema', () => { + const written = { + name: 'task_notes', + label: 'Task notes', + description: 'Open tasks', + aiExposed: true, + source: { + kind: 'object', + object: 'task', + content: ['title', 'notes'], + metadataFields: ['status'], + where: { status: { $ne: 'done' } }, + split: { strategy: 'markdown', maxChars: 600, minChars: 100 }, + }, + refresh: { onRecordChange: true }, + }; + expect(KnowledgeSourceSchema.safeParse(written).success).toBe(true); + }); +}); diff --git a/packages/spec/src/ai/knowledge-source.metadata-form.ts b/packages/spec/src/ai/knowledge-source.metadata-form.ts new file mode 100644 index 00000000000..d7e50767fa5 --- /dev/null +++ b/packages/spec/src/ai/knowledge-source.metadata-form.ts @@ -0,0 +1,116 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +import { defineMetadataForm } from '../ui/view.zod'; + +/** + * Knowledge Source (`knowledge_source`) Metadata Form — ADR-0161 K4, clause 2 + * (authored at run time through Studio), K5 and K10. + * + * The form Studio's generic metadata editor lays a knowledge source out with: + * its identity and store, the object whose records it indexes, the fields + * whose text is indexed and the fields kept beside each passage, the filter, + * the split, and the refresh switch. + * + * Every field picker is scoped by the source's own object, `source.object`: + * the rows of the `source` composite name their sibling `object` in + * `dependsOn` (the `page.metadata-form.ts` precedent, where `columns` inside + * `interfaceConfig` names `source`), and Studio's form host binds the field + * catalog to the path the form declares. + * + * - `source.content` and `source.metadataFields` are the generic + * `field-multi` picker over that object's fields; `content` keeps its order. + * - `source.where` is the JSON editor (the `report.metadata-form.ts` + * `runtimeFilter` precedent): a `where` is an ObjectQL filter object, which + * the `filter-builder` widget does not write (it writes a view's rule list). + * + * ADR-0161 K5 and K10 rule 5: embedding is egress, so `content` offers named + * fields only, and its help says beside it what a build sends and to whom. + * The form offers no control for a key v1 does not carry: no wildcard member, + * and no `embedding`, `vectorStore`, `adapterConfig` or `refresh.cron`. + * + * The form judges nothing. The two save-time guards (the + * `manage_knowledge_sources` capability and source admission as the author) + * and the reference checks of `os validate` and publish refuse what the form + * lets an author write; Studio shows their refusals on the form as it does + * for every kind. + */ +export const knowledgeSourceForm = defineMetadataForm({ + schemaId: 'knowledge_source', + type: 'simple', + sections: [ + { + name: 'basics', + label: 'Basics', + description: 'The source\'s identity, whether agents may search it, and the store that holds its index.', + columns: 2, + fields: [ + { field: 'name', required: true, immutable: true, colSpan: 1, helpText: 'Unique identifier (snake_case). search_knowledge lists the source by it, and its sourceIds argument names the source by it.' }, + { field: 'label', required: true, colSpan: 1, helpText: 'Display name, shown in the sources list of a search_knowledge answer.' }, + { field: 'description', widget: 'textarea', colSpan: 2, helpText: 'What the source holds, shown beside its name in the sources list of a search_knowledge answer.' }, + { field: 'aiExposed', colSpan: 1, helpText: 'Whether search_knowledge may search this source for AI agents. On by default.' }, + { field: 'adapter', type: 'text', colSpan: 1, helpText: 'The store that holds the index, by its adapter id (pgvector, turso, memory). Leave it blank for the deployment\'s store: pgvector on PostgreSQL, turso otherwise, else the only store mounted. A store this deployment does not mount is refused at save.' }, + ], + }, + { + name: 'records', + label: 'Records', + description: 'Which records of which object are indexed, and which of their fields. Each field picker offers the fields of the object chosen here.', + fields: [ + { + field: 'source', + type: 'composite', + helpText: 'What the source indexes: the records of one object.', + fields: [ + { field: 'kind', label: 'Kind', required: true, options: [{ label: 'Records of an object', value: 'object' }], helpText: 'What the source indexes. A source indexes the records of one object.' }, + { field: 'object', label: 'Object', widget: 'ref:object', required: true, helpText: 'The object whose records are indexed. Each matching record becomes one document.' }, + { + field: 'content', + label: 'Content fields', + widget: 'field-multi', + dependsOn: 'object', + required: true, + helpText: 'The fields whose text is indexed, in order. Each field is named: there is no wildcard. Embedding is egress: on the first build the text of every listed field of every matching record is sent to your embedding provider, which bills for it, and kept in an index outside the record store. A field added to the object later is not indexed until you add it here. Credential and internal fields are never indexed, even when listed.', + }, + { field: 'metadataFields', label: 'Filter fields', widget: 'field-multi', dependsOn: 'object', helpText: 'Fields kept beside each passage, so a search can filter on them (for example a status or an owner). Each one must be a field you may query.' }, + { field: 'where', label: 'Records to index', widget: 'json', helpText: 'An ObjectQL filter on the object, for example {"status": {"$ne": "done"}}. Only the records it matches are indexed. Blank: every record.' }, + { + field: 'split', + label: 'Passages', + type: 'composite', + helpText: 'How each document is cut into passages. Blank: recursive, with the settings page\'s chunk size (800 characters unless changed).', + fields: [ + { + field: 'strategy', + label: 'Strategy', + options: [ + { label: 'Whole document', value: 'whole' }, + { label: 'Recursive', value: 'recursive' }, + { label: 'Markdown sections', value: 'markdown' }, + ], + helpText: 'Whole: one passage per document. Recursive: cut at blank lines, then line breaks, then sentence ends. Markdown: one passage per heading, carrying its heading path.', + }, + { field: 'maxChars', label: 'Longest passage', helpText: 'In characters. Wins over the settings page\'s chunk size; the embedding model\'s input limit can lower it. Not read by Whole document.' }, + { field: 'minChars', label: 'Shortest passage', helpText: 'Adjacent pieces shorter than this are merged, up to this length (default 200). Recursive and Markdown only.' }, + ], + }, + ], + }, + ], + }, + { + name: 'refresh', + label: 'Refresh', + description: 'How the index follows the records.', + fields: [ + { + field: 'refresh', + type: 'composite', + helpText: 'How the index is kept in step with the records.', + fields: [ + { field: 'onRecordChange', label: 'Sync on record changes', helpText: 'Keep the index in step as records are created, changed and deleted (on by default). Off: an external indexer keeps the index, and the platform neither syncs nor builds it.' }, + ], + }, + ], + }, + ], +}); diff --git a/packages/spec/src/system/metadata-form-registry.ts b/packages/spec/src/system/metadata-form-registry.ts index 07847a23448..bd3b85ca7ee 100644 --- a/packages/spec/src/system/metadata-form-registry.ts +++ b/packages/spec/src/system/metadata-form-registry.ts @@ -44,7 +44,7 @@ import { } from '../ui'; import { positionForm } from '../identity'; import { permissionForm } from '../security'; -import { agentForm, toolForm, skillForm, aiContextForm } from '../ai'; +import { agentForm, toolForm, skillForm, aiContextForm, knowledgeSourceForm } from '../ai'; import { flowForm } from '../automation'; import { emailTemplateForm } from './email-template.metadata-form'; @@ -85,6 +85,8 @@ export const METADATA_FORM_REGISTRY: Readonly> = Object tool: toolForm, skill: skillForm, ai_context: aiContextForm, + // [ADR-0161 K4, clause 2] a knowledge source is authored in Studio. + knowledge_source: knowledgeSourceForm, flow: flowForm, permission: permissionForm, email_template: emailTemplateForm, From b402cff877418f9afbac3efbe6f5e7a4de9a8816 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 28 Nov 2026 09:03:46 +0000 Subject: [PATCH 2/9] chore(spec): regenerate api-surface and export-origins for knowledgeSourceForm Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP Co-authored-by: Claude --- packages/spec/api-surface/ai.json | 1 + packages/spec/export-origins/ai.json | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/spec/api-surface/ai.json b/packages/spec/api-surface/ai.json index d313446ff0e..fdd2e061505 100644 --- a/packages/spec/api-surface/ai.json +++ b/packages/spec/api-surface/ai.json @@ -316,6 +316,7 @@ "getDatasetToolJsonSchemas (function)", "getRecordContextToolJsonSchemas (function)", "headingsOf (function)", + "knowledgeSourceForm (const)", "parseAskQuestionEnvelope (function)", "scopesToAgentPermissionSets (function)", "skillBindsRecordContextTool (function)", diff --git a/packages/spec/export-origins/ai.json b/packages/spec/export-origins/ai.json index 08ebd052dae..ad9e5772fec 100644 --- a/packages/spec/export-origins/ai.json +++ b/packages/spec/export-origins/ai.json @@ -313,6 +313,7 @@ "getDatasetToolJsonSchemas": "src/ai/dataset-tools.zod.ts#getDatasetToolJsonSchemas (function)", "getRecordContextToolJsonSchemas": "src/ai/record-context-tools.zod.ts#getRecordContextToolJsonSchemas (function)", "headingsOf": "src/ai/record-body-anchor.ts#headingsOf (function)", + "knowledgeSourceForm": "src/ai/knowledge-source.metadata-form.ts#knowledgeSourceForm (const)", "parseAskQuestionEnvelope": "src/ai/ask-question.zod.ts#parseAskQuestionEnvelope (function)", "scopesToAgentPermissionSets": "src/ai/mcp.zod.ts#scopesToAgentPermissionSets (function)", "skillBindsRecordContextTool": "src/ai/skill.zod.ts#skillBindsRecordContextTool (function)", From ed40f19bfc9a7a26d06a4ea2de53c0dbabb0a5a1 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 28 Nov 2026 09:06:43 +0000 Subject: [PATCH 3/9] feat(studio): bind field pickers to the object the form declares; knowledge source round-trip pins (WIP) Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP Co-authored-by: Claude --- ...ge-source-studio-roundtrip.dogfood.test.ts | 145 ++++++++++++++++++ ...rceEditPage.formBoundObject-37309.test.tsx | 145 ++++++++++++++++++ .../views/metadata-admin/ResourceEditPage.tsx | 7 +- .../views/metadata-admin/formBoundObject.ts | 76 +++++++++ 4 files changed, 372 insertions(+), 1 deletion(-) create mode 100644 packages/qa/dogfood/test/knowledge-source-studio-roundtrip.dogfood.test.ts create mode 100644 ui/packages/app-shell/src/views/metadata-admin/ResourceEditPage.formBoundObject-37309.test.tsx create mode 100644 ui/packages/app-shell/src/views/metadata-admin/formBoundObject.ts diff --git a/packages/qa/dogfood/test/knowledge-source-studio-roundtrip.dogfood.test.ts b/packages/qa/dogfood/test/knowledge-source-studio-roundtrip.dogfood.test.ts new file mode 100644 index 00000000000..f2f1dfd4b7f --- /dev/null +++ b/packages/qa/dogfood/test/knowledge-source-studio-roundtrip.dogfood.test.ts @@ -0,0 +1,145 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. +// +// [ADR-0161 K4, clause 2] A knowledge source authored the way Studio's form +// writes one, on a REAL booted showcase (the knowledge service and its one +// store, `memory`), with no restart anywhere: +// +// ⭐ the Studio wire — the item's draft PUT (`?mode=draft`), then that one +// item's publish, which is what a Save in Studio's metadata editor sends +// (objectstack#36902) — saves a source whose body holds every key the +// `knowledge_source` form offers, `adapter` left blank; +// ⭐ `search_knowledge` over the live `/mcp` transport then finds a record +// of that object, named by its object and id, from the new source; +// ⭐ reopened, the item reads back every value the form wrote, as written, +// and parses with `KnowledgeSourceSchema`; +// ⭐ CONTROL: before the publish, the tool lists no such source. +// +// The browser half (the form itself, its pickers bound to `source.object`) is +// pinned in `ui/packages/app-shell`, against the real editor; this file pins +// what the form's body does once it reaches the doors. +// +// The verify harness mounts no MCP server, so this file mounts one, as +// `objectstack dev` and `serve` do. A session bearer carries no OAuth grant, +// so the route serves it the read family, `search_knowledge` included. +// +// The file is ISOLATED: it writes `/meta` and creates a task. + +import { describe, it, expect, beforeAll, afterAll } from 'vitest'; +import { MCPServerPlugin } from '@objectstack/mcp'; +import { type VerifyStack } from '@objectstack/verify'; +import { KnowledgeSourceSchema } from '@objectstack/spec/ai'; +import { bootShowcase } from './showcase-boot.js'; + +const SOURCE = 'ks_studio_open_tasks'; +/** A word no seeded task carries, so a hit on it is the record this file wrote. */ +const MARKER = 'zephyrquartz'; + +/** Every key the `knowledge_source` form offers, as its controls write them; `adapter` left blank. */ +const FORM_BODY = { + name: SOURCE, + label: 'Open tasks (Studio)', + description: 'Titles and notes of open tasks, authored in Studio.', + aiExposed: true, + source: { + kind: 'object', + object: 'showcase_task', + content: ['title', 'notes'], + metadataFields: ['status', 'priority'], + where: { status: { $ne: 'done' } }, + split: { strategy: 'recursive', maxChars: 600, minChars: 100 }, + }, + refresh: { onRecordChange: true }, +}; + +type Row = Record; +const rowsOf = (r: any): Row[] => + (Array.isArray(r) ? r : Array.isArray(r?.records) ? r.records : Array.isArray(r?.data) ? r.data : Array.isArray(r?.value) ? r.value : []); + +describe('[ADR-0161 K4] a knowledge source authored through Studio\'s wire is searched over MCP without a restart', () => { + let stack: VerifyStack; + let admin = ''; + let taskId = ''; + + /** One MCP `tools/call` over the live transport, as the admin's session; its first content block parsed. */ + const tool = async (name: string, args: Record) => { + const res = await stack.api('/mcp', { + method: 'POST', + headers: { 'Content-Type': 'application/json', Accept: 'application/json, text/event-stream', Authorization: `Bearer ${admin}` }, + body: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'tools/call', params: { name, arguments: args } }), + }); + expect(res.status, await res.clone().text()).toBe(200); + const rpc: any = await res.json(); + expect(rpc.error, JSON.stringify(rpc.error)).toBeUndefined(); + const text = String(rpc.result?.content?.[0]?.text ?? ''); + let payload: any; + try { payload = JSON.parse(text); } catch { payload = { message: text }; } + return { isError: rpc.result?.isError === true, payload, text }; + }; + + beforeAll(async () => { + stack = await bootShowcase({ extraPlugins: [new MCPServerPlugin()] }); + admin = await stack.signIn(); + const projects = await stack.apiAs(admin, 'GET', '/data/showcase_project?limit=1'); + expect(projects.status, await projects.clone().text()).toBe(200); + const project = rowsOf(await projects.json())[0]; + expect(project?.id, 'a seeded project').toBeTruthy(); + const created = await stack.apiAs(admin, 'POST', '/data/showcase_task', { + title: `Calibrate the ${MARKER} rig`, + notes: `The ${MARKER} rig needs a new seal before the next run.`, + status: 'todo', + project: project.id, + }); + const body: any = await created.json(); + expect(created.status, JSON.stringify(body)).toBeLessThan(300); + taskId = String(body?.id ?? body?.record?.id ?? body?.data?.id ?? ''); + expect(taskId, JSON.stringify(body)).not.toBe(''); + }, 180_000); + + afterAll(async () => { + await stack?.stop(); + }); + + it('CONTROL: before the publish, search_knowledge lists no such source', async () => { + const answer = await tool('search_knowledge', { query: MARKER }); + expect(answer.isError, answer.text).toBe(false); + expect((answer.payload.sources as Array<{ id: string }>).map((s) => s.id)).not.toContain(SOURCE); + }); + + it('Studio\'s Save — the draft PUT, then the item\'s publish — saves the source', async () => { + const draft = await stack.apiAs(admin, 'PUT', `/meta/knowledge_source/${SOURCE}?mode=draft`, FORM_BODY); + expect(draft.status, await draft.clone().text()).toBe(200); + const published = await stack.apiAs(admin, 'POST', `/meta/knowledge_source/${SOURCE}/publish`, {}); + expect(published.status, await published.clone().text()).toBe(200); + }); + + it('search_knowledge over MCP finds the record of that object from the new source, with no restart', async () => { + const deadline = Date.now() + 30_000; + let last: Awaited> | undefined; + let hit: any; + while (Date.now() < deadline) { + last = await tool('search_knowledge', { query: MARKER, sourceIds: [SOURCE] }); + if (!last.isError) { + hit = (last.payload.hits as any[]).find((h) => h.record?.id === taskId); + if (hit) break; + } + await new Promise((r) => setTimeout(r, 250)); + } + expect(hit, last?.text).toBeDefined(); + expect(hit).toMatchObject({ sourceId: SOURCE, record: { object: 'showcase_task', id: taskId } }); + expect(String(hit.snippet)).toContain(MARKER); + expect((last!.payload.sources as Array<{ id: string; label: string }>)).toContainEqual( + expect.objectContaining({ id: SOURCE, label: FORM_BODY.label }), + ); + }); + + it('reopened, the item shows every value the form wrote, and parses with KnowledgeSourceSchema', async () => { + const res = await stack.apiAs(admin, 'GET', `/meta/knowledge_source/${SOURCE}`); + expect(res.status, await res.clone().text()).toBe(200); + const json: any = await res.json(); + const item = json?.item ?? json?.data ?? json; + expect(item).toMatchObject(FORM_BODY); + expect(item.adapter).toBeUndefined(); + const parsed = KnowledgeSourceSchema.safeParse(item); + expect(parsed.success, JSON.stringify(parsed.error?.issues)).toBe(true); + }); +}); diff --git a/ui/packages/app-shell/src/views/metadata-admin/ResourceEditPage.formBoundObject-37309.test.tsx b/ui/packages/app-shell/src/views/metadata-admin/ResourceEditPage.formBoundObject-37309.test.tsx new file mode 100644 index 00000000000..cc6ac03cec1 --- /dev/null +++ b/ui/packages/app-shell/src/views/metadata-admin/ResourceEditPage.formBoundObject-37309.test.tsx @@ -0,0 +1,145 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * objectstack#37309 — the metadata editor binds its field pickers to the + * object the type's FORM declares, so a knowledge source's pickers offer the + * fields of its `source.object`. + * + * `field-multi` reads no `dependsOn`: it draws the one catalog the editor + * binds, and the editor found that object on a fixed list of draft paths + * (`interfaceConfig.source`, `data.object`, `object`, `objectName`). A + * knowledge source keeps its object at `source.object`, which was on no list, + * so its content and filter pickers offered nothing. The editor now also reads + * the path the form declares: the catalog row's `dependsOn` under the + * composites it sits in. + * + * Two layers: the derivation over every form the spec registers (the paths it + * answers agree with the fixed list where the list already answered), and the + * real `MetadataResourceEditPage` mounting a knowledge source, read off its + * catalog request and the field labels its picker draws. + */ + +import '@testing-library/jest-dom/vitest'; +// The source under test reaches these through dynamic imports: their first load is paid at collection. +import '@objectstack/formula'; +import '@objectstack/lint'; +import * as React from 'react'; +import { describe, it, expect, vi, afterEach } from 'vitest'; +import { render, screen, cleanup, waitFor } from '@testing-library/react'; +import { MemoryRouter } from 'react-router-dom'; +import { z } from 'zod'; +import { knowledgeSourceForm } from '@objectstack/spec/ai'; +import { getMetadataTypeSchema } from '@objectstack/spec/kernel'; +import { METADATA_FORM_REGISTRY } from '@objectstack/spec/system'; + +import { declaredBoundObjectPath, objectNameAt } from './formBoundObject'; + +const TASK = { + name: 'acme_task', + label: 'Task', + fields: { title: { type: 'text', label: 'Task title' }, notes: { type: 'textarea', label: 'Task notes' }, status: { type: 'text', label: 'Task status' } }, +}; + +const SOURCE = vi.hoisted(() => ({ + item: { + name: 'task_notes', + label: 'Task notes', + source: { kind: 'object', object: 'acme_task', content: ['title', 'notes'], metadataFields: ['status'] }, + } as Record, +})); + +/** The server's `/meta/types` row for `knowledge_source`: the served form and the served schema. */ +const ENTRY = { + type: 'knowledge_source', + name: 'knowledge_source', + label: 'Knowledge Source', + allowRuntimeCreate: true, + form: knowledgeSourceForm, + schema: z.toJSONSchema(getMetadataTypeSchema('knowledge_source')!, { unrepresentable: 'any' }), +}; + +const mockClient = { + list: vi.fn(async () => []), + listDrafts: vi.fn(async () => []), + layered: vi.fn(async () => ({ effective: SOURCE.item, code: SOURCE.item, editable: true })), + getDraft: vi.fn(async () => null), + get: vi.fn(async (type: string, name: string) => (type === 'object' && name === TASK.name ? TASK : null)), + references: vi.fn(async () => []), + saveDraft: vi.fn(async () => ({})), +}; + +vi.mock('./useMetadata', async (importOriginal) => { + const mod = await importOriginal(); + return { + ...mod, + useMetadataClient: () => mockClient, + useMetadataTypes: () => ({ entries: [ENTRY] }), + }; +}); + +vi.stubGlobal( + 'fetch', + vi.fn(async () => new Response('null', { status: 404, headers: { 'content-type': 'application/json' } })), +); + +import { MetadataResourceEditPage } from './ResourceEditPage'; +import './register-builtins'; +import { registerBuiltinDesigners } from './register-builtin-designers'; +registerBuiltinDesigners(); + +afterEach(() => { + cleanup(); + mockClient.get.mockClear(); +}); + +describe('the object a form\'s field pickers are bound to, as the form declares it (objectstack#37309)', () => { + it('a knowledge source declares `source.object`; the pack, the page and the view declare what the fixed list already read', () => { + expect(declaredBoundObjectPath(METADATA_FORM_REGISTRY.knowledge_source)).toBe('source.object'); + expect(declaredBoundObjectPath(METADATA_FORM_REGISTRY.ai_context)).toBe('object'); + expect(declaredBoundObjectPath(METADATA_FORM_REGISTRY.page)).toBe('interfaceConfig.source'); + expect(declaredBoundObjectPath(METADATA_FORM_REGISTRY.view)).toBe('data.object'); + }); + + it('a repeater\'s rows are not walked: their `dependsOn` names a key of each row', () => { + const form = { sections: [{ fields: [{ field: 'rows', type: 'repeater', fields: [{ field: 'f', widget: 'field-ref', dependsOn: 'object' }] }] }] }; + expect(declaredBoundObjectPath(form)).toBeUndefined(); + expect(declaredBoundObjectPath(undefined)).toBeUndefined(); + }); + + it('reads only a non-empty string at the path', () => { + expect(objectNameAt({ source: { object: 'acme_task' } }, 'source.object')).toBe('acme_task'); + expect(objectNameAt({ source: { object: '' } }, 'source.object')).toBeUndefined(); + expect(objectNameAt({ source: 'acme_task' }, 'source.object')).toBeUndefined(); + expect(objectNameAt({ source: { object: 'acme_task' } }, undefined)).toBeUndefined(); + }); +}); + +describe('MetadataResourceEditPage — a knowledge source\'s field pickers offer its object\'s fields (objectstack#37309)', () => { + it('reads the catalog of `source.object`, and the content picker draws that object\'s field labels', async () => { + render( + + + , + ); + await waitFor(() => expect(mockClient.get).toHaveBeenCalledWith('object', 'acme_task'), { timeout: 8000 }); + // The labels are the catalog's, so they show only once the catalog is bound to the right object. + expect(await screen.findByText('Task title', {}, { timeout: 8000 })).toBeInTheDocument(); + expect(screen.getByText('Task status')).toBeInTheDocument(); + }); + + it('CONTROL: a source with no object yet reads no catalog', async () => { + const before = SOURCE.item; + SOURCE.item = { name: 'task_notes', label: 'Task notes', source: { kind: 'object', content: ['title'] } }; + try { + render( + + + , + ); + expect((await screen.findAllByText('title', {}, { timeout: 8000 })).length).toBeGreaterThan(0); + expect(mockClient.get.mock.calls.filter(([type]) => type === 'object')).toEqual([]); + } finally { + SOURCE.item = before; + } + }); +}); diff --git a/ui/packages/app-shell/src/views/metadata-admin/ResourceEditPage.tsx b/ui/packages/app-shell/src/views/metadata-admin/ResourceEditPage.tsx index d3cfb801c2e..189514d7b2f 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/ResourceEditPage.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/ResourceEditPage.tsx @@ -183,6 +183,7 @@ import { useNavigationWrites } from '../../hooks/useNavigationSync.js'; import { RefusalMessage } from '../../components/RefusalMessage.js'; import { authoredBuffer, authoredPublished, editsAuthoredLayers, type AuthoredLayers } from './authoredObjectBuffer.js'; import { clearPublishChecksShown, markPublishChecksShown } from '../../preview/publishChecksShown.js'; +import { declaredBoundObjectPath, objectNameAt } from './formBoundObject.js'; /** What an environment section is handed: the item's name and its definition on screen. */ interface EnvironmentSectionProps { @@ -1332,11 +1333,15 @@ function MetadataResourceEditPageImpl({ // widgets (e.g. the interface-page filter-mode selector). For a page the // source is `interfaceConfig.source` (interface mode) or the bound // `object`; other types fall back to their own `object`/`objectName`. + // objectstack#37309 — and last, the path the type's form declares on its + // field-picker rows (`dependsOn`, under the composites they sit in), so a + // knowledge source's pickers offer the fields of its `source.object`. const sourceObjectName: string | undefined = ((draft as any)?.interfaceConfig?.source as string | undefined) || ((draft as any)?.data?.object as string | undefined) || ((draft as any)?.object as string | undefined) || - ((draft as any)?.objectName as string | undefined); + ((draft as any)?.objectName as string | undefined) || + objectNameAt(draft, declaredBoundObjectPath(entry?.form)); // The field catalog and the action catalog come from ONE `client.get('object', // …)` call, so they succeed together and fail together — one `LoadState` for // the pair, not two that could disagree (objectui#5170). diff --git a/ui/packages/app-shell/src/views/metadata-admin/formBoundObject.ts b/ui/packages/app-shell/src/views/metadata-admin/formBoundObject.ts new file mode 100644 index 00000000000..ceddae19c1a --- /dev/null +++ b/ui/packages/app-shell/src/views/metadata-admin/formBoundObject.ts @@ -0,0 +1,76 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * The object a metadata form's field pickers offer the fields of, read off the + * form's own declaration (objectstack#37309). + * + * `field-ref`, `field-multi`, `filter-builder` and `action-multi` draw the + * BOUND object's catalog (`WidgetContext.objectFields` / `objectActions`); none + * of them reads its row's `dependsOn`. The editor binds the catalog to one + * object for the whole form, and it found that object on a fixed list of draft + * paths (`interfaceConfig.source`, `data.object`, `object`, `objectName`). A + * form whose object lives anywhere else — a knowledge source's + * `source.object` — had pickers that offered nothing, whatever its rows' + * `dependsOn` said. + * + * This reads the path the form declares instead: the first catalog row's + * `dependsOn`, prefixed by the composites it sits in, so a row inside the + * `source` composite that names its sibling `object` binds `source.object` + * (the `page.metadata-form.ts` spelling: `columns` inside `interfaceConfig` + * names `source`). A dotted `dependsOn` at the top level (`data.object`, the + * view form's) is a path from the root as written. A repeater's or a record's + * rows are not walked: their `dependsOn` names a key of each ROW, not one + * object for the form. + */ + +/** The widgets that draw the form's one bound object's catalog. */ +const BOUND_CATALOG_WIDGETS: ReadonlySet = new Set(['field-ref', 'field-multi', 'filter-builder', 'action-multi']); + +interface FormRowLike { + field?: unknown; + widget?: unknown; + type?: unknown; + dependsOn?: unknown; + fields?: unknown; +} + +function rowsOf(value: unknown): FormRowLike[] { + return Array.isArray(value) + ? value.filter((r): r is FormRowLike => !!r && typeof r === 'object') + : []; +} + +function walk(rows: FormRowLike[], prefix: string): string | undefined { + for (const row of rows) { + const dep = Array.isArray(row.dependsOn) ? row.dependsOn[0] : row.dependsOn; + if (typeof row.widget === 'string' && BOUND_CATALOG_WIDGETS.has(row.widget) && typeof dep === 'string' && dep) { + return `${prefix}${dep}`; + } + if (row.type === 'composite' && typeof row.field === 'string') { + const nested = walk(rowsOf(row.fields), `${prefix}${row.field}.`); + if (nested) return nested; + } + } + return undefined; +} + +/** The draft path of the object the form's field pickers are bound to, as the form declares it; `undefined` when no catalog row names one. */ +export function declaredBoundObjectPath(form: unknown): string | undefined { + const sections = (form as { sections?: unknown } | null | undefined)?.sections; + for (const section of rowsOf(sections)) { + const found = walk(rowsOf(section.fields), ''); + if (found) return found; + } + return undefined; +} + +/** The non-empty string at a dotted path of the draft, else `undefined`. */ +export function objectNameAt(draft: unknown, path: string | undefined): string | undefined { + if (!path) return undefined; + let node: unknown = draft; + for (const key of path.split('.')) { + if (!node || typeof node !== 'object' || Array.isArray(node)) return undefined; + node = (node as Record)[key]; + } + return typeof node === 'string' && node ? node : undefined; +} From 86542a5c0a018e36279ef3c3215e3129fc2c596e Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 28 Nov 2026 09:44:42 +0000 Subject: [PATCH 4/9] feat(spec,platform-objects): knowledge source form wording matches the cost docs; its strings in every Setup bundle Labels for aiExposed and adapter, the docs' cost wording beside content and the memory-store note beside adapter; the metadataForms bundles regenerated through os i18n extract, zh-CN, ja-JP and es-ES translated. Co-authored-by: Claude Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP --- .../37309-knowledge-source-studio-form.md | 20 ++++ .../ar.metadata-forms.generated.ts | 94 ++++++++++++++++++- .../ar.source-hashes.generated.ts | 44 +++++++++ .../de.metadata-forms.generated.ts | 94 ++++++++++++++++++- .../de.source-hashes.generated.ts | 44 +++++++++ .../en.metadata-forms.generated.ts | 94 ++++++++++++++++++- .../es-ES.metadata-forms.generated.ts | 94 ++++++++++++++++++- .../fr.metadata-forms.generated.ts | 94 ++++++++++++++++++- .../fr.source-hashes.generated.ts | 44 +++++++++ .../ja-JP.metadata-forms.generated.ts | 94 ++++++++++++++++++- .../ko.metadata-forms.generated.ts | 94 ++++++++++++++++++- .../ko.source-hashes.generated.ts | 44 +++++++++ .../pt-BR.metadata-forms.generated.ts | 94 ++++++++++++++++++- .../pt-BR.source-hashes.generated.ts | 44 +++++++++ .../ru.metadata-forms.generated.ts | 94 ++++++++++++++++++- .../ru.source-hashes.generated.ts | 44 +++++++++ .../zh-CN.metadata-forms.generated.ts | 94 ++++++++++++++++++- .../zh-Hant.metadata-forms.generated.ts | 94 ++++++++++++++++++- .../zh-Hant.source-hashes.generated.ts | 44 +++++++++ .../ai/knowledge-source.metadata-form.test.ts | 3 + .../src/ai/knowledge-source.metadata-form.ts | 6 +- 21 files changed, 1357 insertions(+), 14 deletions(-) create mode 100644 .changeset/37309-knowledge-source-studio-form.md diff --git a/.changeset/37309-knowledge-source-studio-form.md b/.changeset/37309-knowledge-source-studio-form.md new file mode 100644 index 00000000000..271abed46ce --- /dev/null +++ b/.changeset/37309-knowledge-source-studio-form.md @@ -0,0 +1,20 @@ +--- +'@objectstack/spec': patch +'@objectstack/platform-objects': patch +'@object-ui/app-shell': patch +--- + +feat(studio): create and edit a knowledge source (`knowledge_source`) in Studio — a form for the type, with field pickers scoped to the source's own object + +Clause-②: yes (widening) — one new public export, `knowledgeSourceForm` from `@objectstack/spec/ai`, and `/meta/types` now serves a form for `knowledge_source`; no key is added to what a source may hold +Metadata-protocol: none + +ADR-0161 K4, clause 2 (runtime authoring). A knowledge source can now be created and edited in Studio like a skill or a context pack: Studio's metadata editor lays it out with the new `knowledgeSourceForm` (`@objectstack/spec/ai`, registered in `METADATA_FORM_REGISTRY` as `knowledge_source`), and a Save goes through the metadata API, where the two save-time guards (the `manage_knowledge_sources` capability, and source admission as the author) refuse what they refuse today. The knowledge service picks the published source up with no restart, and `search_knowledge` answers from it. + +- **Basics.** `name`, `label`, `description`, `aiExposed`, and `adapter` as optional free text: blank means the deployment's store (pgvector on PostgreSQL, turso otherwise, else the only store mounted). +- **Records.** The object is picked from the object catalog; `source.content` (in order) and `source.metadataFields` are field pickers over that object's fields. `source.where` is the JSON editor and takes an ObjectQL filter, for example `{"status": {"$ne": "done"}}`. `source.split` takes the strategy (`whole`, `recursive`, `markdown`), `maxChars` and `minChars`. +- **Egress and cost.** Beside `content` the form says that a build costs money: the first build sends the text of every listed field of every matching record to your embedding provider, which bills for it, and keeps it in an index; a rebuild after a change of embedding model or split sends all of it again. Beside `adapter` it says that the `memory` store re-embeds the whole source on every boot. Content fields are named one by one: there is no wildcard. +- **Refresh.** `refresh.onRecordChange`. +- No control is offered for a key the type does not carry (`embedding`, `vectorStore`, `adapterConfig`, `refresh.cron`, a `'*'` member). +- **Field pickers follow the object the form declares.** Studio's metadata editor bound its field pickers to an object found at a fixed set of item paths (`interfaceConfig.source`, `data.object`, `object`, `objectName`); it now also reads the path the type's form declares on its picker rows (`dependsOn`, under the composites the row sits in), which is how a knowledge source's pickers offer the fields of `source.object`. Types the fixed set already served are bound as before. +- **Translations.** The form's section and help strings are in the Setup bundles (`@objectstack/platform-objects`), translated for zh-CN, ja-JP and es-ES; the other locales carry the English text until they are translated, as for every metadata form. diff --git a/packages/platform-objects/src/apps/translations/ar.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/ar.metadata-forms.generated.ts index ccbc22fcc41..4c50a204acd 100644 --- a/packages/platform-objects/src/apps/translations/ar.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/ar.metadata-forms.generated.ts @@ -3490,6 +3490,98 @@ export const arMetadataForms: NonNullable = { } }, knowledge_source: { - label: "مصدر معرفة" + label: "مصدر معرفة", + sections: { + basics: { + label: "Basics", + description: "The source's identity, whether agents may search it, and the store that holds its index." + }, + records: { + label: "Records", + description: "Which records of which object are indexed, and which of their fields. Each field picker offers the fields of the object chosen here." + }, + refresh: { + label: "Refresh", + description: "How the index follows the records." + } + }, + fields: { + name: { + label: "Name", + helpText: "Unique identifier (snake_case). search_knowledge lists the source by it, and its sourceIds argument names the source by it." + }, + label: { + label: "Label", + helpText: "Display name, shown in the sources list of a search_knowledge answer." + }, + description: { + label: "Description", + helpText: "What the source holds, shown beside its name in the sources list of a search_knowledge answer." + }, + aiExposed: { + label: "Searchable by AI agents", + helpText: "Whether search_knowledge may search this source for AI agents. On by default." + }, + adapter: { + label: "Store", + helpText: "The store that holds the index, by its adapter id (pgvector, turso, memory). Leave it blank for the deployment's store: pgvector on PostgreSQL, turso otherwise, else the only store mounted. A store this deployment does not mount is refused at save. The memory store keeps nothing across a restart, so every boot builds its index again and sends the whole source to the embedding provider." + }, + source: { + label: "Source", + helpText: "What the source indexes: the records of one object." + }, + "source.kind": { + label: "Kind", + helpText: "What the source indexes. A source indexes the records of one object.", + options: { + object: "Records of an object" + } + }, + "source.object": { + label: "Object", + helpText: "The object whose records are indexed. Each matching record becomes one document." + }, + "source.content": { + label: "Content fields", + helpText: "The fields whose text is indexed, in order. Each field is named: there is no wildcard. Embedding is egress, and a build costs money: the first build reads every record the filter matches and sends the text of each listed field to your embedding provider, which bills for it, and that text is kept in an index outside the record store. A rebuild after you change the embedding model or the split sends all of it again. A field added to the object later is not indexed until you add it here. Credential and internal fields are never indexed, even when listed." + }, + "source.metadataFields": { + label: "Filter fields", + helpText: "Fields kept beside each passage, so a search can filter on them (for example a status or an owner). Each one must be a field you may query." + }, + "source.where": { + label: "Records to index", + helpText: "An ObjectQL filter on the object, for example {\"status\": {\"$ne\": \"done\"}}. Only the records it matches are indexed. Blank: every record." + }, + "source.split": { + label: "Passages", + helpText: "How each document is cut into passages. Blank: recursive, with the settings page's chunk size (800 characters unless changed)." + }, + "source.split.strategy": { + label: "Strategy", + helpText: "Whole: one passage per document. Recursive: cut at blank lines, then line breaks, then sentence ends. Markdown: one passage per heading, carrying its heading path.", + options: { + whole: "Whole document", + recursive: "Recursive", + markdown: "Markdown sections" + } + }, + "source.split.maxChars": { + label: "Longest passage", + helpText: "In characters. Wins over the settings page's chunk size; the embedding model's input limit can lower it. Not read by Whole document." + }, + "source.split.minChars": { + label: "Shortest passage", + helpText: "Adjacent pieces shorter than this are merged, up to this length (default 200). Recursive and Markdown only." + }, + refresh: { + label: "Refresh", + helpText: "How the index is kept in step with the records." + }, + "refresh.onRecordChange": { + label: "Sync on record changes", + helpText: "Keep the index in step as records are created, changed and deleted (on by default). Off: an external indexer keeps the index, and the platform neither syncs nor builds it." + } + } } }; diff --git a/packages/platform-objects/src/apps/translations/ar.source-hashes.generated.ts b/packages/platform-objects/src/apps/translations/ar.source-hashes.generated.ts index 425cd5e3b85..43a261d06e8 100644 --- a/packages/platform-objects/src/apps/translations/ar.source-hashes.generated.ts +++ b/packages/platform-objects/src/apps/translations/ar.source-hashes.generated.ts @@ -50,6 +50,50 @@ export const arGeneratedSourceHashes: Readonly> = { "metadataForms.email_template.fields.variables.helpText": "27197774c2cda633", "metadataForms.field.fields.inlineEdit.helpText": "1ce60e4c6d5fc0e1", "metadataForms.field.fields.inlineEdit.label": "f29ea014320f588e", + "metadataForms.knowledge_source.fields.adapter.helpText": "9529330956105d79", + "metadataForms.knowledge_source.fields.adapter.label": "da213009390baa11", + "metadataForms.knowledge_source.fields.aiExposed.helpText": "308cc1b601e6601c", + "metadataForms.knowledge_source.fields.aiExposed.label": "61da7af3c7a42d23", + "metadataForms.knowledge_source.fields.description.helpText": "6117bd9062dbb3d3", + "metadataForms.knowledge_source.fields.description.label": "779a4342c8eb6707", + "metadataForms.knowledge_source.fields.label.helpText": "0108489eabde9658", + "metadataForms.knowledge_source.fields.label.label": "c680364257b11569", + "metadataForms.knowledge_source.fields.name.helpText": "e825b21f14b83cfa", + "metadataForms.knowledge_source.fields.name.label": "5274417ff1ccaf01", + "metadataForms.knowledge_source.fields.refresh.helpText": "3dc3007498cbdddc", + "metadataForms.knowledge_source.fields.refresh.label": "1b63ae2e002930a6", + "metadataForms.knowledge_source.fields.refresh.onRecordChange.helpText": "ef6f113e883733b7", + "metadataForms.knowledge_source.fields.refresh.onRecordChange.label": "53a3285b7bcfb91f", + "metadataForms.knowledge_source.fields.source.content.helpText": "a58391e05d69ffe7", + "metadataForms.knowledge_source.fields.source.content.label": "fb33868fefbf74b3", + "metadataForms.knowledge_source.fields.source.helpText": "0b648dbc7af2f85c", + "metadataForms.knowledge_source.fields.source.kind.helpText": "98e903260393800d", + "metadataForms.knowledge_source.fields.source.kind.label": "3acd2ee4b0e7f2cf", + "metadataForms.knowledge_source.fields.source.kind.options.object": "e094ff2c1c3a195a", + "metadataForms.knowledge_source.fields.source.label": "8fe786e8e29c8cec", + "metadataForms.knowledge_source.fields.source.metadataFields.helpText": "8f41aea242f1a77e", + "metadataForms.knowledge_source.fields.source.metadataFields.label": "de294fc128e44483", + "metadataForms.knowledge_source.fields.source.object.helpText": "37a6686deb6e5201", + "metadataForms.knowledge_source.fields.source.object.label": "d0c49032d95ebb36", + "metadataForms.knowledge_source.fields.source.split.helpText": "a51a59132d112116", + "metadataForms.knowledge_source.fields.source.split.label": "3a77c4c884b1d4a4", + "metadataForms.knowledge_source.fields.source.split.maxChars.helpText": "d7254716c7258828", + "metadataForms.knowledge_source.fields.source.split.maxChars.label": "780596d178bbdef6", + "metadataForms.knowledge_source.fields.source.split.minChars.helpText": "c570045548551b8b", + "metadataForms.knowledge_source.fields.source.split.minChars.label": "f8a2b05e9c16afda", + "metadataForms.knowledge_source.fields.source.split.strategy.helpText": "f3ff47d9386b7956", + "metadataForms.knowledge_source.fields.source.split.strategy.label": "785c1dd353da380b", + "metadataForms.knowledge_source.fields.source.split.strategy.options.markdown": "ed9a22aca881fe59", + "metadataForms.knowledge_source.fields.source.split.strategy.options.recursive": "c38548b1e854c675", + "metadataForms.knowledge_source.fields.source.split.strategy.options.whole": "3eae5cd7567cf40a", + "metadataForms.knowledge_source.fields.source.where.helpText": "45098881521ffbd5", + "metadataForms.knowledge_source.fields.source.where.label": "cae99e947da34116", + "metadataForms.knowledge_source.sections.basics.description": "c232f620677bab66", + "metadataForms.knowledge_source.sections.basics.label": "55562f900da68c5d", + "metadataForms.knowledge_source.sections.records.description": "929da5e97dc7eda2", + "metadataForms.knowledge_source.sections.records.label": "9e5814dbd123f1c1", + "metadataForms.knowledge_source.sections.refresh.description": "79311cb3f9e55b89", + "metadataForms.knowledge_source.sections.refresh.label": "1b63ae2e002930a6", "metadataForms.permission.fields.fields.helpText": "887a0bae04a950e2", "metadataForms.permission.fields.objects.helpText": "e2512cfb3b501aae", "metadataForms.permission.fields.tabPermissions.helpText": "8942e2aebe59897c", diff --git a/packages/platform-objects/src/apps/translations/de.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/de.metadata-forms.generated.ts index 873ac240c5f..5cc2192e562 100644 --- a/packages/platform-objects/src/apps/translations/de.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/de.metadata-forms.generated.ts @@ -3490,6 +3490,98 @@ export const deMetadataForms: NonNullable = { } }, knowledge_source: { - label: "Wissensquelle" + label: "Wissensquelle", + sections: { + basics: { + label: "Basics", + description: "The source's identity, whether agents may search it, and the store that holds its index." + }, + records: { + label: "Records", + description: "Which records of which object are indexed, and which of their fields. Each field picker offers the fields of the object chosen here." + }, + refresh: { + label: "Refresh", + description: "How the index follows the records." + } + }, + fields: { + name: { + label: "Name", + helpText: "Unique identifier (snake_case). search_knowledge lists the source by it, and its sourceIds argument names the source by it." + }, + label: { + label: "Label", + helpText: "Display name, shown in the sources list of a search_knowledge answer." + }, + description: { + label: "Description", + helpText: "What the source holds, shown beside its name in the sources list of a search_knowledge answer." + }, + aiExposed: { + label: "Searchable by AI agents", + helpText: "Whether search_knowledge may search this source for AI agents. On by default." + }, + adapter: { + label: "Store", + helpText: "The store that holds the index, by its adapter id (pgvector, turso, memory). Leave it blank for the deployment's store: pgvector on PostgreSQL, turso otherwise, else the only store mounted. A store this deployment does not mount is refused at save. The memory store keeps nothing across a restart, so every boot builds its index again and sends the whole source to the embedding provider." + }, + source: { + label: "Source", + helpText: "What the source indexes: the records of one object." + }, + "source.kind": { + label: "Kind", + helpText: "What the source indexes. A source indexes the records of one object.", + options: { + object: "Records of an object" + } + }, + "source.object": { + label: "Object", + helpText: "The object whose records are indexed. Each matching record becomes one document." + }, + "source.content": { + label: "Content fields", + helpText: "The fields whose text is indexed, in order. Each field is named: there is no wildcard. Embedding is egress, and a build costs money: the first build reads every record the filter matches and sends the text of each listed field to your embedding provider, which bills for it, and that text is kept in an index outside the record store. A rebuild after you change the embedding model or the split sends all of it again. A field added to the object later is not indexed until you add it here. Credential and internal fields are never indexed, even when listed." + }, + "source.metadataFields": { + label: "Filter fields", + helpText: "Fields kept beside each passage, so a search can filter on them (for example a status or an owner). Each one must be a field you may query." + }, + "source.where": { + label: "Records to index", + helpText: "An ObjectQL filter on the object, for example {\"status\": {\"$ne\": \"done\"}}. Only the records it matches are indexed. Blank: every record." + }, + "source.split": { + label: "Passages", + helpText: "How each document is cut into passages. Blank: recursive, with the settings page's chunk size (800 characters unless changed)." + }, + "source.split.strategy": { + label: "Strategy", + helpText: "Whole: one passage per document. Recursive: cut at blank lines, then line breaks, then sentence ends. Markdown: one passage per heading, carrying its heading path.", + options: { + whole: "Whole document", + recursive: "Recursive", + markdown: "Markdown sections" + } + }, + "source.split.maxChars": { + label: "Longest passage", + helpText: "In characters. Wins over the settings page's chunk size; the embedding model's input limit can lower it. Not read by Whole document." + }, + "source.split.minChars": { + label: "Shortest passage", + helpText: "Adjacent pieces shorter than this are merged, up to this length (default 200). Recursive and Markdown only." + }, + refresh: { + label: "Refresh", + helpText: "How the index is kept in step with the records." + }, + "refresh.onRecordChange": { + label: "Sync on record changes", + helpText: "Keep the index in step as records are created, changed and deleted (on by default). Off: an external indexer keeps the index, and the platform neither syncs nor builds it." + } + } } }; diff --git a/packages/platform-objects/src/apps/translations/de.source-hashes.generated.ts b/packages/platform-objects/src/apps/translations/de.source-hashes.generated.ts index 0a35ec33d1c..632c1fbd492 100644 --- a/packages/platform-objects/src/apps/translations/de.source-hashes.generated.ts +++ b/packages/platform-objects/src/apps/translations/de.source-hashes.generated.ts @@ -85,6 +85,50 @@ export const deGeneratedSourceHashes: Readonly> = { "metadataForms.hook.fields.refusals.status.label": "64a420165247654b", "metadataForms.hook.label": "248bb1cdc692252d", "metadataForms.job.fields.name.label": "5274417ff1ccaf01", + "metadataForms.knowledge_source.fields.adapter.helpText": "9529330956105d79", + "metadataForms.knowledge_source.fields.adapter.label": "da213009390baa11", + "metadataForms.knowledge_source.fields.aiExposed.helpText": "308cc1b601e6601c", + "metadataForms.knowledge_source.fields.aiExposed.label": "61da7af3c7a42d23", + "metadataForms.knowledge_source.fields.description.helpText": "6117bd9062dbb3d3", + "metadataForms.knowledge_source.fields.description.label": "779a4342c8eb6707", + "metadataForms.knowledge_source.fields.label.helpText": "0108489eabde9658", + "metadataForms.knowledge_source.fields.label.label": "c680364257b11569", + "metadataForms.knowledge_source.fields.name.helpText": "e825b21f14b83cfa", + "metadataForms.knowledge_source.fields.name.label": "5274417ff1ccaf01", + "metadataForms.knowledge_source.fields.refresh.helpText": "3dc3007498cbdddc", + "metadataForms.knowledge_source.fields.refresh.label": "1b63ae2e002930a6", + "metadataForms.knowledge_source.fields.refresh.onRecordChange.helpText": "ef6f113e883733b7", + "metadataForms.knowledge_source.fields.refresh.onRecordChange.label": "53a3285b7bcfb91f", + "metadataForms.knowledge_source.fields.source.content.helpText": "a58391e05d69ffe7", + "metadataForms.knowledge_source.fields.source.content.label": "fb33868fefbf74b3", + "metadataForms.knowledge_source.fields.source.helpText": "0b648dbc7af2f85c", + "metadataForms.knowledge_source.fields.source.kind.helpText": "98e903260393800d", + "metadataForms.knowledge_source.fields.source.kind.label": "3acd2ee4b0e7f2cf", + "metadataForms.knowledge_source.fields.source.kind.options.object": "e094ff2c1c3a195a", + "metadataForms.knowledge_source.fields.source.label": "8fe786e8e29c8cec", + "metadataForms.knowledge_source.fields.source.metadataFields.helpText": "8f41aea242f1a77e", + "metadataForms.knowledge_source.fields.source.metadataFields.label": "de294fc128e44483", + "metadataForms.knowledge_source.fields.source.object.helpText": "37a6686deb6e5201", + "metadataForms.knowledge_source.fields.source.object.label": "d0c49032d95ebb36", + "metadataForms.knowledge_source.fields.source.split.helpText": "a51a59132d112116", + "metadataForms.knowledge_source.fields.source.split.label": "3a77c4c884b1d4a4", + "metadataForms.knowledge_source.fields.source.split.maxChars.helpText": "d7254716c7258828", + "metadataForms.knowledge_source.fields.source.split.maxChars.label": "780596d178bbdef6", + "metadataForms.knowledge_source.fields.source.split.minChars.helpText": "c570045548551b8b", + "metadataForms.knowledge_source.fields.source.split.minChars.label": "f8a2b05e9c16afda", + "metadataForms.knowledge_source.fields.source.split.strategy.helpText": "f3ff47d9386b7956", + "metadataForms.knowledge_source.fields.source.split.strategy.label": "785c1dd353da380b", + "metadataForms.knowledge_source.fields.source.split.strategy.options.markdown": "ed9a22aca881fe59", + "metadataForms.knowledge_source.fields.source.split.strategy.options.recursive": "c38548b1e854c675", + "metadataForms.knowledge_source.fields.source.split.strategy.options.whole": "3eae5cd7567cf40a", + "metadataForms.knowledge_source.fields.source.where.helpText": "45098881521ffbd5", + "metadataForms.knowledge_source.fields.source.where.label": "cae99e947da34116", + "metadataForms.knowledge_source.sections.basics.description": "c232f620677bab66", + "metadataForms.knowledge_source.sections.basics.label": "55562f900da68c5d", + "metadataForms.knowledge_source.sections.records.description": "929da5e97dc7eda2", + "metadataForms.knowledge_source.sections.records.label": "9e5814dbd123f1c1", + "metadataForms.knowledge_source.sections.refresh.description": "79311cb3f9e55b89", + "metadataForms.knowledge_source.sections.refresh.label": "1b63ae2e002930a6", "metadataForms.mapping.fields.name.label": "5274417ff1ccaf01", "metadataForms.object.fields.enable.feeds.label": "669c64671f632139", "metadataForms.object.fields.lifecycle.storage.shards.label": "739988affb36b2e0", diff --git a/packages/platform-objects/src/apps/translations/en.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/en.metadata-forms.generated.ts index 33ef019670b..001ca45ac4b 100644 --- a/packages/platform-objects/src/apps/translations/en.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/en.metadata-forms.generated.ts @@ -3490,6 +3490,98 @@ export const enMetadataForms: NonNullable = { } }, knowledge_source: { - label: "Knowledge Source" + label: "Knowledge Source", + sections: { + basics: { + label: "Basics", + description: "The source's identity, whether agents may search it, and the store that holds its index." + }, + records: { + label: "Records", + description: "Which records of which object are indexed, and which of their fields. Each field picker offers the fields of the object chosen here." + }, + refresh: { + label: "Refresh", + description: "How the index follows the records." + } + }, + fields: { + name: { + label: "Name", + helpText: "Unique identifier (snake_case). search_knowledge lists the source by it, and its sourceIds argument names the source by it." + }, + label: { + label: "Label", + helpText: "Display name, shown in the sources list of a search_knowledge answer." + }, + description: { + label: "Description", + helpText: "What the source holds, shown beside its name in the sources list of a search_knowledge answer." + }, + aiExposed: { + label: "Searchable by AI agents", + helpText: "Whether search_knowledge may search this source for AI agents. On by default." + }, + adapter: { + label: "Store", + helpText: "The store that holds the index, by its adapter id (pgvector, turso, memory). Leave it blank for the deployment's store: pgvector on PostgreSQL, turso otherwise, else the only store mounted. A store this deployment does not mount is refused at save. The memory store keeps nothing across a restart, so every boot builds its index again and sends the whole source to the embedding provider." + }, + source: { + label: "Source", + helpText: "What the source indexes: the records of one object." + }, + "source.kind": { + label: "Kind", + helpText: "What the source indexes. A source indexes the records of one object.", + options: { + object: "Records of an object" + } + }, + "source.object": { + label: "Object", + helpText: "The object whose records are indexed. Each matching record becomes one document." + }, + "source.content": { + label: "Content fields", + helpText: "The fields whose text is indexed, in order. Each field is named: there is no wildcard. Embedding is egress, and a build costs money: the first build reads every record the filter matches and sends the text of each listed field to your embedding provider, which bills for it, and that text is kept in an index outside the record store. A rebuild after you change the embedding model or the split sends all of it again. A field added to the object later is not indexed until you add it here. Credential and internal fields are never indexed, even when listed." + }, + "source.metadataFields": { + label: "Filter fields", + helpText: "Fields kept beside each passage, so a search can filter on them (for example a status or an owner). Each one must be a field you may query." + }, + "source.where": { + label: "Records to index", + helpText: "An ObjectQL filter on the object, for example {\"status\": {\"$ne\": \"done\"}}. Only the records it matches are indexed. Blank: every record." + }, + "source.split": { + label: "Passages", + helpText: "How each document is cut into passages. Blank: recursive, with the settings page's chunk size (800 characters unless changed)." + }, + "source.split.strategy": { + label: "Strategy", + helpText: "Whole: one passage per document. Recursive: cut at blank lines, then line breaks, then sentence ends. Markdown: one passage per heading, carrying its heading path.", + options: { + whole: "Whole document", + recursive: "Recursive", + markdown: "Markdown sections" + } + }, + "source.split.maxChars": { + label: "Longest passage", + helpText: "In characters. Wins over the settings page's chunk size; the embedding model's input limit can lower it. Not read by Whole document." + }, + "source.split.minChars": { + label: "Shortest passage", + helpText: "Adjacent pieces shorter than this are merged, up to this length (default 200). Recursive and Markdown only." + }, + refresh: { + label: "Refresh", + helpText: "How the index is kept in step with the records." + }, + "refresh.onRecordChange": { + label: "Sync on record changes", + helpText: "Keep the index in step as records are created, changed and deleted (on by default). Off: an external indexer keeps the index, and the platform neither syncs nor builds it." + } + } } }; diff --git a/packages/platform-objects/src/apps/translations/es-ES.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/es-ES.metadata-forms.generated.ts index 4313e9643bc..1fcb33aeda4 100644 --- a/packages/platform-objects/src/apps/translations/es-ES.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/es-ES.metadata-forms.generated.ts @@ -3490,6 +3490,98 @@ export const esESMetadataForms: NonNullable = } }, knowledge_source: { - label: "Fuente de conocimiento" + label: "Fuente de conocimiento", + sections: { + basics: { + label: "Datos básicos", + description: "La identidad de la fuente, si los agentes pueden buscar en ella y el almacén que guarda su índice." + }, + records: { + label: "Registros", + description: "Qué registros de qué objeto se indexan, y cuáles de sus campos. Cada selector de campos ofrece los campos del objeto elegido aquí." + }, + refresh: { + label: "Actualización", + description: "Cómo sigue el índice a los registros." + } + }, + fields: { + name: { + label: "Nombre", + helpText: "Identificador único (snake_case). search_knowledge lista la fuente por él, y su argumento sourceIds nombra la fuente por él." + }, + label: { + label: "Etiqueta", + helpText: "Nombre visible, que aparece en la lista de fuentes de una respuesta de search_knowledge." + }, + description: { + label: "Descripción", + helpText: "Lo que contiene la fuente, que aparece junto a su nombre en la lista de fuentes de una respuesta de search_knowledge." + }, + aiExposed: { + label: "Buscable por agentes de IA", + helpText: "Si search_knowledge puede buscar en esta fuente para los agentes de IA. Activado de forma predeterminada." + }, + adapter: { + label: "Almacén", + helpText: "El almacén que guarda el índice, por su id de adaptador (pgvector, turso, memory). Déjelo en blanco para usar el almacén de la implementación: pgvector en PostgreSQL, turso en otro caso y, si no, el único almacén montado. Un almacén que esta implementación no monta se rechaza al guardar. El almacén memory no conserva nada tras un reinicio, así que cada arranque vuelve a construir su índice y envía de nuevo toda la fuente al proveedor de embeddings." + }, + source: { + label: "Origen", + helpText: "Lo que indexa la fuente: los registros de un objeto." + }, + "source.kind": { + label: "Tipo", + helpText: "Lo que indexa la fuente. Una fuente indexa los registros de un objeto.", + options: { + object: "Registros de un objeto" + } + }, + "source.object": { + label: "Objeto", + helpText: "El objeto cuyos registros se indexan. Cada registro que coincide se convierte en un documento." + }, + "source.content": { + label: "Campos de contenido", + helpText: "Los campos cuyo texto se indexa, en orden. Cada campo se nombra: no hay comodín. Generar embeddings es una salida de datos, y una construcción cuesta dinero: la primera construcción lee cada registro que coincide con el filtro y envía el texto de cada campo indicado a su proveedor de embeddings, que lo factura, y ese texto se guarda en un índice fuera del almacén de registros. Una reconstrucción tras cambiar el modelo de embeddings o la división lo envía todo de nuevo. Un campo que se añada al objeto más adelante no se indexa hasta que lo añada aquí. Los campos de credenciales e internos nunca se indexan, aunque se indiquen." + }, + "source.metadataFields": { + label: "Campos de filtro", + helpText: "Campos que se guardan junto a cada pasaje, para que una búsqueda pueda filtrar por ellos (por ejemplo, un estado o un propietario). Cada uno debe ser un campo que usted pueda consultar." + }, + "source.where": { + label: "Registros que indexar", + helpText: "Un filtro ObjectQL sobre el objeto, por ejemplo {\"status\": {\"$ne\": \"done\"}}. Solo se indexan los registros que coinciden. En blanco: todos los registros." + }, + "source.split": { + label: "Pasajes", + helpText: "Cómo se divide cada documento en pasajes. En blanco: recursiva, con el tamaño de fragmento de la página de configuración (800 caracteres si no se ha cambiado)." + }, + "source.split.strategy": { + label: "Estrategia", + helpText: "Documento completo: un pasaje por documento. Recursiva: corta en las líneas en blanco, luego en los saltos de línea y luego en los finales de frase. Markdown: un pasaje por encabezado, con su ruta de encabezados.", + options: { + whole: "Documento completo", + recursive: "Recursiva", + markdown: "Secciones Markdown" + } + }, + "source.split.maxChars": { + label: "Pasaje más largo", + helpText: "En caracteres. Prevalece sobre el tamaño de fragmento de la página de configuración; el límite de entrada del modelo de embeddings puede reducirlo. Documento completo no lo lee." + }, + "source.split.minChars": { + label: "Pasaje más corto", + helpText: "Las piezas adyacentes más cortas que esto se fusionan, hasta esta longitud (200 de forma predeterminada). Solo Recursiva y Markdown." + }, + refresh: { + label: "Actualización", + helpText: "Cómo se mantiene el índice al día con los registros." + }, + "refresh.onRecordChange": { + label: "Sincronizar con los cambios de registros", + helpText: "Mantiene el índice al día a medida que se crean, cambian y eliminan registros (activado de forma predeterminada). Desactivado: un indexador externo mantiene el índice, y la plataforma ni lo sincroniza ni lo construye." + } + } } }; diff --git a/packages/platform-objects/src/apps/translations/fr.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/fr.metadata-forms.generated.ts index 83ec352622b..61ab260b806 100644 --- a/packages/platform-objects/src/apps/translations/fr.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/fr.metadata-forms.generated.ts @@ -3490,6 +3490,98 @@ export const frMetadataForms: NonNullable = { } }, knowledge_source: { - label: "Source de connaissances" + label: "Source de connaissances", + sections: { + basics: { + label: "Basics", + description: "The source's identity, whether agents may search it, and the store that holds its index." + }, + records: { + label: "Records", + description: "Which records of which object are indexed, and which of their fields. Each field picker offers the fields of the object chosen here." + }, + refresh: { + label: "Refresh", + description: "How the index follows the records." + } + }, + fields: { + name: { + label: "Name", + helpText: "Unique identifier (snake_case). search_knowledge lists the source by it, and its sourceIds argument names the source by it." + }, + label: { + label: "Label", + helpText: "Display name, shown in the sources list of a search_knowledge answer." + }, + description: { + label: "Description", + helpText: "What the source holds, shown beside its name in the sources list of a search_knowledge answer." + }, + aiExposed: { + label: "Searchable by AI agents", + helpText: "Whether search_knowledge may search this source for AI agents. On by default." + }, + adapter: { + label: "Store", + helpText: "The store that holds the index, by its adapter id (pgvector, turso, memory). Leave it blank for the deployment's store: pgvector on PostgreSQL, turso otherwise, else the only store mounted. A store this deployment does not mount is refused at save. The memory store keeps nothing across a restart, so every boot builds its index again and sends the whole source to the embedding provider." + }, + source: { + label: "Source", + helpText: "What the source indexes: the records of one object." + }, + "source.kind": { + label: "Kind", + helpText: "What the source indexes. A source indexes the records of one object.", + options: { + object: "Records of an object" + } + }, + "source.object": { + label: "Object", + helpText: "The object whose records are indexed. Each matching record becomes one document." + }, + "source.content": { + label: "Content fields", + helpText: "The fields whose text is indexed, in order. Each field is named: there is no wildcard. Embedding is egress, and a build costs money: the first build reads every record the filter matches and sends the text of each listed field to your embedding provider, which bills for it, and that text is kept in an index outside the record store. A rebuild after you change the embedding model or the split sends all of it again. A field added to the object later is not indexed until you add it here. Credential and internal fields are never indexed, even when listed." + }, + "source.metadataFields": { + label: "Filter fields", + helpText: "Fields kept beside each passage, so a search can filter on them (for example a status or an owner). Each one must be a field you may query." + }, + "source.where": { + label: "Records to index", + helpText: "An ObjectQL filter on the object, for example {\"status\": {\"$ne\": \"done\"}}. Only the records it matches are indexed. Blank: every record." + }, + "source.split": { + label: "Passages", + helpText: "How each document is cut into passages. Blank: recursive, with the settings page's chunk size (800 characters unless changed)." + }, + "source.split.strategy": { + label: "Strategy", + helpText: "Whole: one passage per document. Recursive: cut at blank lines, then line breaks, then sentence ends. Markdown: one passage per heading, carrying its heading path.", + options: { + whole: "Whole document", + recursive: "Recursive", + markdown: "Markdown sections" + } + }, + "source.split.maxChars": { + label: "Longest passage", + helpText: "In characters. Wins over the settings page's chunk size; the embedding model's input limit can lower it. Not read by Whole document." + }, + "source.split.minChars": { + label: "Shortest passage", + helpText: "Adjacent pieces shorter than this are merged, up to this length (default 200). Recursive and Markdown only." + }, + refresh: { + label: "Refresh", + helpText: "How the index is kept in step with the records." + }, + "refresh.onRecordChange": { + label: "Sync on record changes", + helpText: "Keep the index in step as records are created, changed and deleted (on by default). Off: an external indexer keeps the index, and the platform neither syncs nor builds it." + } + } } }; diff --git a/packages/platform-objects/src/apps/translations/fr.source-hashes.generated.ts b/packages/platform-objects/src/apps/translations/fr.source-hashes.generated.ts index 5edcd428bcb..09fccb491d9 100644 --- a/packages/platform-objects/src/apps/translations/fr.source-hashes.generated.ts +++ b/packages/platform-objects/src/apps/translations/fr.source-hashes.generated.ts @@ -106,6 +106,50 @@ export const frGeneratedSourceHashes: Readonly> = { "metadataForms.hook.fields.texts.message.label": "2af15199795c25b9", "metadataForms.hook.label": "248bb1cdc692252d", "metadataForms.job.fields.description.label": "779a4342c8eb6707", + "metadataForms.knowledge_source.fields.adapter.helpText": "9529330956105d79", + "metadataForms.knowledge_source.fields.adapter.label": "da213009390baa11", + "metadataForms.knowledge_source.fields.aiExposed.helpText": "308cc1b601e6601c", + "metadataForms.knowledge_source.fields.aiExposed.label": "61da7af3c7a42d23", + "metadataForms.knowledge_source.fields.description.helpText": "6117bd9062dbb3d3", + "metadataForms.knowledge_source.fields.description.label": "779a4342c8eb6707", + "metadataForms.knowledge_source.fields.label.helpText": "0108489eabde9658", + "metadataForms.knowledge_source.fields.label.label": "c680364257b11569", + "metadataForms.knowledge_source.fields.name.helpText": "e825b21f14b83cfa", + "metadataForms.knowledge_source.fields.name.label": "5274417ff1ccaf01", + "metadataForms.knowledge_source.fields.refresh.helpText": "3dc3007498cbdddc", + "metadataForms.knowledge_source.fields.refresh.label": "1b63ae2e002930a6", + "metadataForms.knowledge_source.fields.refresh.onRecordChange.helpText": "ef6f113e883733b7", + "metadataForms.knowledge_source.fields.refresh.onRecordChange.label": "53a3285b7bcfb91f", + "metadataForms.knowledge_source.fields.source.content.helpText": "a58391e05d69ffe7", + "metadataForms.knowledge_source.fields.source.content.label": "fb33868fefbf74b3", + "metadataForms.knowledge_source.fields.source.helpText": "0b648dbc7af2f85c", + "metadataForms.knowledge_source.fields.source.kind.helpText": "98e903260393800d", + "metadataForms.knowledge_source.fields.source.kind.label": "3acd2ee4b0e7f2cf", + "metadataForms.knowledge_source.fields.source.kind.options.object": "e094ff2c1c3a195a", + "metadataForms.knowledge_source.fields.source.label": "8fe786e8e29c8cec", + "metadataForms.knowledge_source.fields.source.metadataFields.helpText": "8f41aea242f1a77e", + "metadataForms.knowledge_source.fields.source.metadataFields.label": "de294fc128e44483", + "metadataForms.knowledge_source.fields.source.object.helpText": "37a6686deb6e5201", + "metadataForms.knowledge_source.fields.source.object.label": "d0c49032d95ebb36", + "metadataForms.knowledge_source.fields.source.split.helpText": "a51a59132d112116", + "metadataForms.knowledge_source.fields.source.split.label": "3a77c4c884b1d4a4", + "metadataForms.knowledge_source.fields.source.split.maxChars.helpText": "d7254716c7258828", + "metadataForms.knowledge_source.fields.source.split.maxChars.label": "780596d178bbdef6", + "metadataForms.knowledge_source.fields.source.split.minChars.helpText": "c570045548551b8b", + "metadataForms.knowledge_source.fields.source.split.minChars.label": "f8a2b05e9c16afda", + "metadataForms.knowledge_source.fields.source.split.strategy.helpText": "f3ff47d9386b7956", + "metadataForms.knowledge_source.fields.source.split.strategy.label": "785c1dd353da380b", + "metadataForms.knowledge_source.fields.source.split.strategy.options.markdown": "ed9a22aca881fe59", + "metadataForms.knowledge_source.fields.source.split.strategy.options.recursive": "c38548b1e854c675", + "metadataForms.knowledge_source.fields.source.split.strategy.options.whole": "3eae5cd7567cf40a", + "metadataForms.knowledge_source.fields.source.where.helpText": "45098881521ffbd5", + "metadataForms.knowledge_source.fields.source.where.label": "cae99e947da34116", + "metadataForms.knowledge_source.sections.basics.description": "c232f620677bab66", + "metadataForms.knowledge_source.sections.basics.label": "55562f900da68c5d", + "metadataForms.knowledge_source.sections.records.description": "929da5e97dc7eda2", + "metadataForms.knowledge_source.sections.records.label": "9e5814dbd123f1c1", + "metadataForms.knowledge_source.sections.refresh.description": "79311cb3f9e55b89", + "metadataForms.knowledge_source.sections.refresh.label": "1b63ae2e002930a6", "metadataForms.mapping.fields.mode.label": "74dde5013435abdc", "metadataForms.object.fields.description.label": "779a4342c8eb6707", "metadataForms.object.fields.fields.description.label": "779a4342c8eb6707", diff --git a/packages/platform-objects/src/apps/translations/ja-JP.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/ja-JP.metadata-forms.generated.ts index 708be7fbf21..00a8f61eb43 100644 --- a/packages/platform-objects/src/apps/translations/ja-JP.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/ja-JP.metadata-forms.generated.ts @@ -3490,6 +3490,98 @@ export const jaJPMetadataForms: NonNullable = } }, knowledge_source: { - label: "ナレッジソース" + label: "ナレッジソース", + sections: { + basics: { + label: "基本情報", + description: "ソースの識別情報、エージェントが検索できるかどうか、およびインデックスを保持するストア。" + }, + records: { + label: "レコード", + description: "どのオブジェクトのどのレコードを、どのフィールドとともにインデックス化するか。各フィールドピッカーには、ここで選択したオブジェクトのフィールドが表示されます。" + }, + refresh: { + label: "更新", + description: "インデックスがレコードにどう追随するか。" + } + }, + fields: { + name: { + label: "名前", + helpText: "一意の識別子(snake_case)。search_knowledge はこの名前でソースを一覧表示し、その sourceIds 引数もこの名前でソースを指定します。" + }, + label: { + label: "ラベル", + helpText: "表示名。search_knowledge の回答のソース一覧に表示されます。" + }, + description: { + label: "説明", + helpText: "ソースの内容。search_knowledge の回答のソース一覧で名前の横に表示されます。" + }, + aiExposed: { + label: "AI エージェントによる検索", + helpText: "search_knowledge が AI エージェントのためにこのソースを検索できるかどうか。既定ではオンです。" + }, + adapter: { + label: "ストア", + helpText: "インデックスを保持するストア。アダプター ID(pgvector、turso、memory)で指定します。空欄にするとデプロイのストアを使用します:PostgreSQL では pgvector、それ以外では turso、さらにそれ以外ではマウントされている唯一のストアです。このデプロイがマウントしていないストアは保存時に拒否されます。memory ストアは再起動をまたいで何も保持しないため、起動のたびにインデックスを再構築し、ソース全体を再び埋め込みプロバイダーに送信します。" + }, + source: { + label: "ソース", + helpText: "ソースがインデックス化するもの:1 つのオブジェクトのレコード。" + }, + "source.kind": { + label: "種類", + helpText: "ソースがインデックス化するもの。ソースは 1 つのオブジェクトのレコードをインデックス化します。", + options: { + object: "オブジェクトのレコード" + } + }, + "source.object": { + label: "オブジェクト", + helpText: "レコードがインデックス化されるオブジェクト。一致する各レコードが 1 つのドキュメントになります。" + }, + "source.content": { + label: "コンテンツフィールド", + helpText: "テキストがインデックス化されるフィールド(順序どおり)。各フィールドは名前で指定します:ワイルドカードはありません。埋め込みはデータの外部送信であり、構築には費用がかかります:初回の構築では、フィルターに一致するすべてのレコードを読み取り、列挙した各フィールドのテキストを埋め込みプロバイダーに送信し(プロバイダーが課金します)、そのテキストはレコードストアの外にあるインデックスに保持されます。埋め込みモデルや分割方法を変更した後の再構築では、すべてを再び送信します。後からオブジェクトに追加されたフィールドは、ここに追加するまでインデックス化されません。資格情報フィールドと内部フィールドは、列挙されていても決してインデックス化されません。" + }, + "source.metadataFields": { + label: "フィルターフィールド", + helpText: "各パッセージの横に保持されるフィールドで、検索でこれらによる絞り込みができます(例:ステータスや所有者)。それぞれ、あなたがクエリできるフィールドである必要があります。" + }, + "source.where": { + label: "インデックス化するレコード", + helpText: "オブジェクトに対する ObjectQL フィルター。例:{\"status\": {\"$ne\": \"done\"}}。一致するレコードだけがインデックス化されます。空欄:すべてのレコード。" + }, + "source.split": { + label: "パッセージ", + helpText: "各ドキュメントをパッセージに分割する方法。空欄:再帰分割で、設定ページのチャンクサイズ(変更されていなければ 800 文字)を使用します。" + }, + "source.split.strategy": { + label: "方式", + helpText: "ドキュメント全体:ドキュメントごとに 1 パッセージ。再帰:空行、改行、文末の順に分割。Markdown:見出しごとに 1 パッセージで、見出しのパスを保持します。", + options: { + whole: "ドキュメント全体", + recursive: "再帰", + markdown: "Markdown セクション" + } + }, + "source.split.maxChars": { + label: "最長パッセージ", + helpText: "文字数。設定ページのチャンクサイズより優先されます。埋め込みモデルの入力上限によって小さくなる場合があります。ドキュメント全体では読み取られません。" + }, + "source.split.minChars": { + label: "最短パッセージ", + helpText: "この長さより短い隣接する断片は、この長さまで結合されます(既定 200)。再帰と Markdown のみ。" + }, + refresh: { + label: "更新", + helpText: "インデックスをレコードと同期させる方法。" + }, + "refresh.onRecordChange": { + label: "レコード変更時に同期", + helpText: "レコードの作成・変更・削除に合わせてインデックスを同期します(既定ではオン)。オフ:外部のインデクサーがインデックスを管理し、プラットフォームは同期も構築もしません。" + } + } } }; diff --git a/packages/platform-objects/src/apps/translations/ko.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/ko.metadata-forms.generated.ts index 730b6ee3f33..eee919a5065 100644 --- a/packages/platform-objects/src/apps/translations/ko.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/ko.metadata-forms.generated.ts @@ -3490,6 +3490,98 @@ export const koMetadataForms: NonNullable = { } }, knowledge_source: { - label: "지식 소스" + label: "지식 소스", + sections: { + basics: { + label: "Basics", + description: "The source's identity, whether agents may search it, and the store that holds its index." + }, + records: { + label: "Records", + description: "Which records of which object are indexed, and which of their fields. Each field picker offers the fields of the object chosen here." + }, + refresh: { + label: "Refresh", + description: "How the index follows the records." + } + }, + fields: { + name: { + label: "Name", + helpText: "Unique identifier (snake_case). search_knowledge lists the source by it, and its sourceIds argument names the source by it." + }, + label: { + label: "Label", + helpText: "Display name, shown in the sources list of a search_knowledge answer." + }, + description: { + label: "Description", + helpText: "What the source holds, shown beside its name in the sources list of a search_knowledge answer." + }, + aiExposed: { + label: "Searchable by AI agents", + helpText: "Whether search_knowledge may search this source for AI agents. On by default." + }, + adapter: { + label: "Store", + helpText: "The store that holds the index, by its adapter id (pgvector, turso, memory). Leave it blank for the deployment's store: pgvector on PostgreSQL, turso otherwise, else the only store mounted. A store this deployment does not mount is refused at save. The memory store keeps nothing across a restart, so every boot builds its index again and sends the whole source to the embedding provider." + }, + source: { + label: "Source", + helpText: "What the source indexes: the records of one object." + }, + "source.kind": { + label: "Kind", + helpText: "What the source indexes. A source indexes the records of one object.", + options: { + object: "Records of an object" + } + }, + "source.object": { + label: "Object", + helpText: "The object whose records are indexed. Each matching record becomes one document." + }, + "source.content": { + label: "Content fields", + helpText: "The fields whose text is indexed, in order. Each field is named: there is no wildcard. Embedding is egress, and a build costs money: the first build reads every record the filter matches and sends the text of each listed field to your embedding provider, which bills for it, and that text is kept in an index outside the record store. A rebuild after you change the embedding model or the split sends all of it again. A field added to the object later is not indexed until you add it here. Credential and internal fields are never indexed, even when listed." + }, + "source.metadataFields": { + label: "Filter fields", + helpText: "Fields kept beside each passage, so a search can filter on them (for example a status or an owner). Each one must be a field you may query." + }, + "source.where": { + label: "Records to index", + helpText: "An ObjectQL filter on the object, for example {\"status\": {\"$ne\": \"done\"}}. Only the records it matches are indexed. Blank: every record." + }, + "source.split": { + label: "Passages", + helpText: "How each document is cut into passages. Blank: recursive, with the settings page's chunk size (800 characters unless changed)." + }, + "source.split.strategy": { + label: "Strategy", + helpText: "Whole: one passage per document. Recursive: cut at blank lines, then line breaks, then sentence ends. Markdown: one passage per heading, carrying its heading path.", + options: { + whole: "Whole document", + recursive: "Recursive", + markdown: "Markdown sections" + } + }, + "source.split.maxChars": { + label: "Longest passage", + helpText: "In characters. Wins over the settings page's chunk size; the embedding model's input limit can lower it. Not read by Whole document." + }, + "source.split.minChars": { + label: "Shortest passage", + helpText: "Adjacent pieces shorter than this are merged, up to this length (default 200). Recursive and Markdown only." + }, + refresh: { + label: "Refresh", + helpText: "How the index is kept in step with the records." + }, + "refresh.onRecordChange": { + label: "Sync on record changes", + helpText: "Keep the index in step as records are created, changed and deleted (on by default). Off: an external indexer keeps the index, and the platform neither syncs nor builds it." + } + } } }; diff --git a/packages/platform-objects/src/apps/translations/ko.source-hashes.generated.ts b/packages/platform-objects/src/apps/translations/ko.source-hashes.generated.ts index 8de3bbc85df..ff160c1defd 100644 --- a/packages/platform-objects/src/apps/translations/ko.source-hashes.generated.ts +++ b/packages/platform-objects/src/apps/translations/ko.source-hashes.generated.ts @@ -50,6 +50,50 @@ export const koGeneratedSourceHashes: Readonly> = { "metadataForms.email_template.fields.variables.helpText": "27197774c2cda633", "metadataForms.field.fields.inlineEdit.helpText": "1ce60e4c6d5fc0e1", "metadataForms.field.fields.inlineEdit.label": "f29ea014320f588e", + "metadataForms.knowledge_source.fields.adapter.helpText": "9529330956105d79", + "metadataForms.knowledge_source.fields.adapter.label": "da213009390baa11", + "metadataForms.knowledge_source.fields.aiExposed.helpText": "308cc1b601e6601c", + "metadataForms.knowledge_source.fields.aiExposed.label": "61da7af3c7a42d23", + "metadataForms.knowledge_source.fields.description.helpText": "6117bd9062dbb3d3", + "metadataForms.knowledge_source.fields.description.label": "779a4342c8eb6707", + "metadataForms.knowledge_source.fields.label.helpText": "0108489eabde9658", + "metadataForms.knowledge_source.fields.label.label": "c680364257b11569", + "metadataForms.knowledge_source.fields.name.helpText": "e825b21f14b83cfa", + "metadataForms.knowledge_source.fields.name.label": "5274417ff1ccaf01", + "metadataForms.knowledge_source.fields.refresh.helpText": "3dc3007498cbdddc", + "metadataForms.knowledge_source.fields.refresh.label": "1b63ae2e002930a6", + "metadataForms.knowledge_source.fields.refresh.onRecordChange.helpText": "ef6f113e883733b7", + "metadataForms.knowledge_source.fields.refresh.onRecordChange.label": "53a3285b7bcfb91f", + "metadataForms.knowledge_source.fields.source.content.helpText": "a58391e05d69ffe7", + "metadataForms.knowledge_source.fields.source.content.label": "fb33868fefbf74b3", + "metadataForms.knowledge_source.fields.source.helpText": "0b648dbc7af2f85c", + "metadataForms.knowledge_source.fields.source.kind.helpText": "98e903260393800d", + "metadataForms.knowledge_source.fields.source.kind.label": "3acd2ee4b0e7f2cf", + "metadataForms.knowledge_source.fields.source.kind.options.object": "e094ff2c1c3a195a", + "metadataForms.knowledge_source.fields.source.label": "8fe786e8e29c8cec", + "metadataForms.knowledge_source.fields.source.metadataFields.helpText": "8f41aea242f1a77e", + "metadataForms.knowledge_source.fields.source.metadataFields.label": "de294fc128e44483", + "metadataForms.knowledge_source.fields.source.object.helpText": "37a6686deb6e5201", + "metadataForms.knowledge_source.fields.source.object.label": "d0c49032d95ebb36", + "metadataForms.knowledge_source.fields.source.split.helpText": "a51a59132d112116", + "metadataForms.knowledge_source.fields.source.split.label": "3a77c4c884b1d4a4", + "metadataForms.knowledge_source.fields.source.split.maxChars.helpText": "d7254716c7258828", + "metadataForms.knowledge_source.fields.source.split.maxChars.label": "780596d178bbdef6", + "metadataForms.knowledge_source.fields.source.split.minChars.helpText": "c570045548551b8b", + "metadataForms.knowledge_source.fields.source.split.minChars.label": "f8a2b05e9c16afda", + "metadataForms.knowledge_source.fields.source.split.strategy.helpText": "f3ff47d9386b7956", + "metadataForms.knowledge_source.fields.source.split.strategy.label": "785c1dd353da380b", + "metadataForms.knowledge_source.fields.source.split.strategy.options.markdown": "ed9a22aca881fe59", + "metadataForms.knowledge_source.fields.source.split.strategy.options.recursive": "c38548b1e854c675", + "metadataForms.knowledge_source.fields.source.split.strategy.options.whole": "3eae5cd7567cf40a", + "metadataForms.knowledge_source.fields.source.where.helpText": "45098881521ffbd5", + "metadataForms.knowledge_source.fields.source.where.label": "cae99e947da34116", + "metadataForms.knowledge_source.sections.basics.description": "c232f620677bab66", + "metadataForms.knowledge_source.sections.basics.label": "55562f900da68c5d", + "metadataForms.knowledge_source.sections.records.description": "929da5e97dc7eda2", + "metadataForms.knowledge_source.sections.records.label": "9e5814dbd123f1c1", + "metadataForms.knowledge_source.sections.refresh.description": "79311cb3f9e55b89", + "metadataForms.knowledge_source.sections.refresh.label": "1b63ae2e002930a6", "metadataForms.permission.fields.fields.helpText": "887a0bae04a950e2", "metadataForms.permission.fields.objects.helpText": "e2512cfb3b501aae", "metadataForms.permission.fields.tabPermissions.helpText": "8942e2aebe59897c", diff --git a/packages/platform-objects/src/apps/translations/pt-BR.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/pt-BR.metadata-forms.generated.ts index 9267e8c6e7a..e53a0f95d34 100644 --- a/packages/platform-objects/src/apps/translations/pt-BR.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/pt-BR.metadata-forms.generated.ts @@ -3490,6 +3490,98 @@ export const ptBRMetadataForms: NonNullable = } }, knowledge_source: { - label: "Fonte de conhecimento" + label: "Fonte de conhecimento", + sections: { + basics: { + label: "Basics", + description: "The source's identity, whether agents may search it, and the store that holds its index." + }, + records: { + label: "Records", + description: "Which records of which object are indexed, and which of their fields. Each field picker offers the fields of the object chosen here." + }, + refresh: { + label: "Refresh", + description: "How the index follows the records." + } + }, + fields: { + name: { + label: "Name", + helpText: "Unique identifier (snake_case). search_knowledge lists the source by it, and its sourceIds argument names the source by it." + }, + label: { + label: "Label", + helpText: "Display name, shown in the sources list of a search_knowledge answer." + }, + description: { + label: "Description", + helpText: "What the source holds, shown beside its name in the sources list of a search_knowledge answer." + }, + aiExposed: { + label: "Searchable by AI agents", + helpText: "Whether search_knowledge may search this source for AI agents. On by default." + }, + adapter: { + label: "Store", + helpText: "The store that holds the index, by its adapter id (pgvector, turso, memory). Leave it blank for the deployment's store: pgvector on PostgreSQL, turso otherwise, else the only store mounted. A store this deployment does not mount is refused at save. The memory store keeps nothing across a restart, so every boot builds its index again and sends the whole source to the embedding provider." + }, + source: { + label: "Source", + helpText: "What the source indexes: the records of one object." + }, + "source.kind": { + label: "Kind", + helpText: "What the source indexes. A source indexes the records of one object.", + options: { + object: "Records of an object" + } + }, + "source.object": { + label: "Object", + helpText: "The object whose records are indexed. Each matching record becomes one document." + }, + "source.content": { + label: "Content fields", + helpText: "The fields whose text is indexed, in order. Each field is named: there is no wildcard. Embedding is egress, and a build costs money: the first build reads every record the filter matches and sends the text of each listed field to your embedding provider, which bills for it, and that text is kept in an index outside the record store. A rebuild after you change the embedding model or the split sends all of it again. A field added to the object later is not indexed until you add it here. Credential and internal fields are never indexed, even when listed." + }, + "source.metadataFields": { + label: "Filter fields", + helpText: "Fields kept beside each passage, so a search can filter on them (for example a status or an owner). Each one must be a field you may query." + }, + "source.where": { + label: "Records to index", + helpText: "An ObjectQL filter on the object, for example {\"status\": {\"$ne\": \"done\"}}. Only the records it matches are indexed. Blank: every record." + }, + "source.split": { + label: "Passages", + helpText: "How each document is cut into passages. Blank: recursive, with the settings page's chunk size (800 characters unless changed)." + }, + "source.split.strategy": { + label: "Strategy", + helpText: "Whole: one passage per document. Recursive: cut at blank lines, then line breaks, then sentence ends. Markdown: one passage per heading, carrying its heading path.", + options: { + whole: "Whole document", + recursive: "Recursive", + markdown: "Markdown sections" + } + }, + "source.split.maxChars": { + label: "Longest passage", + helpText: "In characters. Wins over the settings page's chunk size; the embedding model's input limit can lower it. Not read by Whole document." + }, + "source.split.minChars": { + label: "Shortest passage", + helpText: "Adjacent pieces shorter than this are merged, up to this length (default 200). Recursive and Markdown only." + }, + refresh: { + label: "Refresh", + helpText: "How the index is kept in step with the records." + }, + "refresh.onRecordChange": { + label: "Sync on record changes", + helpText: "Keep the index in step as records are created, changed and deleted (on by default). Off: an external indexer keeps the index, and the platform neither syncs nor builds it." + } + } } }; diff --git a/packages/platform-objects/src/apps/translations/pt-BR.source-hashes.generated.ts b/packages/platform-objects/src/apps/translations/pt-BR.source-hashes.generated.ts index 5eca386c3e6..12bcccbe3ed 100644 --- a/packages/platform-objects/src/apps/translations/pt-BR.source-hashes.generated.ts +++ b/packages/platform-objects/src/apps/translations/pt-BR.source-hashes.generated.ts @@ -62,6 +62,50 @@ export const ptBRGeneratedSourceHashes: Readonly> = { "metadataForms.hook.fields.handler.label": "97d4c25eaee5ed2a", "metadataForms.hook.fields.refusals.status.label": "64a420165247654b", "metadataForms.hook.label": "248bb1cdc692252d", + "metadataForms.knowledge_source.fields.adapter.helpText": "9529330956105d79", + "metadataForms.knowledge_source.fields.adapter.label": "da213009390baa11", + "metadataForms.knowledge_source.fields.aiExposed.helpText": "308cc1b601e6601c", + "metadataForms.knowledge_source.fields.aiExposed.label": "61da7af3c7a42d23", + "metadataForms.knowledge_source.fields.description.helpText": "6117bd9062dbb3d3", + "metadataForms.knowledge_source.fields.description.label": "779a4342c8eb6707", + "metadataForms.knowledge_source.fields.label.helpText": "0108489eabde9658", + "metadataForms.knowledge_source.fields.label.label": "c680364257b11569", + "metadataForms.knowledge_source.fields.name.helpText": "e825b21f14b83cfa", + "metadataForms.knowledge_source.fields.name.label": "5274417ff1ccaf01", + "metadataForms.knowledge_source.fields.refresh.helpText": "3dc3007498cbdddc", + "metadataForms.knowledge_source.fields.refresh.label": "1b63ae2e002930a6", + "metadataForms.knowledge_source.fields.refresh.onRecordChange.helpText": "ef6f113e883733b7", + "metadataForms.knowledge_source.fields.refresh.onRecordChange.label": "53a3285b7bcfb91f", + "metadataForms.knowledge_source.fields.source.content.helpText": "a58391e05d69ffe7", + "metadataForms.knowledge_source.fields.source.content.label": "fb33868fefbf74b3", + "metadataForms.knowledge_source.fields.source.helpText": "0b648dbc7af2f85c", + "metadataForms.knowledge_source.fields.source.kind.helpText": "98e903260393800d", + "metadataForms.knowledge_source.fields.source.kind.label": "3acd2ee4b0e7f2cf", + "metadataForms.knowledge_source.fields.source.kind.options.object": "e094ff2c1c3a195a", + "metadataForms.knowledge_source.fields.source.label": "8fe786e8e29c8cec", + "metadataForms.knowledge_source.fields.source.metadataFields.helpText": "8f41aea242f1a77e", + "metadataForms.knowledge_source.fields.source.metadataFields.label": "de294fc128e44483", + "metadataForms.knowledge_source.fields.source.object.helpText": "37a6686deb6e5201", + "metadataForms.knowledge_source.fields.source.object.label": "d0c49032d95ebb36", + "metadataForms.knowledge_source.fields.source.split.helpText": "a51a59132d112116", + "metadataForms.knowledge_source.fields.source.split.label": "3a77c4c884b1d4a4", + "metadataForms.knowledge_source.fields.source.split.maxChars.helpText": "d7254716c7258828", + "metadataForms.knowledge_source.fields.source.split.maxChars.label": "780596d178bbdef6", + "metadataForms.knowledge_source.fields.source.split.minChars.helpText": "c570045548551b8b", + "metadataForms.knowledge_source.fields.source.split.minChars.label": "f8a2b05e9c16afda", + "metadataForms.knowledge_source.fields.source.split.strategy.helpText": "f3ff47d9386b7956", + "metadataForms.knowledge_source.fields.source.split.strategy.label": "785c1dd353da380b", + "metadataForms.knowledge_source.fields.source.split.strategy.options.markdown": "ed9a22aca881fe59", + "metadataForms.knowledge_source.fields.source.split.strategy.options.recursive": "c38548b1e854c675", + "metadataForms.knowledge_source.fields.source.split.strategy.options.whole": "3eae5cd7567cf40a", + "metadataForms.knowledge_source.fields.source.where.helpText": "45098881521ffbd5", + "metadataForms.knowledge_source.fields.source.where.label": "cae99e947da34116", + "metadataForms.knowledge_source.sections.basics.description": "c232f620677bab66", + "metadataForms.knowledge_source.sections.basics.label": "55562f900da68c5d", + "metadataForms.knowledge_source.sections.records.description": "929da5e97dc7eda2", + "metadataForms.knowledge_source.sections.records.label": "9e5814dbd123f1c1", + "metadataForms.knowledge_source.sections.refresh.description": "79311cb3f9e55b89", + "metadataForms.knowledge_source.sections.refresh.label": "1b63ae2e002930a6", "metadataForms.object.fields.enable.feeds.label": "669c64671f632139", "metadataForms.object.fields.lifecycle.storage.shards.label": "739988affb36b2e0", "metadataForms.page.sections.layout.label": "7f508ea1bb2c3a6b", diff --git a/packages/platform-objects/src/apps/translations/ru.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/ru.metadata-forms.generated.ts index 4c2ba1d6c74..87ed53d1654 100644 --- a/packages/platform-objects/src/apps/translations/ru.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/ru.metadata-forms.generated.ts @@ -3490,6 +3490,98 @@ export const ruMetadataForms: NonNullable = { } }, knowledge_source: { - label: "Источник знаний" + label: "Источник знаний", + sections: { + basics: { + label: "Basics", + description: "The source's identity, whether agents may search it, and the store that holds its index." + }, + records: { + label: "Records", + description: "Which records of which object are indexed, and which of their fields. Each field picker offers the fields of the object chosen here." + }, + refresh: { + label: "Refresh", + description: "How the index follows the records." + } + }, + fields: { + name: { + label: "Name", + helpText: "Unique identifier (snake_case). search_knowledge lists the source by it, and its sourceIds argument names the source by it." + }, + label: { + label: "Label", + helpText: "Display name, shown in the sources list of a search_knowledge answer." + }, + description: { + label: "Description", + helpText: "What the source holds, shown beside its name in the sources list of a search_knowledge answer." + }, + aiExposed: { + label: "Searchable by AI agents", + helpText: "Whether search_knowledge may search this source for AI agents. On by default." + }, + adapter: { + label: "Store", + helpText: "The store that holds the index, by its adapter id (pgvector, turso, memory). Leave it blank for the deployment's store: pgvector on PostgreSQL, turso otherwise, else the only store mounted. A store this deployment does not mount is refused at save. The memory store keeps nothing across a restart, so every boot builds its index again and sends the whole source to the embedding provider." + }, + source: { + label: "Source", + helpText: "What the source indexes: the records of one object." + }, + "source.kind": { + label: "Kind", + helpText: "What the source indexes. A source indexes the records of one object.", + options: { + object: "Records of an object" + } + }, + "source.object": { + label: "Object", + helpText: "The object whose records are indexed. Each matching record becomes one document." + }, + "source.content": { + label: "Content fields", + helpText: "The fields whose text is indexed, in order. Each field is named: there is no wildcard. Embedding is egress, and a build costs money: the first build reads every record the filter matches and sends the text of each listed field to your embedding provider, which bills for it, and that text is kept in an index outside the record store. A rebuild after you change the embedding model or the split sends all of it again. A field added to the object later is not indexed until you add it here. Credential and internal fields are never indexed, even when listed." + }, + "source.metadataFields": { + label: "Filter fields", + helpText: "Fields kept beside each passage, so a search can filter on them (for example a status or an owner). Each one must be a field you may query." + }, + "source.where": { + label: "Records to index", + helpText: "An ObjectQL filter on the object, for example {\"status\": {\"$ne\": \"done\"}}. Only the records it matches are indexed. Blank: every record." + }, + "source.split": { + label: "Passages", + helpText: "How each document is cut into passages. Blank: recursive, with the settings page's chunk size (800 characters unless changed)." + }, + "source.split.strategy": { + label: "Strategy", + helpText: "Whole: one passage per document. Recursive: cut at blank lines, then line breaks, then sentence ends. Markdown: one passage per heading, carrying its heading path.", + options: { + whole: "Whole document", + recursive: "Recursive", + markdown: "Markdown sections" + } + }, + "source.split.maxChars": { + label: "Longest passage", + helpText: "In characters. Wins over the settings page's chunk size; the embedding model's input limit can lower it. Not read by Whole document." + }, + "source.split.minChars": { + label: "Shortest passage", + helpText: "Adjacent pieces shorter than this are merged, up to this length (default 200). Recursive and Markdown only." + }, + refresh: { + label: "Refresh", + helpText: "How the index is kept in step with the records." + }, + "refresh.onRecordChange": { + label: "Sync on record changes", + helpText: "Keep the index in step as records are created, changed and deleted (on by default). Off: an external indexer keeps the index, and the platform neither syncs nor builds it." + } + } } }; diff --git a/packages/platform-objects/src/apps/translations/ru.source-hashes.generated.ts b/packages/platform-objects/src/apps/translations/ru.source-hashes.generated.ts index 2ecfaaa7130..c04c829b305 100644 --- a/packages/platform-objects/src/apps/translations/ru.source-hashes.generated.ts +++ b/packages/platform-objects/src/apps/translations/ru.source-hashes.generated.ts @@ -50,6 +50,50 @@ export const ruGeneratedSourceHashes: Readonly> = { "metadataForms.email_template.fields.variables.helpText": "27197774c2cda633", "metadataForms.field.fields.inlineEdit.helpText": "1ce60e4c6d5fc0e1", "metadataForms.field.fields.inlineEdit.label": "f29ea014320f588e", + "metadataForms.knowledge_source.fields.adapter.helpText": "9529330956105d79", + "metadataForms.knowledge_source.fields.adapter.label": "da213009390baa11", + "metadataForms.knowledge_source.fields.aiExposed.helpText": "308cc1b601e6601c", + "metadataForms.knowledge_source.fields.aiExposed.label": "61da7af3c7a42d23", + "metadataForms.knowledge_source.fields.description.helpText": "6117bd9062dbb3d3", + "metadataForms.knowledge_source.fields.description.label": "779a4342c8eb6707", + "metadataForms.knowledge_source.fields.label.helpText": "0108489eabde9658", + "metadataForms.knowledge_source.fields.label.label": "c680364257b11569", + "metadataForms.knowledge_source.fields.name.helpText": "e825b21f14b83cfa", + "metadataForms.knowledge_source.fields.name.label": "5274417ff1ccaf01", + "metadataForms.knowledge_source.fields.refresh.helpText": "3dc3007498cbdddc", + "metadataForms.knowledge_source.fields.refresh.label": "1b63ae2e002930a6", + "metadataForms.knowledge_source.fields.refresh.onRecordChange.helpText": "ef6f113e883733b7", + "metadataForms.knowledge_source.fields.refresh.onRecordChange.label": "53a3285b7bcfb91f", + "metadataForms.knowledge_source.fields.source.content.helpText": "a58391e05d69ffe7", + "metadataForms.knowledge_source.fields.source.content.label": "fb33868fefbf74b3", + "metadataForms.knowledge_source.fields.source.helpText": "0b648dbc7af2f85c", + "metadataForms.knowledge_source.fields.source.kind.helpText": "98e903260393800d", + "metadataForms.knowledge_source.fields.source.kind.label": "3acd2ee4b0e7f2cf", + "metadataForms.knowledge_source.fields.source.kind.options.object": "e094ff2c1c3a195a", + "metadataForms.knowledge_source.fields.source.label": "8fe786e8e29c8cec", + "metadataForms.knowledge_source.fields.source.metadataFields.helpText": "8f41aea242f1a77e", + "metadataForms.knowledge_source.fields.source.metadataFields.label": "de294fc128e44483", + "metadataForms.knowledge_source.fields.source.object.helpText": "37a6686deb6e5201", + "metadataForms.knowledge_source.fields.source.object.label": "d0c49032d95ebb36", + "metadataForms.knowledge_source.fields.source.split.helpText": "a51a59132d112116", + "metadataForms.knowledge_source.fields.source.split.label": "3a77c4c884b1d4a4", + "metadataForms.knowledge_source.fields.source.split.maxChars.helpText": "d7254716c7258828", + "metadataForms.knowledge_source.fields.source.split.maxChars.label": "780596d178bbdef6", + "metadataForms.knowledge_source.fields.source.split.minChars.helpText": "c570045548551b8b", + "metadataForms.knowledge_source.fields.source.split.minChars.label": "f8a2b05e9c16afda", + "metadataForms.knowledge_source.fields.source.split.strategy.helpText": "f3ff47d9386b7956", + "metadataForms.knowledge_source.fields.source.split.strategy.label": "785c1dd353da380b", + "metadataForms.knowledge_source.fields.source.split.strategy.options.markdown": "ed9a22aca881fe59", + "metadataForms.knowledge_source.fields.source.split.strategy.options.recursive": "c38548b1e854c675", + "metadataForms.knowledge_source.fields.source.split.strategy.options.whole": "3eae5cd7567cf40a", + "metadataForms.knowledge_source.fields.source.where.helpText": "45098881521ffbd5", + "metadataForms.knowledge_source.fields.source.where.label": "cae99e947da34116", + "metadataForms.knowledge_source.sections.basics.description": "c232f620677bab66", + "metadataForms.knowledge_source.sections.basics.label": "55562f900da68c5d", + "metadataForms.knowledge_source.sections.records.description": "929da5e97dc7eda2", + "metadataForms.knowledge_source.sections.records.label": "9e5814dbd123f1c1", + "metadataForms.knowledge_source.sections.refresh.description": "79311cb3f9e55b89", + "metadataForms.knowledge_source.sections.refresh.label": "1b63ae2e002930a6", "metadataForms.permission.fields.fields.helpText": "887a0bae04a950e2", "metadataForms.permission.fields.objects.helpText": "e2512cfb3b501aae", "metadataForms.permission.fields.tabPermissions.helpText": "8942e2aebe59897c", diff --git a/packages/platform-objects/src/apps/translations/zh-CN.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/zh-CN.metadata-forms.generated.ts index f4a06890fdd..df1eb4b4510 100644 --- a/packages/platform-objects/src/apps/translations/zh-CN.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/zh-CN.metadata-forms.generated.ts @@ -3490,6 +3490,98 @@ export const zhCNMetadataForms: NonNullable = } }, knowledge_source: { - label: "知识源" + label: "知识源", + sections: { + basics: { + label: "基本信息", + description: "知识源的标识、智能体能否检索它,以及存放其索引的存储。" + }, + records: { + label: "记录", + description: "索引哪个对象的哪些记录,以及记录的哪些字段。每个字段选择器提供此处所选对象的字段。" + }, + refresh: { + label: "刷新", + description: "索引如何跟随记录更新。" + } + }, + fields: { + name: { + label: "名称", + helpText: "唯一标识(snake_case)。search_knowledge 以它列出该知识源,其 sourceIds 参数也以它指名该知识源。" + }, + label: { + label: "标签", + helpText: "显示名称,显示在 search_knowledge 回答的知识源列表中。" + }, + description: { + label: "描述", + helpText: "知识源包含的内容,显示在 search_knowledge 回答的知识源列表中、名称旁边。" + }, + aiExposed: { + label: "可供 AI 智能体检索", + helpText: "search_knowledge 是否可为 AI 智能体检索此知识源。默认开启。" + }, + adapter: { + label: "存储", + helpText: "存放索引的存储,按其适配器 ID 填写(pgvector、turso、memory)。留空则使用部署的存储:PostgreSQL 上为 pgvector,否则为 turso,再否则为唯一挂载的存储。本部署未挂载的存储会在保存时被拒绝。memory 存储在重启后不保留任何内容,因此每次启动都会重新构建其索引,并把整个知识源再次发送给嵌入服务商。" + }, + source: { + label: "来源", + helpText: "知识源索引的内容:一个对象的记录。" + }, + "source.kind": { + label: "类型", + helpText: "知识源索引的内容。一个知识源索引一个对象的记录。", + options: { + object: "对象的记录" + } + }, + "source.object": { + label: "对象", + helpText: "其记录被索引的对象。每条匹配的记录成为一个文档。" + }, + "source.content": { + label: "内容字段", + helpText: "其文本被索引的字段,按顺序排列。每个字段都需逐一指名:没有通配符。嵌入即数据外发,且构建会产生费用:首次构建会读取筛选条件匹配的每条记录,把每个所列字段的文本发送给你的嵌入服务商(由其计费),这些文本会保存在记录存储之外的索引中。更换嵌入模型或切分方式后重建,会再次发送全部内容。之后添加到对象上的字段,在你于此处添加之前不会被索引。凭据类字段和内部字段即使列出也永远不会被索引。" + }, + "source.metadataFields": { + label: "筛选字段", + helpText: "保存在每个段落旁边的字段,使检索可以按它们筛选(例如状态或负责人)。每个字段都必须是你可以查询的字段。" + }, + "source.where": { + label: "要索引的记录", + helpText: "对该对象的 ObjectQL 筛选条件,例如 {\"status\": {\"$ne\": \"done\"}}。只有匹配的记录会被索引。留空:所有记录。" + }, + "source.split": { + label: "段落", + helpText: "每个文档如何切分为段落。留空:递归切分,使用设置页的分块大小(未修改时为 800 个字符)。" + }, + "source.split.strategy": { + label: "策略", + helpText: "整篇:每个文档一个段落。递归:依次在空行、换行、句末处切分。Markdown:每个标题一个段落,并带上其标题路径。", + options: { + whole: "整篇文档", + recursive: "递归", + markdown: "Markdown 章节" + } + }, + "source.split.maxChars": { + label: "最长段落", + helpText: "以字符计。优先于设置页的分块大小;嵌入模型的输入上限可能会降低它。整篇文档策略不读取此值。" + }, + "source.split.minChars": { + label: "最短段落", + helpText: "短于此长度的相邻片段会被合并,直至达到此长度(默认 200)。仅适用于递归和 Markdown。" + }, + refresh: { + label: "刷新", + helpText: "索引如何与记录保持同步。" + }, + "refresh.onRecordChange": { + label: "记录变更时同步", + helpText: "在记录创建、修改和删除时保持索引同步(默认开启)。关闭:由外部索引器维护索引,平台既不同步也不构建它。" + } + } } }; diff --git a/packages/platform-objects/src/apps/translations/zh-Hant.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/zh-Hant.metadata-forms.generated.ts index 837d956894a..ca27f316a20 100644 --- a/packages/platform-objects/src/apps/translations/zh-Hant.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/zh-Hant.metadata-forms.generated.ts @@ -3490,6 +3490,98 @@ export const zhHantMetadataForms: NonNullable } }, knowledge_source: { - label: "知識來源" + label: "知識來源", + sections: { + basics: { + label: "Basics", + description: "The source's identity, whether agents may search it, and the store that holds its index." + }, + records: { + label: "Records", + description: "Which records of which object are indexed, and which of their fields. Each field picker offers the fields of the object chosen here." + }, + refresh: { + label: "Refresh", + description: "How the index follows the records." + } + }, + fields: { + name: { + label: "Name", + helpText: "Unique identifier (snake_case). search_knowledge lists the source by it, and its sourceIds argument names the source by it." + }, + label: { + label: "Label", + helpText: "Display name, shown in the sources list of a search_knowledge answer." + }, + description: { + label: "Description", + helpText: "What the source holds, shown beside its name in the sources list of a search_knowledge answer." + }, + aiExposed: { + label: "Searchable by AI agents", + helpText: "Whether search_knowledge may search this source for AI agents. On by default." + }, + adapter: { + label: "Store", + helpText: "The store that holds the index, by its adapter id (pgvector, turso, memory). Leave it blank for the deployment's store: pgvector on PostgreSQL, turso otherwise, else the only store mounted. A store this deployment does not mount is refused at save. The memory store keeps nothing across a restart, so every boot builds its index again and sends the whole source to the embedding provider." + }, + source: { + label: "Source", + helpText: "What the source indexes: the records of one object." + }, + "source.kind": { + label: "Kind", + helpText: "What the source indexes. A source indexes the records of one object.", + options: { + object: "Records of an object" + } + }, + "source.object": { + label: "Object", + helpText: "The object whose records are indexed. Each matching record becomes one document." + }, + "source.content": { + label: "Content fields", + helpText: "The fields whose text is indexed, in order. Each field is named: there is no wildcard. Embedding is egress, and a build costs money: the first build reads every record the filter matches and sends the text of each listed field to your embedding provider, which bills for it, and that text is kept in an index outside the record store. A rebuild after you change the embedding model or the split sends all of it again. A field added to the object later is not indexed until you add it here. Credential and internal fields are never indexed, even when listed." + }, + "source.metadataFields": { + label: "Filter fields", + helpText: "Fields kept beside each passage, so a search can filter on them (for example a status or an owner). Each one must be a field you may query." + }, + "source.where": { + label: "Records to index", + helpText: "An ObjectQL filter on the object, for example {\"status\": {\"$ne\": \"done\"}}. Only the records it matches are indexed. Blank: every record." + }, + "source.split": { + label: "Passages", + helpText: "How each document is cut into passages. Blank: recursive, with the settings page's chunk size (800 characters unless changed)." + }, + "source.split.strategy": { + label: "Strategy", + helpText: "Whole: one passage per document. Recursive: cut at blank lines, then line breaks, then sentence ends. Markdown: one passage per heading, carrying its heading path.", + options: { + whole: "Whole document", + recursive: "Recursive", + markdown: "Markdown sections" + } + }, + "source.split.maxChars": { + label: "Longest passage", + helpText: "In characters. Wins over the settings page's chunk size; the embedding model's input limit can lower it. Not read by Whole document." + }, + "source.split.minChars": { + label: "Shortest passage", + helpText: "Adjacent pieces shorter than this are merged, up to this length (default 200). Recursive and Markdown only." + }, + refresh: { + label: "Refresh", + helpText: "How the index is kept in step with the records." + }, + "refresh.onRecordChange": { + label: "Sync on record changes", + helpText: "Keep the index in step as records are created, changed and deleted (on by default). Off: an external indexer keeps the index, and the platform neither syncs nor builds it." + } + } } }; diff --git a/packages/platform-objects/src/apps/translations/zh-Hant.source-hashes.generated.ts b/packages/platform-objects/src/apps/translations/zh-Hant.source-hashes.generated.ts index de71721e4db..9cf800846c9 100644 --- a/packages/platform-objects/src/apps/translations/zh-Hant.source-hashes.generated.ts +++ b/packages/platform-objects/src/apps/translations/zh-Hant.source-hashes.generated.ts @@ -48,6 +48,50 @@ export const zhHantGeneratedSourceHashes: Readonly> = { "metadataForms.dashboard.sections.access.label": "5a06534d8d136ba3", "metadataForms.field.fields.inlineEdit.helpText": "1ce60e4c6d5fc0e1", "metadataForms.field.fields.inlineEdit.label": "f29ea014320f588e", + "metadataForms.knowledge_source.fields.adapter.helpText": "9529330956105d79", + "metadataForms.knowledge_source.fields.adapter.label": "da213009390baa11", + "metadataForms.knowledge_source.fields.aiExposed.helpText": "308cc1b601e6601c", + "metadataForms.knowledge_source.fields.aiExposed.label": "61da7af3c7a42d23", + "metadataForms.knowledge_source.fields.description.helpText": "6117bd9062dbb3d3", + "metadataForms.knowledge_source.fields.description.label": "779a4342c8eb6707", + "metadataForms.knowledge_source.fields.label.helpText": "0108489eabde9658", + "metadataForms.knowledge_source.fields.label.label": "c680364257b11569", + "metadataForms.knowledge_source.fields.name.helpText": "e825b21f14b83cfa", + "metadataForms.knowledge_source.fields.name.label": "5274417ff1ccaf01", + "metadataForms.knowledge_source.fields.refresh.helpText": "3dc3007498cbdddc", + "metadataForms.knowledge_source.fields.refresh.label": "1b63ae2e002930a6", + "metadataForms.knowledge_source.fields.refresh.onRecordChange.helpText": "ef6f113e883733b7", + "metadataForms.knowledge_source.fields.refresh.onRecordChange.label": "53a3285b7bcfb91f", + "metadataForms.knowledge_source.fields.source.content.helpText": "a58391e05d69ffe7", + "metadataForms.knowledge_source.fields.source.content.label": "fb33868fefbf74b3", + "metadataForms.knowledge_source.fields.source.helpText": "0b648dbc7af2f85c", + "metadataForms.knowledge_source.fields.source.kind.helpText": "98e903260393800d", + "metadataForms.knowledge_source.fields.source.kind.label": "3acd2ee4b0e7f2cf", + "metadataForms.knowledge_source.fields.source.kind.options.object": "e094ff2c1c3a195a", + "metadataForms.knowledge_source.fields.source.label": "8fe786e8e29c8cec", + "metadataForms.knowledge_source.fields.source.metadataFields.helpText": "8f41aea242f1a77e", + "metadataForms.knowledge_source.fields.source.metadataFields.label": "de294fc128e44483", + "metadataForms.knowledge_source.fields.source.object.helpText": "37a6686deb6e5201", + "metadataForms.knowledge_source.fields.source.object.label": "d0c49032d95ebb36", + "metadataForms.knowledge_source.fields.source.split.helpText": "a51a59132d112116", + "metadataForms.knowledge_source.fields.source.split.label": "3a77c4c884b1d4a4", + "metadataForms.knowledge_source.fields.source.split.maxChars.helpText": "d7254716c7258828", + "metadataForms.knowledge_source.fields.source.split.maxChars.label": "780596d178bbdef6", + "metadataForms.knowledge_source.fields.source.split.minChars.helpText": "c570045548551b8b", + "metadataForms.knowledge_source.fields.source.split.minChars.label": "f8a2b05e9c16afda", + "metadataForms.knowledge_source.fields.source.split.strategy.helpText": "f3ff47d9386b7956", + "metadataForms.knowledge_source.fields.source.split.strategy.label": "785c1dd353da380b", + "metadataForms.knowledge_source.fields.source.split.strategy.options.markdown": "ed9a22aca881fe59", + "metadataForms.knowledge_source.fields.source.split.strategy.options.recursive": "c38548b1e854c675", + "metadataForms.knowledge_source.fields.source.split.strategy.options.whole": "3eae5cd7567cf40a", + "metadataForms.knowledge_source.fields.source.where.helpText": "45098881521ffbd5", + "metadataForms.knowledge_source.fields.source.where.label": "cae99e947da34116", + "metadataForms.knowledge_source.sections.basics.description": "c232f620677bab66", + "metadataForms.knowledge_source.sections.basics.label": "55562f900da68c5d", + "metadataForms.knowledge_source.sections.records.description": "929da5e97dc7eda2", + "metadataForms.knowledge_source.sections.records.label": "9e5814dbd123f1c1", + "metadataForms.knowledge_source.sections.refresh.description": "79311cb3f9e55b89", + "metadataForms.knowledge_source.sections.refresh.label": "1b63ae2e002930a6", "metadataForms.report.fields.dateRange.allowCustomRange.helpText": "eb95a6b1536e22fd", "metadataForms.report.fields.dateRange.allowCustomRange.label": "a1fb0e1cf5fe5d8e", "metadataForms.report.fields.dateRange.defaultRange.helpText": "03ccdb24491c9b5f", diff --git a/packages/spec/src/ai/knowledge-source.metadata-form.test.ts b/packages/spec/src/ai/knowledge-source.metadata-form.test.ts index 1a4e8cd43ff..78e78ccd288 100644 --- a/packages/spec/src/ai/knowledge-source.metadata-form.test.ts +++ b/packages/spec/src/ai/knowledge-source.metadata-form.test.ts @@ -45,6 +45,8 @@ describe('knowledge_source form (ADR-0161 K4 clause 2)', () => { expect(row('label')).toMatchObject({ required: true }); const adapter = row('adapter'); expect(adapter).toMatchObject({ type: 'text' }); + // The docs' cost callout: the memory store re-embeds the whole source on every boot. + expect(adapter?.helpText).toMatch(/every boot builds its index again/); expect(adapter?.required).toBeUndefined(); expect(adapter?.helpText).toMatch(/blank for the deployment's store/i); }); @@ -73,6 +75,7 @@ describe('knowledge_source form (ADR-0161 K4 clause 2)', () => { it('says beside `content` that its fields are sent to the embedding provider on the first build, billed and kept', () => { const help = sourceRow('content')?.helpText ?? ''; expect(help).toMatch(/egress/i); + expect(help).toMatch(/costs money/); expect(help).toMatch(/first build/); expect(help).toMatch(/embedding provider/); expect(help).toMatch(/bills/); diff --git a/packages/spec/src/ai/knowledge-source.metadata-form.ts b/packages/spec/src/ai/knowledge-source.metadata-form.ts index d7e50767fa5..ce4c35b258a 100644 --- a/packages/spec/src/ai/knowledge-source.metadata-form.ts +++ b/packages/spec/src/ai/knowledge-source.metadata-form.ts @@ -47,8 +47,8 @@ export const knowledgeSourceForm = defineMetadataForm({ { field: 'name', required: true, immutable: true, colSpan: 1, helpText: 'Unique identifier (snake_case). search_knowledge lists the source by it, and its sourceIds argument names the source by it.' }, { field: 'label', required: true, colSpan: 1, helpText: 'Display name, shown in the sources list of a search_knowledge answer.' }, { field: 'description', widget: 'textarea', colSpan: 2, helpText: 'What the source holds, shown beside its name in the sources list of a search_knowledge answer.' }, - { field: 'aiExposed', colSpan: 1, helpText: 'Whether search_knowledge may search this source for AI agents. On by default.' }, - { field: 'adapter', type: 'text', colSpan: 1, helpText: 'The store that holds the index, by its adapter id (pgvector, turso, memory). Leave it blank for the deployment\'s store: pgvector on PostgreSQL, turso otherwise, else the only store mounted. A store this deployment does not mount is refused at save.' }, + { field: 'aiExposed', label: 'Searchable by AI agents', colSpan: 1, helpText: 'Whether search_knowledge may search this source for AI agents. On by default.' }, + { field: 'adapter', label: 'Store', type: 'text', colSpan: 1, helpText: 'The store that holds the index, by its adapter id (pgvector, turso, memory). Leave it blank for the deployment\'s store: pgvector on PostgreSQL, turso otherwise, else the only store mounted. A store this deployment does not mount is refused at save. The memory store keeps nothing across a restart, so every boot builds its index again and sends the whole source to the embedding provider.' }, ], }, { @@ -69,7 +69,7 @@ export const knowledgeSourceForm = defineMetadataForm({ widget: 'field-multi', dependsOn: 'object', required: true, - helpText: 'The fields whose text is indexed, in order. Each field is named: there is no wildcard. Embedding is egress: on the first build the text of every listed field of every matching record is sent to your embedding provider, which bills for it, and kept in an index outside the record store. A field added to the object later is not indexed until you add it here. Credential and internal fields are never indexed, even when listed.', + helpText: 'The fields whose text is indexed, in order. Each field is named: there is no wildcard. Embedding is egress, and a build costs money: the first build reads every record the filter matches and sends the text of each listed field to your embedding provider, which bills for it, and that text is kept in an index outside the record store. A rebuild after you change the embedding model or the split sends all of it again. A field added to the object later is not indexed until you add it here. Credential and internal fields are never indexed, even when listed.', }, { field: 'metadataFields', label: 'Filter fields', widget: 'field-multi', dependsOn: 'object', helpText: 'Fields kept beside each passage, so a search can filter on them (for example a status or an owner). Each one must be a field you may query.' }, { field: 'where', label: 'Records to index', widget: 'json', helpText: 'An ObjectQL filter on the object, for example {"status": {"$ne": "done"}}. Only the records it matches are indexed. Blank: every record.' }, From 1d95aa43b4c94f28a7a5aee9bf9fd23b87596c00 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 28 Nov 2026 10:10:22 +0000 Subject: [PATCH 5/9] test(dogfood): the knowledge source round trip parses the stored item, read decorations stripped Co-authored-by: Claude Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP --- ...knowledge-source-studio-roundtrip.dogfood.test.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/qa/dogfood/test/knowledge-source-studio-roundtrip.dogfood.test.ts b/packages/qa/dogfood/test/knowledge-source-studio-roundtrip.dogfood.test.ts index f2f1dfd4b7f..eb33404616a 100644 --- a/packages/qa/dogfood/test/knowledge-source-studio-roundtrip.dogfood.test.ts +++ b/packages/qa/dogfood/test/knowledge-source-studio-roundtrip.dogfood.test.ts @@ -28,6 +28,7 @@ import { describe, it, expect, beforeAll, afterAll } from 'vitest'; import { MCPServerPlugin } from '@objectstack/mcp'; import { type VerifyStack } from '@objectstack/verify'; import { KnowledgeSourceSchema } from '@objectstack/spec/ai'; +import { stripReadDecorations } from '@objectstack/spec/kernel'; import { bootShowcase } from './showcase-boot.js'; const SOURCE = 'ks_studio_open_tasks'; @@ -136,10 +137,13 @@ describe('[ADR-0161 K4] a knowledge source authored through Studio\'s wire is se const res = await stack.apiAs(admin, 'GET', `/meta/knowledge_source/${SOURCE}`); expect(res.status, await res.clone().text()).toBe(200); const json: any = await res.json(); - const item = json?.item ?? json?.data ?? json; - expect(item).toMatchObject(FORM_BODY); - expect(item.adapter).toBeUndefined(); - const parsed = KnowledgeSourceSchema.safeParse(item); + const served = json?.item ?? json?.data ?? json; + expect(served).toMatchObject(FORM_BODY); + expect(served.adapter).toBeUndefined(); + // The read path's own verdict on the stored item, which Studio shows on the form. + expect(served._diagnostics?.valid, JSON.stringify(served._diagnostics)).toBe(true); + // A served body carries read-time decorations; the stored item is the body without them. + const parsed = KnowledgeSourceSchema.safeParse(stripReadDecorations(served)); expect(parsed.success, JSON.stringify(parsed.error?.issues)).toBe(true); }); }); From e48d479cf29bcfb14579941a5c5ec0de95d34abd Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 28 Nov 2026 12:44:43 +0000 Subject: [PATCH 6/9] fix(platform-objects): knowledge source select choices named in every locale; registry counts follow the new form The four choices of the knowledge source form's selects (`source.kind`, `source.split.strategy`) are translated in de, fr, ko, ar, pt-BR, ru and zh-Hant, as the served-form option test requires of every select. The display-echo ledgers count `knowledge_source` as a panel type now that it has a form (bare 17 to 16, panel 18 to 19, 27 bare leaves) and its labels in the translated catalog (845 to 865). Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP --- .../translations/ar.metadata-forms.generated.ts | 8 ++++---- .../translations/ar.source-hashes.generated.ts | 4 ---- .../bare-type-display-echo-decisions.test.ts | 17 ++++++++++------- .../translations/de.metadata-forms.generated.ts | 8 ++++---- .../translations/de.source-hashes.generated.ts | 4 ---- .../translations/fr.metadata-forms.generated.ts | 8 ++++---- .../translations/fr.source-hashes.generated.ts | 4 ---- .../translations/ko.metadata-forms.generated.ts | 8 ++++---- .../translations/ko.source-hashes.generated.ts | 4 ---- ...bject-lifecycle-panel-echo-decisions.test.ts | 5 ++++- .../pt-BR.metadata-forms.generated.ts | 8 ++++---- .../pt-BR.source-hashes.generated.ts | 4 ---- .../translations/ru.metadata-forms.generated.ts | 8 ++++---- .../translations/ru.source-hashes.generated.ts | 4 ---- .../zh-Hant.metadata-forms.generated.ts | 8 ++++---- .../zh-Hant.source-hashes.generated.ts | 4 ---- 16 files changed, 42 insertions(+), 64 deletions(-) diff --git a/packages/platform-objects/src/apps/translations/ar.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/ar.metadata-forms.generated.ts index 4c50a204acd..4bfe79d0946 100644 --- a/packages/platform-objects/src/apps/translations/ar.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/ar.metadata-forms.generated.ts @@ -3534,7 +3534,7 @@ export const arMetadataForms: NonNullable = { label: "Kind", helpText: "What the source indexes. A source indexes the records of one object.", options: { - object: "Records of an object" + object: "سجلات كائن" } }, "source.object": { @@ -3561,9 +3561,9 @@ export const arMetadataForms: NonNullable = { label: "Strategy", helpText: "Whole: one passage per document. Recursive: cut at blank lines, then line breaks, then sentence ends. Markdown: one passage per heading, carrying its heading path.", options: { - whole: "Whole document", - recursive: "Recursive", - markdown: "Markdown sections" + whole: "المستند كاملاً", + recursive: "تكراري", + markdown: "أقسام Markdown" } }, "source.split.maxChars": { diff --git a/packages/platform-objects/src/apps/translations/ar.source-hashes.generated.ts b/packages/platform-objects/src/apps/translations/ar.source-hashes.generated.ts index 43a261d06e8..1bced799c77 100644 --- a/packages/platform-objects/src/apps/translations/ar.source-hashes.generated.ts +++ b/packages/platform-objects/src/apps/translations/ar.source-hashes.generated.ts @@ -69,7 +69,6 @@ export const arGeneratedSourceHashes: Readonly> = { "metadataForms.knowledge_source.fields.source.helpText": "0b648dbc7af2f85c", "metadataForms.knowledge_source.fields.source.kind.helpText": "98e903260393800d", "metadataForms.knowledge_source.fields.source.kind.label": "3acd2ee4b0e7f2cf", - "metadataForms.knowledge_source.fields.source.kind.options.object": "e094ff2c1c3a195a", "metadataForms.knowledge_source.fields.source.label": "8fe786e8e29c8cec", "metadataForms.knowledge_source.fields.source.metadataFields.helpText": "8f41aea242f1a77e", "metadataForms.knowledge_source.fields.source.metadataFields.label": "de294fc128e44483", @@ -83,9 +82,6 @@ export const arGeneratedSourceHashes: Readonly> = { "metadataForms.knowledge_source.fields.source.split.minChars.label": "f8a2b05e9c16afda", "metadataForms.knowledge_source.fields.source.split.strategy.helpText": "f3ff47d9386b7956", "metadataForms.knowledge_source.fields.source.split.strategy.label": "785c1dd353da380b", - "metadataForms.knowledge_source.fields.source.split.strategy.options.markdown": "ed9a22aca881fe59", - "metadataForms.knowledge_source.fields.source.split.strategy.options.recursive": "c38548b1e854c675", - "metadataForms.knowledge_source.fields.source.split.strategy.options.whole": "3eae5cd7567cf40a", "metadataForms.knowledge_source.fields.source.where.helpText": "45098881521ffbd5", "metadataForms.knowledge_source.fields.source.where.label": "cae99e947da34116", "metadataForms.knowledge_source.sections.basics.description": "c232f620677bab66", diff --git a/packages/platform-objects/src/apps/translations/bare-type-display-echo-decisions.test.ts b/packages/platform-objects/src/apps/translations/bare-type-display-echo-decisions.test.ts index dbacb07f98a..c9e1f292ebe 100644 --- a/packages/platform-objects/src/apps/translations/bare-type-display-echo-decisions.test.ts +++ b/packages/platform-objects/src/apps/translations/bare-type-display-echo-decisions.test.ts @@ -821,16 +821,19 @@ describe('#19403 round 7 — the population, DERIVED from the registry and a sha // #37143), so it is a panel type now. // 15 → 16: `form` joined bare (ADR-0159 card ②, #37086). // 16 / 18 → 17 / 18: `knowledge_source` arrives bare (#37304). - expect(BARE_TYPES.length).toBe(17); - expect(PANEL_TYPES.length).toBe(18); + // 17 / 18 → 16 / 19: `knowledge_source` gained its form (ADR-0161 K4 + // clause 2, #37309), so it is a panel type now. + expect(BARE_TYPES.length).toBe(16); + expect(PANEL_TYPES.length).toBe(19); 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']) { expect(BARE_TYPES, `${type} is bare`).toContain(type); } for (const type of AUTHORED_BARE_TYPES) expect(BARE_TYPES, `${type} is bare`).toContain(type); - // 28 leaves: seventeen labels, and a description on the eleven that carry one. - expect(BARE_LEAVES.length).toBe(28); - expect(BARE_LEAVES.filter((l) => l.prop === 'label').length).toBe(17); + // 27 leaves: sixteen labels, and a description on the eleven that carry one + // (`knowledge_source`, label only, left the class with its form, #37309). + expect(BARE_LEAVES.length).toBe(27); + expect(BARE_LEAVES.filter((l) => l.prop === 'label').length).toBe(16); expect(BARE_LEAVES.filter((l) => l.prop === 'description').length).toBe(11); expect(BARE_LEAVES.every((l) => ['label', 'description'].includes(l.prop))).toBe(true); }); @@ -912,13 +915,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 28 leaves echoes in all three locales', () => { + it('⭐ this class is now DONE — zero of its 27 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(28); + expect(BARE_LEAVES.length).toBe(27); }); }); diff --git a/packages/platform-objects/src/apps/translations/de.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/de.metadata-forms.generated.ts index 5cc2192e562..7aadf243f50 100644 --- a/packages/platform-objects/src/apps/translations/de.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/de.metadata-forms.generated.ts @@ -3534,7 +3534,7 @@ export const deMetadataForms: NonNullable = { label: "Kind", helpText: "What the source indexes. A source indexes the records of one object.", options: { - object: "Records of an object" + object: "Datensätze eines Objekts" } }, "source.object": { @@ -3561,9 +3561,9 @@ export const deMetadataForms: NonNullable = { label: "Strategy", helpText: "Whole: one passage per document. Recursive: cut at blank lines, then line breaks, then sentence ends. Markdown: one passage per heading, carrying its heading path.", options: { - whole: "Whole document", - recursive: "Recursive", - markdown: "Markdown sections" + whole: "Ganzes Dokument", + recursive: "Rekursiv", + markdown: "Markdown-Abschnitte" } }, "source.split.maxChars": { diff --git a/packages/platform-objects/src/apps/translations/de.source-hashes.generated.ts b/packages/platform-objects/src/apps/translations/de.source-hashes.generated.ts index 632c1fbd492..5f8f593ec2e 100644 --- a/packages/platform-objects/src/apps/translations/de.source-hashes.generated.ts +++ b/packages/platform-objects/src/apps/translations/de.source-hashes.generated.ts @@ -104,7 +104,6 @@ export const deGeneratedSourceHashes: Readonly> = { "metadataForms.knowledge_source.fields.source.helpText": "0b648dbc7af2f85c", "metadataForms.knowledge_source.fields.source.kind.helpText": "98e903260393800d", "metadataForms.knowledge_source.fields.source.kind.label": "3acd2ee4b0e7f2cf", - "metadataForms.knowledge_source.fields.source.kind.options.object": "e094ff2c1c3a195a", "metadataForms.knowledge_source.fields.source.label": "8fe786e8e29c8cec", "metadataForms.knowledge_source.fields.source.metadataFields.helpText": "8f41aea242f1a77e", "metadataForms.knowledge_source.fields.source.metadataFields.label": "de294fc128e44483", @@ -118,9 +117,6 @@ export const deGeneratedSourceHashes: Readonly> = { "metadataForms.knowledge_source.fields.source.split.minChars.label": "f8a2b05e9c16afda", "metadataForms.knowledge_source.fields.source.split.strategy.helpText": "f3ff47d9386b7956", "metadataForms.knowledge_source.fields.source.split.strategy.label": "785c1dd353da380b", - "metadataForms.knowledge_source.fields.source.split.strategy.options.markdown": "ed9a22aca881fe59", - "metadataForms.knowledge_source.fields.source.split.strategy.options.recursive": "c38548b1e854c675", - "metadataForms.knowledge_source.fields.source.split.strategy.options.whole": "3eae5cd7567cf40a", "metadataForms.knowledge_source.fields.source.where.helpText": "45098881521ffbd5", "metadataForms.knowledge_source.fields.source.where.label": "cae99e947da34116", "metadataForms.knowledge_source.sections.basics.description": "c232f620677bab66", diff --git a/packages/platform-objects/src/apps/translations/fr.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/fr.metadata-forms.generated.ts index 61ab260b806..99f64f8f750 100644 --- a/packages/platform-objects/src/apps/translations/fr.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/fr.metadata-forms.generated.ts @@ -3534,7 +3534,7 @@ export const frMetadataForms: NonNullable = { label: "Kind", helpText: "What the source indexes. A source indexes the records of one object.", options: { - object: "Records of an object" + object: "Enregistrements d'un objet" } }, "source.object": { @@ -3561,9 +3561,9 @@ export const frMetadataForms: NonNullable = { label: "Strategy", helpText: "Whole: one passage per document. Recursive: cut at blank lines, then line breaks, then sentence ends. Markdown: one passage per heading, carrying its heading path.", options: { - whole: "Whole document", - recursive: "Recursive", - markdown: "Markdown sections" + whole: "Document entier", + recursive: "Récursif", + markdown: "Sections Markdown" } }, "source.split.maxChars": { diff --git a/packages/platform-objects/src/apps/translations/fr.source-hashes.generated.ts b/packages/platform-objects/src/apps/translations/fr.source-hashes.generated.ts index 09fccb491d9..aeeb137c592 100644 --- a/packages/platform-objects/src/apps/translations/fr.source-hashes.generated.ts +++ b/packages/platform-objects/src/apps/translations/fr.source-hashes.generated.ts @@ -125,7 +125,6 @@ export const frGeneratedSourceHashes: Readonly> = { "metadataForms.knowledge_source.fields.source.helpText": "0b648dbc7af2f85c", "metadataForms.knowledge_source.fields.source.kind.helpText": "98e903260393800d", "metadataForms.knowledge_source.fields.source.kind.label": "3acd2ee4b0e7f2cf", - "metadataForms.knowledge_source.fields.source.kind.options.object": "e094ff2c1c3a195a", "metadataForms.knowledge_source.fields.source.label": "8fe786e8e29c8cec", "metadataForms.knowledge_source.fields.source.metadataFields.helpText": "8f41aea242f1a77e", "metadataForms.knowledge_source.fields.source.metadataFields.label": "de294fc128e44483", @@ -139,9 +138,6 @@ export const frGeneratedSourceHashes: Readonly> = { "metadataForms.knowledge_source.fields.source.split.minChars.label": "f8a2b05e9c16afda", "metadataForms.knowledge_source.fields.source.split.strategy.helpText": "f3ff47d9386b7956", "metadataForms.knowledge_source.fields.source.split.strategy.label": "785c1dd353da380b", - "metadataForms.knowledge_source.fields.source.split.strategy.options.markdown": "ed9a22aca881fe59", - "metadataForms.knowledge_source.fields.source.split.strategy.options.recursive": "c38548b1e854c675", - "metadataForms.knowledge_source.fields.source.split.strategy.options.whole": "3eae5cd7567cf40a", "metadataForms.knowledge_source.fields.source.where.helpText": "45098881521ffbd5", "metadataForms.knowledge_source.fields.source.where.label": "cae99e947da34116", "metadataForms.knowledge_source.sections.basics.description": "c232f620677bab66", diff --git a/packages/platform-objects/src/apps/translations/ko.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/ko.metadata-forms.generated.ts index eee919a5065..6c8c497c5bf 100644 --- a/packages/platform-objects/src/apps/translations/ko.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/ko.metadata-forms.generated.ts @@ -3534,7 +3534,7 @@ export const koMetadataForms: NonNullable = { label: "Kind", helpText: "What the source indexes. A source indexes the records of one object.", options: { - object: "Records of an object" + object: "객체의 레코드" } }, "source.object": { @@ -3561,9 +3561,9 @@ export const koMetadataForms: NonNullable = { label: "Strategy", helpText: "Whole: one passage per document. Recursive: cut at blank lines, then line breaks, then sentence ends. Markdown: one passage per heading, carrying its heading path.", options: { - whole: "Whole document", - recursive: "Recursive", - markdown: "Markdown sections" + whole: "전체 문서", + recursive: "재귀", + markdown: "Markdown 섹션" } }, "source.split.maxChars": { diff --git a/packages/platform-objects/src/apps/translations/ko.source-hashes.generated.ts b/packages/platform-objects/src/apps/translations/ko.source-hashes.generated.ts index ff160c1defd..bcca80a75c0 100644 --- a/packages/platform-objects/src/apps/translations/ko.source-hashes.generated.ts +++ b/packages/platform-objects/src/apps/translations/ko.source-hashes.generated.ts @@ -69,7 +69,6 @@ export const koGeneratedSourceHashes: Readonly> = { "metadataForms.knowledge_source.fields.source.helpText": "0b648dbc7af2f85c", "metadataForms.knowledge_source.fields.source.kind.helpText": "98e903260393800d", "metadataForms.knowledge_source.fields.source.kind.label": "3acd2ee4b0e7f2cf", - "metadataForms.knowledge_source.fields.source.kind.options.object": "e094ff2c1c3a195a", "metadataForms.knowledge_source.fields.source.label": "8fe786e8e29c8cec", "metadataForms.knowledge_source.fields.source.metadataFields.helpText": "8f41aea242f1a77e", "metadataForms.knowledge_source.fields.source.metadataFields.label": "de294fc128e44483", @@ -83,9 +82,6 @@ export const koGeneratedSourceHashes: Readonly> = { "metadataForms.knowledge_source.fields.source.split.minChars.label": "f8a2b05e9c16afda", "metadataForms.knowledge_source.fields.source.split.strategy.helpText": "f3ff47d9386b7956", "metadataForms.knowledge_source.fields.source.split.strategy.label": "785c1dd353da380b", - "metadataForms.knowledge_source.fields.source.split.strategy.options.markdown": "ed9a22aca881fe59", - "metadataForms.knowledge_source.fields.source.split.strategy.options.recursive": "c38548b1e854c675", - "metadataForms.knowledge_source.fields.source.split.strategy.options.whole": "3eae5cd7567cf40a", "metadataForms.knowledge_source.fields.source.where.helpText": "45098881521ffbd5", "metadataForms.knowledge_source.fields.source.where.label": "cae99e947da34116", "metadataForms.knowledge_source.sections.basics.description": "c232f620677bab66", diff --git a/packages/platform-objects/src/apps/translations/object-lifecycle-panel-echo-decisions.test.ts b/packages/platform-objects/src/apps/translations/object-lifecycle-panel-echo-decisions.test.ts index 51145085029..f002fce436e 100644 --- a/packages/platform-objects/src/apps/translations/object-lifecycle-panel-echo-decisions.test.ts +++ b/packages/platform-objects/src/apps/translations/object-lifecycle-panel-echo-decisions.test.ts @@ -1350,7 +1350,10 @@ describe('#19403 round 10 — the verdicts, on the live bundles', () => { // all three locales. // 845 since #37304: the `knowledge_source` type's own label (ADR-0161 // K4), authored in every locale. - expect(translated.length, `${locale} positive control`).toBe(845); + // 865 since #37309: the `knowledge_source` form (ADR-0161 K4 clause 2) + // — twenty of its section and row labels, authored in all three + // locales. + expect(translated.length, `${locale} positive control`).toBe(865); } // ⭐ DARK — the blindness, executable. On a synthetic two-locale catalog the // all-three predicate returns 0 while the per-locale one returns 1, so the diff --git a/packages/platform-objects/src/apps/translations/pt-BR.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/pt-BR.metadata-forms.generated.ts index e53a0f95d34..f1346b595f8 100644 --- a/packages/platform-objects/src/apps/translations/pt-BR.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/pt-BR.metadata-forms.generated.ts @@ -3534,7 +3534,7 @@ export const ptBRMetadataForms: NonNullable = label: "Kind", helpText: "What the source indexes. A source indexes the records of one object.", options: { - object: "Records of an object" + object: "Registros de um objeto" } }, "source.object": { @@ -3561,9 +3561,9 @@ export const ptBRMetadataForms: NonNullable = label: "Strategy", helpText: "Whole: one passage per document. Recursive: cut at blank lines, then line breaks, then sentence ends. Markdown: one passage per heading, carrying its heading path.", options: { - whole: "Whole document", - recursive: "Recursive", - markdown: "Markdown sections" + whole: "Documento inteiro", + recursive: "Recursivo", + markdown: "Seções Markdown" } }, "source.split.maxChars": { diff --git a/packages/platform-objects/src/apps/translations/pt-BR.source-hashes.generated.ts b/packages/platform-objects/src/apps/translations/pt-BR.source-hashes.generated.ts index 12bcccbe3ed..07292e81d0f 100644 --- a/packages/platform-objects/src/apps/translations/pt-BR.source-hashes.generated.ts +++ b/packages/platform-objects/src/apps/translations/pt-BR.source-hashes.generated.ts @@ -81,7 +81,6 @@ export const ptBRGeneratedSourceHashes: Readonly> = { "metadataForms.knowledge_source.fields.source.helpText": "0b648dbc7af2f85c", "metadataForms.knowledge_source.fields.source.kind.helpText": "98e903260393800d", "metadataForms.knowledge_source.fields.source.kind.label": "3acd2ee4b0e7f2cf", - "metadataForms.knowledge_source.fields.source.kind.options.object": "e094ff2c1c3a195a", "metadataForms.knowledge_source.fields.source.label": "8fe786e8e29c8cec", "metadataForms.knowledge_source.fields.source.metadataFields.helpText": "8f41aea242f1a77e", "metadataForms.knowledge_source.fields.source.metadataFields.label": "de294fc128e44483", @@ -95,9 +94,6 @@ export const ptBRGeneratedSourceHashes: Readonly> = { "metadataForms.knowledge_source.fields.source.split.minChars.label": "f8a2b05e9c16afda", "metadataForms.knowledge_source.fields.source.split.strategy.helpText": "f3ff47d9386b7956", "metadataForms.knowledge_source.fields.source.split.strategy.label": "785c1dd353da380b", - "metadataForms.knowledge_source.fields.source.split.strategy.options.markdown": "ed9a22aca881fe59", - "metadataForms.knowledge_source.fields.source.split.strategy.options.recursive": "c38548b1e854c675", - "metadataForms.knowledge_source.fields.source.split.strategy.options.whole": "3eae5cd7567cf40a", "metadataForms.knowledge_source.fields.source.where.helpText": "45098881521ffbd5", "metadataForms.knowledge_source.fields.source.where.label": "cae99e947da34116", "metadataForms.knowledge_source.sections.basics.description": "c232f620677bab66", diff --git a/packages/platform-objects/src/apps/translations/ru.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/ru.metadata-forms.generated.ts index 87ed53d1654..819c701a4a5 100644 --- a/packages/platform-objects/src/apps/translations/ru.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/ru.metadata-forms.generated.ts @@ -3534,7 +3534,7 @@ export const ruMetadataForms: NonNullable = { label: "Kind", helpText: "What the source indexes. A source indexes the records of one object.", options: { - object: "Records of an object" + object: "Записи объекта" } }, "source.object": { @@ -3561,9 +3561,9 @@ export const ruMetadataForms: NonNullable = { label: "Strategy", helpText: "Whole: one passage per document. Recursive: cut at blank lines, then line breaks, then sentence ends. Markdown: one passage per heading, carrying its heading path.", options: { - whole: "Whole document", - recursive: "Recursive", - markdown: "Markdown sections" + whole: "Документ целиком", + recursive: "Рекурсивно", + markdown: "Разделы Markdown" } }, "source.split.maxChars": { diff --git a/packages/platform-objects/src/apps/translations/ru.source-hashes.generated.ts b/packages/platform-objects/src/apps/translations/ru.source-hashes.generated.ts index c04c829b305..5c50c2a2711 100644 --- a/packages/platform-objects/src/apps/translations/ru.source-hashes.generated.ts +++ b/packages/platform-objects/src/apps/translations/ru.source-hashes.generated.ts @@ -69,7 +69,6 @@ export const ruGeneratedSourceHashes: Readonly> = { "metadataForms.knowledge_source.fields.source.helpText": "0b648dbc7af2f85c", "metadataForms.knowledge_source.fields.source.kind.helpText": "98e903260393800d", "metadataForms.knowledge_source.fields.source.kind.label": "3acd2ee4b0e7f2cf", - "metadataForms.knowledge_source.fields.source.kind.options.object": "e094ff2c1c3a195a", "metadataForms.knowledge_source.fields.source.label": "8fe786e8e29c8cec", "metadataForms.knowledge_source.fields.source.metadataFields.helpText": "8f41aea242f1a77e", "metadataForms.knowledge_source.fields.source.metadataFields.label": "de294fc128e44483", @@ -83,9 +82,6 @@ export const ruGeneratedSourceHashes: Readonly> = { "metadataForms.knowledge_source.fields.source.split.minChars.label": "f8a2b05e9c16afda", "metadataForms.knowledge_source.fields.source.split.strategy.helpText": "f3ff47d9386b7956", "metadataForms.knowledge_source.fields.source.split.strategy.label": "785c1dd353da380b", - "metadataForms.knowledge_source.fields.source.split.strategy.options.markdown": "ed9a22aca881fe59", - "metadataForms.knowledge_source.fields.source.split.strategy.options.recursive": "c38548b1e854c675", - "metadataForms.knowledge_source.fields.source.split.strategy.options.whole": "3eae5cd7567cf40a", "metadataForms.knowledge_source.fields.source.where.helpText": "45098881521ffbd5", "metadataForms.knowledge_source.fields.source.where.label": "cae99e947da34116", "metadataForms.knowledge_source.sections.basics.description": "c232f620677bab66", diff --git a/packages/platform-objects/src/apps/translations/zh-Hant.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/zh-Hant.metadata-forms.generated.ts index ca27f316a20..be97185f85f 100644 --- a/packages/platform-objects/src/apps/translations/zh-Hant.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/zh-Hant.metadata-forms.generated.ts @@ -3534,7 +3534,7 @@ export const zhHantMetadataForms: NonNullable label: "Kind", helpText: "What the source indexes. A source indexes the records of one object.", options: { - object: "Records of an object" + object: "物件的記錄" } }, "source.object": { @@ -3561,9 +3561,9 @@ export const zhHantMetadataForms: NonNullable label: "Strategy", helpText: "Whole: one passage per document. Recursive: cut at blank lines, then line breaks, then sentence ends. Markdown: one passage per heading, carrying its heading path.", options: { - whole: "Whole document", - recursive: "Recursive", - markdown: "Markdown sections" + whole: "整份文件", + recursive: "遞迴", + markdown: "Markdown 章節" } }, "source.split.maxChars": { diff --git a/packages/platform-objects/src/apps/translations/zh-Hant.source-hashes.generated.ts b/packages/platform-objects/src/apps/translations/zh-Hant.source-hashes.generated.ts index 9cf800846c9..24b354e83db 100644 --- a/packages/platform-objects/src/apps/translations/zh-Hant.source-hashes.generated.ts +++ b/packages/platform-objects/src/apps/translations/zh-Hant.source-hashes.generated.ts @@ -67,7 +67,6 @@ export const zhHantGeneratedSourceHashes: Readonly> = { "metadataForms.knowledge_source.fields.source.helpText": "0b648dbc7af2f85c", "metadataForms.knowledge_source.fields.source.kind.helpText": "98e903260393800d", "metadataForms.knowledge_source.fields.source.kind.label": "3acd2ee4b0e7f2cf", - "metadataForms.knowledge_source.fields.source.kind.options.object": "e094ff2c1c3a195a", "metadataForms.knowledge_source.fields.source.label": "8fe786e8e29c8cec", "metadataForms.knowledge_source.fields.source.metadataFields.helpText": "8f41aea242f1a77e", "metadataForms.knowledge_source.fields.source.metadataFields.label": "de294fc128e44483", @@ -81,9 +80,6 @@ export const zhHantGeneratedSourceHashes: Readonly> = { "metadataForms.knowledge_source.fields.source.split.minChars.label": "f8a2b05e9c16afda", "metadataForms.knowledge_source.fields.source.split.strategy.helpText": "f3ff47d9386b7956", "metadataForms.knowledge_source.fields.source.split.strategy.label": "785c1dd353da380b", - "metadataForms.knowledge_source.fields.source.split.strategy.options.markdown": "ed9a22aca881fe59", - "metadataForms.knowledge_source.fields.source.split.strategy.options.recursive": "c38548b1e854c675", - "metadataForms.knowledge_source.fields.source.split.strategy.options.whole": "3eae5cd7567cf40a", "metadataForms.knowledge_source.fields.source.where.helpText": "45098881521ffbd5", "metadataForms.knowledge_source.fields.source.where.label": "cae99e947da34116", "metadataForms.knowledge_source.sections.basics.description": "c232f620677bab66", From 613670cdadb03c0857b2aad82aa2e1774f9dfeca Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 28 Nov 2026 12:54:29 +0000 Subject: [PATCH 7/9] docs(changeset): the knowledge source choices are named in every locale Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP --- .changeset/37309-knowledge-source-studio-form.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/37309-knowledge-source-studio-form.md b/.changeset/37309-knowledge-source-studio-form.md index 271abed46ce..0c1ed770f82 100644 --- a/.changeset/37309-knowledge-source-studio-form.md +++ b/.changeset/37309-knowledge-source-studio-form.md @@ -17,4 +17,4 @@ ADR-0161 K4, clause 2 (runtime authoring). A knowledge source can now be created - **Refresh.** `refresh.onRecordChange`. - No control is offered for a key the type does not carry (`embedding`, `vectorStore`, `adapterConfig`, `refresh.cron`, a `'*'` member). - **Field pickers follow the object the form declares.** Studio's metadata editor bound its field pickers to an object found at a fixed set of item paths (`interfaceConfig.source`, `data.object`, `object`, `objectName`); it now also reads the path the type's form declares on its picker rows (`dependsOn`, under the composites the row sits in), which is how a knowledge source's pickers offer the fields of `source.object`. Types the fixed set already served are bound as before. -- **Translations.** The form's section and help strings are in the Setup bundles (`@objectstack/platform-objects`), translated for zh-CN, ja-JP and es-ES; the other locales carry the English text until they are translated, as for every metadata form. +- **Translations.** The form's section and help strings are in the Setup bundles (`@objectstack/platform-objects`), translated for zh-CN, ja-JP and es-ES; in the other locales the select choices are translated and the rest carries the English text until it is translated, as for every metadata form. From 0b20f7cce9e33c6829b95a85feb1926853d9299d Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 28 Nov 2026 14:12:56 +0000 Subject: [PATCH 8/9] fix(spec): a knowledge source's split strategy is required once the group is used; the edit round trip is pinned The form marks `source.split.strategy` required and its help says the blank default holds only when the whole group is blank: a passage length without a strategy is refused at save (`KnowledgeSplitSchema`), and a nested mark is the asterisk only. Pinned: `split: { maxChars }` alone is refused at `source.split.strategy`, with a strategy it parses. The dogfood round trip now edits too: the read-back source, changed and saved through the same door, reads back with the change and the search follows it with no restart. Its header says the body is a literal of the keys the form offers. A Studio editor test types into the label and passage-length controls and asserts the body the Save writes. zh-CN, ja-JP and es-ES carry the reworded help; en regenerated. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP --- .../en.metadata-forms.generated.ts | 6 +- .../es-ES.metadata-forms.generated.ts | 6 +- .../ja-JP.metadata-forms.generated.ts | 6 +- .../zh-CN.metadata-forms.generated.ts | 6 +- ...ge-source-studio-roundtrip.dogfood.test.ts | 56 +++++++++++++++++-- .../ai/knowledge-source.metadata-form.test.ts | 15 +++++ .../src/ai/knowledge-source.metadata-form.ts | 9 ++- ...rceEditPage.formBoundObject-37309.test.tsx | 51 ++++++++++++++++- 8 files changed, 134 insertions(+), 21 deletions(-) diff --git a/packages/platform-objects/src/apps/translations/en.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/en.metadata-forms.generated.ts index 56923ba7ffa..3952dcfe568 100644 --- a/packages/platform-objects/src/apps/translations/en.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/en.metadata-forms.generated.ts @@ -3559,7 +3559,7 @@ export const enMetadataForms: NonNullable = { }, "source.split": { label: "Passages", - helpText: "How each document is cut into passages. Blank: recursive, with the settings page's chunk size (800 characters unless changed)." + helpText: "How each document is cut into passages. Leave the whole group blank for recursive with the settings page's chunk size (800 characters unless changed). To set a passage length, choose a strategy too: a length without a strategy is refused at save." }, "source.split.strategy": { label: "Strategy", @@ -3572,11 +3572,11 @@ export const enMetadataForms: NonNullable = { }, "source.split.maxChars": { label: "Longest passage", - helpText: "In characters. Wins over the settings page's chunk size; the embedding model's input limit can lower it. Not read by Whole document." + helpText: "In characters. Needs a strategy. Wins over the settings page's chunk size; the embedding model's input limit can lower it. Not read by Whole document." }, "source.split.minChars": { label: "Shortest passage", - helpText: "Adjacent pieces shorter than this are merged, up to this length (default 200). Recursive and Markdown only." + helpText: "In characters. Needs a strategy. Adjacent pieces shorter than this are merged, up to this length (default 200). Recursive and Markdown only." }, refresh: { label: "Refresh", diff --git a/packages/platform-objects/src/apps/translations/es-ES.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/es-ES.metadata-forms.generated.ts index 67a1cf9b9b4..b7e23abe90e 100644 --- a/packages/platform-objects/src/apps/translations/es-ES.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/es-ES.metadata-forms.generated.ts @@ -3559,7 +3559,7 @@ export const esESMetadataForms: NonNullable = }, "source.split": { label: "Pasajes", - helpText: "Cómo se divide cada documento en pasajes. En blanco: recursiva, con el tamaño de fragmento de la página de configuración (800 caracteres si no se ha cambiado)." + helpText: "Cómo se divide cada documento en pasajes. Deje todo el grupo en blanco para usar la estrategia recursiva con el tamaño de fragmento de la página de configuración (800 caracteres si no se ha cambiado). Para fijar una longitud de pasaje, elija también una estrategia: una longitud sin estrategia se rechaza al guardar." }, "source.split.strategy": { label: "Estrategia", @@ -3572,11 +3572,11 @@ export const esESMetadataForms: NonNullable = }, "source.split.maxChars": { label: "Pasaje más largo", - helpText: "En caracteres. Prevalece sobre el tamaño de fragmento de la página de configuración; el límite de entrada del modelo de embeddings puede reducirlo. Documento completo no lo lee." + helpText: "En caracteres. Requiere una estrategia. Prevalece sobre el tamaño de fragmento de la página de configuración; el límite de entrada del modelo de embeddings puede reducirlo. Documento completo no lo lee." }, "source.split.minChars": { label: "Pasaje más corto", - helpText: "Las piezas adyacentes más cortas que esto se fusionan, hasta esta longitud (200 de forma predeterminada). Solo Recursiva y Markdown." + helpText: "En caracteres. Requiere una estrategia. Las piezas adyacentes más cortas que esto se fusionan, hasta esta longitud (200 de forma predeterminada). Solo Recursiva y Markdown." }, refresh: { label: "Actualización", diff --git a/packages/platform-objects/src/apps/translations/ja-JP.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/ja-JP.metadata-forms.generated.ts index b2c5824e182..7986b5e7d8f 100644 --- a/packages/platform-objects/src/apps/translations/ja-JP.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/ja-JP.metadata-forms.generated.ts @@ -3559,7 +3559,7 @@ export const jaJPMetadataForms: NonNullable = }, "source.split": { label: "パッセージ", - helpText: "各ドキュメントをパッセージに分割する方法。空欄:再帰分割で、設定ページのチャンクサイズ(変更されていなければ 800 文字)を使用します。" + helpText: "各ドキュメントをパッセージに分割する方法。グループ全体を空欄にすると、再帰分割で設定ページのチャンクサイズ(変更されていなければ 800 文字)を使用します。パッセージの長さを設定する場合は戦略も選択してください。戦略のない長さは保存時に拒否されます。" }, "source.split.strategy": { label: "方式", @@ -3572,11 +3572,11 @@ export const jaJPMetadataForms: NonNullable = }, "source.split.maxChars": { label: "最長パッセージ", - helpText: "文字数。設定ページのチャンクサイズより優先されます。埋め込みモデルの入力上限によって小さくなる場合があります。ドキュメント全体では読み取られません。" + helpText: "文字数。戦略が必要です。設定ページのチャンクサイズより優先されます。埋め込みモデルの入力上限によって小さくなる場合があります。ドキュメント全体では読み取られません。" }, "source.split.minChars": { label: "最短パッセージ", - helpText: "この長さより短い隣接する断片は、この長さまで結合されます(既定 200)。再帰と Markdown のみ。" + helpText: "文字数。戦略が必要です。この長さより短い隣接する断片は、この長さまで結合されます(既定 200)。再帰と Markdown のみ。" }, refresh: { label: "更新", diff --git a/packages/platform-objects/src/apps/translations/zh-CN.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/zh-CN.metadata-forms.generated.ts index 55b12328490..ab8bcd54dcf 100644 --- a/packages/platform-objects/src/apps/translations/zh-CN.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/zh-CN.metadata-forms.generated.ts @@ -3559,7 +3559,7 @@ export const zhCNMetadataForms: NonNullable = }, "source.split": { label: "段落", - helpText: "每个文档如何切分为段落。留空:递归切分,使用设置页的分块大小(未修改时为 800 个字符)。" + helpText: "每个文档如何切分为段落。整组留空则递归切分,使用设置页的分块大小(未修改时为 800 个字符)。若要设置段落长度,还须选择策略:只有长度而没有策略,保存时会被拒绝。" }, "source.split.strategy": { label: "策略", @@ -3572,11 +3572,11 @@ export const zhCNMetadataForms: NonNullable = }, "source.split.maxChars": { label: "最长段落", - helpText: "以字符计。优先于设置页的分块大小;嵌入模型的输入上限可能会降低它。整篇文档策略不读取此值。" + helpText: "以字符计。需要选择策略。优先于设置页的分块大小;嵌入模型的输入上限可能会降低它。整篇文档策略不读取此值。" }, "source.split.minChars": { label: "最短段落", - helpText: "短于此长度的相邻片段会被合并,直至达到此长度(默认 200)。仅适用于递归和 Markdown。" + helpText: "以字符计。需要选择策略。短于此长度的相邻片段会被合并,直至达到此长度(默认 200)。仅适用于递归和 Markdown。" }, refresh: { label: "刷新", diff --git a/packages/qa/dogfood/test/knowledge-source-studio-roundtrip.dogfood.test.ts b/packages/qa/dogfood/test/knowledge-source-studio-roundtrip.dogfood.test.ts index eb33404616a..0b05644e5c7 100644 --- a/packages/qa/dogfood/test/knowledge-source-studio-roundtrip.dogfood.test.ts +++ b/packages/qa/dogfood/test/knowledge-source-studio-roundtrip.dogfood.test.ts @@ -12,11 +12,16 @@ // of that object, named by its object and id, from the new source; // ⭐ reopened, the item reads back every value the form wrote, as written, // and parses with `KnowledgeSourceSchema`; -// ⭐ CONTROL: before the publish, the tool lists no such source. +// ⭐ CONTROL: before the publish, the tool lists no such source; +// ⭐ EDIT: the read-back body, changed and saved through the same door (draft +// PUT, publish), reads back with the change and nothing else moved, and +// the search answers from the edited source with no restart. // -// The browser half (the form itself, its pickers bound to `source.object`) is -// pinned in `ui/packages/app-shell`, against the real editor; this file pins -// what the form's body does once it reaches the doors. +// `FORM_BODY` is a hand-written literal holding every key the form offers, in +// the shapes its controls write; no test here drives the form's own controls +// to a Save. The browser half (the form itself, its pickers bound to +// `source.object`) is pinned in `ui/packages/app-shell`, against the real +// editor; this file pins what such a body does once it reaches the doors. // // The verify harness mounts no MCP server, so this file mounts one, as // `objectstack dev` and `serve` do. A session bearer carries no OAuth grant, @@ -146,4 +151,47 @@ describe('[ADR-0161 K4] a knowledge source authored through Studio\'s wire is se const parsed = KnowledgeSourceSchema.safeParse(stripReadDecorations(served)); expect(parsed.success, JSON.stringify(parsed.error?.issues)).toBe(true); }); + + it('EDIT: the read-back source, changed and saved through the same door, reads back with the change, and the search follows it', async () => { + const before = await stack.apiAs(admin, 'GET', `/meta/knowledge_source/${SOURCE}`); + expect(before.status, await before.clone().text()).toBe(200); + const beforeJson: any = await before.json(); + const stored = stripReadDecorations(beforeJson?.item ?? beforeJson?.data ?? beforeJson) as Record; + // What an author changes in the form: the label, the content order, and the passage length. + const edited = { + ...stored, + label: 'Open tasks (edited in Studio)', + source: { ...stored.source, content: ['notes', 'title'], split: { strategy: 'recursive', maxChars: 400, minChars: 100 } }, + }; + const draft = await stack.apiAs(admin, 'PUT', `/meta/knowledge_source/${SOURCE}?mode=draft`, edited); + expect(draft.status, await draft.clone().text()).toBe(200); + const published = await stack.apiAs(admin, 'POST', `/meta/knowledge_source/${SOURCE}/publish`, {}); + expect(published.status, await published.clone().text()).toBe(200); + + const after = await stack.apiAs(admin, 'GET', `/meta/knowledge_source/${SOURCE}`); + expect(after.status, await after.clone().text()).toBe(200); + const afterJson: any = await after.json(); + const served = afterJson?.item ?? afterJson?.data ?? afterJson; + expect(stripReadDecorations(served)).toMatchObject({ + ...FORM_BODY, + label: edited.label, + source: { ...FORM_BODY.source, content: ['notes', 'title'], split: { strategy: 'recursive', maxChars: 400, minChars: 100 } }, + }); + expect(served.adapter).toBeUndefined(); + expect(KnowledgeSourceSchema.safeParse(stripReadDecorations(served)).success).toBe(true); + + // The live service follows the edit with no restart: the sources list names the new label. + const deadline = Date.now() + 30_000; + let last: Awaited> | undefined; + let listed = false; + while (Date.now() < deadline) { + last = await tool('search_knowledge', { query: MARKER, sourceIds: [SOURCE] }); + listed = !last.isError && (last.payload.sources as Array<{ id: string; label: string }>).some((s) => s.id === SOURCE && s.label === edited.label); + const hit = !last.isError && (last.payload.hits as any[]).some((h) => h.record?.id === taskId); + if (listed && hit) break; + await new Promise((r) => setTimeout(r, 250)); + } + expect(listed, last?.text).toBe(true); + expect((last!.payload.hits as any[]).some((h) => h.record?.id === taskId), last?.text).toBe(true); + }); }); diff --git a/packages/spec/src/ai/knowledge-source.metadata-form.test.ts b/packages/spec/src/ai/knowledge-source.metadata-form.test.ts index 78e78ccd288..fd2efc96593 100644 --- a/packages/spec/src/ai/knowledge-source.metadata-form.test.ts +++ b/packages/spec/src/ai/knowledge-source.metadata-form.test.ts @@ -64,6 +64,21 @@ describe('knowledge_source form (ADR-0161 K4 clause 2)', () => { expect(strategy?.options?.map((o) => o.value)).toEqual(['whole', 'recursive', 'markdown']); }); + it('marks `split.strategy` required, and says a length needs one: the schema refuses `split` with a length alone', () => { + const split = sourceRow('split'); + expect(split?.fields?.find((r) => r.field === 'strategy')).toMatchObject({ required: true }); + // A nested mark is display-only in the editor, so the group's help carries the rule. + expect(split?.helpText).toMatch(/whole group blank/); + expect(split?.helpText).toMatch(/a length without a strategy is refused at save/); + const base = { name: 'a', label: 'A', source: { kind: 'object', object: 'task', content: ['title'] } }; + const lengthOnly = KnowledgeSourceSchema.safeParse({ ...base, source: { ...base.source, split: { maxChars: 600 } } }); + expect(lengthOnly.success).toBe(false); + expect(lengthOnly.error?.issues.map((i) => i.path.join('.'))).toContain('source.split.strategy'); + // CONTROL: the same length with a strategy parses, and so does a blank group. + expect(KnowledgeSourceSchema.safeParse({ ...base, source: { ...base.source, split: { strategy: 'recursive', maxChars: 600 } } }).success).toBe(true); + expect(KnowledgeSourceSchema.safeParse(base).success).toBe(true); + }); + it('edits `where` as an ObjectQL filter object (the JSON editor), not as a view rule list', () => { // `filter-builder` writes `[{ field, operator, value }]`; `where` is a record, which refuses a list. expect(sourceRow('where')).toMatchObject({ widget: 'json' }); diff --git a/packages/spec/src/ai/knowledge-source.metadata-form.ts b/packages/spec/src/ai/knowledge-source.metadata-form.ts index ce4c35b258a..c98588fff90 100644 --- a/packages/spec/src/ai/knowledge-source.metadata-form.ts +++ b/packages/spec/src/ai/knowledge-source.metadata-form.ts @@ -77,11 +77,14 @@ export const knowledgeSourceForm = defineMetadataForm({ field: 'split', label: 'Passages', type: 'composite', - helpText: 'How each document is cut into passages. Blank: recursive, with the settings page\'s chunk size (800 characters unless changed).', + helpText: 'How each document is cut into passages. Leave the whole group blank for recursive with the settings page\'s chunk size (800 characters unless changed). To set a passage length, choose a strategy too: a length without a strategy is refused at save.', fields: [ { field: 'strategy', label: 'Strategy', + // Required once the group is used (`KnowledgeSplitSchema`); a nested mark is + // the asterisk only, so the group's help says what a blank strategy does. + required: true, options: [ { label: 'Whole document', value: 'whole' }, { label: 'Recursive', value: 'recursive' }, @@ -89,8 +92,8 @@ export const knowledgeSourceForm = defineMetadataForm({ ], helpText: 'Whole: one passage per document. Recursive: cut at blank lines, then line breaks, then sentence ends. Markdown: one passage per heading, carrying its heading path.', }, - { field: 'maxChars', label: 'Longest passage', helpText: 'In characters. Wins over the settings page\'s chunk size; the embedding model\'s input limit can lower it. Not read by Whole document.' }, - { field: 'minChars', label: 'Shortest passage', helpText: 'Adjacent pieces shorter than this are merged, up to this length (default 200). Recursive and Markdown only.' }, + { field: 'maxChars', label: 'Longest passage', helpText: 'In characters. Needs a strategy. Wins over the settings page\'s chunk size; the embedding model\'s input limit can lower it. Not read by Whole document.' }, + { field: 'minChars', label: 'Shortest passage', helpText: 'In characters. Needs a strategy. Adjacent pieces shorter than this are merged, up to this length (default 200). Recursive and Markdown only.' }, ], }, ], diff --git a/ui/packages/app-shell/src/views/metadata-admin/ResourceEditPage.formBoundObject-37309.test.tsx b/ui/packages/app-shell/src/views/metadata-admin/ResourceEditPage.formBoundObject-37309.test.tsx index cc6ac03cec1..e87f3ba819f 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/ResourceEditPage.formBoundObject-37309.test.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/ResourceEditPage.formBoundObject-37309.test.tsx @@ -25,7 +25,7 @@ import '@objectstack/formula'; import '@objectstack/lint'; import * as React from 'react'; import { describe, it, expect, vi, afterEach } from 'vitest'; -import { render, screen, cleanup, waitFor } from '@testing-library/react'; +import { render, screen, cleanup, waitFor, fireEvent } from '@testing-library/react'; import { MemoryRouter } from 'react-router-dom'; import { z } from 'zod'; import { knowledgeSourceForm } from '@objectstack/spec/ai'; @@ -46,6 +46,8 @@ const SOURCE = vi.hoisted(() => ({ label: 'Task notes', source: { kind: 'object', object: 'acme_task', content: ['title', 'notes'], metadataFields: ['status'] }, } as Record, + /** A source authored in Studio: an org layer and no code layer, so the editor may write it. */ + orgAuthored: false, })); /** The server's `/meta/types` row for `knowledge_source`: the served form and the served schema. */ @@ -61,11 +63,15 @@ const ENTRY = { const mockClient = { list: vi.fn(async () => []), listDrafts: vi.fn(async () => []), - layered: vi.fn(async () => ({ effective: SOURCE.item, code: SOURCE.item, editable: true })), + layered: vi.fn(async () => (SOURCE.orgAuthored + ? { effective: SOURCE.item, org: SOURCE.item, provenance: 'org', editable: true } + : { effective: SOURCE.item, code: SOURCE.item, editable: true })), getDraft: vi.fn(async () => null), get: vi.fn(async (type: string, name: string) => (type === 'object' && name === TASK.name ? TASK : null)), references: vi.fn(async () => []), saveDraft: vi.fn(async () => ({})), + save: vi.fn(async () => ({})), + publish: vi.fn(async () => ({})), }; vi.mock('./useMetadata', async (importOriginal) => { @@ -90,6 +96,8 @@ registerBuiltinDesigners(); afterEach(() => { cleanup(); mockClient.get.mockClear(); + mockClient.saveDraft.mockClear(); + mockClient.save.mockClear(); }); describe('the object a form\'s field pickers are bound to, as the form declares it (objectstack#37309)', () => { @@ -143,3 +151,42 @@ describe('MetadataResourceEditPage — a knowledge source\'s field pickers offer } }); }); + +describe('MetadataResourceEditPage — what a knowledge source\'s form controls save (objectstack#37309)', () => { + it('an edit typed into the label and passage-length controls is the body the Save writes, the rest as it was', async () => { + const before = SOURCE.item; + SOURCE.item = { + name: 'task_notes', + label: 'Task notes', + source: { kind: 'object', object: 'acme_task', content: ['title', 'notes'], metadataFields: ['status'], split: { strategy: 'recursive' } }, + }; + SOURCE.orgAuthored = true; + try { + render( + + + , + ); + // The header and the read-only body both offer Edit; either enters editing. + fireEvent.click((await screen.findAllByRole('button', { name: 'Edit' }, { timeout: 8000 }))[0]!); + const label = (await screen.findByDisplayValue('Task notes', {}, { timeout: 8000 })) as HTMLInputElement; + fireEvent.change(label, { target: { value: 'Task notes, edited' } }); + fireEvent.change(screen.getByLabelText(/Longest passage/), { target: { value: '400' } }); + // Past the live pass's debounce, so it cannot land after the Save. + await new Promise((r) => setTimeout(r, 400)); + fireEvent.click(screen.getByTestId('resource-save')); + const writes = () => [...mockClient.save.mock.calls, ...mockClient.saveDraft.mock.calls] as unknown as Array<[string, string, any]>; + await waitFor(() => expect(writes().length).toBeGreaterThan(0), { timeout: 8000 }); + const [type, name, body] = writes().at(-1)!; + expect([type, name]).toEqual(['knowledge_source', 'task_notes']); + expect(body).toMatchObject({ + name: 'task_notes', + label: 'Task notes, edited', + source: { kind: 'object', object: 'acme_task', content: ['title', 'notes'], metadataFields: ['status'], split: { strategy: 'recursive', maxChars: 400 } }, + }); + } finally { + SOURCE.item = before; + SOURCE.orgAuthored = false; + } + }); +}); From 59defa6ffe5278e25f8489e778535365bea55bff Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 28 Nov 2026 14:43:33 +0000 Subject: [PATCH 9/9] fix(app-shell): the knowledge source form has a zh-CN overlay Studio's own zh-CN overlay for the spec forms names every METADATA_FORM_REGISTRY type; `knowledge_source` gets its type label and field labels, copied leaf for leaf from the platform's zh-CN bundle. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP --- .../metadata-admin/metadata-form-zh-cn.ts | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/ui/packages/app-shell/src/views/metadata-admin/metadata-form-zh-cn.ts b/ui/packages/app-shell/src/views/metadata-admin/metadata-form-zh-cn.ts index 3c3c900d092..c8070019cac 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/metadata-form-zh-cn.ts +++ b/ui/packages/app-shell/src/views/metadata-admin/metadata-form-zh-cn.ts @@ -736,6 +736,28 @@ export const ZH_CN_SPEC_FORMS: NonNullable = { 'body.field': { label: '正文字段' }, }, }, + knowledge_source: { + label: '知识源', + fields: { + name: { label: '名称' }, + label: { label: '标签' }, + description: { label: '描述' }, + aiExposed: { label: '可供 AI 智能体检索' }, + adapter: { label: '存储' }, + source: { label: '来源' }, + 'source.kind': { label: '类型' }, + 'source.object': { label: '对象' }, + 'source.content': { label: '内容字段' }, + 'source.metadataFields': { label: '筛选字段' }, + 'source.where': { label: '要索引的记录' }, + 'source.split': { label: '段落' }, + 'source.split.strategy': { label: '策略' }, + 'source.split.maxChars': { label: '最长段落' }, + 'source.split.minChars': { label: '最短段落' }, + refresh: { label: '刷新' }, + 'refresh.onRecordChange': { label: '记录变更时同步' }, + }, + }, flow: { label: '流程', fields: {