@hasna/logs 0.3.15 → 0.3.17

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 CHANGED
@@ -21,7 +21,7 @@ import {
21
21
  scoreLabel,
22
22
  summarizeLogs,
23
23
  updateIssueStatus
24
- } from "../index-6zrkek5y.js";
24
+ } from "../index-vmr85wa1.js";
25
25
  import {
26
26
  createJob,
27
27
  listJobs
@@ -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.15",
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",
@@ -6566,7 +6567,7 @@ var require_package = __commonJS((exports, module) => {
6566
6567
  author: "Andrei Hasna <andrei@hasna.com>",
6567
6568
  license: "Apache-2.0",
6568
6569
  dependencies: {
6569
- "@hasna/cloud": "^0.1.0",
6570
+ "@hasna/cloud": "0.1.5",
6570
6571
  "@modelcontextprotocol/sdk": "^1.12.1",
6571
6572
  commander: "^14.0.0",
6572
6573
  hono: "^4.7.11",
@@ -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
- server.tool("log_stats", {
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);
@@ -6,7 +6,7 @@ import {
6
6
  setPageAuth,
7
7
  setRetentionPolicy,
8
8
  startScheduler
9
- } from "../index-5qwba140.js";
9
+ } from "../index-4ba0sabv.js";
10
10
  import {
11
11
  getHealth
12
12
  } from "../index-cpvq9np9.js";
@@ -31,7 +31,7 @@ import {
31
31
  updateAlertRule,
32
32
  updateIssueStatus,
33
33
  updateProject
34
- } from "../index-6zrkek5y.js";
34
+ } from "../index-vmr85wa1.js";
35
35
  import {
36
36
  createJob,
37
37
  deleteJob,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/logs",
3
- "version": "0.3.15",
3
+ "version": "0.3.17",
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",
@@ -39,7 +40,7 @@
39
40
  "author": "Andrei Hasna <andrei@hasna.com>",
40
41
  "license": "Apache-2.0",
41
42
  "dependencies": {
42
- "@hasna/cloud": "^0.1.0",
43
+ "@hasna/cloud": "0.1.5",
43
44
  "@modelcontextprotocol/sdk": "^1.12.1",
44
45
  "commander": "^14.0.0",
45
46
  "hono": "^4.7.11",
@@ -55,4 +56,4 @@
55
56
  "@types/react": "^19.1.4",
56
57
  "typescript": "^5.9.3"
57
58
  }
58
- }
59
+ }
@@ -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
- server.tool("log_stats", {
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)