@hazeljs/ops-agent 0.2.0-beta.22

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.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +88 -0
  3. package/package.json +59 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 HazelJS Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,88 @@
1
+ # @hazeljs/ops-agent
2
+
3
+ **Ops Agent** — AI-powered DevOps assistant for Jira, Slack, and incident coordination.
4
+
5
+ ## Overview
6
+
7
+ When you need an AI assistant that can create Jira tickets, post to Slack, and coordinate incidents, use this package. It provides:
8
+
9
+ - **OpsAgent** – `@Agent` with tools for Jira (create, comment, get) and Slack (post)
10
+ - **createOpsRuntime** – wires AI + Agent + tools together
11
+ - **Adapters** – `createJiraTool`, `createSlackTool` for Jira Cloud and Slack Web API
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ npm install @hazeljs/ops-agent @hazeljs/ai @hazeljs/agent @hazeljs/rag
17
+ ```
18
+
19
+ ## Quick Start
20
+
21
+ ```ts
22
+ import { AIEnhancedService } from '@hazeljs/ai';
23
+ import {
24
+ createOpsRuntime,
25
+ runOpsAgent,
26
+ createJiraTool,
27
+ createSlackTool,
28
+ } from '@hazeljs/ops-agent';
29
+
30
+ // Configure tools (uses env vars when omitted)
31
+ const jiraTool = createJiraTool(); // JIRA_HOST, JIRA_EMAIL, JIRA_API_TOKEN
32
+ const slackTool = createSlackTool(); // SLACK_BOT_TOKEN
33
+
34
+ const runtime = createOpsRuntime({
35
+ aiService: new AIEnhancedService(),
36
+ tools: {
37
+ jira: jiraTool,
38
+ slack: slackTool,
39
+ },
40
+ model: 'gpt-4',
41
+ });
42
+
43
+ const result = await runOpsAgent(runtime, {
44
+ input: 'Create a Jira ticket in PROJ for "Payment API timeout in prod" and post a summary to #incidents',
45
+ sessionId: 'incident-2024-01',
46
+ });
47
+
48
+ console.log(result.response);
49
+ ```
50
+
51
+ ## Environment Variables
52
+
53
+ | Variable | Description |
54
+ |----------|-------------|
55
+ | `JIRA_HOST` | Jira host (e.g. https://your-domain.atlassian.net) |
56
+ | `JIRA_EMAIL` | Email for Basic auth |
57
+ | `JIRA_API_TOKEN` | API token from [Atlassian](https://id.atlassian.com/manage-profile/security/api-tokens) |
58
+ | `SLACK_BOT_TOKEN` | Slack bot token (xoxb-...) from app OAuth |
59
+
60
+ When not configured, tools return placeholder responses so you can develop without credentials.
61
+
62
+ ## Tools
63
+
64
+ | Tool | Description | Approval |
65
+ |------|-------------|----------|
66
+ | `create_jira_ticket` | Create Jira issue (project, summary, description, type) | Yes |
67
+ | `add_jira_comment` | Add comment to existing issue | No |
68
+ | `get_jira_ticket` | Get issue details by key | No |
69
+ | `post_to_slack` | Post message to channel (optionally in thread) | Yes |
70
+
71
+ ## Memory
72
+
73
+ The ops agent has memory enabled by default (in-memory `BufferMemory`). Use the same `sessionId` for follow-up requests in the same incident.
74
+
75
+ ## Human-in-the-Loop
76
+
77
+ `create_jira_ticket` and `post_to_slack` use `requiresApproval: true`. Subscribe to `tool.approval.requested` and approve/reject before the action runs:
78
+
79
+ ```ts
80
+ runtime.on('tool.approval.requested', (event) => {
81
+ // Approve: runtime.approveToolExecution(event.data.requestId, userId);
82
+ // Reject: runtime.rejectToolExecution(event.data.requestId);
83
+ });
84
+ ```
85
+
86
+ ## License
87
+
88
+ MIT
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@hazeljs/ops-agent",
3
+ "version": "0.2.0-beta.22",
4
+ "description": "Ops agent for Jira, Slack, and DevOps workflows - AI-powered incident triage and team coordination",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "scripts": {
11
+ "build": "tsc",
12
+ "clean": "rm -rf dist",
13
+ "lint": "eslint src --ext .ts",
14
+ "lint:fix": "eslint src --ext .ts --fix",
15
+ "test": "jest --coverage --passWithNoTests",
16
+ "test:watch": "jest --watch"
17
+ },
18
+ "keywords": [
19
+ "hazeljs",
20
+ "ops",
21
+ "agent",
22
+ "jira",
23
+ "slack",
24
+ "devops",
25
+ "incident",
26
+ "sre"
27
+ ],
28
+ "author": "Muhammad Arslan <marslan@hazeljs.com>",
29
+ "license": "MIT",
30
+ "bugs": {
31
+ "url": "https://github.com/hazeljs/hazel-js/issues"
32
+ },
33
+ "homepage": "https://hazeljs.com",
34
+ "dependencies": {
35
+ "reflect-metadata": "^0.2.1"
36
+ },
37
+ "peerDependencies": {
38
+ "@hazeljs/agent": ">=0.2.0-beta.0",
39
+ "@hazeljs/ai": ">=0.2.0-beta.0",
40
+ "@hazeljs/core": ">=0.2.0-beta.0",
41
+ "@hazeljs/rag": ">=0.1.0"
42
+ },
43
+ "devDependencies": {
44
+ "@types/jest": "^29.5.11",
45
+ "@types/node": "^20.17.50",
46
+ "jest": "^29.7.0",
47
+ "ts-jest": "^29.1.2",
48
+ "typescript": "^5.3.3"
49
+ },
50
+ "publishConfig": {
51
+ "access": "public"
52
+ },
53
+ "repository": {
54
+ "type": "git",
55
+ "url": "https://github.com/hazel-js/hazeljs.git",
56
+ "directory": "packages/ops-agent"
57
+ },
58
+ "gitHead": "51d9d1ebfa8f259b4b50e618d64bde24d586bc2a"
59
+ }