agnets done
This commit is contained in:
@@ -39,9 +39,20 @@ export function useAgentDefinitions() {
|
||||
* `{ path, raw }` is the shape `readAgentRegistry` already takes, so the reader
|
||||
* did not have to learn where definitions come from — only the store changed.
|
||||
*/
|
||||
export function sourcesFrom(rows) {
|
||||
export function sourcesFrom(rows, shippedIds = new Set()) {
|
||||
return (rows || [])
|
||||
.filter((r) => r && typeof r.markdown === 'string' && r.markdown.trim())
|
||||
/* An organization row whose id is a shipped agent IS that shipped agent:
|
||||
`importagents` publishes the same files this build ships, so the registry
|
||||
and the bundle hold one definition between them, not two.
|
||||
|
||||
Passing it through as an authored source made every shipped agent report
|
||||
that it "replaces the built-in agent of the same id" — nine warnings, on
|
||||
the one screen that exists to say what is wrong, describing a deployment
|
||||
that was working correctly. A personal row is a genuine override and is
|
||||
still reported as one; an organization row with an id nothing ships is a
|
||||
shared agent somebody authored, and belongs in the list. */
|
||||
.filter((r) => !(r.visibility === 'organization' && shippedIds.has(r.definition_id)))
|
||||
.map((r) => ({ path: `authored/${r.definition_id || r.id}.md`, raw: r.markdown }));
|
||||
}
|
||||
|
||||
@@ -110,8 +121,8 @@ export function useRowFor(rows) {
|
||||
}
|
||||
|
||||
/** Memoised sources, so the registry is not rebuilt on every render. */
|
||||
export function useAuthoredSources(rows) {
|
||||
return useMemo(() => sourcesFrom(rows), [rows]);
|
||||
export function useAuthoredSources(rows, shippedIds) {
|
||||
return useMemo(() => sourcesFrom(rows, shippedIds), [rows, shippedIds]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -39,7 +39,10 @@ export function useAgents() {
|
||||
const deleteDefinition = useDeleteAgentDefinition();
|
||||
|
||||
const rows = useMemo(() => definitions.data || [], [definitions.data]);
|
||||
const stored = useAuthoredSources(rows);
|
||||
/* The ids this build ships. An organization row carrying one of them is that
|
||||
same definition as published by importagents, not an override of it. */
|
||||
const shippedIds = useMemo(() => new Set(AGENTS.map((a) => a.id)), []);
|
||||
const stored = useAuthoredSources(rows, shippedIds);
|
||||
const customSkills = useMemo(() => preferences.customSkills || [], [preferences.customSkills]);
|
||||
|
||||
/* Anything an author wrote before the store moved. Without this it would stop
|
||||
|
||||
Reference in New Issue
Block a user