@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
52 lines • 2.32 kB
JavaScript
// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
import { z } from 'zod';
import { normalizeNonEmpty } from "../secrets.js";
export const ChromaConfig = z.object({
host: z
.string()
.optional()
.meta({ description: 'Host name of the Chroma HTTP server.', default: 'localhost' }),
port: z
.number()
.optional()
.meta({ description: 'Port of the Chroma HTTP server.', default: 8000 }),
ssl: z
.boolean()
.optional()
.meta({ description: 'Connect over HTTPS instead of HTTP.', default: false }),
collectionName: z.string().describe('Name of the existing Chroma collection to mount.'),
slugField: z.string().optional().meta({
description: 'Chunk metadata key that holds the path of the file a chunk belongs to, relative to the mount root (`guides/quickstart.md`).',
default: 'page_slug',
}),
chunkIndexField: z.string().optional().meta({
description: "Chunk metadata key whose integer orders a file's chunks; a chunk without one sorts as `0`.",
default: 'chunk_index',
}),
});
export function resolveChromaConfig(config) {
return {
host: config.host ?? 'localhost',
port: config.port ?? 8000,
ssl: config.ssl ?? false,
collectionName: normalizeNonEmpty(config.collectionName, 'collectionName'),
slugField: normalizeNonEmpty(config.slugField ?? 'page_slug', 'slugField'),
chunkIndexField: normalizeNonEmpty(config.chunkIndexField ?? 'chunk_index', 'chunkIndexField'),
};
}
export function redactChromaConfig(config) {
return { ...config };
}
//# sourceMappingURL=config.js.map