@achieveai/hitl-mcp-server 2.9.6 → 2.11.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.
Files changed (54) hide show
  1. package/dist/cli.d.ts +31 -1
  2. package/dist/cli.d.ts.map +1 -1
  3. package/dist/cli.js +133 -5
  4. package/dist/cli.js.map +1 -1
  5. package/dist/git-context.d.ts +41 -2
  6. package/dist/git-context.d.ts.map +1 -1
  7. package/dist/git-context.js +86 -2
  8. package/dist/git-context.js.map +1 -1
  9. package/dist/host-settings.d.ts +68 -0
  10. package/dist/host-settings.d.ts.map +1 -0
  11. package/dist/host-settings.js +136 -0
  12. package/dist/host-settings.js.map +1 -0
  13. package/dist/mcp-server.d.ts +54 -1
  14. package/dist/mcp-server.d.ts.map +1 -1
  15. package/dist/mcp-server.js +410 -65
  16. package/dist/mcp-server.js.map +1 -1
  17. package/dist/ntfy-transport.d.ts +285 -13
  18. package/dist/ntfy-transport.d.ts.map +1 -1
  19. package/dist/ntfy-transport.js +747 -88
  20. package/dist/ntfy-transport.js.map +1 -1
  21. package/dist/payload.d.ts +80 -0
  22. package/dist/payload.d.ts.map +1 -0
  23. package/dist/payload.js +135 -0
  24. package/dist/payload.js.map +1 -0
  25. package/dist/plan-diff.d.ts +29 -0
  26. package/dist/plan-diff.d.ts.map +1 -0
  27. package/dist/plan-diff.js +138 -0
  28. package/dist/plan-diff.js.map +1 -0
  29. package/dist/plan-file.d.ts +24 -0
  30. package/dist/plan-file.d.ts.map +1 -0
  31. package/dist/plan-file.js +98 -0
  32. package/dist/plan-file.js.map +1 -0
  33. package/dist/plan-review.d.ts +54 -0
  34. package/dist/plan-review.d.ts.map +1 -0
  35. package/dist/plan-review.js +110 -0
  36. package/dist/plan-review.js.map +1 -0
  37. package/dist/setup.d.ts +22 -5
  38. package/dist/setup.d.ts.map +1 -1
  39. package/dist/setup.js +52 -15
  40. package/dist/setup.js.map +1 -1
  41. package/dist/snapshot-store.d.ts +104 -0
  42. package/dist/snapshot-store.d.ts.map +1 -0
  43. package/dist/snapshot-store.js +209 -0
  44. package/dist/snapshot-store.js.map +1 -0
  45. package/dist/types.d.ts +114 -1
  46. package/dist/types.d.ts.map +1 -1
  47. package/dist/types.js +2 -0
  48. package/dist/types.js.map +1 -1
  49. package/dist/version.d.ts +13 -0
  50. package/dist/version.d.ts.map +1 -0
  51. package/dist/version.js +15 -0
  52. package/dist/version.js.map +1 -0
  53. package/package.json +64 -61
  54. package/dist/bin/windows-x64/hitl-client.exe +0 -0
@@ -0,0 +1,209 @@
1
+ import { createHash, randomBytes } from 'crypto';
2
+ import { mkdirSync, readFileSync, writeFileSync, renameSync, existsSync, unlinkSync } from 'fs';
3
+ import { homedir } from 'os';
4
+ import path from 'path';
5
+ import { resolveRepoRoot, normalizePath, toRepoRelative } from './git-context.js';
6
+ /** Root of the snapshot store. Overridable so tests never touch a real home dir. */
7
+ export function getPlansRoot() {
8
+ return path.join(process.env.HITL_HOME ?? path.join(homedir(), '.hitl'), 'plans');
9
+ }
10
+ const DIR_MODE = 0o700;
11
+ const FILE_MODE = 0o600;
12
+ function sha256Hex(value) {
13
+ return createHash('sha256').update(value, 'utf8').digest('hex');
14
+ }
15
+ /**
16
+ * Locate a plan file's history directory and its display name.
17
+ *
18
+ * Identity is keyed on the repo root when there is one, else on the containing
19
+ * directory — so the same relative path in two different repos gets two
20
+ * identities (B-7), while two spellings of one Windows path collapse to one
21
+ * (B-10). Git is resolved from the plan's own directory, never `process.cwd()`,
22
+ * because the plan usually lives in a sibling repo (B-6).
23
+ */
24
+ export function resolvePlanIdentity(resolvedPath) {
25
+ const normalizedPath = normalizePath(resolvedPath);
26
+ const dirName = path.dirname(resolvedPath);
27
+ const repoRoot = resolveRepoRoot(dirName);
28
+ const identityKey = repoRoot ?? normalizePath(dirName);
29
+ const identityHash = sha256Hex(identityKey);
30
+ const pathHash = sha256Hex(normalizedPath);
31
+ return {
32
+ planId: sha256Hex(`${identityHash}:${pathHash}`),
33
+ dir: path.join(getPlansRoot(), identityHash, pathHash),
34
+ displayPath: repoRoot ? toRepoRelative(repoRoot, resolvedPath) : path.basename(resolvedPath),
35
+ repoRoot,
36
+ resolvedPath,
37
+ };
38
+ }
39
+ /**
40
+ * Validate a raw `latest.json` body before anything trusts it.
41
+ *
42
+ * Returns null — never a partially-trusted object — when the digest is not 64
43
+ * lowercase hex, the revision is not a positive integer, `createdAt` is zero,
44
+ * or the recorded `displayPath` names a different file than the one being
45
+ * reviewed. A rejected pointer degrades to "no history", which restarts the
46
+ * revision count rather than diffing against something unverified.
47
+ */
48
+ export function parseLatest(raw, expectedDisplayPath) {
49
+ let parsed;
50
+ try {
51
+ parsed = JSON.parse(raw);
52
+ }
53
+ catch {
54
+ return null;
55
+ }
56
+ if (typeof parsed !== 'object' || parsed === null)
57
+ return null;
58
+ const { displayPath, digest, revision, createdAt } = parsed;
59
+ if (typeof digest !== 'string' || !/^[0-9a-f]{64}$/.test(digest))
60
+ return null;
61
+ if (typeof revision !== 'number' || !Number.isInteger(revision) || revision < 1)
62
+ return null;
63
+ if (typeof createdAt !== 'number' || createdAt <= 0)
64
+ return null;
65
+ if (typeof displayPath !== 'string' || displayPath !== expectedDisplayPath)
66
+ return null;
67
+ return { displayPath, digest, revision, createdAt };
68
+ }
69
+ /** Read and validate `latest.json`, or null when absent or untrustworthy. */
70
+ export function readLatest(identity) {
71
+ const file = path.join(identity.dir, 'latest.json');
72
+ if (!existsSync(file))
73
+ return null;
74
+ try {
75
+ return parseLatest(readFileSync(file, 'utf8'), identity.displayPath);
76
+ }
77
+ catch {
78
+ return null;
79
+ }
80
+ }
81
+ /** Read a stored revision by digest, or null when the object is missing. */
82
+ export function readObject(identity, digest) {
83
+ const file = path.join(identity.dir, 'objects', digest);
84
+ if (!existsSync(file))
85
+ return null;
86
+ try {
87
+ return readFileSync(file, 'utf8');
88
+ }
89
+ catch {
90
+ return null;
91
+ }
92
+ }
93
+ /**
94
+ * Stage `content` as the next revision of this plan.
95
+ *
96
+ * Byte-identical content still advances the revision: a resubmit is a distinct
97
+ * review event, and the human must still be able to select every line of an
98
+ * unchanged plan (B-3).
99
+ *
100
+ * The pointer flip is deliberately a separate step. `latest.json` is what the
101
+ * next review diffs against, so writing it before the plan has actually reached
102
+ * the human means a failed publish silently rebases the next review onto a
103
+ * revision nobody ever saw — the change the human was meant to review vanishes
104
+ * from the diff (M6). Callers commit once the revision is out the door.
105
+ *
106
+ * The object is written either way; it is content-addressed and immutable, so
107
+ * an uncommitted one costs a few KB of orphaned disk and nothing else.
108
+ */
109
+ export function prepareRevision(identity, content) {
110
+ mkdirSync(path.join(identity.dir, 'objects'), { recursive: true, mode: DIR_MODE });
111
+ // The client writes drafts here; the directory is part of the layout either way.
112
+ mkdirSync(path.join(identity.dir, 'drafts'), { recursive: true, mode: DIR_MODE });
113
+ const previous = readLatest(identity);
114
+ const previousContent = previous ? readObject(identity, previous.digest) : null;
115
+ const digest = sha256Hex(content);
116
+ const objectFile = path.join(identity.dir, 'objects', digest);
117
+ if (!existsSync(objectFile)) {
118
+ writeAtomic(objectFile, content);
119
+ }
120
+ const record = {
121
+ revision: (previous?.revision ?? 0) + 1,
122
+ digest,
123
+ isNewPlan: previous === null,
124
+ previous,
125
+ previousContent,
126
+ };
127
+ return {
128
+ ...record,
129
+ commit() {
130
+ const meta = {
131
+ displayPath: identity.displayPath,
132
+ digest,
133
+ revision: record.revision,
134
+ createdAt: Date.now(),
135
+ };
136
+ writeAtomic(path.join(identity.dir, 'latest.json'), JSON.stringify(meta, null, 2) + '\n');
137
+ return record;
138
+ },
139
+ };
140
+ }
141
+ /**
142
+ * Write via a temp file in the same directory, then rename over the target.
143
+ *
144
+ * `renameSync` maps to MoveFileEx with MOVEFILE_REPLACE_EXISTING on Windows, so
145
+ * replacing an existing destination is atomic there too. The temp file is
146
+ * removed on failure so a full disk cannot leave debris behind.
147
+ *
148
+ * The temp name must be unique per write, not per target. A shared name lets a
149
+ * second writer append into the first one's half-written file and then rename
150
+ * the torn result into place — which is precisely the corruption this function
151
+ * claims to prevent, and it is reproducible with two concurrent writers.
152
+ *
153
+ * Rename can also fail with EPERM on Windows when another process has the
154
+ * destination open for reading, which is ordinary here: every ReviewPlan reads
155
+ * `latest.json`. That is transient, so `renameWithRetry` absorbs it.
156
+ */
157
+ function writeAtomic(file, contents) {
158
+ const tmp = `${file}.${process.pid}.${randomBytes(6).toString('hex')}.tmp`;
159
+ try {
160
+ writeFileSync(tmp, contents, { encoding: 'utf8', mode: FILE_MODE });
161
+ renameWithRetry(tmp, file);
162
+ }
163
+ catch (err) {
164
+ try {
165
+ unlinkSync(tmp);
166
+ }
167
+ catch { /* nothing to clean up */ }
168
+ throw err;
169
+ }
170
+ }
171
+ /**
172
+ * Rename, tolerating Windows sharing violations.
173
+ *
174
+ * `MoveFileEx` fails with ERROR_ACCESS_DENIED (EPERM) while another process
175
+ * holds the destination open, and every ReviewPlan reads `latest.json`, so this
176
+ * collides in ordinary use rather than only under stress. It is transient, so
177
+ * it is retried with jitter — without the jitter two writers that collided once
178
+ * retry in lockstep and collide again. Anything that is not a sharing violation
179
+ * is a real failure and is raised immediately.
180
+ */
181
+ const RENAME_RETRY_BUDGET_MS = 5_000;
182
+ function renameWithRetry(from, to) {
183
+ const started = Date.now();
184
+ let delay = 2;
185
+ for (;;) {
186
+ try {
187
+ renameSync(from, to);
188
+ return;
189
+ }
190
+ catch (err) {
191
+ const code = err.code;
192
+ const transient = code === 'EPERM' || code === 'EACCES' || code === 'EBUSY';
193
+ if (!transient || Date.now() - started >= RENAME_RETRY_BUDGET_MS)
194
+ throw err;
195
+ sleepSync(delay + Math.floor(Math.random() * delay));
196
+ delay = Math.min(delay * 2, 250);
197
+ }
198
+ }
199
+ }
200
+ /**
201
+ * Block for `ms`, without an event-loop turn.
202
+ *
203
+ * The whole store is synchronous so that a snapshot is durable before the
204
+ * caller can act on it; a promise here would let a second write interleave.
205
+ */
206
+ function sleepSync(ms) {
207
+ Atomics.wait(new Int32Array(new SharedArr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C,GAAG,CAAC,KAAK,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;QACnC,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,SAAS,SAAS,CAAC,EAAU;IAC3B,OAAO,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,IAAI,iBAAiB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;AACnE,CAAC"}
package/dist/types.d.ts CHANGED
@@ -49,7 +49,21 @@ interface BaseMessage {
49
49
  messageId: string;
50
50
  /** Unix-epoch millis when the message was created */
51
51
  timestamp: number;
52
+ /**
53
+ * Wire-shape version. Absent ⇒ 1.
54
+ *
55
+ * Emitted ONLY on plan_review / plan_review_response / plan_review_ack /
56
+ * cancel_review. The four shipping types (question, answer, notification,
57
+ * dismiss_notification) must keep a byte-identical wire format so a new
58
+ * server never breaks an already-installed client.
59
+ *
60
+ * Increment only when the wire shape changes — NEVER derive it from the
61
+ * package version.
62
+ */
63
+ protocolVersion?: number;
52
64
  }
65
+ /** Current wire-shape version. See BaseMessage.protocolVersion. */
66
+ export declare const PROTOCOL_VERSION = 2;
53
67
  /** Published by MCP server when the LLM calls ask_human. */
54
68
  export interface QuestionMessage extends BaseMessage {
55
69
  type: 'question';
@@ -86,7 +100,10 @@ export interface AnswerMessage extends BaseMessage {
86
100
  /** Per-question answers for batch questions */
87
101
  subAnswers?: SubAnswer[];
88
102
  }
89
- /** Union type for all messages over the ntfy channel. */
103
+ /**
104
+ * Union of the four message types that predate `protocolVersion`.
105
+ * Their wire format is frozen — see BaseMessage.protocolVersion.
106
+ */
90
107
  export type HitlMessage = QuestionMessage | AnswerMessage | NotificationMessage | DismissNotificationMessage;
91
108
  /** Published by MCP server for fire-and-forget progress notifications. */
92
109
  export interface NotificationMessage extends BaseMessage {
@@ -122,6 +139,102 @@ export interface ChunkMessage extends BaseMessage {
122
139
  /** Slice of the base64-encoded original body */
123
140
  data: string;
124
141
  }
142
+ export type PlanVerdict = 'approved' | 'changes_requested' | 'rejected' | 'skipped' | 'cancelled';
143
+ /**
144
+ * ntfy-event-level attachment metadata, parsed off the raw ntfy JSON event.
145
+ * NEVER carried inside our own message — the URL only exists after the PUT.
146
+ * This is plaintext metadata outside our encryption, which is why `name` must
147
+ * be random hex and never a real path (F-9).
148
+ */
149
+ export interface AttachmentRef {
150
+ name: string;
151
+ url: string;
152
+ type?: string;
153
+ size?: number;
154
+ /** Unix seconds. ntfy expires attachments after 3 h — messages after 12 h. */
155
+ expires?: number;
156
+ }
157
+ /** Where a plan-review body lives, and how to verify it once fetched. */
158
+ export interface PlanPayloadRef {
159
+ kind: 'inline' | 'attachment';
160
+ /** inline only: the encrypted-envelope JSON string produced by crypto.encrypt() */
161
+ data?: string;
162
+ /** sha256 hex of the payload plaintext (the base64(gzip(bodyJson)) string) */
163
+ contentHash: string;
164
+ /** utf-8 byte length of that same payload plaintext */
165
+ contentLength: number;
166
+ }
167
+ /** The gzipped body of a plan_review message. */
168
+ export interface PlanReviewBody {
169
+ content: string;
170
+ diff: string;
171
+ }
172
+ /** Published by the MCP server when the agent calls ReviewPlan. */
173
+ export interface PlanReviewMessage extends BaseMessage {
174
+ type: 'plan_review';
175
+ protocolVersion: number;
176
+ repo: RepoContext | null;
177
+ context: string;
178
+ /** '' when absent — never undefined */
179
+ summary: string;
180
+ /** repo-relative ONLY, never an absolute path (F-9) */
181
+ displayPath: string;
182
+ /** identity hash of the plan file location; keys drafts across revisions */
183
+ planId: string;
184
+ revision: number;
185
+ isNewPlan: boolean;
186
+ /** 'sha256:<hex>' of the plan file content */
187
+ snapshotHash: string;
188
+ body: PlanPayloadRef;
189
+ }
190
+ /** A single line-anchored comment, in source-line space. */
191
+ export interface InlineComment {
192
+ path: string;
193
+ startLine: number;
194
+ endLine: number;
195
+ side: 'old' | 'new';
196
+ comment: string;
197
+ }
198
+ /** The gzipped body of a plan_review_response message. */
199
+ export interface PlanReviewResponseBody {
200
+ overallFeedback: string;
201
+ inlineComments: InlineComment[];
202
+ }
203
+ /** Published by a client when the human finishes reviewing. */
204
+ export interface PlanReviewResponseMessage extends BaseMessage {
205
+ type: 'plan_review_response';
206
+ protocolVersion: number;
207
+ /** messageId of the plan_review being answered */
208
+ reviewId: string;
209
+ respondedFrom: string;
210
+ verdict: PlanVerdict;
211
+ snapshotHash: string;
212
+ body: PlanPayloadRef;
213
+ }
214
+ /**
215
+ * Published by the server once it has actually read a response body. Without
216
+ * it the client shows "submitted" at click time even when the response
217
+ * attachment later 404s (attachments expire in 3 h, messages in 12 h).
218
+ */
219
+ export interface PlanReviewAckMessage extends BaseMessage {
220
+ type: 'plan_review_ack';
221
+ protocolVersion: number;
222
+ reviewId: string;
223
+ responseId: string;
224
+ status: 'received' | 'lost';
225
+ reason?: string;
226
+ }
227
+ /** Published by the server when an outstanding review will never be read. */
228
+ export interface CancelReviewMessage extends BaseMessage {
229
+ type: 'cancel_review';
230
+ protocolVersion: number;
231
+ reviewId: string;
232
+ reason: 'agent_exited' | 'cancelled' | 'superseded';
233
+ }
234
+ /** Union of the plan-review message types. These never chunk. */
235
+ export type PlanMessage = PlanReviewMessage | PlanReviewResponseMessage | PlanReviewAckMessage | CancelReviewMessage;
236
+ /** Anything that can arrive on the topic (excluding the transport-only chunk wrapper). */
237
+ export type AnyHitlMessage = HitlMessage | PlanMessage;
125
238
  export interface HitlConfig {
126
239
  /** ntfy topic ID — a UUID used as the shared channel */
127
240
  topicId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAIA,kDAAkD;AAClD,MAAM,WAAW,YAAY;IAC3B,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,wDAAwD;IACxD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kFAAkF;IAClF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,0DAA0D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M,CAAC;CACjB"}
package/dist/types.js CHANGED
@@ -1,6 +1,8 @@
1
1
  // ============================================================
2
2
  // @hitl/shared — Protocol types for HITL MCP cross-machine messaging
3
3
  // ============================================================
4
+ /** Current wire-shape version. See BaseMessage.protocolVersion. */
5
+ export const PROTOCOL_VERSION = 2;
4
6
  export const DEFAULT_NTFY_URL = 'https://ntfy.sh';
5
7
  export const DEFAULT_CONFIG = {
6
8
  ntfyUrl: DEFAULT_NTFY_URL,
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,qEAAqE;AACrE,+DAA+D;AAkK/D,MAAM,CAAC,MAAM,gBAAgB,GAAG,iBAAiB,CAAC;AAElD,MAAM,CAAC,MAAM,cAAc,GAAgC;IACzD,OAAO,EAAE,gBAAgB;IACzB,UAAU,EAAE,EAAE;IACd,YAAY,EAAE,IAAI;CACnB,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,qEAAqE;AACrE,+DAA+D;AA2E/D,mEAAmE;AACnE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAgOlC,MAAM,CAAC,MAAM,gBAAgB,GAAG,iBAAiB,CAAC;AAElD,MAAM,CAAC,MAAM,cAAc,GAAgC;IACzD,OAAO,EAAE,gBAAgB;IACzB,UAAU,EAAE,EAAE;IACd,YAAY,EAAE,IAAI;CACnB,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The single source of truth for the server's version — read from package.json
3
+ * rather than duplicated as a literal, which had already drifted five ways
4
+ * (root 2.0.0 / server 2.9.6 / client 2.6.0 / shared 2.0.0 / Cargo 2.9.6).
5
+ *
6
+ * Resolves identically from `src/` (ts-jest) and from `dist/` (compiled): both
7
+ * sit one directory below the package root.
8
+ *
9
+ * This is NOT the wire protocol version — see PROTOCOL_VERSION in types.ts,
10
+ * which is a small integer bumped only when the message shape changes.
11
+ */
12
+ export declare const SERVER_VERSION: string;
13
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,EAAE,MAAoE,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { createRequire } from 'module';
2
+ const require = createRequire(import.meta.url);
3
+ /**
4
+ * The single source of truth for the server's version — read from package.json
5
+ * rather than duplicated as a literal, which had already drifted five ways
6
+ * (root 2.0.0 / server 2.9.6 / client 2.6.0 / shared 2.0.0 / Cargo 2.9.6).
7
+ *
8
+ * Resolves identically from `src/` (ts-jest) and from `dist/` (compiled): both
9
+ * sit one directory below the package root.
10
+ *
11
+ * This is NOT the wire protocol version — see PROTOCOL_VERSION in types.ts,
12
+ * which is a small integer bumped only when the message shape changes.
13
+ */
14
+ export const SERVER_VERSION = require('../package.json').version;
15
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/C;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,cAAc,GAAY,OAAO,CAAC,iBAAiB,CAAyB,CAAC,OAAO,CAAC"}
package/package.json CHANGED
@@ -1,61 +1,64 @@
1
- {
2
- "name": "@achieveai/hitl-mcp-server",
3
- "version": "2.9.6",
4
- "description": "Human-in-the-Loop MCP Server — enables LLM agents to ask questions across all your devices via ntfy.sh",
5
- "type": "module",
6
- "main": "./dist/mcp-server.js",
7
- "bin": {
8
- "hitl": "dist/cli.js",
9
- "hitl-mcp-server": "dist/mcp-server.js"
10
- },
11
- "files": [
12
- "dist/**/*.js",
13
- "dist/**/*.d.ts",
14
- "dist/**/*.map",
15
- "dist/bin/**/*",
16
- "scripts/postinstall.js",
17
- "README.md"
18
- ],
19
- "keywords": [
20
- "mcp",
21
- "llm",
22
- "human-in-the-loop",
23
- "hitl",
24
- "dialog",
25
- "interactive",
26
- "model-context-protocol",
27
- "ntfy",
28
- "notifications"
29
- ],
30
- "repository": {
31
- "type": "git",
32
- "url": "git+https://github.com/achieveai/HumanInTheLoop.git"
33
- },
34
- "license": "MIT",
35
- "scripts": {
36
- "build": "tsc",
37
- "start": "node dist/mcp-server.js",
38
- "dev": "tsx src/index.ts",
39
- "test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --config jest.config.js",
40
- "clean": "rimraf dist",
41
- "postinstall": "node scripts/postinstall.js",
42
- "prepublishOnly": "npm run build"
43
- },
44
- "dependencies": {
45
- "@modelcontextprotocol/sdk": "^1.0.0",
46
- "eventsource": "^2.0.2",
47
- "uuid": "^9.0.0"
48
- },
49
- "devDependencies": {
50
- "@jest/globals": "^29.7.0",
51
- "@types/eventsource": "^1.1.15",
52
- "@types/node": "^20.0.0",
53
- "@types/uuid": "^9.0.0",
54
- "cross-env": "^10.1.0",
55
- "jest": "^29.7.0",
56
- "rimraf": "^5.0.0",
57
- "ts-jest": "^29.1.0",
58
- "tsx": "^4.0.0",
59
- "typescript": "^5.3.0"
60
- }
61
- }
1
+ {
2
+ "name": "@achieveai/hitl-mcp-server",
3
+ "version": "2.11.0",
4
+ "description": "Human-in-the-Loop MCP Server — enables LLM agents to ask questions across all your devices via ntfy.sh",
5
+ "type": "module",
6
+ "main": "./dist/mcp-server.js",
7
+ "bin": {
8
+ "hitl": "dist/cli.js",
9
+ "hitl-mcp-server": "dist/mcp-server.js"
10
+ },
11
+ "files": [
12
+ "dist/**/*.js",
13
+ "dist/**/*.d.ts",
14
+ "dist/**/*.map",
15
+ "dist/bin/**/*",
16
+ "scripts/postinstall.js",
17
+ "README.md"
18
+ ],
19
+ "keywords": [
20
+ "mcp",
21
+ "llm",
22
+ "human-in-the-loop",
23
+ "hitl",
24
+ "dialog",
25
+ "interactive",
26
+ "model-context-protocol",
27
+ "ntfy",
28
+ "notifications"
29
+ ],
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "git+https://github.com/achieveai/HumanInTheLoop.git"
33
+ },
34
+ "license": "GPL-3.0",
35
+ "scripts": {
36
+ "build": "tsc",
37
+ "start": "node dist/mcp-server.js",
38
+ "dev": "tsx src/index.ts",
39
+ "test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --config jest.config.js",
40
+ "fixture:payload": "tsx scripts/gen-payload-fixture.ts",
41
+ "clean": "rimraf dist",
42
+ "postinstall": "node scripts/postinstall.js",
43
+ "prepublishOnly": "npm run build"
44
+ },
45
+ "dependencies": {
46
+ "@modelcontextprotocol/sdk": "^1.0.0",
47
+ "diff": "^5.2.2",
48
+ "eventsource": "^2.0.2",
49
+ "uuid": "^9.0.0"
50
+ },
51
+ "devDependencies": {
52
+ "@jest/globals": "^29.7.0",
53
+ "@types/diff": "^5.2.3",
54
+ "@types/eventsource": "^1.1.15",
55
+ "@types/node": "^20.0.0",
56
+ "@types/uuid": "^9.0.0",
57
+ "cross-env": "^10.1.0",
58
+ "jest": "^29.7.0",
59
+ "rimraf": "^5.0.0",
60
+ "ts-jest": "^29.1.0",
61
+ "tsx": "^4.0.0",
62
+ "typescript": "^5.3.0"
63
+ }
64
+ }