@kaelio/ktx 0.1.0-rc.6 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/assets/python/{kaelio_ktx-0.1.0rc6-py3-none-any.whl → kaelio_ktx-0.1.0-py3-none-any.whl} +0 -0
  2. package/assets/python/manifest.json +4 -4
  3. package/dist/commands/mcp-commands.js +11 -3
  4. package/dist/commands/mcp-commands.test.js +30 -1
  5. package/dist/ingest.test.js +2 -26
  6. package/dist/next-steps.js +1 -1
  7. package/dist/next-steps.test.js +2 -0
  8. package/dist/runtime-requirements.d.ts +1 -2
  9. package/dist/runtime-requirements.js +0 -7
  10. package/dist/runtime-requirements.test.js +2 -2
  11. package/dist/setup-agents.d.ts +11 -3
  12. package/dist/setup-agents.js +397 -134
  13. package/dist/setup-agents.test.js +359 -61
  14. package/dist/setup-runtime.d.ts +0 -1
  15. package/dist/setup-runtime.js +0 -1
  16. package/dist/setup-runtime.test.js +7 -13
  17. package/dist/setup.d.ts +3 -0
  18. package/dist/setup.js +51 -25
  19. package/dist/setup.test.js +112 -16
  20. package/node_modules/@ktx/connector-clickhouse/dist/package-exports.test.js +1 -1
  21. package/node_modules/@ktx/context/dist/core/git.service.d.ts +0 -1
  22. package/node_modules/@ktx/context/dist/core/git.service.js +0 -12
  23. package/node_modules/@ktx/context/dist/ingest/adapters/historic-sql/historic-sql.adapter.d.ts +1 -2
  24. package/node_modules/@ktx/context/dist/ingest/adapters/historic-sql/historic-sql.adapter.js +0 -18
  25. package/node_modules/@ktx/context/dist/ingest/adapters/historic-sql/local-ingest-acceptance.test.js +6 -6
  26. package/node_modules/@ktx/context/dist/ingest/adapters/historic-sql/post-processor.d.ts +4 -0
  27. package/node_modules/@ktx/context/dist/ingest/adapters/historic-sql/post-processor.js +38 -0
  28. package/node_modules/@ktx/context/dist/ingest/adapters/historic-sql/post-processor.test.js +63 -0
  29. package/node_modules/@ktx/context/dist/ingest/adapters/historic-sql/projection.d.ts +0 -5
  30. package/node_modules/@ktx/context/dist/ingest/adapters/historic-sql/projection.js +0 -48
  31. package/node_modules/@ktx/context/dist/ingest/adapters/historic-sql/projection.test.js +0 -83
  32. package/node_modules/@ktx/context/dist/ingest/index.d.ts +2 -1
  33. package/node_modules/@ktx/context/dist/ingest/index.js +1 -0
  34. package/node_modules/@ktx/context/dist/ingest/ingest-bundle.runner.d.ts +0 -2
  35. package/node_modules/@ktx/context/dist/ingest/ingest-bundle.runner.isolated-diff.test.js +0 -166
  36. package/node_modules/@ktx/context/dist/ingest/ingest-bundle.runner.js +45 -235
  37. package/node_modules/@ktx/context/dist/ingest/ingest-bundle.runner.test.js +38 -193
  38. package/node_modules/@ktx/context/dist/ingest/local-bundle-ingest.test.js +3 -22
  39. package/node_modules/@ktx/context/dist/ingest/local-bundle-runtime.js +4 -0
  40. package/node_modules/@ktx/context/dist/ingest/local-ingest.js +7 -0
  41. package/node_modules/@ktx/context/dist/ingest/memory-flow/schema.d.ts +4 -4
  42. package/node_modules/@ktx/context/dist/ingest/memory-flow/schema.js +1 -1
  43. package/node_modules/@ktx/context/dist/ingest/memory-flow/types.d.ts +1 -1
  44. package/node_modules/@ktx/context/dist/ingest/ports.d.ts +20 -1
  45. package/node_modules/@ktx/context/dist/ingest/report-snapshot.d.ts +2 -73
  46. package/node_modules/@ktx/context/dist/ingest/report-snapshot.js +0 -27
  47. package/node_modules/@ktx/context/dist/ingest/reports.d.ts +5 -23
  48. package/node_modules/@ktx/context/dist/ingest/reports.js +24 -7
  49. package/node_modules/@ktx/context/dist/ingest/types.d.ts +0 -33
  50. package/node_modules/@ktx/context/dist/package-exports.test.js +1 -2
  51. package/package.json +4 -4
  52. package/node_modules/@ktx/context/dist/ingest/finalization-scope.d.ts +0 -22
  53. package/node_modules/@ktx/context/dist/ingest/finalization-scope.js +0 -95
  54. package/node_modules/@ktx/context/dist/ingest/finalization-scope.test.js +0 -114
  55. /package/node_modules/@ktx/context/dist/ingest/{finalization-scope.test.d.ts → adapters/historic-sql/post-processor.test.d.ts} +0 -0
@@ -2,10 +2,10 @@
2
2
  "schemaVersion": 1,
3
3
  "distributionName": "kaelio-ktx",
4
4
  "normalizedName": "kaelio_ktx",
5
- "version": "0.1.0rc6",
5
+ "version": "0.1.0",
6
6
  "wheel": {
7
- "file": "kaelio_ktx-0.1.0rc6-py3-none-any.whl",
8
- "sha256": "0515d73bf89eb1c32422eb1fab0b59b01b49a23ef7bd8749dc5114361ba17ccc",
9
- "bytes": 80550
7
+ "file": "kaelio_ktx-0.1.0-py3-none-any.whl",
8
+ "sha256": "1145cf0c90879270dc335a8d0ca49a598f81e0f47a37fdf646fc6c6798fe3c8b",
9
+ "bytes": 80523
10
10
  }
11
11
  }
@@ -11,6 +11,16 @@ function tokenFromOption(value) {
11
11
  function binPath() {
12
12
  return fileURLToPath(new URL('../bin.js', import.meta.url));
13
13
  }
14
+ function formatMcpStartResultMessage(input) {
15
+ return [
16
+ input.status === 'started' ? `KTX MCP daemon started: ${input.url}` : `KTX MCP daemon already running: ${input.url}`,
17
+ '',
18
+ 'KTX is ready for configured agents.',
19
+ 'Open your agent for this KTX project and ask a data question, for example:',
20
+ ' "Use KTX to show me the available tables and metrics."',
21
+ '',
22
+ ].join('\n');
23
+ }
14
24
  export function registerMcpCommands(program, context) {
15
25
  const mcp = program.command('mcp').description('Run the KTX MCP HTTP server');
16
26
  mcp
@@ -66,9 +76,7 @@ export function registerMcpCommands(program, context) {
66
76
  allowedOrigins: options.allowedOrigin,
67
77
  binPath: binPath(),
68
78
  });
69
- context.io.stdout.write(result.status === 'started'
70
- ? `KTX MCP daemon started: ${result.url}\n`
71
- : `KTX MCP daemon already running: ${result.url}\n`);
79
+ context.io.stdout.write(formatMcpStartResultMessage({ status: result.status, url: result.url }));
72
80
  });
73
81
  mcp
74
82
  .command('stop')
@@ -65,7 +65,36 @@ describe('registerMcpCommands', () => {
65
65
  registerMcpCommands(program, context);
66
66
  await program.parseAsync(['--project-dir', '/tmp/ktx-already', 'mcp', 'start'], { from: 'user' });
67
67
  expect(startDaemon).toHaveBeenCalledTimes(1);
68
- expect(context.io.stdout.write).toHaveBeenCalledWith('KTX MCP daemon already running: http://127.0.0.1:7878/mcp\n');
68
+ expect(context.io.stdout.write).toHaveBeenCalledWith([
69
+ 'KTX MCP daemon already running: http://127.0.0.1:7878/mcp',
70
+ '',
71
+ 'KTX is ready for configured agents.',
72
+ 'Open your agent for this KTX project and ask a data question, for example:',
73
+ ' "Use KTX to show me the available tables and metrics."',
74
+ '',
75
+ ].join('\n'));
76
+ });
77
+ it('prints a friendly next step after starting the daemon', async () => {
78
+ const program = new Command().exitOverride().option('--project-dir <path>');
79
+ const startDaemon = vi.fn().mockResolvedValue({
80
+ status: 'started',
81
+ url: 'http://127.0.0.1:7878/mcp',
82
+ state: {
83
+ schemaVersion: 1,
84
+ pid: 4242,
85
+ host: '127.0.0.1',
86
+ port: 7878,
87
+ tokenAuth: false,
88
+ projectDir: '/tmp/ktx-started',
89
+ startedAt: '2026-05-14T00:00:00.000Z',
90
+ logPath: '/tmp/ktx-started/.ktx/logs/mcp.log',
91
+ },
92
+ });
93
+ const context = makeContext({ deps: { mcp: { startDaemon } } });
94
+ registerMcpCommands(program, context);
95
+ await program.parseAsync(['--project-dir', '/tmp/ktx-started', 'mcp', 'start'], { from: 'user' });
96
+ expect(context.io.stdout.write).toHaveBeenCalledWith(expect.stringContaining('KTX MCP daemon started: http://127.0.0.1:7878/mcp\n\nKTX is ready for configured agents.'));
97
+ expect(context.io.stdout.write).toHaveBeenCalledWith(expect.stringContaining('"Use KTX to show me the available tables and metrics."'));
69
98
  });
70
99
  it('runs the stdio server with the resolved project directory', async () => {
71
100
  const program = new Command().exitOverride().option('--project-dir <path>');
@@ -807,16 +807,9 @@ describe('runKtxIngest', () => {
807
807
  sourceKey: 'historic-sql',
808
808
  body: {
809
809
  workUnits: [],
810
- finalization: {
810
+ postProcessor: {
811
811
  sourceKey: 'historic-sql',
812
812
  status: 'success',
813
- commitSha: 'finalization-sha',
814
- touchedPaths: ['semantic-layer/warehouse/_schema/public.yaml', 'wiki/global/historic-sql-orders.md'],
815
- declaredTouchedSources: [{ connectionId: 'warehouse', sourceName: 'orders' }],
816
- derivedTouchedSources: [{ connectionId: 'warehouse', sourceName: 'orders' }],
817
- declaredChangedWikiPageKeys: ['historic-sql-orders'],
818
- derivedChangedWikiPageKeys: ['historic-sql-orders'],
819
- mismatches: [],
820
813
  result: {
821
814
  tableUsageMerged: 56,
822
815
  staleTablesMarked: 1,
@@ -826,24 +819,7 @@ describe('runKtxIngest', () => {
826
819
  },
827
820
  errors: [],
828
821
  warnings: [],
829
- actions: [
830
- ...Array.from({ length: 57 }, (_, index) => ({
831
- target: 'sl',
832
- type: 'updated',
833
- key: `orders-${index}`,
834
- detail: 'Merged usage',
835
- targetConnectionId: 'warehouse',
836
- rawPaths: ['tables/public/orders.json'],
837
- })),
838
- ...Array.from({ length: 35 }, (_, index) => ({
839
- target: 'wiki',
840
- type: 'updated',
841
- key: `historic-sql-orders-${index}`,
842
- detail: 'Projected pattern',
843
- rawPaths: ['patterns/orders.json'],
844
- })),
845
- ],
846
- provenanceExclusions: [],
822
+ touchedSources: [],
847
823
  },
848
824
  },
849
825
  }),
@@ -29,7 +29,7 @@ function commandLines(commands, indent) {
29
29
  }
30
30
  export function formatNextStepLines(indent = ' ') {
31
31
  return [
32
- `${indent}KTX context is ready for agents. Open your coding agent in this directory and ask a data question.`,
32
+ `${indent}KTX context is ready for agents. Open your coding agent from the KTX project directory and ask a data question.`,
33
33
  `${indent}Verify with:`,
34
34
  ...commandLines(KTX_NEXT_STEP_DIRECT_COMMANDS, indent),
35
35
  ];
@@ -38,8 +38,10 @@ describe('KTX demo next steps', () => {
38
38
  it('explains what the next-step commands are for', () => {
39
39
  const rendered = formatNextStepLines().join('\n');
40
40
  expect(rendered).toContain('KTX context is ready for agents.');
41
+ expect(rendered).toContain('KTX project directory');
41
42
  expect(rendered).toContain('ask a data question');
42
43
  expect(rendered).toContain('Verify with:');
44
+ expect(rendered).not.toContain('this directory');
43
45
  expect(rendered).not.toContain('Preferred route');
44
46
  expect(rendered).not.toContain('Optional MCP:');
45
47
  });
@@ -1,7 +1,7 @@
1
1
  import type { KtxProjectConfig } from '@ktx/context/project';
2
2
  import type { KtxRuntimeFeature } from './managed-python-runtime.js';
3
3
  import type { KtxPublicIngestPlan } from './public-ingest.js';
4
- type KtxRuntimeRequirementReason = 'agent-mcp' | 'query-history' | 'looker-source' | 'database-introspection' | 'local-embeddings';
4
+ type KtxRuntimeRequirementReason = 'query-history' | 'looker-source' | 'database-introspection' | 'local-embeddings';
5
5
  interface KtxRuntimeRequirement {
6
6
  feature: KtxRuntimeFeature;
7
7
  reason: KtxRuntimeRequirementReason;
@@ -12,7 +12,6 @@ export interface KtxRuntimeRequirements {
12
12
  requirements: KtxRuntimeRequirement[];
13
13
  }
14
14
  export interface KtxProjectRuntimeRequirementOptions {
15
- agents?: boolean;
16
15
  databaseIntrospectionFallback?: boolean;
17
16
  env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
18
17
  }
@@ -41,13 +41,6 @@ function uniqueRequirements(requirements) {
41
41
  export function resolveProjectRuntimeRequirements(config, options = {}) {
42
42
  const env = options.env ?? process.env;
43
43
  const requirements = [];
44
- if (options.agents === true) {
45
- requirements.push({
46
- feature: 'core',
47
- reason: 'agent-mcp',
48
- detail: 'Agent MCP setup uses semantic-layer query tools and SQL validation.',
49
- });
50
- }
51
44
  if (options.databaseIntrospectionFallback === true && !hasDaemonOverride(env)) {
52
45
  requirements.push({
53
46
  feature: 'core',
@@ -3,9 +3,9 @@ import { buildDefaultKtxProjectConfig } from '@ktx/context/project';
3
3
  import { describe, expect, it } from 'vitest';
4
4
  import { resolveProjectRuntimeRequirements, resolvePublicIngestRuntimeRequirements, } from './runtime-requirements.js';
5
5
  describe('runtime requirement detection', () => {
6
- it('requires core for agent/MCP setup', () => {
6
+ it('does not require runtime for agent/MCP setup alone', () => {
7
7
  const config = buildDefaultKtxProjectConfig();
8
- expect(resolveProjectRuntimeRequirements(config, { agents: true }).features).toEqual(['core']);
8
+ expect(resolveProjectRuntimeRequirements(config).features).toEqual([]);
9
9
  });
10
10
  it('requires core for Looker source ingest unless an external daemon is configured', () => {
11
11
  const config = {
@@ -12,6 +12,7 @@ export interface KtxSetupAgentsArgs {
12
12
  scope: KtxAgentScope;
13
13
  mode: KtxAgentInstallMode;
14
14
  skipAgents: boolean;
15
+ showNextActions?: boolean;
15
16
  }
16
17
  export type KtxSetupAgentsResult = {
17
18
  status: 'ready';
@@ -21,6 +22,7 @@ export type KtxSetupAgentsResult = {
21
22
  scope: KtxAgentScope;
22
23
  mode: KtxAgentInstallMode;
23
24
  }>;
25
+ nextActions?: string;
24
26
  } | {
25
27
  status: 'skipped';
26
28
  projectDir: string;
@@ -46,7 +48,7 @@ export interface KtxAgentInstallManifest {
46
48
  entries: Array<{
47
49
  kind: 'file';
48
50
  path: string;
49
- role?: 'skill' | 'rule' | 'analytics-skill' | 'claude-plugin' | 'launcher';
51
+ role?: 'skill' | 'rule' | 'analytics-skill' | 'claude-desktop-skill-bundle' | 'launcher';
50
52
  } | {
51
53
  kind: 'json-key';
52
54
  path: string;
@@ -54,6 +56,7 @@ export interface KtxAgentInstallManifest {
54
56
  }>;
55
57
  }
56
58
  type InstallEntry = KtxAgentInstallManifest['entries'][number];
59
+ export declare function createAgentNextActionsLineFormatter(stdout: KtxCliIo['stdout']): (line: string) => string;
57
60
  export declare function collectClaudeDesktopForwardedEnv(source: NodeJS.ProcessEnv): Record<string, string>;
58
61
  export declare function agentInstallManifestPath(projectDir: string): string;
59
62
  export declare function plannedKtxAgentFiles(input: {
@@ -79,10 +82,15 @@ export interface KtxSetupAgentsPromptAdapter {
79
82
  export interface KtxSetupAgentsDeps {
80
83
  prompts?: KtxSetupAgentsPromptAdapter;
81
84
  }
82
- export declare function formatInstallSummary(installs: Array<{
85
+ export declare function targetDisplayName(target: string): string;
86
+ export interface InstallSummaryEntry {
87
+ title: string;
88
+ lines: string[];
89
+ }
90
+ export declare function formatInstallSummaryLines(installs: Array<{
83
91
  target: KtxAgentTarget;
84
92
  scope: KtxAgentScope;
85
93
  mode: KtxAgentInstallMode;
86
- }>, entries: InstallEntry[], projectDir: string): string;
94
+ }>, entries: InstallEntry[], projectDir: string): InstallSummaryEntry[];
87
95
  export declare function runKtxSetupAgentsStep(args: KtxSetupAgentsArgs, io: KtxCliIo, deps?: KtxSetupAgentsDeps): Promise<KtxSetupAgentsResult>;
88
96
  export {};