fairwire-ticket-sla 0.0.0-stage → 0.1.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/CHANGELOG.md +5 -0
- package/LICENSE +21 -0
- package/README.md +222 -2
- package/bin/fairwire-ticket-sla.js +7 -0
- package/evals/cases.json +334 -0
- package/fixtures/README.md +6 -0
- package/fixtures/intl/README.md +12 -0
- package/fixtures/intl/de/tickets.csv +12 -0
- package/fixtures/intl/ja/tickets.csv +12 -0
- package/fixtures/settings-tight.json +3 -0
- package/fixtures/settings.json +4 -0
- package/fixtures/tickets.csv +12 -0
- package/package.json +57 -4
- package/server.json +37 -0
- package/src/demo.js +19 -0
- package/src/index.js +2 -0
- package/src/logic.js +67 -0
- package/src/manifest.js +39 -0
package/CHANGELOG.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kurt Francisco
|
|
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
CHANGED
|
@@ -1,3 +1,223 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Fairwire Ticket SLA
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Ticket SLA aging from a service desk export: tickets past their response or resolution target by priority, aging buckets, tickets with no assignee, tickets reopened again and again, tickets parked on hold and the teams with the most breaches. Drafts a status note; never closes a ticket.
|
|
4
|
+
|
|
5
|
+
Part of **Fairwire**, the IT and network family of [Mythos Machines](https://fair-agents.com) agents. The software is free (MIT); you pay a fixed price for the setup on your files. It reads files your IT team exports, on your own computer, and drafts notes. Every change to a live device, firewall, DNS zone, directory or cloud account stays one named person's click.
|
|
6
|
+
|
|
7
|
+
## What it checks
|
|
8
|
+
|
|
9
|
+
| Finding | What it means |
|
|
10
|
+
|---|---|
|
|
11
|
+
| `resolution_breached` | An open ticket past its resolution target (high for P1 and P2). |
|
|
12
|
+
| `response_breached` | An open ticket with no first response past its response target, or a first response that came late. |
|
|
13
|
+
| `no_assignee` | An open ticket older than a day with nobody assigned. |
|
|
14
|
+
| `team_breach_rate` | A team where more than your share of tickets breached their resolution target. |
|
|
15
|
+
| `parked_on_hold` | A ticket on hold for longer than your limit (on hold often stops the SLA clock). |
|
|
16
|
+
| `reopened_often` | A ticket reopened several times (the fix did not hold). |
|
|
17
|
+
|
|
18
|
+
Findings come back worst first (high, medium, low). A finding a named person has reviewed can be accepted as known, with a reason and a date to look again; it then moves to "Accepted as known" instead of counting as open.
|
|
19
|
+
|
|
20
|
+
## Settings
|
|
21
|
+
|
|
22
|
+
Pass a settings file with `settings`. Every setting is optional; a misspelt setting is refused by name.
|
|
23
|
+
|
|
24
|
+
| Setting | What it does |
|
|
25
|
+
|---|---|
|
|
26
|
+
| `response_hours` | First response target in hours per priority, e.g. {"P1": 1, "P2": 4, "P3": 8, "P4": 24} (default) |
|
|
27
|
+
| `resolve_hours` | Resolution target in hours per priority, e.g. {"P1": 4, "P2": 24, "P3": 72, "P4": 120} (default) |
|
|
28
|
+
| `hold_days` | Days on hold after which a ticket is flagged (default 7) |
|
|
29
|
+
| `reopen_min` | Reopens after which a ticket is flagged (default 2) |
|
|
30
|
+
| `team_breach_pct` | Share of a team's tickets breached above which the team is flagged (default 20) |
|
|
31
|
+
|
|
32
|
+
## What it never does
|
|
33
|
+
|
|
34
|
+
- `itsm_update_ticket` is refused: Fairwire Ticket SLA never edits, assigns, closes or reprioritises a ticket.
|
|
35
|
+
- `itsm_notify_requester` is refused: Fairwire Ticket SLA never messages requesters.
|
|
36
|
+
- `tickets_request_send` waits for one named person's click, even in Auto (`binding_send`).
|
|
37
|
+
- `tickets_accept_learning` waits for one named person's click, even in Auto (`accept_learning`).
|
|
38
|
+
- `tickets_retire_memory` waits for one named person's click, even in Auto (`accept_learning`).
|
|
39
|
+
- `itsm_update_ticket` waits for one named person's click, even in Auto (`production_deploy`).
|
|
40
|
+
- `itsm_notify_requester` waits for one named person's click, even in Auto (`binding_send`).
|
|
41
|
+
|
|
42
|
+
<!-- generated:start -->
|
|
43
|
+
|
|
44
|
+
## A demo run
|
|
45
|
+
|
|
46
|
+
`npx -y fairwire-ticket-sla demo` runs the agent on the fictional files in [`fixtures/`](fixtures) in a temporary folder. Captured output:
|
|
47
|
+
|
|
48
|
+
```text
|
|
49
|
+
Fairwire Ticket SLA demo (fictional data) in a temporary folder, Auto on for the draft only
|
|
50
|
+
|
|
51
|
+
▶ Check the exported files
|
|
52
|
+
status: executed decision: allow
|
|
53
|
+
11 ticket(s), 6 open (1 older than 30 days): 11 open finding(s), 1 high.
|
|
54
|
+
high resolution_breached Service Desk
|
|
55
|
+
medium no_assignee Service Desk
|
|
56
|
+
medium resolution_breached Applications
|
|
57
|
+
medium resolution_breached Applications
|
|
58
|
+
medium response_breached Service Desk
|
|
59
|
+
medium response_breached Network
|
|
60
|
+
medium team_breach_rate Applications
|
|
61
|
+
medium team_breach_rate Service Desk
|
|
62
|
+
low parked_on_hold Applications
|
|
63
|
+
low parked_on_hold Applications
|
|
64
|
+
low reopened_often Service Desk
|
|
65
|
+
|
|
66
|
+
▶ Explain one finding
|
|
67
|
+
status: executed decision: allow
|
|
68
|
+
medium resolution_breached: P3 ticket INC-1004 (Applications) has been open 207 hours; the target is 72. Fix: Escalate it to the team lead today, or agree a new date with the requester.
|
|
69
|
+
medium resolution_breached: P4 ticket INC-1011 (Applications) has been open 1167 hours; the target is 120. Fix: Escalate it to the team lead today, or agree a new date with the requester.
|
|
70
|
+
medium team_breach_rate: 100% of the tickets for Applications missed their resolution target (4 of 4). Fix: Look at staffing, triage and the priorities the team receives.
|
|
71
|
+
low parked_on_hold: Ticket INC-1004 is "On Hold" and was opened 8.6 days ago. Fix: Chase the person it waits for, or close it with a note.
|
|
72
|
+
low parked_on_hold: Ticket INC-1011 is "Awaiting user" and was opened 48.6 days ago. Fix: Chase the person it waits for, or close it with a note.
|
|
73
|
+
|
|
74
|
+
▶ Write the worklist
|
|
75
|
+
status: executed decision: allow
|
|
76
|
+
Ticket SLA aging written: 11 ticket(s), 6 open (1 older than 30 days): 11 open finding(s), 1 high.
|
|
77
|
+
|
|
78
|
+
▶ Draft the note for a person
|
|
79
|
+
status: executed decision: allow (auto)
|
|
80
|
+
status note 2026-11-18 drafted with 1 open marker(s) ([TO CONFIRM service desk team leads]). Nothing was sent.
|
|
81
|
+
|
|
82
|
+
▶ Auto: approving it still waits for one named person
|
|
83
|
+
status: needs_approval decision: ask
|
|
84
|
+
reason: binding_send stays one-click, even in Auto
|
|
85
|
+
|
|
86
|
+
▶ The agent tries to change the live system itself
|
|
87
|
+
status: blocked decision: block
|
|
88
|
+
reason: Fairwire Ticket SLA never edits, assigns, closes or reprioritises a ticket.
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Tools
|
|
92
|
+
|
|
93
|
+
| Tool | What it does | Policy |
|
|
94
|
+
|---|---|---|
|
|
95
|
+
| `tickets_check` | Review tickets against your response and resolution targets and list breaches, unassigned tickets, team breach rates, parked and reopened tickets. | runs |
|
|
96
|
+
| `tickets_explain` | Every finding for one ticket or team. | runs |
|
|
97
|
+
| `tickets_write_report` | Write ticket-sla.csv (one row per finding, with blank owner and decision columns) and ticket-sla.html into out_dir (default fairwire-out/tickets). | runs |
|
|
98
|
+
| `tickets_draft_status_note` | Write drafts/status_note-<date>.md: the open findings at or above min_severity (default medium), each with what to do, addressed to service desk team leads. | asks first (Auto can be opted in) |
|
|
99
|
+
| `tickets_request_send` | After one named human click (even in Auto), record that the reviewed status note draft is approved in status_note-requests.csv. | one named click, even in Auto (`binding_send`) |
|
|
100
|
+
| `tickets_recall` | Search this agent's own memory of the customer's setup: accepted facts (in use) and facts waiting for a person. | runs |
|
|
101
|
+
| `tickets_learn` | Propose one fact about the customer's setup for this agent to remember. | runs |
|
|
102
|
+
| `tickets_accept_learning` | A named person accepts or rejects a fact waiting in this agent's memory. | one named click, even in Auto (`accept_learning`) |
|
|
103
|
+
| `tickets_retire_memory` | A named person stops an accepted fact from applying. | one named click, even in Auto (`accept_learning`) |
|
|
104
|
+
| `itsm_update_ticket` | Fairwire Ticket SLA never edits, assigns, closes or reprioritises a ticket. | refused |
|
|
105
|
+
| `itsm_notify_requester` | Fairwire Ticket SLA never messages requesters. | refused |
|
|
106
|
+
|
|
107
|
+
Any tool name not in this table is blocked, including names a model invents. `refused` tools are listed so a model can see they exist and are refused.
|
|
108
|
+
|
|
109
|
+
## Columns it reads
|
|
110
|
+
|
|
111
|
+
Table inputs can be CSV, TSV, semicolon- or pipe-separated text, Excel `.xlsx`, JSON or JSONL. Columns are matched by the agent's own name, then by the English names below, then by their names in German, French, Spanish, Portuguese, Italian, Japanese, Chinese and Korean. Dates become `YYYY-MM-DD`; amounts and counts are read with either decimal mark. Every result lists under `sources` how each file was read.
|
|
112
|
+
|
|
113
|
+
### Tickets (`tickets`)
|
|
114
|
+
|
|
115
|
+
| Column | Type | Also read as | For example, in other languages |
|
|
116
|
+
|---|---|---|---|
|
|
117
|
+
| `ticket` (required) | text | Number, Ticket, Ticket ID, Issue key, ID, Incident | Ticketnummer, N° de ticket, チケット番号, 工单号 |
|
|
118
|
+
| `priority` | text | Priority, Urgency, Severity, Impact | Priorität, Priorité, 優先度, 优先级 |
|
|
119
|
+
| `opened_at` (required) | date and time | Opened, Created, opened_at, Created Date, Submitted | Erstellt am, Ouvert le, 起票日時, 创建时间 |
|
|
120
|
+
| `first_response_at` | date and time | First Response, First Responded, Responded At, First Reply | - |
|
|
121
|
+
| `resolved_at` | date and time | Resolved, Resolved At, Closed, Resolution Date, resolved_at | Gelöst am, Résolu le, 解決日時, 解决时间 |
|
|
122
|
+
| `state` | text | State, Status, Ticket Status, incident_state, Incident state | - |
|
|
123
|
+
| `team` | text | Assignment group, Team, Group, Queue, assignment_group | Team, Équipe, 担当チーム, 团队 |
|
|
124
|
+
| `assignee` | text | Assigned to, Assignee, Agent, Technician, Owner | - |
|
|
125
|
+
| `reopen_count` | number | Reopen Count, Reopened, Times Reopened | - |
|
|
126
|
+
|
|
127
|
+
Named exports recognised by their column names:
|
|
128
|
+
|
|
129
|
+
| System | Export | Recognised by | Layout checked against vendor docs |
|
|
130
|
+
|---|---|---|---|
|
|
131
|
+
| ServiceNow | Incident list exported to CSV | number, priority, opened_at, state, assignment_group | no |
|
|
132
|
+
| Jira Service Management | Issue search exported to CSV | Issue key, Priority, Created, Status | no |
|
|
133
|
+
|
|
134
|
+
Where a layout says "checked", its column names were compared with the vendor's documentation on that date. The other layouts were written from knowledge of the export and were not checked. None was tested against a live account.
|
|
135
|
+
|
|
136
|
+
### Files from other countries
|
|
137
|
+
|
|
138
|
+
A German export in Windows-1252 with semicolons, `1.234,56` and `03.11.2026`, or a Japanese one in Shift_JIS with `2026/11/03`, is read the same way as the English file. [`fixtures/intl/`](fixtures/intl) has both versions of the demo data, and the eval cases `intl-de-*` and `intl-ja-*` require the same results as the English case. Columns named differently? Run `npx fairwire-ticket-sla inspect <file>` (names and shapes only, never values) and name them in `fairwire-sources.json`:
|
|
139
|
+
|
|
140
|
+
```json
|
|
141
|
+
{ "files": { "exports/devices.csv": { "columns": { "host": "Gerätename" }, "date_order": "dmy" } } }
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Memory
|
|
145
|
+
|
|
146
|
+
fairwire-ticket-sla can remember facts about your setup so the next run does not have to be told again. `tickets_learn` only proposes a fact; it changes nothing until a named person accepts it with `tickets_accept_learning`, which is one click even in Auto. Facts live in one hash-chained file per agent under `.fairwire/memory/`; if the chain does not verify, no fact is used. Credentials, personal identifiers and text that reads like instructions to an AI are refused. Run without memory with `--no-memory`.
|
|
147
|
+
|
|
148
|
+
| Kind | What an accepted fact changes |
|
|
149
|
+
|---|---|
|
|
150
|
+
| `known_exception` | that finding is listed under "Accepted as known" instead of as open, until review_by (when given) has passed. |
|
|
151
|
+
| `note` | nothing (shown by recall only) |
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
fairwire-ticket-sla memory list
|
|
155
|
+
fairwire-ticket-sla memory accept MEM-1a2b3c4d5e6f --as "Your Name"
|
|
156
|
+
fairwire-ticket-sla memory retire MEM-1a2b3c4d5e6f --as "Your Name" --reason "rule removed"
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Install
|
|
160
|
+
|
|
161
|
+
Node 20 or newer. No other dependencies.
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
npx -y fairwire-ticket-sla demo
|
|
165
|
+
npx -y fairwire-ticket-sla mcp --root /path/to/your/files
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Claude Desktop, Cursor and other MCP hosts:
|
|
169
|
+
|
|
170
|
+
```json
|
|
171
|
+
{
|
|
172
|
+
"mcpServers": {
|
|
173
|
+
"fairwire-ticket-sla": {
|
|
174
|
+
"command": "npx",
|
|
175
|
+
"args": [
|
|
176
|
+
"-y",
|
|
177
|
+
"fairwire-ticket-sla",
|
|
178
|
+
"mcp",
|
|
179
|
+
"--root",
|
|
180
|
+
"/path/to/your/files"
|
|
181
|
+
]
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Claude Code: `claude mcp add fairwire-ticket-sla -- npx -y fairwire-ticket-sla mcp --root .`, or install the `fairwire-ticket-sla` plugin from this repository's marketplace.
|
|
188
|
+
|
|
189
|
+
## Modes and approvals
|
|
190
|
+
|
|
191
|
+
- **Review** (`--mode review`): reads and reports only.
|
|
192
|
+
- **Assist** (default): the policy above. A tool that asks returns an `approval_id`; a person approves it once with `fairwire-ticket-sla approve <id> --as "Your Name"` (or on the local approvals page, `fairwire-ticket-sla approvals`), and the same call is repeated.
|
|
193
|
+
- **Auto** (`--mode auto --auto <tool,...>`): opt-in per tool, with step caps and a kill switch (`fairwire-ticket-sla kill`). Paying, sending, posting to a ledger or a live system and accepting a learned fact stay **one named click even in Auto**; an approval is tied to the sha256 of the reviewed draft, so a changed draft needs a new click.
|
|
194
|
+
|
|
195
|
+
## CLI
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
fairwire-ticket-sla tools # every tool, its policy and arguments
|
|
199
|
+
fairwire-ticket-sla sources # the columns each input is read from
|
|
200
|
+
fairwire-ticket-sla inspect <file> # how a file would be read (names and shapes, never values)
|
|
201
|
+
fairwire-ticket-sla call tickets_check '{"tickets":"<tickets>"}'
|
|
202
|
+
fairwire-ticket-sla eval # the private eval cases on the fictional fixtures
|
|
203
|
+
fairwire-ticket-sla demo
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## Audit log and data
|
|
207
|
+
|
|
208
|
+
Every call is written to `.fairwire/audit.jsonl` under the root: hash-chained JSON lines, with arguments stored as a hash, signed with an Ed25519 key when you configure one. Everything runs on your machine on files you choose. No network calls, no telemetry, no credentials. The bundled fixtures are fictional.
|
|
209
|
+
|
|
210
|
+
<!-- generated:end -->
|
|
211
|
+
|
|
212
|
+
## Limits
|
|
213
|
+
|
|
214
|
+
- Reads only the files you export and give it. It does not log in to a firewall, switch, controller, cloud console, identity provider or any other live system.
|
|
215
|
+
- Targets are counted in calendar hours from the opened time; business hours, holidays and SLA pauses in your tool are not modelled, so your tool's own SLA flag wins where they differ.
|
|
216
|
+
- Thresholds are working defaults in a settings file you control; they are not a vendor rule, a requirement of any standard or a security guarantee.
|
|
217
|
+
- Results returned to the AI model have the names of people, sign-in names, e-mail addresses, phone numbers and client addresses masked. The files written here keep the real values: keep them in a secure folder.
|
|
218
|
+
- It changes nothing on a live device, firewall, DNS zone, directory or cloud account. Every change it suggests is a draft that one named person applies.
|
|
219
|
+
- Export layouts were written from knowledge of common exports and have not been tested on live customer accounts. Run `inspect` on a new export and name columns in `fairwire-sources.json` when they differ.
|
|
220
|
+
|
|
221
|
+
## Licence
|
|
222
|
+
|
|
223
|
+
MIT. Fictional data only in `fixtures/`.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import { main } from 'fairwire-core';
|
|
4
|
+
import { manifest } from '../src/manifest.js';
|
|
5
|
+
import { demo } from '../src/demo.js';
|
|
6
|
+
|
|
7
|
+
main(manifest, { bin: 'fairwire-ticket-sla', demo, evalFile: fileURLToPath(new URL('../evals/cases.json', import.meta.url)) });
|
package/evals/cases.json
ADDED
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
{
|
|
2
|
+
"suite": "fairwire-ticket-sla",
|
|
3
|
+
"root": "..",
|
|
4
|
+
"data_note": "Fictional tickets in ../fixtures, measured at the end of 2026-11-18 in calendar hours. No model is called.",
|
|
5
|
+
"cases": [
|
|
6
|
+
{
|
|
7
|
+
"id": "check-totals",
|
|
8
|
+
"tool": "tickets_check",
|
|
9
|
+
"args": {
|
|
10
|
+
"tickets": "fixtures/tickets.csv",
|
|
11
|
+
"settings": "fixtures/settings.json",
|
|
12
|
+
"as_of": "2026-11-18"
|
|
13
|
+
},
|
|
14
|
+
"expect": {
|
|
15
|
+
"equals": {
|
|
16
|
+
"result.tickets": 11,
|
|
17
|
+
"result.open_tickets": 6,
|
|
18
|
+
"result.aging.over_30_days": 1,
|
|
19
|
+
"result.open": 11,
|
|
20
|
+
"result.high": 1
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"id": "every-planted-issue",
|
|
26
|
+
"tool": "tickets_check",
|
|
27
|
+
"args": {
|
|
28
|
+
"tickets": "fixtures/tickets.csv",
|
|
29
|
+
"settings": "fixtures/settings.json",
|
|
30
|
+
"as_of": "2026-11-18"
|
|
31
|
+
},
|
|
32
|
+
"expect": {
|
|
33
|
+
"contains": [
|
|
34
|
+
"resolution_breached",
|
|
35
|
+
"INC-1002",
|
|
36
|
+
"response_breached",
|
|
37
|
+
"after 6 hours",
|
|
38
|
+
"no_assignee",
|
|
39
|
+
"INC-1003",
|
|
40
|
+
"team_breach_rate",
|
|
41
|
+
"Applications",
|
|
42
|
+
"parked_on_hold",
|
|
43
|
+
"INC-1011",
|
|
44
|
+
"reopened_often",
|
|
45
|
+
"3 times"
|
|
46
|
+
],
|
|
47
|
+
"not_contains": [
|
|
48
|
+
"INC-1001"
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"id": "assignees-masked",
|
|
54
|
+
"tool": "tickets_check",
|
|
55
|
+
"args": {
|
|
56
|
+
"tickets": "fixtures/tickets.csv",
|
|
57
|
+
"as_of": "2026-11-18"
|
|
58
|
+
},
|
|
59
|
+
"expect": {
|
|
60
|
+
"not_contains": [
|
|
61
|
+
"Ana Ortiz",
|
|
62
|
+
"Ben Kim"
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"id": "tighter-p2-target",
|
|
68
|
+
"tool": "tickets_check",
|
|
69
|
+
"args": {
|
|
70
|
+
"tickets": "fixtures/tickets.csv",
|
|
71
|
+
"settings": "fixtures/settings-tight.json",
|
|
72
|
+
"as_of": "2026-11-18",
|
|
73
|
+
"severity": "high"
|
|
74
|
+
},
|
|
75
|
+
"expect": {
|
|
76
|
+
"equals": {
|
|
77
|
+
"result.findings": 2
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"id": "explain-team",
|
|
83
|
+
"tool": "tickets_explain",
|
|
84
|
+
"args": {
|
|
85
|
+
"tickets": "fixtures/tickets.csv",
|
|
86
|
+
"settings": "fixtures/settings.json",
|
|
87
|
+
"as_of": "2026-11-18",
|
|
88
|
+
"ticket": "Applications"
|
|
89
|
+
},
|
|
90
|
+
"expect": {
|
|
91
|
+
"contains": [
|
|
92
|
+
"team_breach_rate",
|
|
93
|
+
"parked_on_hold"
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"id": "draft-after-approval",
|
|
99
|
+
"tool": "tickets_draft_status_note",
|
|
100
|
+
"approve": "Pat Example",
|
|
101
|
+
"args": {
|
|
102
|
+
"tickets": "fixtures/tickets.csv",
|
|
103
|
+
"settings": "fixtures/settings.json",
|
|
104
|
+
"as_of": "2026-11-18"
|
|
105
|
+
},
|
|
106
|
+
"expect": {
|
|
107
|
+
"status": "executed",
|
|
108
|
+
"contains": [
|
|
109
|
+
"Nothing was sent"
|
|
110
|
+
],
|
|
111
|
+
"equals": {
|
|
112
|
+
"result.items": 8,
|
|
113
|
+
"result.open_markers": 1
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"id": "review-mode-still-reads",
|
|
119
|
+
"tool": "tickets_check",
|
|
120
|
+
"mode": "review",
|
|
121
|
+
"args": {
|
|
122
|
+
"tickets": "fixtures/tickets.csv",
|
|
123
|
+
"settings": "fixtures/settings.json",
|
|
124
|
+
"as_of": "2026-11-18"
|
|
125
|
+
},
|
|
126
|
+
"expect": {
|
|
127
|
+
"status": "executed",
|
|
128
|
+
"equals": {
|
|
129
|
+
"result.tickets": 11,
|
|
130
|
+
"result.open_tickets": 6,
|
|
131
|
+
"result.aging.over_30_days": 1,
|
|
132
|
+
"result.open": 11,
|
|
133
|
+
"result.high": 1
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
"generated": true
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"id": "severity-filter",
|
|
140
|
+
"tool": "tickets_check",
|
|
141
|
+
"args": {
|
|
142
|
+
"tickets": "fixtures/tickets.csv",
|
|
143
|
+
"settings": "fixtures/settings.json",
|
|
144
|
+
"as_of": "2026-11-18",
|
|
145
|
+
"severity": "high"
|
|
146
|
+
},
|
|
147
|
+
"expect": {
|
|
148
|
+
"status": "executed",
|
|
149
|
+
"equals": {
|
|
150
|
+
"result.findings": 1
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
"generated": true
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"id": "missing-argument-named",
|
|
157
|
+
"tool": "tickets_check",
|
|
158
|
+
"args": {},
|
|
159
|
+
"expect": {
|
|
160
|
+
"status": "error",
|
|
161
|
+
"contains": [
|
|
162
|
+
"tickets"
|
|
163
|
+
]
|
|
164
|
+
},
|
|
165
|
+
"generated": true
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"id": "file-outside-root-refused",
|
|
169
|
+
"tool": "tickets_check",
|
|
170
|
+
"args": {
|
|
171
|
+
"tickets": "../../../outside.csv",
|
|
172
|
+
"settings": "fixtures/settings.json",
|
|
173
|
+
"as_of": "2026-11-18"
|
|
174
|
+
},
|
|
175
|
+
"expect": {
|
|
176
|
+
"status": "error",
|
|
177
|
+
"contains": [
|
|
178
|
+
"outside"
|
|
179
|
+
]
|
|
180
|
+
},
|
|
181
|
+
"generated": true
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"id": "invented-tool-name-refused",
|
|
185
|
+
"tool": "tickets_apply_every_fix_now",
|
|
186
|
+
"args": {},
|
|
187
|
+
"expect": {
|
|
188
|
+
"status": "blocked"
|
|
189
|
+
},
|
|
190
|
+
"generated": true
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"id": "write-report-writes-files",
|
|
194
|
+
"tool": "tickets_write_report",
|
|
195
|
+
"args": {
|
|
196
|
+
"tickets": "fixtures/tickets.csv",
|
|
197
|
+
"settings": "fixtures/settings.json",
|
|
198
|
+
"as_of": "2026-11-18"
|
|
199
|
+
},
|
|
200
|
+
"expect": {
|
|
201
|
+
"status": "executed",
|
|
202
|
+
"contains": [
|
|
203
|
+
"ticket-sla.csv",
|
|
204
|
+
"ticket-sla.html"
|
|
205
|
+
]
|
|
206
|
+
},
|
|
207
|
+
"generated": true
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"id": "recall-memory-starts-empty",
|
|
211
|
+
"tool": "tickets_recall",
|
|
212
|
+
"args": {},
|
|
213
|
+
"expect": {
|
|
214
|
+
"status": "executed",
|
|
215
|
+
"contains": [
|
|
216
|
+
"memory is empty"
|
|
217
|
+
]
|
|
218
|
+
},
|
|
219
|
+
"generated": true
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"id": "accept-learning-stays-one-click",
|
|
223
|
+
"tool": "tickets_accept_learning",
|
|
224
|
+
"mode": "auto",
|
|
225
|
+
"args": {
|
|
226
|
+
"id": "MEM-000000000000",
|
|
227
|
+
"decision": "accept"
|
|
228
|
+
},
|
|
229
|
+
"expect": {
|
|
230
|
+
"status": "needs_approval"
|
|
231
|
+
},
|
|
232
|
+
"generated": true
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
"id": "never-itsm-update-ticket",
|
|
236
|
+
"tool": "itsm_update_ticket",
|
|
237
|
+
"mode": "auto",
|
|
238
|
+
"args": {},
|
|
239
|
+
"expect": {
|
|
240
|
+
"status": "blocked"
|
|
241
|
+
},
|
|
242
|
+
"generated": true
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
"id": "never-itsm-notify-requester",
|
|
246
|
+
"tool": "itsm_notify_requester",
|
|
247
|
+
"mode": "auto",
|
|
248
|
+
"args": {},
|
|
249
|
+
"expect": {
|
|
250
|
+
"status": "blocked"
|
|
251
|
+
},
|
|
252
|
+
"generated": true
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
"id": "draft-waits-for-a-person",
|
|
256
|
+
"tool": "tickets_draft_status_note",
|
|
257
|
+
"args": {
|
|
258
|
+
"tickets": "fixtures/tickets.csv",
|
|
259
|
+
"settings": "fixtures/settings.json",
|
|
260
|
+
"as_of": "2026-11-18"
|
|
261
|
+
},
|
|
262
|
+
"expect": {
|
|
263
|
+
"status": "needs_approval",
|
|
264
|
+
"decision": "ask"
|
|
265
|
+
},
|
|
266
|
+
"generated": true
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"id": "review-mode-drafts-nothing",
|
|
270
|
+
"tool": "tickets_draft_status_note",
|
|
271
|
+
"mode": "review",
|
|
272
|
+
"args": {
|
|
273
|
+
"tickets": "fixtures/tickets.csv",
|
|
274
|
+
"settings": "fixtures/settings.json",
|
|
275
|
+
"as_of": "2026-11-18"
|
|
276
|
+
},
|
|
277
|
+
"expect": {
|
|
278
|
+
"status": "blocked"
|
|
279
|
+
},
|
|
280
|
+
"generated": true
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
"id": "request-stays-one-click",
|
|
284
|
+
"tool": "tickets_request_send",
|
|
285
|
+
"mode": "auto",
|
|
286
|
+
"args": {
|
|
287
|
+
"draft": "fixtures/README.md",
|
|
288
|
+
"draft_sha256": "0000000000000000000000000000000000000000000000000000000000000000"
|
|
289
|
+
},
|
|
290
|
+
"expect": {
|
|
291
|
+
"status": "needs_approval"
|
|
292
|
+
},
|
|
293
|
+
"generated": true
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
"id": "intl-de-check-totals",
|
|
297
|
+
"tool": "tickets_check",
|
|
298
|
+
"args": {
|
|
299
|
+
"tickets": "fixtures/intl/de/tickets.csv",
|
|
300
|
+
"settings": "fixtures/settings.json",
|
|
301
|
+
"as_of": "2026-11-18"
|
|
302
|
+
},
|
|
303
|
+
"expect": {
|
|
304
|
+
"equals": {
|
|
305
|
+
"result.tickets": 11,
|
|
306
|
+
"result.open_tickets": 6,
|
|
307
|
+
"result.aging.over_30_days": 1,
|
|
308
|
+
"result.open": 11,
|
|
309
|
+
"result.high": 1
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
"note": "German export of the same data (fixtures/intl/de); must match the English case \"check-totals\"."
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
"id": "intl-ja-check-totals",
|
|
316
|
+
"tool": "tickets_check",
|
|
317
|
+
"args": {
|
|
318
|
+
"tickets": "fixtures/intl/ja/tickets.csv",
|
|
319
|
+
"settings": "fixtures/settings.json",
|
|
320
|
+
"as_of": "2026-11-18"
|
|
321
|
+
},
|
|
322
|
+
"expect": {
|
|
323
|
+
"equals": {
|
|
324
|
+
"result.tickets": 11,
|
|
325
|
+
"result.open_tickets": 6,
|
|
326
|
+
"result.aging.over_30_days": 1,
|
|
327
|
+
"result.open": 11,
|
|
328
|
+
"result.high": 1
|
|
329
|
+
}
|
|
330
|
+
},
|
|
331
|
+
"note": "Japanese export of the same data (fixtures/intl/ja); must match the English case \"check-totals\"."
|
|
332
|
+
}
|
|
333
|
+
]
|
|
334
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Fairwire Ticket SLA fixtures
|
|
2
|
+
|
|
3
|
+
Fictional service desk tickets, read as of the end of 18 November 2026 (calendar hours).
|
|
4
|
+
|
|
5
|
+
- `tickets.csv`: 11 tickets. A P1 opened at 21:00 is still inside its four hours; a P2 has been open since Monday; a P3 has no response and no assignee; a P3 has been on hold since 10 November; a resolved P4 was reopened three times; two Applications tickets were resolved after their target, so the team breach rate is high; a P2 got its first response after six hours; a P4 has waited on the user since 1 October.
|
|
6
|
+
- `settings.json`: the default hold and team limits written out.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Fixtures from other countries
|
|
2
|
+
|
|
3
|
+
Generated by `node scripts/make-intl-fixtures.mjs` from the English fixtures one
|
|
4
|
+
folder up. The same fictional data, written the way a local export writes it:
|
|
5
|
+
|
|
6
|
+
- `de/`: German column names, Windows-1252 text, semicolons, comma decimals
|
|
7
|
+
(1.234,56), day-first dotted dates (03.11.2026), kilograms and kilometres.
|
|
8
|
+
- `ja/`: Japanese column names, Shift_JIS text, year-first dates (2026/11/03),
|
|
9
|
+
kilograms and kilometres.
|
|
10
|
+
|
|
11
|
+
Values (names, codes, charge wording) stay in English. The eval cases
|
|
12
|
+
`intl-de-*` and `intl-ja-*` expect exactly the same results as the English case.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Ticketnummer;Priorit�t;Erstellt am;first_response_at;Gel�st am;state;Zust�ndige Gruppe;assignee;reopen_count
|
|
2
|
+
INC-1001;1 - Critical;18.11.2026 21:00:00;18.11.2026 21:20:00;;In Progress;Network;Ana Ortiz;0
|
|
3
|
+
INC-1002;2 - High;16.11.2026 09:00:00;16.11.2026 10:00:00;;In Progress;Service Desk;Ben Kim;0
|
|
4
|
+
INC-1003;3 - Moderate;17.11.2026 09:00:00;;;New;Service Desk;;0
|
|
5
|
+
INC-1004;3 - Moderate;10.11.2026 09:00:00;10.11.2026 12:00:00;;On Hold;Applications;Cy Diaz;0
|
|
6
|
+
INC-1005;4 - Low;12.11.2026 09:00:00;12.11.2026 11:00:00;14.11.2026 09:00:00;Resolved;Service Desk;Ben Kim;3
|
|
7
|
+
INC-1006;3 - Moderate;01.11.2026 09:00:00;01.11.2026 10:00:00;07.11.2026 09:00:00;Resolved;Applications;Cy Diaz;0
|
|
8
|
+
INC-1007;3 - Moderate;02.11.2026 09:00:00;02.11.2026 10:00:00;08.11.2026 09:00:00;Resolved;Applications;Dee Lee;0
|
|
9
|
+
INC-1008;2 - High;15.11.2026 09:00:00;15.11.2026 15:00:00;15.11.2026 20:00:00;Resolved;Network;Ana Ortiz;0
|
|
10
|
+
INC-1009;4 - Low;17.11.2026 14:00:00;17.11.2026 15:00:00;;In Progress;Service Desk;Ben Kim;0
|
|
11
|
+
INC-1010;3 - Moderate;16.11.2026 10:00:00;16.11.2026 11:00:00;16.11.2026 15:00:00;Resolved;Network;Eli Moss;0
|
|
12
|
+
INC-1011;4 - Low;01.10.2026 09:00:00;01.10.2026 10:00:00;;Awaiting user;Applications;Dee Lee;1
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
�`�P�b�g�ԍ�,�D��x,�N�[����,first_response_at,��������,state,�S���`�[��,assignee,reopen_count
|
|
2
|
+
INC-1001,1 - Critical,2026/11/18 21:00:00,2026/11/18 21:20:00,,In Progress,Network,Ana Ortiz,0
|
|
3
|
+
INC-1002,2 - High,2026/11/16 09:00:00,2026/11/16 10:00:00,,In Progress,Service Desk,Ben Kim,0
|
|
4
|
+
INC-1003,3 - Moderate,2026/11/17 09:00:00,,,New,Service Desk,,0
|
|
5
|
+
INC-1004,3 - Moderate,2026/11/10 09:00:00,2026/11/10 12:00:00,,On Hold,Applications,Cy Diaz,0
|
|
6
|
+
INC-1005,4 - Low,2026/11/12 09:00:00,2026/11/12 11:00:00,2026/11/14 09:00:00,Resolved,Service Desk,Ben Kim,3
|
|
7
|
+
INC-1006,3 - Moderate,2026/11/01 09:00:00,2026/11/01 10:00:00,2026/11/07 09:00:00,Resolved,Applications,Cy Diaz,0
|
|
8
|
+
INC-1007,3 - Moderate,2026/11/02 09:00:00,2026/11/02 10:00:00,2026/11/08 09:00:00,Resolved,Applications,Dee Lee,0
|
|
9
|
+
INC-1008,2 - High,2026/11/15 09:00:00,2026/11/15 15:00:00,2026/11/15 20:00:00,Resolved,Network,Ana Ortiz,0
|
|
10
|
+
INC-1009,4 - Low,2026/11/17 14:00:00,2026/11/17 15:00:00,,In Progress,Service Desk,Ben Kim,0
|
|
11
|
+
INC-1010,3 - Moderate,2026/11/16 10:00:00,2026/11/16 11:00:00,2026/11/16 15:00:00,Resolved,Network,Eli Moss,0
|
|
12
|
+
INC-1011,4 - Low,2026/10/01 09:00:00,2026/10/01 10:00:00,,Awaiting user,Applications,Dee Lee,1
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
ticket,priority,opened_at,first_response_at,resolved_at,state,team,assignee,reopen_count
|
|
2
|
+
INC-1001,1 - Critical,2026-11-18 21:00:00,2026-11-18 21:20:00,,In Progress,Network,Ana Ortiz,0
|
|
3
|
+
INC-1002,2 - High,2026-11-16 09:00:00,2026-11-16 10:00:00,,In Progress,Service Desk,Ben Kim,0
|
|
4
|
+
INC-1003,3 - Moderate,2026-11-17 09:00:00,,,New,Service Desk,,0
|
|
5
|
+
INC-1004,3 - Moderate,2026-11-10 09:00:00,2026-11-10 12:00:00,,On Hold,Applications,Cy Diaz,0
|
|
6
|
+
INC-1005,4 - Low,2026-11-12 09:00:00,2026-11-12 11:00:00,2026-11-14 09:00:00,Resolved,Service Desk,Ben Kim,3
|
|
7
|
+
INC-1006,3 - Moderate,2026-11-01 09:00:00,2026-11-01 10:00:00,2026-11-07 09:00:00,Resolved,Applications,Cy Diaz,0
|
|
8
|
+
INC-1007,3 - Moderate,2026-11-02 09:00:00,2026-11-02 10:00:00,2026-11-08 09:00:00,Resolved,Applications,Dee Lee,0
|
|
9
|
+
INC-1008,2 - High,2026-11-15 09:00:00,2026-11-15 15:00:00,2026-11-15 20:00:00,Resolved,Network,Ana Ortiz,0
|
|
10
|
+
INC-1009,4 - Low,2026-11-17 14:00:00,2026-11-17 15:00:00,,In Progress,Service Desk,Ben Kim,0
|
|
11
|
+
INC-1010,3 - Moderate,2026-11-16 10:00:00,2026-11-16 11:00:00,2026-11-16 15:00:00,Resolved,Network,Eli Moss,0
|
|
12
|
+
INC-1011,4 - Low,2026-10-01 09:00:00,2026-10-01 10:00:00,,Awaiting user,Applications,Dee Lee,1
|
package/package.json
CHANGED
|
@@ -1,6 +1,59 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fairwire-ticket-sla",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"mcpName": "io.github.fpavia111-creator/fairwire-ticket-sla",
|
|
5
|
+
"description": "Fairwire Ticket SLA: Ticket SLA aging from a service desk export: tickets past their response or resolution target by priority, aging buckets, tickets with no assignee, tickets reopened again and again, tickets parked on hold and the teams with the most breaches. Drafts a status note; never closes a ticket.",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"author": "Kurt Francisco",
|
|
9
|
+
"engines": {
|
|
10
|
+
"node": ">=20"
|
|
11
|
+
},
|
|
12
|
+
"main": "src/index.js",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": "./src/index.js",
|
|
15
|
+
"./package.json": "./package.json"
|
|
16
|
+
},
|
|
17
|
+
"bin": {
|
|
18
|
+
"fairwire-ticket-sla": "bin/fairwire-ticket-sla.js"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"src",
|
|
22
|
+
"bin",
|
|
23
|
+
"fixtures",
|
|
24
|
+
"evals",
|
|
25
|
+
"README.md",
|
|
26
|
+
"CHANGELOG.md",
|
|
27
|
+
"LICENSE",
|
|
28
|
+
"server.json"
|
|
29
|
+
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"test": "node scripts/run-tests.cjs",
|
|
32
|
+
"demo": "node bin/fairwire-ticket-sla.js demo",
|
|
33
|
+
"eval": "node bin/fairwire-ticket-sla.js eval"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"fairwire-core": "^0.1.0"
|
|
37
|
+
},
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "git+https://github.com/fpavia111-creator/fairwire-agents.git",
|
|
41
|
+
"directory": "packages/fairwire-ticket-sla"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://github.com/fpavia111-creator/fairwire-agents/tree/master/packages/fairwire-ticket-sla#readme",
|
|
44
|
+
"bugs": {
|
|
45
|
+
"url": "https://github.com/fpavia111-creator/fairwire-agents/issues"
|
|
46
|
+
},
|
|
47
|
+
"keywords": [
|
|
48
|
+
"mcp",
|
|
49
|
+
"mcp-server",
|
|
50
|
+
"it-operations",
|
|
51
|
+
"network",
|
|
52
|
+
"fairwire",
|
|
53
|
+
"service-desk",
|
|
54
|
+
"sla",
|
|
55
|
+
"itsm",
|
|
56
|
+
"servicenow",
|
|
57
|
+
"jira-service-management"
|
|
58
|
+
]
|
|
59
|
+
}
|
package/server.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
|
+
"name": "io.github.fpavia111-creator/fairwire-ticket-sla",
|
|
4
|
+
"title": "Fairwire Ticket SLA",
|
|
5
|
+
"description": "Fairwire Ticket SLA: Ticket SLA aging from a service desk export: tickets past their response or…",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"repository": {
|
|
8
|
+
"url": "https://github.com/fpavia111-creator/fairwire-agents",
|
|
9
|
+
"source": "github",
|
|
10
|
+
"subfolder": "packages/fairwire-ticket-sla"
|
|
11
|
+
},
|
|
12
|
+
"websiteUrl": "https://fair-agents.com/fairwire.html",
|
|
13
|
+
"packages": [
|
|
14
|
+
{
|
|
15
|
+
"registryType": "npm",
|
|
16
|
+
"identifier": "fairwire-ticket-sla",
|
|
17
|
+
"version": "0.1.0",
|
|
18
|
+
"transport": {
|
|
19
|
+
"type": "stdio"
|
|
20
|
+
},
|
|
21
|
+
"packageArguments": [
|
|
22
|
+
{
|
|
23
|
+
"type": "positional",
|
|
24
|
+
"value": "mcp"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"type": "named",
|
|
28
|
+
"name": "--root",
|
|
29
|
+
"description": "Folder holding the exports this agent may read and write (it cannot reach outside it)",
|
|
30
|
+
"isRequired": true,
|
|
31
|
+
"format": "filepath",
|
|
32
|
+
"valueHint": "exports_folder"
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
}
|
package/src/demo.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { fileURLToPath } from 'node:url';
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { standardDemo } from 'fairwire-core';
|
|
4
|
+
|
|
5
|
+
// The demo runs the eval case "check-totals" and the agent's draft on the fictional fixtures.
|
|
6
|
+
const cases = JSON.parse(readFileSync(new URL('../evals/cases.json', import.meta.url), 'utf8')).cases;
|
|
7
|
+
const base = cases.find((c) => c.id === 'check-totals');
|
|
8
|
+
const explain = cases.find((c) => /_explain$/.test(c.tool) && !c.expect.status);
|
|
9
|
+
const draft = cases.find((c) => /_draft_/.test(c.tool) && c.approve);
|
|
10
|
+
|
|
11
|
+
export async function demo(manifest) {
|
|
12
|
+
const refused = manifest.tools.filter((t) => (manifest.policy.rules.find((r) => r.tool === t.name) || {}).decision === 'block')[0];
|
|
13
|
+
await standardDemo(manifest, fileURLToPath(new URL('../fixtures', import.meta.url)), {
|
|
14
|
+
title: 'Fairwire Ticket SLA demo', args: base.args,
|
|
15
|
+
explain: explain ? { label: 'Explain one finding', args: explain.args } : null,
|
|
16
|
+
draft: draft ? { label: 'Draft the note for a person', args: draft.args } : null,
|
|
17
|
+
refused: refused ? refused.name : null,
|
|
18
|
+
});
|
|
19
|
+
}
|
package/src/index.js
ADDED
package/src/logic.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// Fairwire Ticket SLA: service desk SLA aging. Pure functions.
|
|
2
|
+
import { num, str, low, toMs, round1, pct, finding } from 'fairwire-core';
|
|
3
|
+
|
|
4
|
+
export const CHECKS = Object.freeze({
|
|
5
|
+
resolution_breached: 'An open ticket past its resolution target (high for P1 and P2).',
|
|
6
|
+
response_breached: 'An open ticket with no first response past its response target, or a first response that came late.',
|
|
7
|
+
no_assignee: 'An open ticket older than a day with nobody assigned.',
|
|
8
|
+
team_breach_rate: 'A team where more than your share of tickets breached their resolution target.',
|
|
9
|
+
parked_on_hold: 'A ticket on hold for longer than your limit (on hold often stops the SLA clock).',
|
|
10
|
+
reopened_often: 'A ticket reopened several times (the fix did not hold).',
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export const TICKET_FIELDS = Object.freeze({
|
|
14
|
+
ticket: { aliases: ['Number', 'Ticket', 'Ticket ID', 'Issue key', 'ID', 'Incident'], required: true },
|
|
15
|
+
priority: { aliases: ['Priority', 'Urgency', 'Severity', 'Impact'] },
|
|
16
|
+
opened_at: { type: 'datetime', aliases: ['Opened', 'Created', 'opened_at', 'Created Date', 'Submitted'], required: true },
|
|
17
|
+
first_response_at: { type: 'datetime', aliases: ['First Response', 'First Responded', 'Responded At', 'First Reply'] },
|
|
18
|
+
resolved_at: { type: 'datetime', aliases: ['Resolved', 'Resolved At', 'Closed', 'Resolution Date', 'resolved_at'] },
|
|
19
|
+
state: { aliases: ['State', 'Status', 'Ticket Status', 'incident_state', 'Incident state'] },
|
|
20
|
+
team: { aliases: ['Assignment group', 'Team', 'Group', 'Queue', 'assignment_group'] },
|
|
21
|
+
assignee: { aliases: ['Assigned to', 'Assignee', 'Agent', 'Technician', 'Owner'], pii: 'name' },
|
|
22
|
+
reopen_count: { type: 'number', aliases: ['Reopen Count', 'Reopened', 'Times Reopened'] },
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export const SETTINGS_SCHEMA = { type: 'object', additionalProperties: false, properties: {
|
|
26
|
+
response_hours: { type: 'object', additionalProperties: { type: 'number', minimum: 0 }, description: 'First response target in hours per priority, e.g. {"P1": 1, "P2": 4, "P3": 8, "P4": 24} (default)' },
|
|
27
|
+
resolve_hours: { type: 'object', additionalProperties: { type: 'number', minimum: 0 }, description: 'Resolution target in hours per priority, e.g. {"P1": 4, "P2": 24, "P3": 72, "P4": 120} (default)' },
|
|
28
|
+
hold_days: { type: 'number', minimum: 1, description: 'Days on hold after which a ticket is flagged (default 7)' },
|
|
29
|
+
reopen_min: { type: 'integer', minimum: 1, description: 'Reopens after which a ticket is flagged (default 2)' },
|
|
30
|
+
team_breach_pct: { type: 'number', minimum: 1, maximum: 100, description: 'Share of a team\'s tickets breached above which the team is flagged (default 20)' },
|
|
31
|
+
} };
|
|
32
|
+
export const DEFAULTS = Object.freeze({ response_hours: { P1: 1, P2: 4, P3: 8, P4: 24 }, resolve_hours: { P1: 4, P2: 24, P3: 72, P4: 120 }, hold_days: 7, reopen_min: 2, team_breach_pct: 20 });
|
|
33
|
+
|
|
34
|
+
/** P1..P4 from words or numbers: "1 - Critical", "High", "P2". */
|
|
35
|
+
export function priorityOf(v) {
|
|
36
|
+
const t = low(v); const m = /(?:^|p|\b)([1-4])\b/.exec(t);
|
|
37
|
+
if (m) return `P${m[1]}`;
|
|
38
|
+
return /crit|urgent|highest/.test(t) ? 'P1' : /high/.test(t) ? 'P2' : /med|normal|moderate/.test(t) ? 'P3' : /low|lowest|plan/.test(t) ? 'P4' : 'P3';
|
|
39
|
+
}
|
|
40
|
+
const OPEN = (st) => !/resolved|closed|cancel|done|complete/.test(low(st));
|
|
41
|
+
|
|
42
|
+
export function reviewTickets(rows, settings = {}, asOf) {
|
|
43
|
+
const s = { ...DEFAULTS, ...settings, response_hours: { ...DEFAULTS.response_hours, ...(settings.response_hours || {}) }, resolve_hours: { ...DEFAULTS.resolve_hours, ...(settings.resolve_hours || {}) } };
|
|
44
|
+
const now = asOf ? toMs(`${asOf} 23:59:59`) : Date.now();
|
|
45
|
+
const ts = rows.filter((r) => str(r.ticket) && Number.isFinite(toMs(r.opened_at))).map((r) => ({ id: str(r.ticket), p: priorityOf(r.priority), open: toMs(r.opened_at), resp: toMs(r.first_response_at), res: toMs(r.resolved_at), state: str(r.state), team: str(r.team) || '(no team)', who: str(r.assignee), reopen: num(r.reopen_count) || 0 }));
|
|
46
|
+
const items = []; const teams = {}; const pri = {};
|
|
47
|
+
const hours = (a, b) => round1((b - a) / 3600000);
|
|
48
|
+
for (const t of ts) {
|
|
49
|
+
const isOpen = OPEN(t.state) && !Number.isFinite(t.res); const end = Number.isFinite(t.res) ? t.res : now; const age = hours(t.open, end);
|
|
50
|
+
const resT = s.resolve_hours[t.p]; const respT = s.response_hours[t.p];
|
|
51
|
+
// A closed ticket with no resolution time cannot be measured (1,556 such rows in the public ServiceNow log).
|
|
52
|
+
const measurable = isOpen || Number.isFinite(t.res);
|
|
53
|
+
const breached = measurable && resT !== undefined && age > resT;
|
|
54
|
+
const tm = teams[t.team] || (teams[t.team] = { team: t.team, tickets: 0, breached: 0, open: 0 }); tm.tickets++; if (breached) tm.breached++; if (isOpen) tm.open++;
|
|
55
|
+
const pr = pri[t.p] || (pri[t.p] = { priority: t.p, open: 0, breached_open: 0 }); if (isOpen) { pr.open++; if (breached) pr.breached_open++; }
|
|
56
|
+
if (isOpen && breached) items.push(finding('resolution_breached', ['P1', 'P2'].includes(t.p) ? 'high' : 'medium', t.id, `${t.p} ticket ${t.id} (${t.team}) has been open ${age} hours; the target is ${resT}.`, 'Escalate it to the team lead today, or agree a new date with the requester.', { subject: t.team }));
|
|
57
|
+
if (respT !== undefined) { const r = Number.isFinite(t.resp) ? hours(t.open, t.resp) : null; if ((r === null && isOpen && age > respT) || (r !== null && r > respT)) items.push(finding('response_breached', 'medium', t.id, `${t.p} ticket ${t.id} ${r === null ? `has had no first response after ${age} hours` : `got its first response after ${r} hours`}; the target is ${respT}.`, 'Check the queue for this team and priority; an automatic acknowledgement does not count as a response.', { subject: t.team })); }
|
|
58
|
+
if (isOpen && !t.who && age > 24) items.push(finding('no_assignee', 'medium', t.id, `Ticket ${t.id} has been open ${age} hours with nobody assigned.`, 'Assign it in the next triage round.', { subject: t.team }));
|
|
59
|
+
if (isOpen && /hold|pending|waiting/i.test(t.state) && age > s.hold_days * 24) items.push(finding('parked_on_hold', 'low', t.id, `Ticket ${t.id} is "${t.state}" and was opened ${round1(age / 24)} days ago.`, 'Chase the person it waits for, or close it with a note.', { subject: t.team }));
|
|
60
|
+
if (t.reopen >= s.reopen_min) items.push(finding('reopened_often', 'low', t.id, `Ticket ${t.id} was reopened ${t.reopen} times.`, 'Look for the root cause instead of closing it again.', { subject: t.team }));
|
|
61
|
+
}
|
|
62
|
+
for (const tm of Object.values(teams)) { const sh = pct(tm.breached, tm.tickets); if (tm.tickets >= 3 && sh > s.team_breach_pct) items.push(finding('team_breach_rate', 'medium', tm.team, `${sh}% of the tickets for ${tm.team} missed their resolution target (${tm.breached} of ${tm.tickets}).`, 'Look at staffing, triage and the priorities the team receives.', { subject: tm.team })); }
|
|
63
|
+
const open = ts.filter((t) => OPEN(t.state) && !Number.isFinite(t.res)); const ageDays = (t) => (now - t.open) / 86400000;
|
|
64
|
+
const buckets = { under_1_day: 0, '1_to_7_days': 0, '8_to_30_days': 0, over_30_days: 0 };
|
|
65
|
+
for (const t of open) { const d = ageDays(t); buckets[d < 1 ? 'under_1_day' : d <= 7 ? '1_to_7_days' : d <= 30 ? '8_to_30_days' : 'over_30_days']++; }
|
|
66
|
+
return { tickets: ts.length, open_tickets: open.length, aging: buckets, by_priority: Object.values(pri).sort((a, b) => (a.priority < b.priority ? -1 : 1)), by_team: Object.values(teams).sort((a, b) => (a.team < b.team ? -1 : 1)), items };
|
|
67
|
+
}
|
package/src/manifest.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { wireAgent, fileArg, SETTINGS_ARG, AS_OF_ARG, settingsFrom, LIMITS, exportProfile, today } from 'fairwire-core';
|
|
3
|
+
import { TICKET_FIELDS, SETTINGS_SCHEMA, DEFAULTS, reviewTickets } from './logic.js';
|
|
4
|
+
|
|
5
|
+
const pkg = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
|
|
6
|
+
const args = {
|
|
7
|
+
tickets: fileArg('Service desk export under --root (ServiceNow, Jira Service Management, Freshservice, Zendesk or any CSV, Excel or JSON): one row per ticket with priority, opened, first response, resolved, state, team, assignee and reopen count'),
|
|
8
|
+
settings: SETTINGS_ARG('response_hours, resolve_hours, hold_days, reopen_min, team_breach_pct'),
|
|
9
|
+
as_of: AS_OF_ARG,
|
|
10
|
+
};
|
|
11
|
+
const PROFILES = [
|
|
12
|
+
exportProfile('servicenow_incidents', { ticket: 'number', priority: 'priority', opened_at: 'opened_at', state: 'state', team: 'assignment_group', assignee: 'assigned_to', resolved_at: 'resolved_at', reopen_count: 'reopen_count' }),
|
|
13
|
+
exportProfile('jira_service_management', { ticket: 'Issue key', priority: 'Priority', opened_at: 'Created', state: 'Status', resolved_at: 'Resolved', assignee: 'Assignee' }),
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
export const manifest = wireAgent({
|
|
17
|
+
// Columns the "value is missing" checks depend on: an export without the column skips the check instead of flagging every row.
|
|
18
|
+
needs: { response_breached: ['first_response_at'], no_assignee: ['assignee'] },
|
|
19
|
+
pkg, prefix: 'tickets', title: 'Fairwire Ticket SLA',
|
|
20
|
+
description: 'Reviews a service desk export for SLA aging: open tickets past their resolution or response targets, tickets with nobody assigned, teams with many breaches, tickets parked on hold and tickets reopened again and again, with aging buckets by priority. Assignee names are masked for the model. Drafts a status note; never closes a ticket.',
|
|
21
|
+
args, required: ['tickets'],
|
|
22
|
+
sources: { tickets: { label: 'Tickets', args: ['tickets'], fields: TICKET_FIELDS, profiles: PROFILES } },
|
|
23
|
+
configSchemas: { tickets_settings: SETTINGS_SCHEMA },
|
|
24
|
+
run: (a, ctx) => reviewTickets(ctx.records(a.tickets, 'tickets'), settingsFrom(a, ctx, 'tickets_settings', DEFAULTS), a.as_of || today()),
|
|
25
|
+
summary: (o) => `${o.tickets} ticket(s), ${o.open_tickets} open (${o.aging.over_30_days} older than 30 days): ${o.open} open finding(s), ${o.high} high.`,
|
|
26
|
+
check: { title: 'Review ticket SLAs', description: 'Review tickets against your response and resolution targets and list breaches, unassigned tickets, team breach rates, parked and reopened tickets.' },
|
|
27
|
+
explain: { arg: 'ticket', argSchema: { type: 'string', maxLength: 100, description: 'Ticket number or team from tickets_check' }, title: 'Explain one ticket or team', description: 'Every finding for one ticket or team.', match: (i, v) => i.key === v || i.subject === v },
|
|
28
|
+
report: {
|
|
29
|
+
title: 'Ticket SLA aging', base: 'ticket-sla',
|
|
30
|
+
sections: (o) => [{ title: 'By priority', rows: o.by_priority, columns: ['priority', 'open', 'breached_open'] }, { title: 'By team', rows: o.by_team, columns: ['team', 'tickets', 'breached', 'open'] }],
|
|
31
|
+
limits: [LIMITS.files, 'Targets are counted in calendar hours from the opened time; business hours, holidays and SLA pauses in your tool are not modelled, so your tool\'s own SLA flag wins where they differ.', LIMITS.defaults, LIMITS.pii, LIMITS.live],
|
|
32
|
+
},
|
|
33
|
+
note: { noun: 'status_note', verb: 'send', category: 'binding_send', actor: 'the service desk manager', to: 'service desk team leads', subject: 'Tickets behind their targets', ask: 'Please take each item to your next stand-up and reply with an owner and a date.' },
|
|
34
|
+
refused: [
|
|
35
|
+
{ name: 'itsm_update_ticket', category: 'production_deploy', description: 'Fairwire Ticket SLA never edits, assigns, closes or reprioritises a ticket.' },
|
|
36
|
+
{ name: 'itsm_notify_requester', category: 'binding_send', description: 'Fairwire Ticket SLA never messages requesters.' },
|
|
37
|
+
],
|
|
38
|
+
prompt: { title: 'Review ticket SLAs', description: 'Walks the host model through an SLA review with Fairwire Ticket SLA.', text: 'You are helping a service desk manager review ticket aging with fairwire-ticket-sla. Assignees are pseudonyms. 1. Call tickets_check; lead with P1 and P2 tickets past their target. 2. Use tickets_explain for a ticket or team. 3. Call tickets_write_report. 4. Offer tickets_draft_status_note; tickets_request_send waits for one named click.' },
|
|
39
|
+
});
|