mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-10 08:05:14 +02:00
feat(context): pass MCP ingest pull config options
This commit is contained in:
parent
478c06d467
commit
0fc5809e02
3 changed files with 70 additions and 3 deletions
|
|
@ -41,10 +41,17 @@ export interface RunLocalIngestOptions {
|
|||
export interface LocalIngestMcpOptions
|
||||
extends Pick<
|
||||
RunLocalIngestOptions,
|
||||
'agentRunner' | 'llmProvider' | 'memoryModel' | 'semanticLayerCompute' | 'queryExecutor' | 'logger'
|
||||
> {
|
||||
| 'agentRunner'
|
||||
| 'llmProvider'
|
||||
| 'memoryModel'
|
||||
| 'semanticLayerCompute'
|
||||
| 'queryExecutor'
|
||||
| 'logger'
|
||||
| 'pullConfigOptions'
|
||||
> {
|
||||
adapters?: SourceAdapter[];
|
||||
jobIdFactory?: () => string;
|
||||
runLocalIngest?: (options: RunLocalIngestOptions) => Promise<LocalIngestResult>;
|
||||
runLocalMetabaseIngest?: (options: RunLocalMetabaseIngestOptions) => Promise<LocalMetabaseFanoutResult>;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -845,6 +845,63 @@ describe('createLocalProjectMcpContextPorts', () => {
|
|||
expect(agentRunner.runLoop).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it('passes local ingest pull-config options into runLocalIngest', async () => {
|
||||
const project = await initKtxProject({ projectDir: tempDir, projectName: 'warehouse' });
|
||||
project.config.connections.warehouse = { driver: 'postgres' };
|
||||
project.config.ingest.adapters = ['looker'];
|
||||
const runLocalIngest = vi.fn(async () => ({
|
||||
result: { ok: true },
|
||||
report: {
|
||||
id: 'report-1',
|
||||
runId: 'run-1',
|
||||
jobId: 'job-1',
|
||||
sourceKey: 'looker',
|
||||
connectionId: 'warehouse',
|
||||
body: {
|
||||
syncId: 'sync-1',
|
||||
workUnits: [],
|
||||
failedWorkUnits: [],
|
||||
diffSummary: { added: 0, modified: 0, deleted: 0, unchanged: 0 },
|
||||
provenanceRows: [],
|
||||
},
|
||||
},
|
||||
}) as never);
|
||||
const ports = createLocalProjectMcpContextPorts(project, {
|
||||
localIngest: {
|
||||
adapters: [{ source: 'looker', skillNames: [] }],
|
||||
pullConfigOptions: {
|
||||
looker: {
|
||||
daemonBaseUrl: 'http://127.0.0.1:61234',
|
||||
},
|
||||
},
|
||||
runLocalIngest,
|
||||
},
|
||||
});
|
||||
|
||||
await expect(
|
||||
ports.ingest?.trigger({
|
||||
adapter: 'looker',
|
||||
connectionId: 'warehouse',
|
||||
trigger: 'manual_resync',
|
||||
config: {},
|
||||
}),
|
||||
).resolves.toMatchObject({
|
||||
runId: 'run-1',
|
||||
jobId: 'job-1',
|
||||
reportId: 'report-1',
|
||||
});
|
||||
|
||||
expect(runLocalIngest).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
pullConfigOptions: {
|
||||
looker: {
|
||||
daemonBaseUrl: 'http://127.0.0.1:61234',
|
||||
},
|
||||
},
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('triggers fetch-capable local ingest without sourceDir config', async () => {
|
||||
const project = await initKtxProject({ projectDir: tempDir, projectName: 'warehouse' });
|
||||
project.config.connections.warehouse = {
|
||||
|
|
|
|||
|
|
@ -587,6 +587,7 @@ export function createLocalProjectMcpContextPorts(
|
|||
metabaseConnectionId: input.connectionId,
|
||||
trigger: input.trigger,
|
||||
jobIdFactory: options.localIngest?.jobIdFactory,
|
||||
pullConfigOptions: options.localIngest?.pullConfigOptions,
|
||||
agentRunner: options.localIngest?.agentRunner,
|
||||
llmProvider: options.localIngest?.llmProvider,
|
||||
memoryModel: options.localIngest?.memoryModel,
|
||||
|
|
@ -611,12 +612,14 @@ export function createLocalProjectMcpContextPorts(
|
|||
};
|
||||
}
|
||||
|
||||
const result = await runLocalIngest({
|
||||
const executeLocalIngest = options.localIngest?.runLocalIngest ?? runLocalIngest;
|
||||
const result = await executeLocalIngest({
|
||||
project,
|
||||
adapters: options.localIngest?.adapters ?? createDefaultLocalIngestAdapters(project),
|
||||
adapter: input.adapter,
|
||||
connectionId: input.connectionId,
|
||||
sourceDir,
|
||||
pullConfigOptions: options.localIngest?.pullConfigOptions,
|
||||
trigger: input.trigger,
|
||||
jobId: options.localIngest?.jobIdFactory?.(),
|
||||
agentRunner: options.localIngest?.agentRunner,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue