Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review (codex): hydrate catalog spec from resolved voice specs

[._.]/ Adam Eivy0e25ba8d07fd
diff --git a/server/services/creative/toolRegistry.js b/server/services/creative/toolRegistry.js
index 75091cba28..8c84da9528 100644
--- a/server/services/creative/toolRegistry.js
+++ b/server/services/creative/toolRegistry.js
@@ -19,7 +19,7 @@
// Writers-Room live mode self-gate today).
import { getCreativeAutonomyMode } from '../../lib/domainAutonomy.js';
-import { getToolMetadata } from '../voice/tools.js';
+import { getToolMetadata, getToolSpecs as getVoiceToolSpecs } from '../voice/tools.js';
import { loadState } from '../cosState.js';
import { getDomainBudgetStatus, recordDomainUsage } from '../domainUsage.js';
import { appendCreativeLedgerEntry, argsDigest } from './creativeRunLedger.js';
@@ -99,12 +99,17 @@ assertCreativeToolIntegrity(CREATIVE_TOOLS);
const byName = new Map(CREATIVE_TOOLS.map((t) => [t.name, t]));
// Resolve a tool's advertised description + parameters. When a tool declares
-// `hydrateFrom`, pull them from the voice tool of that name (single source of
-// schemas — the palette pattern) instead of the tool's own authored fallback.
+// `hydrateFrom`, pull them from the voice tool's fully-RESOLVED spec of that name
+// (single source of schemas — the palette pattern) instead of the tool's own
+// authored fallback. It reads the resolved `getToolSpecs()` output rather than
+// the static `getToolMetadata()` so any spec-build-time widening survives — e.g.
+// `catalog_lookup` widens its `type` enum to the user's active custom catalog
+// types, which the static metadata doesn't carry; hydrating from the metadata
+// would advertise only the built-in types to the orchestrator.
function resolveDisplay(t) {
if (t.hydrateFrom) {
- const meta = getToolMetadata(t.hydrateFrom);
- if (meta) return { description: meta.description, parameters: meta.parameters };
+ const spec = getVoiceToolSpecs().find((s) => s.function?.name === t.hydrateFrom);
+ if (spec) return { description: spec.function.description, parameters: spec.function.parameters };
}
return { description: t.description, parameters: t.parameters };
}
diff --git a/server/services/creative/toolRegistry.test.js b/server/services/creative/toolRegistry.test.js
index 0bf47d6d8a..34214c34da 100644
--- a/server/services/creative/toolRegistry.test.js
+++ b/server/services/creative/toolRegistry.test.js
@@ -12,6 +12,25 @@ vi.mock('../voice/tools.js', () => ({
parameters: { type: 'object', properties: { query: { type: 'string' } }, required: ['query'] },
}
: null),
+ // Resolved specs carry the spec-build-time widening (custom catalog types in
+ // the `type` enum) that the static metadata above lacks — hydration reads this.
+ getToolSpecs: vi.fn(() => [
+ {
+ type: 'function',
+ function: {
+ name: 'catalog_lookup',
+ description: 'VOICE catalog search description',
+ parameters: {
+ type: 'object',
+ properties: {
+ query: { type: 'string' },
+ type: { type: 'string', enum: ['character', 'wardrobe', 'faction'] },
+ },
+ required: ['query'],
+ },
+ },
+ },
+ ]),
dispatchTool: vi.fn(async () => ({ summary: 'voice catalog result', results: [] })),
}));
@@ -100,10 +119,13 @@ describe('registry shape', () => {
}
});
- it('hydrates catalog.searchIngredients description + parameters from the voice tool', () => {
+ it('hydrates catalog_searchIngredients from the voice tool\'s RESOLVED spec (custom types survive)', () => {
const meta = getCreativeToolMetadata('catalog_searchIngredients');
expect(meta.description).toBe('VOICE catalog search description');
expect(meta.parameters.required).toEqual(['query']);
+ // The widened enum (custom catalog types) from the resolved spec must survive,
+ // not the static built-in-only metadata.
+ expect(meta.parameters.properties.type.enum).toEqual(['character', 'wardrobe', 'faction']);
});
});