@hasna/logs 0.3.15 → 0.3.16
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/dist/mcp/index.js +6 -3
- package/package.json +4 -3
- package/src/mcp/index.test.ts +2 -0
- package/src/mcp/index.ts +3 -1
package/dist/mcp/index.js
CHANGED
|
@@ -6527,7 +6527,7 @@ var require_dist = __commonJS((exports, module) => {
|
|
|
6527
6527
|
var require_package = __commonJS((exports, module) => {
|
|
6528
6528
|
module.exports = {
|
|
6529
6529
|
name: "@hasna/logs",
|
|
6530
|
-
version: "0.3.
|
|
6530
|
+
version: "0.3.16",
|
|
6531
6531
|
description: "Log aggregation + browser script + headless page scanner + performance monitoring for AI agents",
|
|
6532
6532
|
type: "module",
|
|
6533
6533
|
main: "./dist/index.js",
|
|
@@ -6544,7 +6544,8 @@ var require_package = __commonJS((exports, module) => {
|
|
|
6544
6544
|
dev: "bun run src/server/index.ts",
|
|
6545
6545
|
test: "bun test",
|
|
6546
6546
|
"test:coverage": "bun test --coverage",
|
|
6547
|
-
lint: "biome check src/"
|
|
6547
|
+
lint: "biome check src/",
|
|
6548
|
+
postinstall: "mkdir -p $HOME/.hasna/logs 2>/dev/null || true"
|
|
6548
6549
|
},
|
|
6549
6550
|
repository: {
|
|
6550
6551
|
type: "git",
|
|
@@ -24028,6 +24029,7 @@ var TOOLS = {
|
|
|
24028
24029
|
log_summary: { desc: "Error/warn counts by service", params: "(project_id?, since?)" },
|
|
24029
24030
|
log_context: { desc: "All logs for a trace_id", params: "(trace_id, brief?=true)" },
|
|
24030
24031
|
log_context_from_id: { desc: "Trace context from a log ID (no trace_id needed)", params: "(log_id, brief?=true)" },
|
|
24032
|
+
log_export: { desc: "Export matching logs as JSON or CSV", params: "(project_id?, format?='json', since?, until?, level?, service?, limit?=100000)" },
|
|
24031
24033
|
log_diagnose: { desc: "Full diagnosis: score, top errors, failing pages, perf regressions", params: "(project_id, since?='24h', include?=['top_errors','error_rate','failing_pages','perf'])" },
|
|
24032
24034
|
log_compare: { desc: "Diff two time windows for new/resolved errors", params: "(project_id, a_since, a_until, b_since, b_until)" },
|
|
24033
24035
|
log_session_context: { desc: "Logs + session metadata for a session_id", params: "(session_id, brief?=true)" },
|
|
@@ -24042,6 +24044,7 @@ var TOOLS = {
|
|
|
24042
24044
|
list_alert_rules: { desc: "List alert rules", params: "(project_id?)" },
|
|
24043
24045
|
delete_alert_rule: { desc: "Delete alert rule", params: "(id)" },
|
|
24044
24046
|
get_health: { desc: "Server health + DB stats", params: "()" },
|
|
24047
|
+
log_stats: { desc: "Aggregate DB-level log statistics for a project", params: "(project_id?)" },
|
|
24045
24048
|
search_tools: { desc: "Search tools by keyword \u2014 returns names, descriptions, param signatures", params: "(query)" },
|
|
24046
24049
|
describe_tools: { desc: "List all tools with descriptions and param signatures", params: "()" }
|
|
24047
24050
|
};
|
|
@@ -24297,7 +24300,7 @@ registerTool("delete_alert_rule", { id: exports_external.string() }, ({ id }) =>
|
|
|
24297
24300
|
registerTool("get_health", {}, () => ({
|
|
24298
24301
|
content: [{ type: "text", text: JSON.stringify(getHealth(db)) }]
|
|
24299
24302
|
}));
|
|
24300
|
-
|
|
24303
|
+
registerTool("log_stats", {
|
|
24301
24304
|
project_id: exports_external.string().optional().describe("Project name or ID (scope stats to a project)")
|
|
24302
24305
|
}, (args) => {
|
|
24303
24306
|
const projectId = rp(args.project_id);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hasna/logs",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.16",
|
|
4
4
|
"description": "Log aggregation + browser script + headless page scanner + performance monitoring for AI agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
"dev": "bun run src/server/index.ts",
|
|
18
18
|
"test": "bun test",
|
|
19
19
|
"test:coverage": "bun test --coverage",
|
|
20
|
-
"lint": "biome check src/"
|
|
20
|
+
"lint": "biome check src/",
|
|
21
|
+
"postinstall": "mkdir -p $HOME/.hasna/logs 2>/dev/null || true"
|
|
21
22
|
},
|
|
22
23
|
"repository": {
|
|
23
24
|
"type": "git",
|
|
@@ -55,4 +56,4 @@
|
|
|
55
56
|
"@types/react": "^19.1.4",
|
|
56
57
|
"typescript": "^5.9.3"
|
|
57
58
|
}
|
|
58
|
-
}
|
|
59
|
+
}
|
package/src/mcp/index.test.ts
CHANGED
|
@@ -18,7 +18,9 @@ test("logs MCP lists tools over stdio", async () => {
|
|
|
18
18
|
|
|
19
19
|
expect(toolNames.length).toBeGreaterThan(0)
|
|
20
20
|
expect(toolNames).toContain("get_health")
|
|
21
|
+
expect(toolNames).toContain("log_export")
|
|
21
22
|
expect(toolNames).toContain("log_search")
|
|
23
|
+
expect(toolNames).toContain("log_stats")
|
|
22
24
|
} finally {
|
|
23
25
|
await client.close().catch(() => {})
|
|
24
26
|
}
|
package/src/mcp/index.ts
CHANGED
|
@@ -61,6 +61,7 @@ const TOOLS: Record<string, { desc: string; params: string }> = {
|
|
|
61
61
|
log_summary: { desc: "Error/warn counts by service", params: "(project_id?, since?)" },
|
|
62
62
|
log_context: { desc: "All logs for a trace_id", params: "(trace_id, brief?=true)" },
|
|
63
63
|
log_context_from_id: { desc: "Trace context from a log ID (no trace_id needed)", params: "(log_id, brief?=true)" },
|
|
64
|
+
log_export: { desc: "Export matching logs as JSON or CSV", params: "(project_id?, format?='json', since?, until?, level?, service?, limit?=100000)" },
|
|
64
65
|
log_diagnose: { desc: "Full diagnosis: score, top errors, failing pages, perf regressions", params: "(project_id, since?='24h', include?=['top_errors','error_rate','failing_pages','perf'])" },
|
|
65
66
|
log_compare: { desc: "Diff two time windows for new/resolved errors", params: "(project_id, a_since, a_until, b_since, b_until)" },
|
|
66
67
|
log_session_context: { desc: "Logs + session metadata for a session_id", params: "(session_id, brief?=true)" },
|
|
@@ -75,6 +76,7 @@ const TOOLS: Record<string, { desc: string; params: string }> = {
|
|
|
75
76
|
list_alert_rules: { desc: "List alert rules", params: "(project_id?)" },
|
|
76
77
|
delete_alert_rule: { desc: "Delete alert rule", params: "(id)" },
|
|
77
78
|
get_health: { desc: "Server health + DB stats", params: "()" },
|
|
79
|
+
log_stats: { desc: "Aggregate DB-level log statistics for a project", params: "(project_id?)" },
|
|
78
80
|
search_tools: { desc: "Search tools by keyword — returns names, descriptions, param signatures", params: "(query)" },
|
|
79
81
|
describe_tools: { desc: "List all tools with descriptions and param signatures", params: "()" },
|
|
80
82
|
}
|
|
@@ -321,7 +323,7 @@ registerTool("get_health", {}, () => ({
|
|
|
321
323
|
content: [{ type: "text", text: JSON.stringify(getHealth(db)) }]
|
|
322
324
|
}))
|
|
323
325
|
|
|
324
|
-
|
|
326
|
+
registerTool("log_stats", {
|
|
325
327
|
project_id: z.string().optional().describe("Project name or ID (scope stats to a project)"),
|
|
326
328
|
}, (args) => {
|
|
327
329
|
const projectId = rp(args.project_id)
|