hivecode-mcp 0.12.2 → 0.13.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 (62) hide show
  1. package/HIVE_RULES.md +11 -40
  2. package/LICENSE +21 -21
  3. package/README.md +421 -167
  4. package/core.js +91 -91
  5. package/docs/ALWAYS_ON.md +310 -0
  6. package/docs/GITHUB_WORKFLOW.md +334 -0
  7. package/docs/HIVE_RULES.md +41 -41
  8. package/docs/MCP.md +157 -118
  9. package/docs/QUICKSTART.md +266 -0
  10. package/docs/SELF_HOSTING.md +256 -256
  11. package/docs/SLACK_SETUP.md +450 -0
  12. package/docs/TROUBLESHOOTING.md +87 -0
  13. package/hive-activity.js +336 -310
  14. package/hive-await.js +207 -0
  15. package/hive-branch.js +686 -0
  16. package/hive-busy.js +88 -88
  17. package/hive-coord.js +110 -110
  18. package/hive-gate.js +135 -135
  19. package/hive-github.js +1904 -0
  20. package/hive-hook-install.js +179 -103
  21. package/hive-instructions.js +74 -66
  22. package/hive-listen.js +81 -0
  23. package/hive-mailbox.js +520 -386
  24. package/hive-mcp-http.js +580 -0
  25. package/hive-mcp.js +579 -137
  26. package/hive-mux-proto.js +58 -58
  27. package/hive-mux.js +350 -350
  28. package/hive-notify.js +233 -0
  29. package/hive-obligations.js +247 -247
  30. package/hive-pr-staleness.js +189 -189
  31. package/hive-pr.js +350 -0
  32. package/hive-privacy.js +327 -288
  33. package/hive-receipts.js +233 -233
  34. package/hive-relay-health.js +230 -225
  35. package/hive-room-key.js +209 -0
  36. package/hive-secrets.js +89 -0
  37. package/hive-session.js +114 -0
  38. package/hive-setup.js +558 -445
  39. package/hive-slack-agent.js +396 -0
  40. package/hive-slack.js +1809 -0
  41. package/hive-stdio.js +172 -168
  42. package/hive-stop-hook.js +293 -241
  43. package/hive-throttle.js +118 -118
  44. package/hive-time.js +71 -0
  45. package/hive-update.js +58 -58
  46. package/hive-version.js +110 -59
  47. package/hive-webhook.js +54 -0
  48. package/icr-merge.js +58 -58
  49. package/icr.js +851 -745
  50. package/lang-json.js +211 -211
  51. package/lang-ruby.js +230 -230
  52. package/lang-toml.js +136 -136
  53. package/lang-yaml.js +183 -183
  54. package/limits.js +413 -394
  55. package/package.json +189 -164
  56. package/reconcile.cjs +614 -477
  57. package/slack-app-manifest-agent.json +61 -0
  58. package/slack-app-manifest-inbound.json +36 -0
  59. package/slack-app-manifest.json +27 -0
  60. package/substrate.js +252 -252
  61. package/sync.js +1956 -177
  62. package/grm-link.cjs +0 -141
package/hive-mux-proto.js CHANGED
@@ -1,58 +1,58 @@
1
- // hive-mux-proto.js -- the wire format for ONE socket per participant, shared by relay and client.
2
- //
3
- // WHY: Hivecode opened one WebSocket per FILE. A participant held 1 + min(files, 128) sockets,
4
- // so an agent in a 1000-file repository saw only 128 files on disk, and a relay's connection cap
5
- // divided by 129 per person. The mux carries every file doc of one room over one socket.
6
- //
7
- // The design rule that makes it safe: the relay does not grow a second enforcement path. Each
8
- // OPEN runs the SAME per-doc admission a per-file upgrade runs (token scope for that path, the
9
- // per-room ceiling, the committer limit), and the accepted channel is wrapped in a VirtualConn
10
- // that looks exactly like a ws connection to installUsageLimits, makeReadOnly, installWriteGate
11
- // and setupWSConnection. The bytes inside a MSG frame are the same y-protocols message a
12
- // per-file socket would carry.
13
- //
14
- // Frames are binary, lib0-encoded:
15
- // client -> relay OPEN [0, id, docName] open this file doc as channel `id`
16
- // CLOSE [1, id] the client is done with it
17
- // MSG [2, id, ...payload] a y-protocols message for that doc
18
- // relay -> client MSG [2, id, ...payload]
19
- // OPENED [3, id] admitted; the relay's sync step 1 follows
20
- // REFUSED [4, id, code, reason] not admitted -- the HTTP status a per-file
21
- // upgrade would have answered, and why
22
- // CLOSED [5, id, reason] the relay closed that channel
23
- // BEAT [6, 0] liveness, so a dead socket is noticed
24
- // Channel ids are chosen by the client and are only meaningful on the socket that opened them.
25
- import * as encoding from 'lib0/encoding'
26
- import * as decoding from 'lib0/decoding'
27
-
28
- export const MUX_PREFIX = '_hive_mux/'
29
- export const MUX_VERSION = 1
30
- export const F = Object.freeze({ OPEN: 0, CLOSE: 1, MSG: 2, OPENED: 3, REFUSED: 4, CLOSED: 5, BEAT: 6 })
31
-
32
- export function encodeFrame(kind, id, a, b) {
33
- const e = encoding.createEncoder()
34
- encoding.writeVarUint(e, kind)
35
- encoding.writeVarUint(e, id >>> 0)
36
- if (kind === F.OPEN) encoding.writeVarString(e, String(a))
37
- else if (kind === F.MSG) encoding.writeUint8Array(e, a instanceof Uint8Array ? a : new Uint8Array(a))
38
- else if (kind === F.REFUSED) { encoding.writeVarUint(e, a >>> 0); encoding.writeVarString(e, String(b || '')) }
39
- else if (kind === F.CLOSED) encoding.writeVarString(e, String(a || ''))
40
- return encoding.toUint8Array(e)
41
- }
42
-
43
- /** Decode one frame. Throws on garbage, which the caller treats as a protocol violation. */
44
- export function decodeFrame(buf) {
45
- const u8 = buf instanceof Uint8Array ? buf : new Uint8Array(buf)
46
- const d = decoding.createDecoder(u8)
47
- const kind = decoding.readVarUint(d)
48
- const id = decoding.readVarUint(d)
49
- if (kind === F.OPEN) return { kind, id, docName: decoding.readVarString(d) }
50
- if (kind === F.MSG) return { kind, id, payload: u8.subarray(d.pos) }
51
- if (kind === F.REFUSED) return { kind, id, code: decoding.readVarUint(d), reason: decoding.readVarString(d) }
52
- if (kind === F.CLOSED) return { kind, id, reason: decoding.readVarString(d) }
53
- if (kind === F.CLOSE || kind === F.OPENED || kind === F.BEAT) return { kind, id }
54
- throw new Error(`unknown mux frame kind ${kind}`)
55
- }
56
-
57
- /** The mux upgrade path for a base room, as the relay parses it (pathname minus the slash). */
58
- export function muxPath(room) { return MUX_PREFIX + encodeURIComponent(room) }
1
+ // hive-mux-proto.js -- the wire format for ONE socket per participant, shared by relay and client.
2
+ //
3
+ // WHY: Hivecode opened one WebSocket per FILE. A participant held 1 + min(files, 128) sockets,
4
+ // so an agent in a 1000-file repository saw only 128 files on disk, and a relay's connection cap
5
+ // divided by 129 per person. The mux carries every file doc of one room over one socket.
6
+ //
7
+ // The design rule that makes it safe: the relay does not grow a second enforcement path. Each
8
+ // OPEN runs the SAME per-doc admission a per-file upgrade runs (token scope for that path, the
9
+ // per-room ceiling, the committer limit), and the accepted channel is wrapped in a VirtualConn
10
+ // that looks exactly like a ws connection to installUsageLimits, makeReadOnly, installWriteGate
11
+ // and setupWSConnection. The bytes inside a MSG frame are the same y-protocols message a
12
+ // per-file socket would carry.
13
+ //
14
+ // Frames are binary, lib0-encoded:
15
+ // client -> relay OPEN [0, id, docName] open this file doc as channel `id`
16
+ // CLOSE [1, id] the client is done with it
17
+ // MSG [2, id, ...payload] a y-protocols message for that doc
18
+ // relay -> client MSG [2, id, ...payload]
19
+ // OPENED [3, id] admitted; the relay's sync step 1 follows
20
+ // REFUSED [4, id, code, reason] not admitted -- the HTTP status a per-file
21
+ // upgrade would have answered, and why
22
+ // CLOSED [5, id, reason] the relay closed that channel
23
+ // BEAT [6, 0] liveness, so a dead socket is noticed
24
+ // Channel ids are chosen by the client and are only meaningful on the socket that opened them.
25
+ import * as encoding from 'lib0/encoding'
26
+ import * as decoding from 'lib0/decoding'
27
+
28
+ export const MUX_PREFIX = '_hive_mux/'
29
+ export const MUX_VERSION = 1
30
+ export const F = Object.freeze({ OPEN: 0, CLOSE: 1, MSG: 2, OPENED: 3, REFUSED: 4, CLOSED: 5, BEAT: 6 })
31
+
32
+ export function encodeFrame(kind, id, a, b) {
33
+ const e = encoding.createEncoder()
34
+ encoding.writeVarUint(e, kind)
35
+ encoding.writeVarUint(e, id >>> 0)
36
+ if (kind === F.OPEN) encoding.writeVarString(e, String(a))
37
+ else if (kind === F.MSG) encoding.writeUint8Array(e, a instanceof Uint8Array ? a : new Uint8Array(a))
38
+ else if (kind === F.REFUSED) { encoding.writeVarUint(e, a >>> 0); encoding.writeVarString(e, String(b || '')) }
39
+ else if (kind === F.CLOSED) encoding.writeVarString(e, String(a || ''))
40
+ return encoding.toUint8Array(e)
41
+ }
42
+
43
+ /** Decode one frame. Throws on garbage, which the caller treats as a protocol violation. */
44
+ export function decodeFrame(buf) {
45
+ const u8 = buf instanceof Uint8Array ? buf : new Uint8Array(buf)
46
+ const d = decoding.createDecoder(u8)
47
+ const kind = decoding.readVarUint(d)
48
+ const id = decoding.readVarUint(d)
49
+ if (kind === F.OPEN) return { kind, id, docName: decoding.readVarString(d) }
50
+ if (kind === F.MSG) return { kind, id, payload: u8.subarray(d.pos) }
51
+ if (kind === F.REFUSED) return { kind, id, code: decoding.readVarUint(d), reason: decoding.readVarString(d) }
52
+ if (kind === F.CLOSED) return { kind, id, reason: decoding.readVarString(d) }
53
+ if (kind === F.CLOSE || kind === F.OPENED || kind === F.BEAT) return { kind, id }
54
+ throw new Error(`unknown mux frame kind ${kind}`)
55
+ }
56
+
57
+ /** The mux upgrade path for a base room, as the relay parses it (pathname minus the slash). */
58
+ export function muxPath(room) { return MUX_PREFIX + encodeURIComponent(room) }