swarm-mail 1.3.0 → 1.5.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/README.md +174 -144
- package/bin/swarm-db.ts +168 -0
- package/dist/adapter.d.ts.map +1 -1
- package/dist/analytics/formatters.d.ts +50 -0
- package/dist/analytics/formatters.d.ts.map +1 -0
- package/dist/analytics/index.d.ts +35 -0
- package/dist/analytics/index.d.ts.map +1 -0
- package/dist/analytics/queries/agent-activity.d.ts +21 -0
- package/dist/analytics/queries/agent-activity.d.ts.map +1 -0
- package/dist/analytics/queries/checkpoint-frequency.d.ts +26 -0
- package/dist/analytics/queries/checkpoint-frequency.d.ts.map +1 -0
- package/dist/analytics/queries/failed-decompositions.d.ts +22 -0
- package/dist/analytics/queries/failed-decompositions.d.ts.map +1 -0
- package/dist/analytics/queries/human-feedback.d.ts +26 -0
- package/dist/analytics/queries/human-feedback.d.ts.map +1 -0
- package/dist/analytics/queries/index.d.ts +21 -0
- package/dist/analytics/queries/index.d.ts.map +1 -0
- package/dist/analytics/queries/lock-contention.d.ts +20 -0
- package/dist/analytics/queries/lock-contention.d.ts.map +1 -0
- package/dist/analytics/queries/message-latency.d.ts +24 -0
- package/dist/analytics/queries/message-latency.d.ts.map +1 -0
- package/dist/analytics/queries/recovery-success.d.ts +26 -0
- package/dist/analytics/queries/recovery-success.d.ts.map +1 -0
- package/dist/analytics/queries/scope-violations.d.ts +27 -0
- package/dist/analytics/queries/scope-violations.d.ts.map +1 -0
- package/dist/analytics/queries/strategy-success-rates.d.ts +20 -0
- package/dist/analytics/queries/strategy-success-rates.d.ts.map +1 -0
- package/dist/analytics/queries/task-duration.d.ts +31 -0
- package/dist/analytics/queries/task-duration.d.ts.map +1 -0
- package/dist/analytics/query-builder.d.ts +110 -0
- package/dist/analytics/query-builder.d.ts.map +1 -0
- package/dist/analytics/types.d.ts +36 -0
- package/dist/analytics/types.d.ts.map +1 -0
- package/dist/analytics.d.ts +46 -0
- package/dist/analytics.d.ts.map +1 -0
- package/dist/cli/db.d.ts +73 -0
- package/dist/cli/db.d.ts.map +1 -0
- package/dist/db/retry.d.ts +24 -0
- package/dist/db/retry.d.ts.map +1 -0
- package/dist/debug-demo.d.ts +12 -0
- package/dist/debug-demo.d.ts.map +1 -0
- package/dist/debug.d.ts +19 -0
- package/dist/debug.d.ts.map +1 -0
- package/dist/errors/base-error.d.ts +49 -0
- package/dist/errors/base-error.d.ts.map +1 -0
- package/dist/errors/checkpoint-error.d.ts +10 -0
- package/dist/errors/checkpoint-error.d.ts.map +1 -0
- package/dist/errors/decomposition-error.d.ts +10 -0
- package/dist/errors/decomposition-error.d.ts.map +1 -0
- package/dist/errors/index.d.ts +37 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/reservation-error.d.ts +10 -0
- package/dist/errors/reservation-error.d.ts.map +1 -0
- package/dist/errors/validation-error.d.ts +10 -0
- package/dist/errors/validation-error.d.ts.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +91560 -90272
- package/dist/libsql.d.ts.map +1 -1
- package/dist/streams/durable-adapter.d.ts +85 -0
- package/dist/streams/durable-adapter.d.ts.map +1 -0
- package/dist/streams/durable-server.d.ts +55 -0
- package/dist/streams/durable-server.d.ts.map +1 -0
- package/package.json +6 -2
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Analytics Module
|
|
3
|
+
*
|
|
4
|
+
* Type-safe query builder and result formatters for SQL analytics.
|
|
5
|
+
*
|
|
6
|
+
* ## Usage
|
|
7
|
+
*
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { QueryBuilder, formatTable } from "swarm-mail/analytics";
|
|
10
|
+
*
|
|
11
|
+
* const query = new QueryBuilder()
|
|
12
|
+
* .select(["type", "COUNT(*) as count"])
|
|
13
|
+
* .from("events")
|
|
14
|
+
* .where("project_key = ?", ["my-project"])
|
|
15
|
+
* .groupBy("type")
|
|
16
|
+
* .orderBy("count", "DESC")
|
|
17
|
+
* .limit(10)
|
|
18
|
+
* .withName("event-counts")
|
|
19
|
+
* .withDescription("Event type counts by project")
|
|
20
|
+
* .build();
|
|
21
|
+
*
|
|
22
|
+
* // Execute query (you provide the database adapter)
|
|
23
|
+
* const result = await db.query(query.sql, Object.values(query.parameters || {}));
|
|
24
|
+
*
|
|
25
|
+
* // Format output
|
|
26
|
+
* console.log(formatTable(result));
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @module analytics
|
|
30
|
+
*/
|
|
31
|
+
export { formatCSV, formatJSON, formatJSONL, formatTable } from "./formatters.js";
|
|
32
|
+
export { QueryBuilder } from "./query-builder.js";
|
|
33
|
+
export * from "./queries/index.js";
|
|
34
|
+
export type { AnalyticsQuery, OutputFormat, QueryResult } from "./types.js";
|
|
35
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/analytics/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,cAAc,oBAAoB,CAAC;AACnC,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Query 4: Agent Activity
|
|
3
|
+
*
|
|
4
|
+
* Tracks agent activity levels by event count and time span.
|
|
5
|
+
*/
|
|
6
|
+
import type { AnalyticsQuery } from "../types.js";
|
|
7
|
+
export interface AgentActivityFilters {
|
|
8
|
+
project_key?: string;
|
|
9
|
+
since?: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Build a query for agent activity analysis.
|
|
13
|
+
*
|
|
14
|
+
* Returns agent_name, event count, first event timestamp, last event timestamp,
|
|
15
|
+
* and active time span, ordered by event count descending.
|
|
16
|
+
*
|
|
17
|
+
* @param filters - Optional filters for project_key and time range
|
|
18
|
+
* @returns AnalyticsQuery ready for execution
|
|
19
|
+
*/
|
|
20
|
+
export declare function agentActivity(filters?: AgentActivityFilters): AnalyticsQuery;
|
|
21
|
+
//# sourceMappingURL=agent-activity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-activity.d.ts","sourceRoot":"","sources":["../../../src/analytics/queries/agent-activity.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,MAAM,WAAW,oBAAoB;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE,oBAAoB,GAAG,cAAc,CA0B5E"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checkpoint Frequency Query
|
|
3
|
+
*
|
|
4
|
+
* Analyzes how often agents create checkpoints.
|
|
5
|
+
* Useful for understanding checkpoint adoption and patterns.
|
|
6
|
+
*/
|
|
7
|
+
import type { AnalyticsQuery } from "../types.js";
|
|
8
|
+
/**
|
|
9
|
+
* Pre-built query to measure checkpoint frequency per agent.
|
|
10
|
+
*
|
|
11
|
+
* Counts checkpoint_created events grouped by agent.
|
|
12
|
+
* Shows which agents are actively using checkpoints.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const adapter = await getSwarmMailLibSQL(projectPath);
|
|
17
|
+
* const db = await adapter.getDatabase();
|
|
18
|
+
* const result = await db.query(checkpointFrequency.sql);
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare const checkpointFrequency: AnalyticsQuery & {
|
|
22
|
+
buildQuery?: (filters: {
|
|
23
|
+
project_key?: string;
|
|
24
|
+
}) => AnalyticsQuery;
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=checkpoint-frequency.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkpoint-frequency.d.ts","sourceRoot":"","sources":["../../../src/analytics/queries/checkpoint-frequency.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,mBAAmB,EAAE,cAAc,GAAG;IAClD,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,cAAc,CAAC;CAyCnE,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Query 1: Failed Decompositions
|
|
3
|
+
*
|
|
4
|
+
* Analyzes decomposition failures by strategy, showing which strategies
|
|
5
|
+
* have the highest failure rates and average duration.
|
|
6
|
+
*/
|
|
7
|
+
import type { AnalyticsQuery } from "../types.js";
|
|
8
|
+
export interface FailedDecompositionsFilters {
|
|
9
|
+
project_key?: string;
|
|
10
|
+
limit?: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Build a query for failed decompositions grouped by strategy.
|
|
14
|
+
*
|
|
15
|
+
* Returns strategy, failure count, and average duration for all failed
|
|
16
|
+
* subtask outcomes, ordered by failure count descending.
|
|
17
|
+
*
|
|
18
|
+
* @param filters - Optional filters for project_key and limit
|
|
19
|
+
* @returns AnalyticsQuery ready for execution
|
|
20
|
+
*/
|
|
21
|
+
export declare function failedDecompositions(filters?: FailedDecompositionsFilters): AnalyticsQuery;
|
|
22
|
+
//# sourceMappingURL=failed-decompositions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"failed-decompositions.d.ts","sourceRoot":"","sources":["../../../src/analytics/queries/failed-decompositions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,MAAM,WAAW,2BAA2B;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CACnC,OAAO,CAAC,EAAE,2BAA2B,GACnC,cAAc,CA0BhB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Human Feedback Query
|
|
3
|
+
*
|
|
4
|
+
* Analyzes approval vs rejection rates from human review.
|
|
5
|
+
* Tracks review_feedback events to measure quality control.
|
|
6
|
+
*/
|
|
7
|
+
import type { AnalyticsQuery } from "../types.js";
|
|
8
|
+
/**
|
|
9
|
+
* Pre-built query to analyze human feedback patterns.
|
|
10
|
+
*
|
|
11
|
+
* Counts approvals vs rejections from review_feedback events.
|
|
12
|
+
* Shows breakdown by status (approved vs needs_changes).
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const adapter = await getSwarmMailLibSQL(projectPath);
|
|
17
|
+
* const db = await adapter.getDatabase();
|
|
18
|
+
* const result = await db.query(humanFeedback.sql);
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare const humanFeedback: AnalyticsQuery & {
|
|
22
|
+
buildQuery?: (filters: {
|
|
23
|
+
project_key?: string;
|
|
24
|
+
}) => AnalyticsQuery;
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=human-feedback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"human-feedback.d.ts","sourceRoot":"","sources":["../../../src/analytics/queries/human-feedback.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,aAAa,EAAE,cAAc,GAAG;IAC5C,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,cAAc,CAAC;CAqCnE,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pre-built Analytics Queries
|
|
3
|
+
*
|
|
4
|
+
* Barrel export for all query functions.
|
|
5
|
+
*/
|
|
6
|
+
export type { AgentActivityFilters } from "./agent-activity.js";
|
|
7
|
+
export { agentActivity } from "./agent-activity.js";
|
|
8
|
+
export { checkpointFrequency } from "./checkpoint-frequency.js";
|
|
9
|
+
export type { FailedDecompositionsFilters } from "./failed-decompositions.js";
|
|
10
|
+
export { failedDecompositions } from "./failed-decompositions.js";
|
|
11
|
+
export { humanFeedback } from "./human-feedback.js";
|
|
12
|
+
export type { LockContentionFilters } from "./lock-contention.js";
|
|
13
|
+
export { lockContention } from "./lock-contention.js";
|
|
14
|
+
export type { MessageLatencyFilters } from "./message-latency.js";
|
|
15
|
+
export { messageLatency } from "./message-latency.js";
|
|
16
|
+
export { recoverySuccess } from "./recovery-success.js";
|
|
17
|
+
export { scopeViolations } from "./scope-violations.js";
|
|
18
|
+
export type { StrategySuccessRatesFilters } from "./strategy-success-rates.js";
|
|
19
|
+
export { strategySuccessRates } from "./strategy-success-rates.js";
|
|
20
|
+
export { taskDuration } from "./task-duration.js";
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/analytics/queries/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,YAAY,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,YAAY,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,YAAY,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Query 3: Lock Contention
|
|
3
|
+
*
|
|
4
|
+
* Identifies files with highest reservation counts and average hold times.
|
|
5
|
+
*/
|
|
6
|
+
import type { AnalyticsQuery } from "../types.js";
|
|
7
|
+
export interface LockContentionFilters {
|
|
8
|
+
limit?: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Build a query for lock contention analysis.
|
|
12
|
+
*
|
|
13
|
+
* Returns path_pattern, reservation count, and average hold time for
|
|
14
|
+
* file reservations, ordered by reservation count descending.
|
|
15
|
+
*
|
|
16
|
+
* @param filters - Optional limit
|
|
17
|
+
* @returns AnalyticsQuery ready for execution
|
|
18
|
+
*/
|
|
19
|
+
export declare function lockContention(filters?: LockContentionFilters): AnalyticsQuery;
|
|
20
|
+
//# sourceMappingURL=lock-contention.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lock-contention.d.ts","sourceRoot":"","sources":["../../../src/analytics/queries/lock-contention.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,MAAM,WAAW,qBAAqB;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,OAAO,CAAC,EAAE,qBAAqB,GAAG,cAAc,CAqB9E"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Query 5: Message Latency
|
|
3
|
+
*
|
|
4
|
+
* Calculates p50, p95, p99 response times for messages.
|
|
5
|
+
*
|
|
6
|
+
* Note: SQLite doesn't have native percentile functions, so we use
|
|
7
|
+
* a simplified approach that orders by latency and extracts values
|
|
8
|
+
* at approximate percentile positions.
|
|
9
|
+
*/
|
|
10
|
+
import type { AnalyticsQuery } from "../types.js";
|
|
11
|
+
export interface MessageLatencyFilters {
|
|
12
|
+
project_key?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Build a query for message latency percentiles.
|
|
16
|
+
*
|
|
17
|
+
* Returns approximate p50, p95, p99 latency values for messages.
|
|
18
|
+
* Uses a CTE to compute latencies, then calculates percentiles.
|
|
19
|
+
*
|
|
20
|
+
* @param filters - Optional filters for project_key
|
|
21
|
+
* @returns AnalyticsQuery ready for execution
|
|
22
|
+
*/
|
|
23
|
+
export declare function messageLatency(filters?: MessageLatencyFilters): AnalyticsQuery;
|
|
24
|
+
//# sourceMappingURL=message-latency.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-latency.d.ts","sourceRoot":"","sources":["../../../src/analytics/queries/message-latency.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,MAAM,WAAW,qBAAqB;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC7B,OAAO,CAAC,EAAE,qBAAqB,GAC7B,cAAc,CA8ChB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recovery Success Query
|
|
3
|
+
*
|
|
4
|
+
* Calculates success rate for deferred task resolution.
|
|
5
|
+
* Tracks how often deferred tasks resolve successfully vs fail.
|
|
6
|
+
*/
|
|
7
|
+
import type { AnalyticsQuery } from "../types.js";
|
|
8
|
+
/**
|
|
9
|
+
* Pre-built query to measure recovery success rate.
|
|
10
|
+
*
|
|
11
|
+
* Calculates percentage of deferred tasks that resolved successfully
|
|
12
|
+
* vs those that were rejected or failed.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const adapter = await getSwarmMailLibSQL(projectPath);
|
|
17
|
+
* const db = await adapter.getDatabase();
|
|
18
|
+
* const result = await db.query(recoverySuccess.sql);
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare const recoverySuccess: AnalyticsQuery & {
|
|
22
|
+
buildQuery?: (filters: {
|
|
23
|
+
project_key?: string;
|
|
24
|
+
}) => AnalyticsQuery;
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=recovery-success.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recovery-success.d.ts","sourceRoot":"","sources":["../../../src/analytics/queries/recovery-success.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,eAAe,EAAE,cAAc,GAAG;IAC9C,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,cAAc,CAAC;CAmCnE,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scope Violations Query
|
|
3
|
+
*
|
|
4
|
+
* Identifies files touched outside the agent's assigned scope.
|
|
5
|
+
* Useful for detecting agents that modify files they weren't
|
|
6
|
+
* supposed to touch.
|
|
7
|
+
*/
|
|
8
|
+
import type { AnalyticsQuery } from "../types.js";
|
|
9
|
+
/**
|
|
10
|
+
* Pre-built query to find scope violations.
|
|
11
|
+
*
|
|
12
|
+
* Extracts files_touched from task_completed events and compares
|
|
13
|
+
* against assigned scope (from task data).
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const adapter = await getSwarmMailLibSQL(projectPath);
|
|
18
|
+
* const db = await adapter.getDatabase();
|
|
19
|
+
* const result = await db.query(scopeViolations.sql);
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare const scopeViolations: AnalyticsQuery & {
|
|
23
|
+
buildQuery?: (filters: {
|
|
24
|
+
project_key?: string;
|
|
25
|
+
}) => AnalyticsQuery;
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=scope-violations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope-violations.d.ts","sourceRoot":"","sources":["../../../src/analytics/queries/scope-violations.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,eAAe,EAAE,cAAc,GAAG;IAC9C,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,cAAc,CAAC;CAyCnE,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Query 2: Strategy Success Rates
|
|
3
|
+
*
|
|
4
|
+
* Calculates success rate percentage for each decomposition strategy.
|
|
5
|
+
*/
|
|
6
|
+
import type { AnalyticsQuery } from "../types.js";
|
|
7
|
+
export interface StrategySuccessRatesFilters {
|
|
8
|
+
project_key?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Build a query for strategy success rates.
|
|
12
|
+
*
|
|
13
|
+
* Returns strategy, total attempts, successful count, failed count, and
|
|
14
|
+
* success rate percentage, ordered by success rate descending.
|
|
15
|
+
*
|
|
16
|
+
* @param filters - Optional filters for project_key
|
|
17
|
+
* @returns AnalyticsQuery ready for execution
|
|
18
|
+
*/
|
|
19
|
+
export declare function strategySuccessRates(filters?: StrategySuccessRatesFilters): AnalyticsQuery;
|
|
20
|
+
//# sourceMappingURL=strategy-success-rates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strategy-success-rates.d.ts","sourceRoot":"","sources":["../../../src/analytics/queries/strategy-success-rates.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,MAAM,WAAW,2BAA2B;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CACnC,OAAO,CAAC,EAAE,2BAA2B,GACnC,cAAc,CAuBhB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task Duration Query
|
|
3
|
+
*
|
|
4
|
+
* Calculates p50, p95, and p99 percentiles for task completion times.
|
|
5
|
+
* Uses window functions to compute percentiles from task start/end events.
|
|
6
|
+
*/
|
|
7
|
+
import type { AnalyticsQuery } from "../types.js";
|
|
8
|
+
/**
|
|
9
|
+
* Pre-built query to calculate task duration percentiles.
|
|
10
|
+
*
|
|
11
|
+
* Computes p50 (median), p95, and p99 durations by:
|
|
12
|
+
* 1. Finding task_started and task_completed event pairs
|
|
13
|
+
* 2. Calculating duration = completed_timestamp - started_timestamp
|
|
14
|
+
* 3. Using ORDER BY + LIMIT to approximate percentiles
|
|
15
|
+
*
|
|
16
|
+
* Note: libSQL doesn't have percentile_cont, so we use row counting
|
|
17
|
+
* to approximate percentiles.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const adapter = await getSwarmMailLibSQL(projectPath);
|
|
22
|
+
* const db = await adapter.getDatabase();
|
|
23
|
+
* const result = await db.query(taskDuration.sql);
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare const taskDuration: AnalyticsQuery & {
|
|
27
|
+
buildQuery?: (filters: {
|
|
28
|
+
project_key?: string;
|
|
29
|
+
}) => AnalyticsQuery;
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=task-duration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-duration.d.ts","sourceRoot":"","sources":["../../../src/analytics/queries/task-duration.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,YAAY,EAAE,cAAc,GAAG;IAC3C,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,cAAc,CAAC;CAqEnE,CAAC"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Analytics Query Builder
|
|
3
|
+
*
|
|
4
|
+
* Fluent API for constructing SQL queries with type safety.
|
|
5
|
+
* Produces parameterized queries to prevent SQL injection.
|
|
6
|
+
*/
|
|
7
|
+
import type { AnalyticsQuery } from "./types.js";
|
|
8
|
+
/**
|
|
9
|
+
* Fluent query builder for constructing SQL queries.
|
|
10
|
+
*
|
|
11
|
+
* Supports SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT.
|
|
12
|
+
* Accumulates parameters from WHERE and HAVING clauses.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const query = new QueryBuilder()
|
|
17
|
+
* .select(["type", "COUNT(*) as count"])
|
|
18
|
+
* .from("events")
|
|
19
|
+
* .where("project_key = ?", ["my-project"])
|
|
20
|
+
* .groupBy("type")
|
|
21
|
+
* .orderBy("count", "DESC")
|
|
22
|
+
* .limit(10)
|
|
23
|
+
* .withName("event-counts")
|
|
24
|
+
* .withDescription("Event type counts by project")
|
|
25
|
+
* .build();
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare class QueryBuilder {
|
|
29
|
+
private selectClause;
|
|
30
|
+
private fromClause;
|
|
31
|
+
private whereClauses;
|
|
32
|
+
private groupByClause;
|
|
33
|
+
private havingClauses;
|
|
34
|
+
private orderByClause;
|
|
35
|
+
private limitClause;
|
|
36
|
+
private queryName;
|
|
37
|
+
private queryDescription;
|
|
38
|
+
private params;
|
|
39
|
+
/**
|
|
40
|
+
* Add SELECT clause with column expressions.
|
|
41
|
+
*
|
|
42
|
+
* @param columns - Array of column names or expressions (e.g., ["id", "COUNT(*) as count"])
|
|
43
|
+
*/
|
|
44
|
+
select(columns: string[]): this;
|
|
45
|
+
/**
|
|
46
|
+
* Set FROM clause with table name.
|
|
47
|
+
*
|
|
48
|
+
* @param table - Table name to query from
|
|
49
|
+
*/
|
|
50
|
+
from(table: string): this;
|
|
51
|
+
/**
|
|
52
|
+
* Add WHERE condition with optional parameters.
|
|
53
|
+
*
|
|
54
|
+
* Multiple calls are combined with AND.
|
|
55
|
+
*
|
|
56
|
+
* @param condition - SQL condition (use ? for parameter placeholders)
|
|
57
|
+
* @param params - Parameter values to bind
|
|
58
|
+
*/
|
|
59
|
+
where(condition: string, params?: unknown[]): this;
|
|
60
|
+
/**
|
|
61
|
+
* Set GROUP BY clause.
|
|
62
|
+
*
|
|
63
|
+
* @param column - Column to group by
|
|
64
|
+
*/
|
|
65
|
+
groupBy(column: string): this;
|
|
66
|
+
/**
|
|
67
|
+
* Add HAVING condition with optional parameters.
|
|
68
|
+
*
|
|
69
|
+
* Multiple calls are combined with AND.
|
|
70
|
+
*
|
|
71
|
+
* @param condition - SQL condition (use ? for parameter placeholders)
|
|
72
|
+
* @param params - Parameter values to bind
|
|
73
|
+
*/
|
|
74
|
+
having(condition: string, params?: unknown[]): this;
|
|
75
|
+
/**
|
|
76
|
+
* Set ORDER BY clause.
|
|
77
|
+
*
|
|
78
|
+
* @param column - Column to sort by
|
|
79
|
+
* @param direction - Sort direction (ASC or DESC)
|
|
80
|
+
*/
|
|
81
|
+
orderBy(column: string, direction?: "ASC" | "DESC"): this;
|
|
82
|
+
/**
|
|
83
|
+
* Set LIMIT clause.
|
|
84
|
+
*
|
|
85
|
+
* @param count - Maximum number of rows to return
|
|
86
|
+
*/
|
|
87
|
+
limit(count: number): this;
|
|
88
|
+
/**
|
|
89
|
+
* Set query name (for AnalyticsQuery.name).
|
|
90
|
+
*
|
|
91
|
+
* @param name - Unique identifier for this query
|
|
92
|
+
*/
|
|
93
|
+
withName(name: string): this;
|
|
94
|
+
/**
|
|
95
|
+
* Set query description (for AnalyticsQuery.description).
|
|
96
|
+
*
|
|
97
|
+
* @param description - Human-readable description of what query does
|
|
98
|
+
*/
|
|
99
|
+
withDescription(description: string): this;
|
|
100
|
+
/**
|
|
101
|
+
* Build the final AnalyticsQuery object.
|
|
102
|
+
*
|
|
103
|
+
* Constructs SQL string from accumulated clauses and returns
|
|
104
|
+
* AnalyticsQuery with name, description, sql, and parameters.
|
|
105
|
+
*
|
|
106
|
+
* @returns Complete AnalyticsQuery ready for execution
|
|
107
|
+
*/
|
|
108
|
+
build(): AnalyticsQuery;
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=query-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-builder.d.ts","sourceRoot":"","sources":["../../src/analytics/query-builder.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,YAAY;IACxB,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,UAAU,CAAM;IACxB,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,aAAa,CAAM;IAC3B,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,aAAa,CAAM;IAC3B,OAAO,CAAC,WAAW,CAAM;IACzB,OAAO,CAAC,SAAS,CAAM;IACvB,OAAO,CAAC,gBAAgB,CAAM;IAC9B,OAAO,CAAC,MAAM,CAAiB;IAE/B;;;;OAIG;IACH,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI;IAK/B;;;;OAIG;IACH,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAKzB;;;;;;;OAOG;IACH,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,GAAE,OAAO,EAAO,GAAG,IAAI;IAMtD;;;;OAIG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAK7B;;;;;;;OAOG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,GAAE,OAAO,EAAO,GAAG,IAAI;IAMvD;;;;;OAKG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,GAAE,KAAK,GAAG,MAAc,GAAG,IAAI;IAKhE;;;;OAIG;IACH,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK1B;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAK5B;;;;OAIG;IACH,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAK1C;;;;;;;OAOG;IACH,KAAK,IAAI,cAAc;CA2DvB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Analytics Query Builder Types
|
|
3
|
+
*
|
|
4
|
+
* Type-safe interfaces for SQL query construction and result formatting.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Represents a named analytics query with optional parameters.
|
|
8
|
+
*/
|
|
9
|
+
export interface AnalyticsQuery {
|
|
10
|
+
/** Unique identifier for the query */
|
|
11
|
+
name: string;
|
|
12
|
+
/** Human-readable description of what the query does */
|
|
13
|
+
description: string;
|
|
14
|
+
/** SQL query string (may include ? placeholders for parameters) */
|
|
15
|
+
sql: string;
|
|
16
|
+
/** Optional parameters to bind to the SQL query */
|
|
17
|
+
parameters?: Record<string, unknown>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Result of executing an analytics query.
|
|
21
|
+
*/
|
|
22
|
+
export interface QueryResult {
|
|
23
|
+
/** Column names in result set */
|
|
24
|
+
columns: string[];
|
|
25
|
+
/** Result rows as objects (column name -> value) */
|
|
26
|
+
rows: Record<string, unknown>[];
|
|
27
|
+
/** Total number of rows returned */
|
|
28
|
+
rowCount: number;
|
|
29
|
+
/** Query execution time in milliseconds */
|
|
30
|
+
executionTimeMs: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Supported output formats for query results.
|
|
34
|
+
*/
|
|
35
|
+
export type OutputFormat = "table" | "json" | "csv" | "jsonl";
|
|
36
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/analytics/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,WAAW,EAAE,MAAM,CAAC;IACpB,mEAAmE;IACnE,GAAG,EAAE,MAAM,CAAC;IACZ,mDAAmD;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC3B,iCAAiC;IACjC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IAChC,oCAAoC;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,eAAe,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { DatabaseAdapter } from "./types/database.js";
|
|
2
|
+
/**
|
|
3
|
+
* Analytics query definition for pre-built queries.
|
|
4
|
+
* Based on Google's Four Golden Signals: Latency, Traffic, Errors, Saturation.
|
|
5
|
+
*/
|
|
6
|
+
export interface AnalyticsQuery {
|
|
7
|
+
/** Short name for CLI reference (e.g., "latency", "traffic") */
|
|
8
|
+
name: string;
|
|
9
|
+
/** Human-readable description */
|
|
10
|
+
description: string;
|
|
11
|
+
/** Parameterized SQL query (use ? placeholders for since/until) */
|
|
12
|
+
sql: string;
|
|
13
|
+
/** Format query results as string (table/json/csv handled by caller) */
|
|
14
|
+
format: (rows: unknown[]) => string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Pre-built analytics queries for swarm-db CLI.
|
|
18
|
+
* Based on Four Golden Signals monitoring framework.
|
|
19
|
+
*/
|
|
20
|
+
export declare const ANALYTICS_QUERIES: AnalyticsQuery[];
|
|
21
|
+
/**
|
|
22
|
+
* Run a pre-built analytics query against the database.
|
|
23
|
+
*
|
|
24
|
+
* @param db Database adapter
|
|
25
|
+
* @param queryName Name of the query to run (e.g., "latency", "traffic")
|
|
26
|
+
* @param options Query options
|
|
27
|
+
* @param options.since Filter events after this timestamp
|
|
28
|
+
* @param options.until Filter events before this timestamp
|
|
29
|
+
* @param options.format Output format: "table" (default), "json", or "csv"
|
|
30
|
+
* @returns Formatted query results as string
|
|
31
|
+
*
|
|
32
|
+
* @throws Error if query name is not found
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* const db = await createInMemoryDatabaseAdapter();
|
|
37
|
+
* const result = await runAnalyticsQuery(db, "latency", { format: "json" });
|
|
38
|
+
* console.log(result);
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function runAnalyticsQuery(db: DatabaseAdapter, queryName: string, options?: {
|
|
42
|
+
since?: Date;
|
|
43
|
+
until?: Date;
|
|
44
|
+
format?: "table" | "json" | "csv";
|
|
45
|
+
}): Promise<string>;
|
|
46
|
+
//# sourceMappingURL=analytics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../src/analytics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC9B,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,iCAAiC;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,mEAAmE;IACnE,GAAG,EAAE,MAAM,CAAC;IACZ,wEAAwE;IACxE,MAAM,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,MAAM,CAAC;CACpC;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,cAAc,EAuH7C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,iBAAiB,CACtC,EAAE,EAAE,eAAe,EACnB,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE;IACT,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC;CAClC,GACC,OAAO,CAAC,MAAM,CAAC,CA2CjB"}
|
package/dist/cli/db.d.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI DB Commands Implementation
|
|
3
|
+
*
|
|
4
|
+
* Implements swarm-db CLI commands:
|
|
5
|
+
* - query: execute raw SQL
|
|
6
|
+
* - analytics: run pre-built queries
|
|
7
|
+
* - list: show available analytics
|
|
8
|
+
*/
|
|
9
|
+
import type { OutputFormat } from "../analytics/types.js";
|
|
10
|
+
/**
|
|
11
|
+
* Analytics command definition
|
|
12
|
+
*/
|
|
13
|
+
export interface AnalyticsCommand {
|
|
14
|
+
name: string;
|
|
15
|
+
description: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Options for executeQueryCommand
|
|
19
|
+
*/
|
|
20
|
+
export interface QueryOptions {
|
|
21
|
+
sql: string;
|
|
22
|
+
db: string;
|
|
23
|
+
format: OutputFormat;
|
|
24
|
+
limit?: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Options for executeAnalyticsCommand
|
|
28
|
+
*/
|
|
29
|
+
export interface AnalyticsOptions {
|
|
30
|
+
command: string;
|
|
31
|
+
db: string;
|
|
32
|
+
format: OutputFormat;
|
|
33
|
+
since?: string;
|
|
34
|
+
until?: string;
|
|
35
|
+
project?: string;
|
|
36
|
+
epic?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Validate SQL query is read-only (SELECT only).
|
|
40
|
+
*
|
|
41
|
+
* @param sql - SQL query to validate
|
|
42
|
+
* @throws Error if query is not a SELECT
|
|
43
|
+
*/
|
|
44
|
+
export declare function validateSQL(sql: string): void;
|
|
45
|
+
/**
|
|
46
|
+
* Parse time range string (7d, 24h, 30m) into a Date.
|
|
47
|
+
*
|
|
48
|
+
* @param range - Time range string (e.g., "7d", "24h", "30m")
|
|
49
|
+
* @returns Date object representing the point in time
|
|
50
|
+
* @throws Error if format is invalid
|
|
51
|
+
*/
|
|
52
|
+
export declare function parseTimeRange(range: string): Date;
|
|
53
|
+
/**
|
|
54
|
+
* List all available analytics commands with descriptions.
|
|
55
|
+
*
|
|
56
|
+
* @returns Array of analytics command definitions
|
|
57
|
+
*/
|
|
58
|
+
export declare function listAnalyticsCommands(): AnalyticsCommand[];
|
|
59
|
+
/**
|
|
60
|
+
* Execute a raw SQL query command.
|
|
61
|
+
*
|
|
62
|
+
* @param options - Query options including SQL, database path, format, and limit
|
|
63
|
+
* @returns Formatted query result as string
|
|
64
|
+
*/
|
|
65
|
+
export declare function executeQueryCommand(options: QueryOptions): Promise<string>;
|
|
66
|
+
/**
|
|
67
|
+
* Execute an analytics command.
|
|
68
|
+
*
|
|
69
|
+
* @param options - Analytics options including command name, filters, and format
|
|
70
|
+
* @returns Formatted query result as string
|
|
71
|
+
*/
|
|
72
|
+
export declare function executeAnalyticsCommand(options: AnalyticsOptions): Promise<string>;
|
|
73
|
+
//# sourceMappingURL=db.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../src/cli/db.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAe,MAAM,uBAAuB,CAAC;AAIvE;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,YAAY,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,YAAY,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAa7C;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAgClD;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,gBAAgB,EAAE,CAmD1D;AAED;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACxC,OAAO,EAAE,YAAY,GACnB,OAAO,CAAC,MAAM,CAAC,CA2BjB;AAED;;;;;GAKG;AACH,wBAAsB,uBAAuB,CAC5C,OAAO,EAAE,gBAAgB,GACvB,OAAO,CAAC,MAAM,CAAC,CAsCjB"}
|