@hasna/uptime 0.1.2 → 0.1.4
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 +50 -0
- package/README.md +72 -1
- package/dist/api.d.ts +12 -0
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +2427 -123
- package/dist/checks.d.ts +23 -1
- package/dist/checks.d.ts.map +1 -1
- package/dist/checks.js +131 -2
- package/dist/cli/index.js +2772 -115
- package/dist/dashboard.js +1 -1
- package/dist/imports.d.ts +90 -0
- package/dist/imports.d.ts.map +1 -0
- package/dist/imports.js +556 -0
- package/dist/index.d.ts +9 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2437 -123
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +2307 -49
- package/dist/paths.d.ts +1 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +4 -0
- package/dist/probes.d.ts +13 -0
- package/dist/probes.d.ts.map +1 -0
- package/dist/probes.js +62 -0
- package/dist/report.d.ts +2 -7
- package/dist/report.d.ts.map +1 -1
- package/dist/report.js +1 -1
- package/dist/service.d.ts +152 -4
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +2154 -60
- package/dist/store.d.ts +130 -3
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +1086 -18
- package/dist/target-policy.d.ts +7 -0
- package/dist/target-policy.d.ts.map +1 -0
- package/dist/types.d.ts +189 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +6 -2
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,56 @@ project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.1.4] - 2026-06-28
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Local scheduled uptime reports with persisted schedules, run history, and due
|
|
14
|
+
execution through Mailery email, Telephony SMS, and Open Logs.
|
|
15
|
+
- CLI commands under `uptime report-schedules` plus `uptime audit`.
|
|
16
|
+
- Local API and MCP surfaces for report schedules, report runs, and audit
|
|
17
|
+
events.
|
|
18
|
+
- Immutable local audit events for report schedule create/update/delete/run
|
|
19
|
+
actions.
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- Bumped the local SQLite schema to version 3 while keeping schema version 1
|
|
24
|
+
and 2 backups restorable when they only lack newer probe/report/audit tables.
|
|
25
|
+
- Hosted report schedule routes fail closed until cloud channel refs, workspace
|
|
26
|
+
stores, and audit logging are implemented.
|
|
27
|
+
|
|
28
|
+
### Security
|
|
29
|
+
|
|
30
|
+
- Persisted report schedules reject inline API keys and tokens; scheduled runs
|
|
31
|
+
resolve Mailery/Open Logs credentials from environment variables or future
|
|
32
|
+
cloud channel refs.
|
|
33
|
+
- Audit metadata redacts token/key/secret-like fields before persistence.
|
|
34
|
+
|
|
35
|
+
## [0.1.3] - 2026-06-28
|
|
36
|
+
|
|
37
|
+
### Added
|
|
38
|
+
|
|
39
|
+
- Private/local probe identities, check jobs, fenced signed submissions, and
|
|
40
|
+
probe signing helpers exported from `@hasna/uptime/probes`.
|
|
41
|
+
- CLI commands for `uptime probes create`, `uptime probes jobs create`,
|
|
42
|
+
`uptime probes jobs claim`, and `uptime probes submit`.
|
|
43
|
+
- Local API and MCP probe surfaces for public-key enrollment, job
|
|
44
|
+
creation/claiming, and signed result submission.
|
|
45
|
+
|
|
46
|
+
### Changed
|
|
47
|
+
|
|
48
|
+
- Bumped the local SQLite schema to version 2 while keeping schema version 1
|
|
49
|
+
backups restorable when they are only missing the new probe tables.
|
|
50
|
+
- Hosted probe ingest fails closed until cloud check jobs, workspace stores, and
|
|
51
|
+
audit logging are implemented.
|
|
52
|
+
|
|
53
|
+
### Security
|
|
54
|
+
|
|
55
|
+
- API and MCP probe enrollment require caller-managed public keys; generated
|
|
56
|
+
private keys are written only by the CLI to an explicit private-key file.
|
|
57
|
+
- Probe job reads redact fencing tokens outside the claim response.
|
|
58
|
+
|
|
9
59
|
## [0.1.2] - 2026-06-28
|
|
10
60
|
|
|
11
61
|
### Fixed
|
package/README.md
CHANGED
|
@@ -27,10 +27,39 @@ uptime summary
|
|
|
27
27
|
uptime report --dry-run
|
|
28
28
|
uptime report --email ops@example.com --from alerts@example.com --send-key "$MAILERY_SEND_KEY"
|
|
29
29
|
uptime report --sms +15550000001 --logs
|
|
30
|
+
uptime report-schedules create ops --interval 3600 --email ops@example.com --from alerts@example.com
|
|
31
|
+
uptime report-schedules run-due
|
|
32
|
+
uptime report-schedules runs
|
|
33
|
+
uptime audit
|
|
30
34
|
uptime incidents
|
|
31
35
|
uptime serve --port 3899 --check
|
|
32
36
|
```
|
|
33
37
|
|
|
38
|
+
Scheduled reports persist endpoint and recipient configuration, but not send
|
|
39
|
+
keys or API tokens. Configure `MAILERY_SEND_KEY`, `HASNA_MAILERY_SEND_KEY`,
|
|
40
|
+
`HASNA_LOGS_API_TOKEN`, or the matching service env vars before scheduled runs.
|
|
41
|
+
|
|
42
|
+
Private/local probes can submit signed results from another machine:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
uptime probes create spark01 --private-key-file ./spark01-probe.key.pem
|
|
46
|
+
uptime probes jobs create --monitor <monitor-id> --schedule-slot 2026-06-28T12:00:00Z
|
|
47
|
+
uptime probes jobs claim <job-id> --probe <probe-id>
|
|
48
|
+
uptime probes submit \
|
|
49
|
+
--probe <probe-id> \
|
|
50
|
+
--job <job-id> \
|
|
51
|
+
--schedule-slot 2026-06-28T12:00:00Z \
|
|
52
|
+
--fencing-token <claim-fencing-token> \
|
|
53
|
+
--monitor <monitor-id> \
|
|
54
|
+
--monitor-revision <claim-monitor-revision> \
|
|
55
|
+
--private-key-file ./spark01-probe.key.pem \
|
|
56
|
+
--status up
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Generated probe private keys are written only to the explicit
|
|
60
|
+
`--private-key-file` path. API and MCP probe enrollment require caller-managed
|
|
61
|
+
public keys.
|
|
62
|
+
|
|
34
63
|
The local dashboard and API bind to `127.0.0.1` by default:
|
|
35
64
|
|
|
36
65
|
```bash
|
|
@@ -70,7 +99,9 @@ claude mcp add --scope user uptime -- uptime-mcp
|
|
|
70
99
|
```
|
|
71
100
|
|
|
72
101
|
The MCP server exposes monitor CRUD, check execution, summary, incident, and
|
|
73
|
-
result tools,
|
|
102
|
+
result tools, an `uptime_send_report` tool for one-shot report delivery,
|
|
103
|
+
scheduled report tools, local audit event reads, and local probe tools for
|
|
104
|
+
public-key enrollment, job creation/claiming, and signed result submission.
|
|
74
105
|
|
|
75
106
|
## SDK
|
|
76
107
|
|
|
@@ -98,8 +129,20 @@ await uptime.sendReport({
|
|
|
98
129
|
sms: { apiUrl: "http://localhost:19451", to: "+15550000001" },
|
|
99
130
|
logs: { apiUrl: "http://localhost:3460", apiKey: process.env.HASNA_LOGS_API_TOKEN, projectId: "open-uptime" },
|
|
100
131
|
});
|
|
132
|
+
|
|
133
|
+
const schedule = uptime.createReportSchedule({
|
|
134
|
+
name: "ops",
|
|
135
|
+
intervalSeconds: 3600,
|
|
136
|
+
channels: {
|
|
137
|
+
email: { from: "alerts@example.com", to: "ops@example.com" },
|
|
138
|
+
logs: { apiUrl: "http://localhost:3460", projectId: "open-uptime" },
|
|
139
|
+
},
|
|
140
|
+
});
|
|
141
|
+
await uptime.runReportSchedule(schedule.id);
|
|
101
142
|
```
|
|
102
143
|
|
|
144
|
+
Probe agents can import signing helpers from `@hasna/uptime/probes`.
|
|
145
|
+
|
|
103
146
|
## API
|
|
104
147
|
|
|
105
148
|
Run `uptime serve` and use:
|
|
@@ -108,6 +151,15 @@ Run `uptime serve` and use:
|
|
|
108
151
|
- `GET /api/summary`
|
|
109
152
|
- `GET /api/report`
|
|
110
153
|
- `POST /api/report`
|
|
154
|
+
- `GET /api/report-schedules`
|
|
155
|
+
- `POST /api/report-schedules`
|
|
156
|
+
- `GET /api/report-schedules/:id`
|
|
157
|
+
- `PATCH /api/report-schedules/:id`
|
|
158
|
+
- `DELETE /api/report-schedules/:id`
|
|
159
|
+
- `POST /api/report-schedules/:id/run`
|
|
160
|
+
- `POST /api/report-schedules/run-due`
|
|
161
|
+
- `GET /api/report-runs?scheduleId=<id>&limit=100`
|
|
162
|
+
- `GET /api/audit-events?resourceType=<type>&resourceId=<id>`
|
|
111
163
|
- `GET /api/monitors`
|
|
112
164
|
- `POST /api/monitors`
|
|
113
165
|
- `GET /api/monitors/:id`
|
|
@@ -115,6 +167,21 @@ Run `uptime serve` and use:
|
|
|
115
167
|
- `POST /api/monitors/:id/check`
|
|
116
168
|
- `GET /api/incidents`
|
|
117
169
|
- `GET /api/results?monitorId=<id>&limit=100`
|
|
170
|
+
- `GET /api/probes`
|
|
171
|
+
- `POST /api/probes`
|
|
172
|
+
- `POST /api/probes/jobs`
|
|
173
|
+
- `GET /api/probes/jobs/:id`
|
|
174
|
+
- `POST /api/probes/jobs/:id/claim`
|
|
175
|
+
- `POST /api/probes/results`
|
|
176
|
+
|
|
177
|
+
Hosted `/api/v1/probes*` routes currently fail closed with `501` until cloud
|
|
178
|
+
check jobs, workspace stores, and audit logging are implemented. Local job reads
|
|
179
|
+
redact fencing tokens; the claim response is the only API response that returns
|
|
180
|
+
the active fencing token.
|
|
181
|
+
|
|
182
|
+
Hosted `/api/v1/report-schedules*`, `/api/v1/report-runs`, and
|
|
183
|
+
`/api/v1/audit-events` also fail closed until cloud channel refs, workspace
|
|
184
|
+
stores, and cloud audit logging are implemented.
|
|
118
185
|
|
|
119
186
|
## Scope
|
|
120
187
|
|
|
@@ -129,11 +196,15 @@ First release:
|
|
|
129
196
|
- local dashboard/API
|
|
130
197
|
- CLI, MCP, SDK, and tests
|
|
131
198
|
- Optional report delivery through Open Mailery, Open Telephony, and Open Logs
|
|
199
|
+
- Scheduled report definitions, report run history, and local audit events
|
|
200
|
+
- Private/local probe identities, check jobs, signed submissions, and fenced
|
|
201
|
+
result recording for internal agents
|
|
132
202
|
|
|
133
203
|
Non-goals for this first release:
|
|
134
204
|
|
|
135
205
|
- Sentry-style exception tracing
|
|
136
206
|
- hosted multi-tenant SaaS billing
|
|
207
|
+
- hosted probe ingest before cloud check jobs and workspace-scoped storage
|
|
137
208
|
- synthetic browser journeys
|
|
138
209
|
- public incident pages
|
|
139
210
|
- provider-owned delivery configuration; Open Uptime sends through existing
|
package/dist/api.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { UptimeService, type UptimeServiceOptions } from "./service.js";
|
|
2
|
+
import { type UptimeRuntimeMode } from "./store.js";
|
|
2
3
|
import type { SchedulerHandle } from "./types.js";
|
|
3
4
|
export interface ServeOptions extends UptimeServiceOptions {
|
|
4
5
|
host?: string;
|
|
@@ -6,13 +7,24 @@ export interface ServeOptions extends UptimeServiceOptions {
|
|
|
6
7
|
check?: boolean;
|
|
7
8
|
service?: UptimeService;
|
|
8
9
|
apiToken?: string;
|
|
10
|
+
hostedToken?: string;
|
|
11
|
+
hostedTokens?: HostedToken[];
|
|
9
12
|
allowUnsafeRemoteMutations?: boolean;
|
|
10
13
|
}
|
|
11
14
|
export interface CreateApiHandlerOptions {
|
|
12
15
|
apiToken?: string;
|
|
16
|
+
hostedToken?: string;
|
|
17
|
+
hostedTokens?: HostedToken[];
|
|
13
18
|
allowUnsafeRemoteMutations?: boolean;
|
|
14
19
|
fetchImpl?: typeof fetch;
|
|
15
20
|
trustedLoopback?: boolean;
|
|
21
|
+
mode?: UptimeRuntimeMode;
|
|
22
|
+
}
|
|
23
|
+
export type HostedScope = "uptime:read" | "uptime:write" | "uptime:probe" | "uptime:report" | "uptime:admin";
|
|
24
|
+
export interface HostedToken {
|
|
25
|
+
token: string;
|
|
26
|
+
scopes: HostedScope[];
|
|
27
|
+
workspaceId?: string;
|
|
16
28
|
}
|
|
17
29
|
export declare function createApiHandler(service: UptimeService, options?: CreateApiHandlerOptions): (request: Request) => Promise<Response>;
|
|
18
30
|
export declare function serveUptime(options?: ServeOptions): {
|
package/dist/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,KAAK,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAsB,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,WAAW,YAAa,SAAQ,oBAAoB;IACxD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;IAC7B,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACtC;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;IAC7B,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;IACzB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,IAAI,CAAC,EAAE,iBAAiB,CAAC;CAC1B;AAED,MAAM,MAAM,WAAW,GAAG,aAAa,GAAG,cAAc,GAAG,cAAc,GAAG,eAAe,GAAG,cAAc,CAAC;AAE7G,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAOD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,GAAE,uBAA4B,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CA2BvI;AAED,wBAAgB,WAAW,CAAC,OAAO,GAAE,YAAiB,GAAG;IAAE,MAAM,EAAE,UAAU,CAAC,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC;IAAC,OAAO,EAAE,aAAa,CAAC;IAAC,SAAS,CAAC,EAAE,eAAe,CAAA;CAAE,CA2BrJ"}
|