@kaelio/ktx 0.9.0 → 0.11.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.
- package/assets/python/{kaelio_ktx-0.9.0-py3-none-any.whl → kaelio_ktx-0.11.0-py3-none-any.whl} +0 -0
- package/assets/python/manifest.json +4 -4
- package/dist/.tsbuildinfo +1 -1
- package/dist/clack.d.ts +6 -0
- package/dist/clack.js +17 -2
- package/dist/cli-program.d.ts +3 -0
- package/dist/cli-program.js +46 -2
- package/dist/cli-runtime.d.ts +5 -0
- package/dist/cli-runtime.js +50 -0
- package/dist/commands/setup-commands.js +2 -3
- package/dist/community-cta.d.ts +11 -0
- package/dist/community-cta.js +19 -0
- package/dist/connection.js +23 -1
- package/dist/connectors/bigquery/connector.d.ts +2 -5
- package/dist/connectors/bigquery/connector.js +2 -2
- package/dist/connectors/clickhouse/connector.d.ts +2 -5
- package/dist/connectors/clickhouse/connector.js +2 -2
- package/dist/connectors/mysql/connector.d.ts +7 -6
- package/dist/connectors/mysql/connector.js +25 -5
- package/dist/connectors/mysql/dialect.d.ts +1 -1
- package/dist/connectors/mysql/dialect.js +12 -2
- package/dist/connectors/postgres/connector.d.ts +2 -5
- package/dist/connectors/postgres/connector.js +2 -2
- package/dist/connectors/snowflake/connector.d.ts +2 -5
- package/dist/connectors/snowflake/connector.js +2 -2
- package/dist/connectors/sqlite/connector.d.ts +2 -5
- package/dist/connectors/sqlite/connector.js +2 -2
- package/dist/connectors/sqlserver/connector.d.ts +2 -5
- package/dist/connectors/sqlserver/connector.js +2 -2
- package/dist/context/connections/drivers.d.ts +0 -1
- package/dist/context/connections/drivers.js +0 -7
- package/dist/context/connections/query-executor.d.ts +2 -1
- package/dist/context/core/abort.d.ts +9 -0
- package/dist/context/core/abort.js +36 -0
- package/dist/context/core/git-env.d.ts +12 -1
- package/dist/context/core/git-env.js +17 -2
- package/dist/context/core/git.service.js +15 -7
- package/dist/context/ingest/adapters/historic-sql/query-history-filter-picker.d.ts +1 -0
- package/dist/context/ingest/adapters/historic-sql/query-history-filter-picker.js +6 -2
- package/dist/context/ingest/context-candidates/curator-pagination.service.d.ts +1 -5
- package/dist/context/ingest/context-candidates/curator-pagination.service.js +1 -3
- package/dist/context/ingest/context-evidence/sqlite-context-evidence-store.d.ts +1 -1
- package/dist/context/ingest/final-gate-repair.d.ts +1 -0
- package/dist/context/ingest/final-gate-repair.js +1 -0
- package/dist/context/ingest/ingest-bundle.runner.d.ts +3 -0
- package/dist/context/ingest/ingest-bundle.runner.js +127 -53
- package/dist/context/ingest/isolated-diff/textual-conflict-resolver.d.ts +1 -0
- package/dist/context/ingest/isolated-diff/textual-conflict-resolver.js +1 -0
- package/dist/context/ingest/isolated-diff/work-unit-executor.d.ts +1 -0
- package/dist/context/ingest/local-bundle-runtime.js +11 -4
- package/dist/context/ingest/local-ingest.d.ts +1 -0
- package/dist/context/ingest/local-ingest.js +13 -3
- package/dist/context/ingest/memory-flow/events.js +1 -1
- package/dist/context/ingest/memory-flow/schema.js +8 -3
- package/dist/context/ingest/memory-flow/types.d.ts +7 -3
- package/dist/context/ingest/ports.d.ts +3 -5
- package/dist/context/ingest/stages/stage-3-work-units.d.ts +1 -4
- package/dist/context/ingest/stages/stage-3-work-units.js +5 -1
- package/dist/context/ingest/stages/stage-4-reconciliation.d.ts +1 -4
- package/dist/context/ingest/stages/stage-4-reconciliation.js +1 -1
- package/dist/context/ingest/types.d.ts +1 -0
- package/dist/context/llm/ai-sdk-runtime.d.ts +3 -0
- package/dist/context/llm/ai-sdk-runtime.js +152 -16
- package/dist/context/llm/claude-code-runtime.d.ts +6 -4
- package/dist/context/llm/claude-code-runtime.js +127 -48
- package/dist/context/llm/codex-runtime.d.ts +3 -3
- package/dist/context/llm/codex-runtime.js +90 -47
- package/dist/context/llm/local-config.d.ts +15 -5
- package/dist/context/llm/local-config.js +6 -1
- package/dist/context/llm/rate-limit-governor.d.ts +103 -0
- package/dist/context/llm/rate-limit-governor.js +285 -0
- package/dist/context/llm/runtime-port.d.ts +3 -6
- package/dist/context/mcp/context-tools.js +43 -13
- package/dist/context/project/config.d.ts +12 -0
- package/dist/context/project/config.js +35 -0
- package/dist/context/scan/types.d.ts +15 -2
- package/dist/context/scan/types.js +12 -0
- package/dist/context/sl/description-normalization.js +4 -14
- package/dist/context/tools/context-candidate-mark.tool.d.ts +2 -2
- package/dist/context-build-view.d.ts +13 -0
- package/dist/context-build-view.js +60 -1
- package/dist/demo-metrics.d.ts +0 -2
- package/dist/demo-metrics.js +1 -11
- package/dist/ingest.d.ts +1 -0
- package/dist/ingest.js +32 -3
- package/dist/io/symbols.d.ts +2 -0
- package/dist/io/symbols.js +2 -0
- package/dist/io/tty.d.ts +9 -0
- package/dist/io/tty.js +5 -0
- package/dist/links.d.ts +1 -0
- package/dist/links.js +1 -0
- package/dist/memory-flow-hud.js +8 -16
- package/dist/public-ingest.js +50 -15
- package/dist/reveal-password-prompt.d.ts +24 -0
- package/dist/reveal-password-prompt.js +78 -0
- package/dist/scan.js +18 -2
- package/dist/setup-agents.js +1 -5
- package/dist/setup-databases.d.ts +1 -0
- package/dist/setup-databases.js +23 -3
- package/dist/setup-demo-tour.js +1 -0
- package/dist/setup-embeddings.js +1 -1
- package/dist/setup-models.d.ts +1 -14
- package/dist/setup-models.js +116 -340
- package/dist/setup-prompts.js +4 -7
- package/dist/setup-sources.js +7 -7
- package/dist/setup.d.ts +26 -1
- package/dist/setup.js +78 -7
- package/dist/sl.d.ts +2 -2
- package/dist/sl.js +20 -4
- package/dist/sql.js +18 -2
- package/dist/star-prompt/cache.d.ts +16 -0
- package/dist/star-prompt/cache.js +45 -0
- package/dist/star-prompt/star-count.d.ts +7 -0
- package/dist/star-prompt/star-count.js +66 -0
- package/dist/star-prompt/star-line.d.ts +12 -0
- package/dist/star-prompt/star-line.js +26 -0
- package/dist/telemetry/command-hook.d.ts +24 -0
- package/dist/telemetry/command-hook.js +37 -3
- package/dist/telemetry/emitter.d.ts +10 -0
- package/dist/telemetry/emitter.js +31 -0
- package/dist/telemetry/events.d.ts +24 -0
- package/dist/telemetry/events.js +15 -0
- package/dist/telemetry/exception.d.ts +18 -0
- package/dist/telemetry/exception.js +162 -0
- package/dist/telemetry/index.d.ts +4 -3
- package/dist/telemetry/index.js +3 -2
- package/dist/telemetry/redaction-secrets.d.ts +11 -0
- package/dist/telemetry/redaction-secrets.js +92 -0
- package/dist/update-check/cache.d.ts +21 -0
- package/dist/update-check/cache.js +38 -0
- package/dist/update-check/channel.d.ts +15 -0
- package/dist/update-check/channel.js +30 -0
- package/dist/update-check/registry.d.ts +1 -0
- package/dist/update-check/registry.js +45 -0
- package/dist/update-check/update-check.d.ts +43 -0
- package/dist/update-check/update-check.js +116 -0
- package/package.json +8 -1
- package/dist/context/connections/local-query-executor.d.ts +0 -6
- package/dist/context/connections/local-query-executor.js +0 -39
- package/dist/context/connections/postgres-query-executor.d.ts +0 -25
- package/dist/context/connections/postgres-query-executor.js +0 -53
- package/dist/context/connections/sqlite-query-executor.d.ts +0 -4
- package/dist/context/connections/sqlite-query-executor.js +0 -74
|
@@ -6,7 +6,7 @@ import { getDialectForDriver } from '../../context/connections/dialects.js';
|
|
|
6
6
|
import { assertReadOnlySql, limitSqlForExecution } from '../../context/connections/read-only-sql.js';
|
|
7
7
|
import { tryConstraintQuery } from '../../context/scan/constraint-discovery.js';
|
|
8
8
|
import { scopedTableNames } from '../../context/scan/table-ref.js';
|
|
9
|
-
import { createKtxConnectorCapabilities, } from '../../context/scan/types.js';
|
|
9
|
+
import { connectorTestFailure, createKtxConnectorCapabilities, } from '../../context/scan/types.js';
|
|
10
10
|
import snowflake from 'snowflake-sdk';
|
|
11
11
|
import { assertSafeSnowflakeIdentifier, quoteSnowflakeIdentifier } from './identifiers.js';
|
|
12
12
|
import { configureSnowflakeSdkLogger } from './sdk-logger.js';
|
|
@@ -282,7 +282,7 @@ class SnowflakeSdkDriver {
|
|
|
282
282
|
return { success: true };
|
|
283
283
|
}
|
|
284
284
|
catch (error) {
|
|
285
|
-
return
|
|
285
|
+
return connectorTestFailure(error);
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
288
|
async getPool() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type KtxColumnSampleInput, type KtxColumnSampleResult, type KtxColumnStatsInput, type KtxColumnStatsResult, type KtxQueryResult, type KtxReadOnlyQueryInput, type KtxScanConnector, type KtxScanContext, type KtxScanInput, type KtxSchemaSnapshot, type KtxTableListEntry, type KtxTableRef, type KtxTableSampleInput, type KtxTableSampleResult } from '../../context/scan/types.js';
|
|
1
|
+
import { type KtxConnectorTestResult, type KtxColumnSampleInput, type KtxColumnSampleResult, type KtxColumnStatsInput, type KtxColumnStatsResult, type KtxQueryResult, type KtxReadOnlyQueryInput, type KtxScanConnector, type KtxScanContext, type KtxScanInput, type KtxSchemaSnapshot, type KtxTableListEntry, type KtxTableRef, type KtxTableSampleInput, type KtxTableSampleResult } from '../../context/scan/types.js';
|
|
2
2
|
export interface KtxSqliteConnectionConfig {
|
|
3
3
|
driver?: string;
|
|
4
4
|
path?: string;
|
|
@@ -39,10 +39,7 @@ export declare class KtxSqliteScanConnector implements KtxScanConnector {
|
|
|
39
39
|
private readonly dialect;
|
|
40
40
|
private db;
|
|
41
41
|
constructor(options: KtxSqliteScanConnectorOptions);
|
|
42
|
-
testConnection(): Promise<
|
|
43
|
-
success: boolean;
|
|
44
|
-
error?: string;
|
|
45
|
-
}>;
|
|
42
|
+
testConnection(): Promise<KtxConnectorTestResult>;
|
|
46
43
|
introspect(input: KtxScanInput, _ctx: KtxScanContext): Promise<KtxSchemaSnapshot>;
|
|
47
44
|
listSchemas(): Promise<string[]>;
|
|
48
45
|
listTables(_schemas?: string[]): Promise<KtxTableListEntry[]>;
|
|
@@ -6,7 +6,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
6
6
|
import { getDialectForDriver } from '../../context/connections/dialects.js';
|
|
7
7
|
import { assertReadOnlySql, limitSqlForExecution } from '../../context/connections/read-only-sql.js';
|
|
8
8
|
import { normalizeQueryRows } from '../../context/connections/query-executor.js';
|
|
9
|
-
import { createKtxConnectorCapabilities } from '../../context/scan/types.js';
|
|
9
|
+
import { connectorTestFailure, createKtxConnectorCapabilities } from '../../context/scan/types.js';
|
|
10
10
|
import { scopedTableNames } from '../../context/scan/table-ref.js';
|
|
11
11
|
function stringConfigValue(connection, key) {
|
|
12
12
|
const value = connection?.[key];
|
|
@@ -106,7 +106,7 @@ export class KtxSqliteScanConnector {
|
|
|
106
106
|
return { success: true };
|
|
107
107
|
}
|
|
108
108
|
catch (error) {
|
|
109
|
-
return
|
|
109
|
+
return connectorTestFailure(error);
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
async introspect(input, _ctx) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type KtxColumnSampleInput, type KtxColumnSampleResult, type KtxColumnStatsInput, type KtxColumnStatsResult, type KtxQueryResult, type KtxReadOnlyQueryInput, type KtxScanConnector, type KtxScanContext, type KtxScanInput, type KtxSchemaSnapshot, type KtxTableListEntry, type KtxTableRef, type KtxTableSampleInput, type KtxTableSampleResult } from '../../context/scan/types.js';
|
|
1
|
+
import { type KtxConnectorTestResult, type KtxColumnSampleInput, type KtxColumnSampleResult, type KtxColumnStatsInput, type KtxColumnStatsResult, type KtxQueryResult, type KtxReadOnlyQueryInput, type KtxScanConnector, type KtxScanContext, type KtxScanInput, type KtxSchemaSnapshot, type KtxTableListEntry, type KtxTableRef, type KtxTableSampleInput, type KtxTableSampleResult } from '../../context/scan/types.js';
|
|
2
2
|
export interface KtxSqlServerConnectionConfig {
|
|
3
3
|
driver?: string;
|
|
4
4
|
host?: string;
|
|
@@ -113,10 +113,7 @@ export declare class KtxSqlServerScanConnector implements KtxScanConnector {
|
|
|
113
113
|
private pool;
|
|
114
114
|
private resolvedEndpoint;
|
|
115
115
|
constructor(options: KtxSqlServerScanConnectorOptions);
|
|
116
|
-
testConnection(): Promise<
|
|
117
|
-
success: boolean;
|
|
118
|
-
error?: string;
|
|
119
|
-
}>;
|
|
116
|
+
testConnection(): Promise<KtxConnectorTestResult>;
|
|
120
117
|
introspect(input: KtxScanInput, _ctx: KtxScanContext): Promise<KtxSchemaSnapshot>;
|
|
121
118
|
sampleTable(input: KtxTableSampleInput, _ctx: KtxScanContext): Promise<KtxSqlServerTableSampleResult>;
|
|
122
119
|
sampleColumn(input: KtxColumnSampleInput, _ctx: KtxScanContext): Promise<KtxColumnSampleResult>;
|
|
@@ -2,7 +2,7 @@ import { assertReadOnlySql } from '../../context/connections/read-only-sql.js';
|
|
|
2
2
|
import { getDialectForDriver } from '../../context/connections/dialects.js';
|
|
3
3
|
import { tryConstraintQuery } from '../../context/scan/constraint-discovery.js';
|
|
4
4
|
import { scopedTableNames } from '../../context/scan/table-ref.js';
|
|
5
|
-
import { createKtxConnectorCapabilities, } from '../../context/scan/types.js';
|
|
5
|
+
import { connectorTestFailure, createKtxConnectorCapabilities, } from '../../context/scan/types.js';
|
|
6
6
|
import { readFileSync } from 'node:fs';
|
|
7
7
|
import { homedir } from 'node:os';
|
|
8
8
|
import { resolve } from 'node:path';
|
|
@@ -235,7 +235,7 @@ export class KtxSqlServerScanConnector {
|
|
|
235
235
|
return { success: true };
|
|
236
236
|
}
|
|
237
237
|
catch (error) {
|
|
238
|
-
return
|
|
238
|
+
return connectorTestFailure(error);
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
241
|
async introspect(input, _ctx) {
|
|
@@ -14,7 +14,6 @@ export interface KtxDriverRegistration {
|
|
|
14
14
|
readonly driver: KtxConnectionDriver;
|
|
15
15
|
readonly scopeConfigKey: KtxScopeConfigKey | null;
|
|
16
16
|
readonly hasHistoricSqlReader: boolean;
|
|
17
|
-
readonly hasLocalQueryExecutor: boolean;
|
|
18
17
|
load(): Promise<KtxDriverConnectorModule>;
|
|
19
18
|
}
|
|
20
19
|
/** @internal */
|
|
@@ -7,7 +7,6 @@ export const driverRegistrations = {
|
|
|
7
7
|
driver: 'bigquery',
|
|
8
8
|
scopeConfigKey: 'dataset_ids',
|
|
9
9
|
hasHistoricSqlReader: true,
|
|
10
|
-
hasLocalQueryExecutor: false,
|
|
11
10
|
load: async () => {
|
|
12
11
|
const m = await import('../../connectors/bigquery/connector.js');
|
|
13
12
|
return {
|
|
@@ -29,7 +28,6 @@ export const driverRegistrations = {
|
|
|
29
28
|
driver: 'clickhouse',
|
|
30
29
|
scopeConfigKey: 'databases',
|
|
31
30
|
hasHistoricSqlReader: false,
|
|
32
|
-
hasLocalQueryExecutor: false,
|
|
33
31
|
load: async () => {
|
|
34
32
|
const m = await import('../../connectors/clickhouse/connector.js');
|
|
35
33
|
return {
|
|
@@ -51,7 +49,6 @@ export const driverRegistrations = {
|
|
|
51
49
|
driver: 'mysql',
|
|
52
50
|
scopeConfigKey: 'schemas',
|
|
53
51
|
hasHistoricSqlReader: false,
|
|
54
|
-
hasLocalQueryExecutor: false,
|
|
55
52
|
load: async () => {
|
|
56
53
|
const m = await import('../../connectors/mysql/connector.js');
|
|
57
54
|
return {
|
|
@@ -73,7 +70,6 @@ export const driverRegistrations = {
|
|
|
73
70
|
driver: 'postgres',
|
|
74
71
|
scopeConfigKey: 'schemas',
|
|
75
72
|
hasHistoricSqlReader: true,
|
|
76
|
-
hasLocalQueryExecutor: true,
|
|
77
73
|
load: async () => {
|
|
78
74
|
const m = await import('../../connectors/postgres/connector.js');
|
|
79
75
|
return {
|
|
@@ -95,7 +91,6 @@ export const driverRegistrations = {
|
|
|
95
91
|
driver: 'sqlite',
|
|
96
92
|
scopeConfigKey: null,
|
|
97
93
|
hasHistoricSqlReader: false,
|
|
98
|
-
hasLocalQueryExecutor: true,
|
|
99
94
|
load: async () => {
|
|
100
95
|
const m = await import('../../connectors/sqlite/connector.js');
|
|
101
96
|
return {
|
|
@@ -117,7 +112,6 @@ export const driverRegistrations = {
|
|
|
117
112
|
driver: 'snowflake',
|
|
118
113
|
scopeConfigKey: 'schema_names',
|
|
119
114
|
hasHistoricSqlReader: true,
|
|
120
|
-
hasLocalQueryExecutor: false,
|
|
121
115
|
load: async () => {
|
|
122
116
|
const m = await import('../../connectors/snowflake/connector.js');
|
|
123
117
|
return {
|
|
@@ -139,7 +133,6 @@ export const driverRegistrations = {
|
|
|
139
133
|
driver: 'sqlserver',
|
|
140
134
|
scopeConfigKey: 'schemas',
|
|
141
135
|
hasHistoricSqlReader: false,
|
|
142
|
-
hasLocalQueryExecutor: false,
|
|
143
136
|
load: async () => {
|
|
144
137
|
const m = await import('../../connectors/sqlserver/connector.js');
|
|
145
138
|
return {
|
|
@@ -6,7 +6,7 @@ export interface KtxSqlQueryExecutionInput {
|
|
|
6
6
|
sql: string;
|
|
7
7
|
maxRows?: number;
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
interface KtxSqlQueryExecutionResult {
|
|
10
10
|
headers: string[];
|
|
11
11
|
rows: unknown[][];
|
|
12
12
|
totalRows: number;
|
|
@@ -17,3 +17,4 @@ export interface KtxSqlQueryExecutorPort {
|
|
|
17
17
|
execute(input: KtxSqlQueryExecutionInput): Promise<KtxSqlQueryExecutionResult>;
|
|
18
18
|
}
|
|
19
19
|
export declare function normalizeQueryRows(rows: unknown[]): unknown[][];
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** @internal */
|
|
2
|
+
export declare function createAbortError(message?: string): DOMException;
|
|
3
|
+
export declare function isAbortError(error: unknown): boolean;
|
|
4
|
+
/** @internal */
|
|
5
|
+
export declare function throwIfAborted(signal?: AbortSignal): void;
|
|
6
|
+
export declare function linkAbortSignal(parent?: AbortSignal): {
|
|
7
|
+
controller: AbortController;
|
|
8
|
+
dispose: () => void;
|
|
9
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** @internal */
|
|
2
|
+
export function createAbortError(message = 'Aborted') {
|
|
3
|
+
return new DOMException(message, 'AbortError');
|
|
4
|
+
}
|
|
5
|
+
export function isAbortError(error) {
|
|
6
|
+
if (error instanceof DOMException && error.name === 'AbortError') {
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
if (!error || typeof error !== 'object') {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
const record = error;
|
|
13
|
+
return record.name === 'AbortError' || record.code === 'ABORT_ERR';
|
|
14
|
+
}
|
|
15
|
+
/** @internal */
|
|
16
|
+
export function throwIfAborted(signal) {
|
|
17
|
+
if (signal?.aborted) {
|
|
18
|
+
throw createAbortError();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export function linkAbortSignal(parent) {
|
|
22
|
+
const controller = new AbortController();
|
|
23
|
+
if (!parent) {
|
|
24
|
+
return { controller, dispose: () => undefined };
|
|
25
|
+
}
|
|
26
|
+
if (parent.aborted) {
|
|
27
|
+
controller.abort(createAbortError());
|
|
28
|
+
return { controller, dispose: () => undefined };
|
|
29
|
+
}
|
|
30
|
+
const onAbort = () => controller.abort(createAbortError());
|
|
31
|
+
parent.addEventListener('abort', onAbort, { once: true });
|
|
32
|
+
return {
|
|
33
|
+
controller,
|
|
34
|
+
dispose: () => parent.removeEventListener('abort', onAbort),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
@@ -1,2 +1,13 @@
|
|
|
1
1
|
import { type SimpleGit } from 'simple-git';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Create a simple-git client scoped to `baseDir`. When an identity is provided, ktx's own
|
|
4
|
+
* commits carry it through the GIT_AUTHOR and GIT_COMMITTER environment variables instead of
|
|
5
|
+
* relying on repo-local or global git config. This keeps commits working when the project
|
|
6
|
+
* directory is an existing repo ktx did not create and the machine has no configured git
|
|
7
|
+
* identity (e.g. a fresh Mac with no ~/.gitconfig), without mutating the user's repo config.
|
|
8
|
+
* Explicit `--author` flags on individual commits still take precedence over GIT_AUTHOR_NAME.
|
|
9
|
+
*/
|
|
10
|
+
export declare function createSimpleGit(baseDir: string, identity?: {
|
|
11
|
+
name: string;
|
|
12
|
+
email: string;
|
|
13
|
+
}): SimpleGit;
|
|
@@ -21,6 +21,21 @@ function sanitizedGitEnv(env = process.env) {
|
|
|
21
21
|
}
|
|
22
22
|
return sanitized;
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Create a simple-git client scoped to `baseDir`. When an identity is provided, ktx's own
|
|
26
|
+
* commits carry it through the GIT_AUTHOR and GIT_COMMITTER environment variables instead of
|
|
27
|
+
* relying on repo-local or global git config. This keeps commits working when the project
|
|
28
|
+
* directory is an existing repo ktx did not create and the machine has no configured git
|
|
29
|
+
* identity (e.g. a fresh Mac with no ~/.gitconfig), without mutating the user's repo config.
|
|
30
|
+
* Explicit `--author` flags on individual commits still take precedence over GIT_AUTHOR_NAME.
|
|
31
|
+
*/
|
|
32
|
+
export function createSimpleGit(baseDir, identity) {
|
|
33
|
+
const env = sanitizedGitEnv();
|
|
34
|
+
if (identity?.name && identity.email) {
|
|
35
|
+
env.GIT_AUTHOR_NAME = identity.name;
|
|
36
|
+
env.GIT_AUTHOR_EMAIL = identity.email;
|
|
37
|
+
env.GIT_COMMITTER_NAME = identity.name;
|
|
38
|
+
env.GIT_COMMITTER_EMAIL = identity.email;
|
|
39
|
+
}
|
|
40
|
+
return simpleGit({ baseDir, unsafe: { allowUnsafeAskPass: true } }).env(env);
|
|
26
41
|
}
|
|
@@ -47,8 +47,12 @@ export class GitService {
|
|
|
47
47
|
// Ensure config directory exists
|
|
48
48
|
await fs.mkdir(this.configDir, { recursive: true });
|
|
49
49
|
this.logger.log(`Config directory ensured at: ${this.configDir}`);
|
|
50
|
-
// Initialize simple-git
|
|
51
|
-
this
|
|
50
|
+
// Initialize simple-git. Carry ktx's identity in the environment so commits succeed even
|
|
51
|
+
// when this repo already exists and the machine has no configured git identity.
|
|
52
|
+
this.git = createSimpleGit(this.configDir, {
|
|
53
|
+
name: this.config.git.userName,
|
|
54
|
+
email: this.config.git.userEmail,
|
|
55
|
+
});
|
|
52
56
|
// Initialize git repository
|
|
53
57
|
await this.initialize();
|
|
54
58
|
}
|
|
@@ -58,9 +62,6 @@ export class GitService {
|
|
|
58
62
|
const isRepo = await this.git.checkIsRepo();
|
|
59
63
|
if (!isRepo) {
|
|
60
64
|
await this.git.init();
|
|
61
|
-
const gitConfig = this.config.git;
|
|
62
|
-
await this.git.addConfig('user.name', gitConfig.userName);
|
|
63
|
-
await this.git.addConfig('user.email', gitConfig.userEmail);
|
|
64
65
|
this.logger.log('Initialized git repository');
|
|
65
66
|
}
|
|
66
67
|
// Keep any auto-maintenance triggered by writes in-process. Detached maintenance can
|
|
@@ -81,7 +82,11 @@ export class GitService {
|
|
|
81
82
|
}
|
|
82
83
|
catch (error) {
|
|
83
84
|
this.logger.error('Failed to initialize git repository', error);
|
|
84
|
-
|
|
85
|
+
// Preserve the underlying git error: the generic message alone is undiagnosable in
|
|
86
|
+
// telemetry and unactionable for the user. The exception reporter walks `cause` and
|
|
87
|
+
// redacts secrets before send.
|
|
88
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
89
|
+
throw new Error(`Failed to initialize git repository: ${detail}`, { cause: error });
|
|
85
90
|
}
|
|
86
91
|
}
|
|
87
92
|
async commitFile(filePath, commitMessage, author, authorEmail) {
|
|
@@ -740,7 +745,10 @@ export class GitService {
|
|
|
740
745
|
*/
|
|
741
746
|
forWorktree(workdir) {
|
|
742
747
|
const scoped = new GitService(this.config, this.logger);
|
|
743
|
-
scoped.git = createSimpleGit(workdir
|
|
748
|
+
scoped.git = createSimpleGit(workdir, {
|
|
749
|
+
name: this.config.git.userName,
|
|
750
|
+
email: this.config.git.userEmail,
|
|
751
|
+
});
|
|
744
752
|
scoped.configDir = workdir;
|
|
745
753
|
return scoped;
|
|
746
754
|
}
|
|
@@ -12,6 +12,7 @@ export interface QueryHistoryFilterProposal {
|
|
|
12
12
|
reason: 'no-llm' | 'no-daemon' | 'no-in-scope-history' | 'user-block-present';
|
|
13
13
|
} | null;
|
|
14
14
|
warnings: string[];
|
|
15
|
+
parseFailedTemplateIds: string[];
|
|
15
16
|
}
|
|
16
17
|
export interface ProposeQueryHistoryServiceAccountFiltersInput {
|
|
17
18
|
connectionId: string;
|
|
@@ -12,7 +12,7 @@ const queryHistoryFilterAdjudicationSchema = z.object({
|
|
|
12
12
|
}).strict()),
|
|
13
13
|
}).strict();
|
|
14
14
|
function emptyProposal(skipped, warnings = []) {
|
|
15
|
-
return { excludedRoles: [], consideredRoleCount: 0, skipped, warnings };
|
|
15
|
+
return { excludedRoles: [], consideredRoleCount: 0, skipped, warnings, parseFailedTemplateIds: [] };
|
|
16
16
|
}
|
|
17
17
|
function displayTableRef(ref) {
|
|
18
18
|
return [ref.catalog, ref.db, ref.name].filter((part) => !!part && part.length > 0).join('.');
|
|
@@ -98,6 +98,7 @@ export async function proposeQueryHistoryServiceAccountFilters(input) {
|
|
|
98
98
|
const windowDays = 'windowDays' in config ? config.windowDays : 90;
|
|
99
99
|
const windowStart = new Date(now.getTime() - windowDays * 24 * 60 * 60 * 1000);
|
|
100
100
|
const warnings = [];
|
|
101
|
+
const parseFailedTemplateIds = [];
|
|
101
102
|
const snapshot = [];
|
|
102
103
|
try {
|
|
103
104
|
for await (const row of input.reader.fetchAggregated(input.queryClient, { start: windowStart, end: now }, config)) {
|
|
@@ -127,7 +128,7 @@ export async function proposeQueryHistoryServiceAccountFilters(input) {
|
|
|
127
128
|
for (const template of snapshot) {
|
|
128
129
|
const parsed = analysis.get(template.templateId);
|
|
129
130
|
if (!parsed || parsed.error) {
|
|
130
|
-
|
|
131
|
+
parseFailedTemplateIds.push(template.templateId);
|
|
131
132
|
continue;
|
|
132
133
|
}
|
|
133
134
|
const tablesTouched = [...new Map(parsed.tablesTouched.map((ref) => [tableRefKey(ref), ref])).values()]
|
|
@@ -150,6 +151,7 @@ export async function proposeQueryHistoryServiceAccountFilters(input) {
|
|
|
150
151
|
consideredRoleCount: records.length,
|
|
151
152
|
skipped: { reason: 'no-in-scope-history' },
|
|
152
153
|
warnings,
|
|
154
|
+
parseFailedTemplateIds,
|
|
153
155
|
};
|
|
154
156
|
}
|
|
155
157
|
let generated;
|
|
@@ -170,6 +172,7 @@ export async function proposeQueryHistoryServiceAccountFilters(input) {
|
|
|
170
172
|
...warnings,
|
|
171
173
|
`query_history_filter_picker_llm_failed:${error instanceof Error ? error.message : String(error)}`,
|
|
172
174
|
],
|
|
175
|
+
parseFailedTemplateIds,
|
|
173
176
|
};
|
|
174
177
|
}
|
|
175
178
|
const knownRoles = new Set(records.map((record) => record.role));
|
|
@@ -186,5 +189,6 @@ export async function proposeQueryHistoryServiceAccountFilters(input) {
|
|
|
186
189
|
consideredRoleCount: records.length,
|
|
187
190
|
skipped: input.userServiceAccountsPresent ? { reason: 'user-block-present' } : null,
|
|
188
191
|
warnings,
|
|
192
|
+
parseFailedTemplateIds,
|
|
189
193
|
};
|
|
190
194
|
}
|
|
@@ -31,11 +31,7 @@ export interface CuratorPaginationInput {
|
|
|
31
31
|
buildUserPrompt: (input: CuratorPaginationPromptInput) => string;
|
|
32
32
|
buildToolSet: (passNumber: number) => KtxRuntimeToolSet;
|
|
33
33
|
getReconciliationActions: () => MemoryAction[];
|
|
34
|
-
|
|
35
|
-
passNumber: number;
|
|
36
|
-
stepIndex: number;
|
|
37
|
-
stepBudget: number;
|
|
38
|
-
}) => void;
|
|
34
|
+
abortSignal?: AbortSignal;
|
|
39
35
|
}
|
|
40
36
|
interface CuratorPaginationResult extends ReconciliationOutcome {
|
|
41
37
|
report: CuratorPaginationReport;
|
|
@@ -163,9 +163,7 @@ export class CuratorPaginationService {
|
|
|
163
163
|
sourceKey: params.input.sourceKey,
|
|
164
164
|
jobId: params.input.jobId,
|
|
165
165
|
forceRun: params.forceRun,
|
|
166
|
-
|
|
167
|
-
? ({ stepIndex, stepBudget }) => params.input.onStepFinish?.({ passNumber: params.passNumber, stepIndex, stepBudget })
|
|
168
|
-
: undefined,
|
|
166
|
+
abortSignal: params.input.abortSignal,
|
|
169
167
|
});
|
|
170
168
|
}
|
|
171
169
|
batchSummary(items) {
|
|
@@ -47,7 +47,7 @@ export declare class SqliteContextEvidenceStore implements ContextEvidenceIndexS
|
|
|
47
47
|
assertion: string;
|
|
48
48
|
rationale: string;
|
|
49
49
|
actionHint: string;
|
|
50
|
-
status: "conflict" | "merged" | "
|
|
50
|
+
status: "conflict" | "merged" | "rejected" | "pending" | "promoted";
|
|
51
51
|
promotionScore: number;
|
|
52
52
|
suggestedPageKey: string | null;
|
|
53
53
|
evidenceRefs: JsonValue;
|
|
@@ -153,6 +153,7 @@ export async function repairFinalGateFailure(input) {
|
|
|
153
153
|
jobId: input.trace.context.jobId,
|
|
154
154
|
repairKind: input.repairKind,
|
|
155
155
|
},
|
|
156
|
+
abortSignal: input.abortSignal,
|
|
156
157
|
}));
|
|
157
158
|
if (result.stopReason === 'error') {
|
|
158
159
|
lastFailure = result.error?.message ?? 'gate repair agent loop errored';
|
|
@@ -9,6 +9,9 @@ export declare class IngestBundleRunner {
|
|
|
9
9
|
private readonly chainByConnection;
|
|
10
10
|
constructor(deps: IngestBundleRunnerDeps);
|
|
11
11
|
run(job: IngestBundleJob, ctx?: IngestJobContext): Promise<IngestBundleResult>;
|
|
12
|
+
private formatRateLimitWait;
|
|
13
|
+
private subscribeRateLimitGovernor;
|
|
14
|
+
private withRateLimitWorkSlot;
|
|
12
15
|
/**
|
|
13
16
|
* When profiling is enabled — via the `KTX_PROFILE_INGEST` env var or the
|
|
14
17
|
* `ingest.profile` config setting — read the job's trace + tool transcripts
|