@sentropic/h2a-cli 0.1.0 → 0.1.6

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 (67) hide show
  1. package/dist/bin.js +30 -2
  2. package/dist/bin.js.map +1 -1
  3. package/dist/cli-contract.d.ts +62 -0
  4. package/dist/cli-contract.d.ts.map +1 -0
  5. package/dist/cli-contract.js +239 -0
  6. package/dist/cli-contract.js.map +1 -0
  7. package/dist/cli.d.ts +51 -0
  8. package/dist/cli.d.ts.map +1 -1
  9. package/dist/cli.js +711 -2
  10. package/dist/cli.js.map +1 -1
  11. package/dist/hosts/claude.d.ts +11 -6
  12. package/dist/hosts/claude.d.ts.map +1 -1
  13. package/dist/hosts/claude.js +40 -1
  14. package/dist/hosts/claude.js.map +1 -1
  15. package/dist/hosts/codex.d.ts +64 -6
  16. package/dist/hosts/codex.d.ts.map +1 -1
  17. package/dist/hosts/codex.js +39 -1
  18. package/dist/hosts/codex.js.map +1 -1
  19. package/dist/hosts/gemini.d.ts +8 -6
  20. package/dist/hosts/gemini.d.ts.map +1 -1
  21. package/dist/hosts/gemini.js +9 -1
  22. package/dist/hosts/gemini.js.map +1 -1
  23. package/dist/index.d.ts +8 -34
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +5 -2
  26. package/dist/index.js.map +1 -1
  27. package/dist/runtime/local-files/index.d.ts +5 -0
  28. package/dist/runtime/local-files/index.d.ts.map +1 -0
  29. package/dist/runtime/local-files/index.js +5 -0
  30. package/dist/runtime/local-files/index.js.map +1 -0
  31. package/dist/runtime/local-files/locks.d.ts +43 -0
  32. package/dist/runtime/local-files/locks.d.ts.map +1 -0
  33. package/dist/runtime/local-files/locks.js +197 -0
  34. package/dist/runtime/local-files/locks.js.map +1 -0
  35. package/dist/runtime/local-files/paths.d.ts +18 -0
  36. package/dist/runtime/local-files/paths.d.ts.map +1 -0
  37. package/dist/runtime/local-files/paths.js +28 -0
  38. package/dist/runtime/local-files/paths.js.map +1 -0
  39. package/dist/runtime/local-files/schema.d.ts +47 -0
  40. package/dist/runtime/local-files/schema.d.ts.map +1 -0
  41. package/dist/runtime/local-files/schema.js +77 -0
  42. package/dist/runtime/local-files/schema.js.map +1 -0
  43. package/dist/runtime/local-files/store.d.ts +44 -0
  44. package/dist/runtime/local-files/store.d.ts.map +1 -0
  45. package/dist/runtime/local-files/store.js +407 -0
  46. package/dist/runtime/local-files/store.js.map +1 -0
  47. package/dist/runtime/mcp/handlers.d.ts +62 -0
  48. package/dist/runtime/mcp/handlers.d.ts.map +1 -0
  49. package/dist/runtime/mcp/handlers.js +261 -0
  50. package/dist/runtime/mcp/handlers.js.map +1 -0
  51. package/dist/runtime/mcp/index.d.ts +5 -0
  52. package/dist/runtime/mcp/index.d.ts.map +1 -0
  53. package/dist/runtime/mcp/index.js +5 -0
  54. package/dist/runtime/mcp/index.js.map +1 -0
  55. package/dist/runtime/mcp/server.d.ts +26 -0
  56. package/dist/runtime/mcp/server.d.ts.map +1 -0
  57. package/dist/runtime/mcp/server.js +45 -0
  58. package/dist/runtime/mcp/server.js.map +1 -0
  59. package/dist/runtime/mcp/stdio.d.ts +21 -0
  60. package/dist/runtime/mcp/stdio.d.ts.map +1 -0
  61. package/dist/runtime/mcp/stdio.js +103 -0
  62. package/dist/runtime/mcp/stdio.js.map +1 -0
  63. package/dist/runtime/mcp/tools.d.ts +19 -0
  64. package/dist/runtime/mcp/tools.d.ts.map +1 -0
  65. package/dist/runtime/mcp/tools.js +175 -0
  66. package/dist/runtime/mcp/tools.js.map +1 -0
  67. package/package.json +7 -4
@@ -0,0 +1,175 @@
1
+ import { H2A_CLI_MCP_TOOL_NAMES } from "../../mcp.js";
2
+ /**
3
+ * Canonical tool descriptors for the in-process MCP server. Schemas are
4
+ * intentionally permissive — wire-level validation lives in the store /
5
+ * @sentropic/h2a invariants, not in the MCP shim.
6
+ */
7
+ export const H2A_CLI_MCP_TOOL_DESCRIPTORS = [
8
+ {
9
+ name: "h2a_register_instance",
10
+ description: "Register an h2a instance (PRINCIPAL / CONDUCTOR / AGENT / ...) in the local registry.",
11
+ inputSchema: {
12
+ type: "object",
13
+ properties: {
14
+ registration: {
15
+ type: "object",
16
+ description: "Full H2AActorRegistration record."
17
+ }
18
+ },
19
+ required: ["registration"]
20
+ }
21
+ },
22
+ {
23
+ name: "h2a_discover_instances",
24
+ description: "List instances from the registry, optionally filtered by role and/or scope.",
25
+ inputSchema: {
26
+ type: "object",
27
+ properties: {
28
+ role: { type: "string" },
29
+ scope: { type: "string" }
30
+ }
31
+ }
32
+ },
33
+ {
34
+ name: "h2a_open_negotiation",
35
+ description: "Open a new negotiation. The record is persisted under negotiations/<id>/state.json.",
36
+ inputSchema: {
37
+ type: "object",
38
+ properties: {
39
+ record: {
40
+ type: "object",
41
+ description: "Full H2ANegotiationRecord: { id, scope, parties, subject, status, requiredSigners, ... }."
42
+ }
43
+ },
44
+ required: ["record"]
45
+ }
46
+ },
47
+ {
48
+ name: "h2a_offer",
49
+ description: "Submit an initial offer (journal entry, type=propose) bearing the current artifact.",
50
+ inputSchema: {
51
+ type: "object",
52
+ properties: {
53
+ negotiationId: { type: "string" },
54
+ instance: {
55
+ type: "string",
56
+ description: "Conductor instance id producing the offer."
57
+ },
58
+ artifact: {
59
+ description: "Arbitrary JSON-serializable artifact to propose."
60
+ },
61
+ eventId: {
62
+ type: "string",
63
+ description: "Optional deterministic event id; generated if absent."
64
+ }
65
+ },
66
+ required: ["negotiationId", "instance", "artifact"]
67
+ }
68
+ },
69
+ {
70
+ name: "h2a_counteroffer",
71
+ description: "Submit a counter-offer (journal entry, type=counter) bearing a revised artifact.",
72
+ inputSchema: {
73
+ type: "object",
74
+ properties: {
75
+ negotiationId: { type: "string" },
76
+ instance: {
77
+ type: "string",
78
+ description: "Conductor instance id producing the counter-offer."
79
+ },
80
+ artifact: {
81
+ description: "Arbitrary JSON-serializable artifact to counter with."
82
+ },
83
+ eventId: {
84
+ type: "string",
85
+ description: "Optional deterministic event id; generated if absent."
86
+ }
87
+ },
88
+ required: ["negotiationId", "instance", "artifact"]
89
+ }
90
+ },
91
+ {
92
+ name: "h2a_sign",
93
+ description: "Sign the canonical {artifactHash} of an artifact with an ed25519 PEM-encoded private key. The signature is appended as a journal event with body.kind='signature'.",
94
+ inputSchema: {
95
+ type: "object",
96
+ properties: {
97
+ negotiationId: { type: "string" },
98
+ instance: { type: "string" },
99
+ artifact: {
100
+ description: "JSON-serializable artifact whose canonical hash is signed."
101
+ },
102
+ privateKeyPem: {
103
+ type: "string",
104
+ description: "ed25519 PKCS#8 PEM-encoded private key contents (NOT a file path)."
105
+ },
106
+ eventId: { type: "string" }
107
+ },
108
+ required: ["negotiationId", "instance", "artifact", "privateKeyPem"]
109
+ }
110
+ },
111
+ {
112
+ name: "h2a_stabilize",
113
+ description: "Stabilize a negotiation once the registered signers' ed25519 signatures form a quorum on a single artifactHash. Returns the stabilized record and the winning hash.",
114
+ inputSchema: {
115
+ type: "object",
116
+ properties: {
117
+ negotiationId: { type: "string" },
118
+ eventId: {
119
+ type: "string",
120
+ description: "Optional deterministic id for the final 'stabilized' event."
121
+ }
122
+ },
123
+ required: ["negotiationId"]
124
+ }
125
+ },
126
+ {
127
+ name: "h2a_inbox",
128
+ description: "Inbox dispatch — read | put | pop envelopes for a given instance.",
129
+ inputSchema: {
130
+ type: "object",
131
+ properties: {
132
+ action: { type: "string", enum: ["read", "put", "pop"] },
133
+ instance: { type: "string" },
134
+ envelope: { type: "object" },
135
+ envelopeId: { type: "string" }
136
+ },
137
+ required: ["action", "instance"]
138
+ }
139
+ },
140
+ {
141
+ name: "h2a_append_journal",
142
+ description: "Append a journal event to a negotiation's chained journal.jsonl.",
143
+ inputSchema: {
144
+ type: "object",
145
+ properties: {
146
+ negotiationId: { type: "string" },
147
+ payload: { type: "object" }
148
+ },
149
+ required: ["negotiationId", "payload"]
150
+ }
151
+ },
152
+ {
153
+ name: "h2a_escalate",
154
+ description: "Escalate a negotiation to a higher control surface. Appends a journal event with type=escalate carrying { kind: 'escalation', channel, payload }.",
155
+ inputSchema: {
156
+ type: "object",
157
+ properties: {
158
+ negotiationId: { type: "string" },
159
+ instance: {
160
+ type: "string",
161
+ description: "Instance performing the escalation (acts as MANDATAIRE)."
162
+ },
163
+ channel: {
164
+ type: "string",
165
+ enum: ["advise", "decide", "alert"]
166
+ },
167
+ payload: {
168
+ description: "Arbitrary JSON-serializable escalation payload."
169
+ }
170
+ },
171
+ required: ["negotiationId", "instance", "channel"]
172
+ }
173
+ }
174
+ ];
175
+ //# sourceMappingURL=tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.js","sourceRoot":"","sources":["../../../src/runtime/mcp/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAetD;;;;GAIG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAwB;IAC/D;QACE,IAAI,EAAE,uBAAuB;QAC7B,WAAW,EACT,uFAAuF;QACzF,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,YAAY,EAAE;oBACZ,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,mCAAmC;iBACjD;aACF;YACD,QAAQ,EAAE,CAAC,cAAc,CAAC;SAC3B;KACF;IACD;QACE,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EACT,6EAA6E;QAC/E,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBACxB,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;aAC1B;SACF;KACF;IACD;QACE,IAAI,EAAE,sBAAsB;QAC5B,WAAW,EACT,qFAAqF;QACvF,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,2FAA2F;iBAC9F;aACF;YAC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AAE,cAAc;QACpB,WAAW,EACT,mJAAmJ;QACrJ,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,aAAa,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBACjC,QAAQ,EAAE;oBACR,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,0DAA0D;iBACxE;gBACD,OAAO,EAAE;oBACP,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC;iBACpC;gBACD,OAAO,EAAE;oBACP,WAAW,EAAE,iDAAiD;iBAC/D;aACF;YACD,QAAQ,EAAE,CAAC,eAAe,EAAE,UAAU,EAAE,SAAS,CAAC;SACnD;KACF;CACF,CAAC"}
package/package.json CHANGED
@@ -1,13 +1,16 @@
1
1
  {
2
2
  "name": "@sentropic/h2a-cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.6",
4
4
  "description": "Unified CLI surface for h2a hosts and MCP-oriented coordination flows.",
5
- "license": "UNLICENSED",
5
+ "license": "MIT",
6
6
  "type": "module",
7
7
  "main": "./dist/index.js",
8
8
  "types": "./dist/index.d.ts",
9
+ "scripts": {
10
+ "prepack": "chmod +x dist/bin.js"
11
+ },
9
12
  "bin": {
10
- "h2a": "./dist/bin.js"
13
+ "h2a": "dist/bin.js"
11
14
  },
12
15
  "keywords": [
13
16
  "h2a",
@@ -36,7 +39,7 @@
36
39
  "dist"
37
40
  ],
38
41
  "dependencies": {
39
- "@sentropic/h2a": "^0.1.0"
42
+ "@sentropic/h2a": "^0.1.6"
40
43
  },
41
44
  "publishConfig": {
42
45
  "access": "public"