@sweny-ai/core 0.1.4 → 0.1.6

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.
@@ -1,15 +1,14 @@
1
1
  import { describe, it, expect } from "vitest";
2
- import { github, linear, slack, sentry, datadog, betterstack, notification, builtinSkills, createSkillMap, allSkills, isSkillConfigured, validateWorkflowSkills, } from "../skills/index.js";
2
+ import { github, linear, slack, sentry, datadog, notification, builtinSkills, createSkillMap, allSkills, isSkillConfigured, validateWorkflowSkills, } from "../skills/index.js";
3
3
  describe("skills registry", () => {
4
4
  it("exports all builtin skills", () => {
5
- expect(builtinSkills.length).toBeGreaterThanOrEqual(7);
5
+ expect(builtinSkills.length).toBeGreaterThanOrEqual(6);
6
6
  const ids = builtinSkills.map((s) => s.id);
7
7
  expect(ids).toContain("github");
8
8
  expect(ids).toContain("linear");
9
9
  expect(ids).toContain("slack");
10
10
  expect(ids).toContain("sentry");
11
11
  expect(ids).toContain("datadog");
12
- expect(ids).toContain("betterstack");
13
12
  expect(ids).toContain("notification");
14
13
  });
15
14
  it("individual skill exports match builtins", () => {
@@ -18,7 +17,6 @@ describe("skills registry", () => {
18
17
  expect(builtinSkills).toContain(slack);
19
18
  expect(builtinSkills).toContain(sentry);
20
19
  expect(builtinSkills).toContain(datadog);
21
- expect(builtinSkills).toContain(betterstack);
22
20
  expect(builtinSkills).toContain(notification);
23
21
  });
24
22
  it("createSkillMap builds a correct map", () => {
@@ -78,7 +76,7 @@ describe("skills registry", () => {
78
76
  it("validateWorkflowSkills detects missing providers", () => {
79
77
  const workflow = {
80
78
  nodes: {
81
- gather: { skills: ["github", "sentry", "betterstack"] },
79
+ gather: { skills: ["github", "sentry"] },
82
80
  notify: { skills: ["slack"] },
83
81
  },
84
82
  };
@@ -88,7 +86,6 @@ describe("skills registry", () => {
88
86
  expect(result.configured).toHaveLength(1);
89
87
  expect(result.configured[0].id).toBe("github");
90
88
  expect(result.missing.some((m) => m.id === "sentry")).toBe(true);
91
- expect(result.missing.some((m) => m.id === "betterstack")).toBe(true);
92
89
  // gather node has github (git) but no observability → error
93
90
  expect(result.errors.length).toBeGreaterThan(0);
94
91
  // notify node has no notification → warning (not error)
package/dist/browser.d.ts CHANGED
@@ -9,7 +9,7 @@ export type { Skill, SkillCategory, Tool, ToolContext, ConfigField, JSONSchema,
9
9
  export { consoleLogger } from "./types.js";
10
10
  export { execute } from "./executor.js";
11
11
  export type { ExecuteOptions } from "./executor.js";
12
- export { github, linear, slack, sentry, datadog, betterstack, notification, builtinSkills, createSkillMap, allSkills, isSkillConfigured, configuredSkills, validateWorkflowSkills, } from "./skills/index.js";
12
+ export { github, linear, slack, sentry, datadog, notification, builtinSkills, createSkillMap, allSkills, isSkillConfigured, configuredSkills, validateWorkflowSkills, } from "./skills/index.js";
13
13
  export type { SkillValidationResult } from "./skills/index.js";
14
14
  export { workflowZ, nodeZ, edgeZ, skillZ, parseWorkflow, validateWorkflow, workflowJsonSchema } from "./schema.js";
15
15
  export type { WorkflowError } from "./schema.js";
package/dist/browser.js CHANGED
@@ -9,7 +9,7 @@ export { consoleLogger } from "./types.js";
9
9
  // Executor
10
10
  export { execute } from "./executor.js";
11
11
  // Skills
12
- export { github, linear, slack, sentry, datadog, betterstack, notification, builtinSkills, createSkillMap, allSkills, isSkillConfigured, configuredSkills, validateWorkflowSkills, } from "./skills/index.js";
12
+ export { github, linear, slack, sentry, datadog, notification, builtinSkills, createSkillMap, allSkills, isSkillConfigured, configuredSkills, validateWorkflowSkills, } from "./skills/index.js";
13
13
  // Schema & validation
14
14
  export { workflowZ, nodeZ, edgeZ, skillZ, parseWorkflow, validateWorkflow, workflowJsonSchema } from "./schema.js";
15
15
  // Studio adapter
package/dist/cli/main.js CHANGED
@@ -106,6 +106,8 @@ function buildCredentialMap() {
106
106
  "NR_API_KEY",
107
107
  "NR_REGION",
108
108
  "BETTERSTACK_API_TOKEN",
109
+ "BETTERSTACK_SOURCE_ID",
110
+ "BETTERSTACK_TABLE_NAME",
109
111
  "SLACK_BOT_TOKEN",
110
112
  "SLACK_TEAM_ID",
111
113
  "NOTION_TOKEN",
@@ -295,6 +297,13 @@ triageCmd.action(async (options) => {
295
297
  issueOverride: config.issueOverride,
296
298
  noveltyMode: config.noveltyMode,
297
299
  reviewMode: config.reviewMode,
300
+ observabilityProvider: config.observabilityProvider,
301
+ ...(config.observabilityCredentials.sourceId && {
302
+ betterstackSourceId: config.observabilityCredentials.sourceId,
303
+ }),
304
+ ...(config.observabilityCredentials.tableName && {
305
+ betterstackTableName: config.observabilityCredentials.tableName,
306
+ }),
298
307
  };
299
308
  try {
300
309
  const results = await execute(triageWorkflow, workflowInput, {
@@ -519,6 +528,13 @@ export async function workflowRunAction(file, options) {
519
528
  baseBranch: config.baseBranch,
520
529
  prLabels: config.prLabels,
521
530
  additionalInstructions: config.additionalInstructions,
531
+ observabilityProvider: config.observabilityProvider,
532
+ ...(config.observabilityCredentials.sourceId && {
533
+ betterstackSourceId: config.observabilityCredentials.sourceId,
534
+ }),
535
+ ...(config.observabilityCredentials.tableName && {
536
+ betterstackTableName: config.observabilityCredentials.tableName,
537
+ }),
522
538
  };
523
539
  try {
524
540
  const results = await execute(workflow, workflowInput, {
package/dist/index.d.ts CHANGED
@@ -27,7 +27,7 @@ export { execute } from "./executor.js";
27
27
  export type { ExecuteOptions } from "./executor.js";
28
28
  export { ClaudeClient } from "./claude.js";
29
29
  export type { ClaudeClientOptions } from "./claude.js";
30
- export { github, linear, slack, sentry, datadog, betterstack, notification, builtinSkills, createSkillMap, allSkills, isSkillConfigured, configuredSkills, validateWorkflowSkills, } from "./skills/index.js";
30
+ export { github, linear, slack, sentry, datadog, notification, builtinSkills, createSkillMap, allSkills, isSkillConfigured, configuredSkills, validateWorkflowSkills, } from "./skills/index.js";
31
31
  export type { SkillValidationResult } from "./skills/index.js";
32
32
  export { workflowZ, nodeZ, edgeZ, skillZ, parseWorkflow, validateWorkflow, workflowJsonSchema } from "./schema.js";
33
33
  export type { WorkflowError } from "./schema.js";
package/dist/index.js CHANGED
@@ -27,7 +27,7 @@ export { execute } from "./executor.js";
27
27
  // Claude client
28
28
  export { ClaudeClient } from "./claude.js";
29
29
  // Skills
30
- export { github, linear, slack, sentry, datadog, betterstack, notification, builtinSkills, createSkillMap, allSkills, isSkillConfigured, configuredSkills, validateWorkflowSkills, } from "./skills/index.js";
30
+ export { github, linear, slack, sentry, datadog, notification, builtinSkills, createSkillMap, allSkills, isSkillConfigured, configuredSkills, validateWorkflowSkills, } from "./skills/index.js";
31
31
  // Schema & validation
32
32
  export { workflowZ, nodeZ, edgeZ, skillZ, parseWorkflow, validateWorkflow, workflowJsonSchema } from "./schema.js";
33
33
  // MCP auto-injection
package/dist/mcp.js CHANGED
@@ -106,8 +106,10 @@ export function buildAutoMcpServers(config) {
106
106
  };
107
107
  }
108
108
  // Better Stack MCP — HTTP remote MCP; Bearer token auth.
109
+ // Injected whenever the token is present (not just when it's the primary provider)
110
+ // because BetterStack logs complement any primary observability provider.
109
111
  const bsApiToken = creds.BETTERSTACK_API_TOKEN;
110
- if (config.observabilityProvider === "betterstack" && bsApiToken) {
112
+ if (bsApiToken) {
111
113
  auto["betterstack"] = {
112
114
  type: "http",
113
115
  url: "https://mcp.betterstack.com",
package/dist/mcp.test.js CHANGED
@@ -175,6 +175,19 @@ describe("buildAutoMcpServers", () => {
175
175
  headers: { Authorization: "Bearer bst_abc" },
176
176
  });
177
177
  });
178
+ it("injects Better Stack MCP even when primary provider is not betterstack", () => {
179
+ const result = buildAutoMcpServers(cfg({
180
+ observabilityProvider: "sentry",
181
+ credentials: { BETTERSTACK_API_TOKEN: "bst_xyz", SENTRY_AUTH_TOKEN: "sntrx_test" },
182
+ }));
183
+ expect(result["betterstack"]).toEqual({
184
+ type: "http",
185
+ url: "https://mcp.betterstack.com",
186
+ headers: { Authorization: "Bearer bst_xyz" },
187
+ });
188
+ // Sentry should also be present
189
+ expect(result["sentry"]).toBeDefined();
190
+ });
178
191
  // ── Jira MCP ────────────────────────────────────────────────────
179
192
  it("injects Jira MCP when all 3 credentials present", () => {
180
193
  const result = buildAutoMcpServers(cfg({
@@ -9,10 +9,9 @@ import { linear } from "./linear.js";
9
9
  import { slack } from "./slack.js";
10
10
  import { sentry } from "./sentry.js";
11
11
  import { datadog } from "./datadog.js";
12
- import { betterstack } from "./betterstack.js";
13
12
  import { notification } from "./notification.js";
14
13
  export declare const builtinSkills: Skill[];
15
- export { github, linear, slack, sentry, datadog, betterstack, notification };
14
+ export { github, linear, slack, sentry, datadog, notification };
16
15
  /**
17
16
  * Build a skill map from an array of skills.
18
17
  * Pass to `execute()` as the `skills` option.
@@ -8,11 +8,10 @@ import { linear } from "./linear.js";
8
8
  import { slack } from "./slack.js";
9
9
  import { sentry } from "./sentry.js";
10
10
  import { datadog } from "./datadog.js";
11
- import { betterstack } from "./betterstack.js";
12
11
  import { notification } from "./notification.js";
13
12
  // ─── Built-in skill catalog ─────────────────────────────────────
14
- export const builtinSkills = [github, linear, slack, sentry, datadog, betterstack, notification];
15
- export { github, linear, slack, sentry, datadog, betterstack, notification };
13
+ export const builtinSkills = [github, linear, slack, sentry, datadog, notification];
14
+ export { github, linear, slack, sentry, datadog, notification };
16
15
  // ─── Registry helpers ───────────────────────────────────────────
17
16
  /**
18
17
  * Build a skill map from an array of skills.
@@ -28,8 +28,10 @@ export const triageWorkflow = {
28
28
  2. **Source control**: Check recent commits, pull requests, and deploys that might be related.
29
29
  3. **Issue tracker**: Search for similar past issues or known problems.
30
30
 
31
+ If input.betterstackSourceId or input.betterstackTableName is provided, use those to scope your BetterStack log queries to the correct source.
32
+
31
33
  Be thorough — the investigation step depends on complete context. Use every tool available to you.`,
32
- skills: ["github", "sentry", "datadog", "betterstack", "linear"],
34
+ skills: ["github", "sentry", "datadog", "linear"],
33
35
  },
34
36
  investigate: {
35
37
  name: "Root Cause Analysis",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sweny-ai/core",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "sweny": "./dist/cli/main.js"
@@ -1,7 +0,0 @@
1
- /**
2
- * BetterStack Skill
3
- *
4
- * Uptime monitoring (incidents, monitors) and log search via BetterStack APIs.
5
- */
6
- import type { Skill } from "../types.js";
7
- export declare const betterstack: Skill;
@@ -1,114 +0,0 @@
1
- /**
2
- * BetterStack Skill
3
- *
4
- * Uptime monitoring (incidents, monitors) and log search via BetterStack APIs.
5
- */
6
- const UPTIME_BASE = "https://uptime.betterstack.com/api/v2";
7
- async function uptimeApi(path, ctx, init) {
8
- const res = await fetch(`${UPTIME_BASE}${path}`, {
9
- ...init,
10
- headers: {
11
- Authorization: `Bearer ${ctx.config.BETTERSTACK_API_TOKEN}`,
12
- "Content-Type": "application/json",
13
- ...init?.headers,
14
- },
15
- signal: AbortSignal.timeout(30_000),
16
- });
17
- if (!res.ok)
18
- throw new Error(`[BetterStack] API request failed (HTTP ${res.status}): ${await res.text()}`);
19
- return res.json();
20
- }
21
- export const betterstack = {
22
- id: "betterstack",
23
- name: "BetterStack",
24
- description: "Query incidents, monitors, and logs from BetterStack (Better Uptime + Logtail)",
25
- category: "observability",
26
- config: {
27
- BETTERSTACK_API_TOKEN: {
28
- description: "BetterStack API token (from Uptime > Settings > API)",
29
- required: true,
30
- env: "BETTERSTACK_API_TOKEN",
31
- },
32
- },
33
- tools: [
34
- {
35
- name: "betterstack_list_incidents",
36
- description: "List recent incidents from BetterStack Uptime. Returns ongoing and resolved incidents.",
37
- input_schema: {
38
- type: "object",
39
- properties: {
40
- from: { type: "string", description: "ISO 8601 start date (e.g. 2024-01-01T00:00:00Z)" },
41
- to: { type: "string", description: "ISO 8601 end date" },
42
- per_page: { type: "number", description: "Results per page (default 20, max 100)" },
43
- },
44
- },
45
- handler: async (input, ctx) => {
46
- const params = new URLSearchParams();
47
- if (input.from)
48
- params.set("from", input.from);
49
- if (input.to)
50
- params.set("to", input.to);
51
- if (input.per_page)
52
- params.set("per_page", String(input.per_page));
53
- const qs = params.toString();
54
- return uptimeApi(`/incidents${qs ? `?${qs}` : ""}`, ctx);
55
- },
56
- },
57
- {
58
- name: "betterstack_get_incident",
59
- description: "Get detailed information about a specific incident including timeline.",
60
- input_schema: {
61
- type: "object",
62
- properties: {
63
- incident_id: { type: "string", description: "Incident ID" },
64
- },
65
- required: ["incident_id"],
66
- },
67
- handler: async (input, ctx) => {
68
- return uptimeApi(`/incidents/${input.incident_id}`, ctx);
69
- },
70
- },
71
- {
72
- name: "betterstack_list_monitors",
73
- description: "List all monitors (uptime checks) and their current status.",
74
- input_schema: {
75
- type: "object",
76
- properties: {
77
- per_page: { type: "number", description: "Results per page (default 20, max 100)" },
78
- },
79
- },
80
- handler: async (input, ctx) => {
81
- const params = new URLSearchParams();
82
- if (input.per_page)
83
- params.set("per_page", String(input.per_page));
84
- const qs = params.toString();
85
- return uptimeApi(`/monitors${qs ? `?${qs}` : ""}`, ctx);
86
- },
87
- },
88
- {
89
- name: "betterstack_get_monitor",
90
- description: "Get details and recent status of a specific monitor.",
91
- input_schema: {
92
- type: "object",
93
- properties: {
94
- monitor_id: { type: "string", description: "Monitor ID" },
95
- },
96
- required: ["monitor_id"],
97
- },
98
- handler: async (input, ctx) => {
99
- return uptimeApi(`/monitors/${input.monitor_id}`, ctx);
100
- },
101
- },
102
- {
103
- name: "betterstack_list_on_call",
104
- description: "List current on-call calendars and who is on-call.",
105
- input_schema: {
106
- type: "object",
107
- properties: {},
108
- },
109
- handler: async (_input, ctx) => {
110
- return uptimeApi("/on-calls", ctx);
111
- },
112
- },
113
- ],
114
- };