@melra/http-runtime 0.3.0-alpha.11

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/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,49 @@
1
+ # @melra/http-runtime
2
+
3
+ Governed HTTP and API calls for [MELRA](https://github.com/XAGI-Lab/melra) —
4
+ one bounded request, checked against the same destination boundary the browser
5
+ uses.
6
+
7
+ ```bash
8
+ npm install @melra/http-runtime
9
+ ```
10
+
11
+ ```ts
12
+ import { HttpRuntime } from "@melra/http-runtime";
13
+
14
+ const http = new HttpRuntime({ allowedDomains: ["api.example.com"], allowLocalhost: false });
15
+ ```
16
+
17
+ One action, `http.request`, with a method, a URL, optional headers and body, a
18
+ response-size cap, and a timeout. `GET` and `HEAD` classify as reads; every
19
+ other method is a mutation and needs declared evidence and an approval like any
20
+ other mutation.
21
+
22
+ ## The destination boundary
23
+
24
+ `assertSafeDestination` from [`@melra/policy-core`](../policy-core) runs before
25
+ any socket opens: non-`http(s)` protocols, URL credentials, and private,
26
+ loopback, link-local, and cloud-metadata addresses are refused, and DNS is
27
+ resolved first so a public name cannot be rebound to a private address.
28
+
29
+ The socket then connects to the **address that was checked**, not to the name —
30
+ the same pinning the browser's proxy does, and for the same reason.
31
+
32
+ Redirects are not followed. A `Location` header points somewhere the destination
33
+ check never saw, so the status and the header come back and the caller can plan
34
+ a second governed request.
35
+
36
+ ## What it cannot promise
37
+
38
+ Exactly-once. HTTP is at-least-once at the provider, so a mutation here runs at
39
+ most once from MELRA and is never retried. `idempotencyKey` is sent as
40
+ `Idempotency-Key` for providers that honour it, but MELRA cannot verify that
41
+ they do — it does not upgrade the execution guarantee.
42
+
43
+ The request body travels under the `content` field, which redaction strips
44
+ before anything is persisted. Raw bytes reach the live caller only.
45
+
46
+ Requires Node.js 22 or newer. Full documentation:
47
+ [github.com/XAGI-Lab/melra](https://github.com/XAGI-Lab/melra)
48
+
49
+ Apache-2.0
@@ -0,0 +1,24 @@
1
+ import type { HttpOperation } from "@melra/protocol";
2
+ import { type CredentialBroker, type NetworkPolicy } from "@melra/policy-core";
3
+ export interface HttpRuntimeOptions extends NetworkPolicy {
4
+ /**
5
+ * Supplies the secrets this adapter is allowed to send. Omitted means every
6
+ * request goes out with exactly the headers the caller wrote.
7
+ */
8
+ credentials?: CredentialBroker;
9
+ }
10
+ /**
11
+ * One governed HTTP call.
12
+ *
13
+ * The interesting part is which socket opens. `assertSafeDestination` resolves
14
+ * the name and checks every answer, then this connects to the address it just
15
+ * checked rather than to the name — the same pinning `PinningProxy` does for the
16
+ * browser, and for the same reason: a resolver that answers public once and
17
+ * private the second time would otherwise make the check meaningless.
18
+ */
19
+ export declare class HttpRuntime {
20
+ private readonly options;
21
+ constructor(options: HttpRuntimeOptions);
22
+ execute(operation: HttpOperation, signal?: AbortSignal): Promise<Record<string, unknown>>;
23
+ }
24
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,EAGL,KAAK,gBAAgB,EACrB,KAAK,aAAa,EACnB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,kBAAmB,SAAQ,aAAa;IACvD;;;OAGG;IACH,WAAW,CAAC,EAAE,gBAAgB,CAAC;CAChC;AAED;;;;;;;;GAQG;AACH,qBAAa,WAAW;IACV,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,kBAAkB;IAElD,OAAO,CACX,SAAS,EAAE,aAAa,EACxB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAuIpC"}
package/dist/index.js ADDED
@@ -0,0 +1,145 @@
1
+ // Copyright 2026 XAGI Labs Private Limited
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { request as httpRequest } from "node:http";
4
+ import { request as httpsRequest } from "node:https";
5
+ import { outcomeUnknown } from "@melra/protocol";
6
+ import { assertSafeDestination, classifyOperation, } from "@melra/policy-core";
7
+ /**
8
+ * One governed HTTP call.
9
+ *
10
+ * The interesting part is which socket opens. `assertSafeDestination` resolves
11
+ * the name and checks every answer, then this connects to the address it just
12
+ * checked rather than to the name — the same pinning `PinningProxy` does for the
13
+ * browser, and for the same reason: a resolver that answers public once and
14
+ * private the second time would otherwise make the check meaningless.
15
+ */
16
+ export class HttpRuntime {
17
+ options;
18
+ constructor(options) {
19
+ this.options = options;
20
+ }
21
+ async execute(operation, signal) {
22
+ const { url, address } = await assertSafeDestination(operation.url, this.options);
23
+ // Checked here and not only in the router: the destination check above is
24
+ // an await, and a cancel that lands inside that window would otherwise be
25
+ // lost and the request would go out anyway.
26
+ if (signal?.aborted === true)
27
+ throw new Error("task_cancelled");
28
+ const secure = url.protocol === "https:";
29
+ const send = secure ? httpsRequest : httpRequest;
30
+ // Brokered against the destination that was *checked*, not the one the
31
+ // caller wrote: pinning already collapsed the name to an address, and a
32
+ // credential scoped by host has to be scoped by the same host the socket
33
+ // will actually talk to.
34
+ const { capability, target } = classifyOperation(operation);
35
+ const brokered = await this.options.credentials?.headersFor({
36
+ host: url.hostname,
37
+ capability,
38
+ target,
39
+ });
40
+ const headers = {
41
+ // Lowercased before the merge, or `Authorization: guess` from the caller
42
+ // and `authorization: <secret>` from the broker are two distinct keys and
43
+ // both go on the wire — which server wins is then the server's choice.
44
+ ...Object.fromEntries(Object.entries(operation.headers ?? {}).map(([name, value]) => [
45
+ name.toLowerCase(),
46
+ value,
47
+ ])),
48
+ // Last, so a caller cannot name the same header and have its own value
49
+ // ride out under a credential's name.
50
+ ...brokered?.headers,
51
+ // `Host` carries the name so a name-based virtual host still resolves at
52
+ // the far end even though the socket was opened to a literal address.
53
+ host: url.host,
54
+ ...(operation.idempotencyKey === undefined
55
+ ? {}
56
+ : { "idempotency-key": operation.idempotencyKey }),
57
+ };
58
+ if (operation.content !== undefined) {
59
+ headers["content-length"] = String(Buffer.byteLength(operation.content));
60
+ }
61
+ return await new Promise((resolve, reject) => {
62
+ const call = send({
63
+ host: address,
64
+ port: url.port === "" ? (secure ? 443 : 80) : Number(url.port),
65
+ method: operation.method,
66
+ path: `${url.pathname}${url.search}`,
67
+ headers,
68
+ // TLS is validated against the name the caller asked for, not the
69
+ // address the socket went to, or pinning would break every https URL.
70
+ ...(secure ? { servername: url.hostname } : {}),
71
+ timeout: operation.timeoutMs,
72
+ }, (response) => {
73
+ const chunks = [];
74
+ let bytes = 0;
75
+ let truncated = false;
76
+ response.on("data", (chunk) => {
77
+ bytes += chunk.length;
78
+ if (bytes > operation.maxResponseBytes) {
79
+ // Stop reading rather than buffering an unbounded body into the
80
+ // host's heap. What arrived is still reported, flagged.
81
+ truncated = true;
82
+ response.destroy();
83
+ return;
84
+ }
85
+ chunks.push(chunk);
86
+ });
87
+ const finish = () => {
88
+ const status = response.statusCode ?? 0;
89
+ resolve({
90
+ // The far end's own word, which is all HTTP can offer. A caller
91
+ // who needs more declares an independent re-read as evidence.
92
+ //
93
+ // 3xx is not success: redirects are deliberately not followed —
94
+ // the destination check ran against the URL the caller named, and
95
+ // a `Location` pointing at 169.254.169.254 would walk straight
96
+ // past it. The caller gets the status and the header and can plan
97
+ // a second governed request to wherever it points.
98
+ success: status >= 200 && status < 300,
99
+ status,
100
+ statusText: response.statusMessage ?? "",
101
+ headers: response.headers,
102
+ content: Buffer.concat(chunks).toString("utf8"),
103
+ bytes,
104
+ truncated,
105
+ url: url.toString(),
106
+ method: operation.method,
107
+ // Names only. Which credential authorised the call is something a
108
+ // receipt should record; its value is the one thing that must not
109
+ // leave this function.
110
+ credentials: brokered?.used ?? [],
111
+ // Echoed back so a reconciliation predicate can be written
112
+ // against the one fact that was true *before* the call. After a
113
+ // request that went unanswered there is no response to read, so
114
+ // this is the only handle on what the provider was asked to do.
115
+ ...(operation.idempotencyKey === undefined
116
+ ? {}
117
+ : { idempotencyKey: operation.idempotencyKey }),
118
+ });
119
+ };
120
+ response.on("end", finish);
121
+ response.on("close", finish);
122
+ response.on("error", reject);
123
+ });
124
+ // Whether the request made it out. A socket error before this is a
125
+ // request that never happened; after it, the far end may have done the
126
+ // work and lost the reply, and only `outcomeUnknown` says so honestly.
127
+ // `bytesWritten` is not the signal — it counts headers buffered on a
128
+ // socket that never connected, so ECONNREFUSED reports a nonzero count.
129
+ const failed = (error) => {
130
+ reject(call.writableFinished ? outcomeUnknown(error.message) : error);
131
+ };
132
+ // A timeout fires the event but does not end the request; without this an
133
+ // unresponsive host holds the socket for the life of the process.
134
+ call.on("timeout", () => {
135
+ call.destroy(new Error("http_timeout"));
136
+ });
137
+ call.on("error", failed);
138
+ signal?.addEventListener("abort", () => call.destroy(new Error("task_cancelled")), { once: true });
139
+ if (operation.content !== undefined)
140
+ call.write(operation.content);
141
+ call.end();
142
+ });
143
+ }
144
+ }
145
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,sCAAsC;AAEtC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,YAAY,CAAC;AAGrD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EACL,qBAAqB,EACrB,iBAAiB,GAGlB,MAAM,oBAAoB,CAAC;AAU5B;;;;;;;;GAQG;AACH,MAAM,OAAO,WAAW;IACO;IAA7B,YAA6B,OAA2B;QAA3B,YAAO,GAAP,OAAO,CAAoB;IAAG,CAAC;IAE5D,KAAK,CAAC,OAAO,CACX,SAAwB,EACxB,MAAoB;QAEpB,MA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AAO,EAAE,MAAM,CAAC,CAAC;YAC/B,CAAC,CACF,CAAC;YACF,mEAAmE;YACnE,uEAAuE;YACvE,uEAAuE;YACvE,qEAAqE;YACrE,wEAAwE;YACxE,MAAM,MAAM,GAAG,CAAC,KAAY,EAAQ,EAAE;gBACpC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACxE,CAAC,CAAC;YACF,0EAA0E;YAC1E,kEAAkE;YAClE,IAAI,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE;gBACtB,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;YAC1C,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YACzB,MAAM,EAAE,gBAAgB,CACtB,OAAO,EACP,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC,EAC/C,EAAE,IAAI,EAAE,IAAI,EAAE,CACf,CAAC;YACF,IAAI,SAAS,CAAC,OAAO,KAAK,SAAS;gBAAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;YACnE,IAAI,CAAC,GAAG,EAAE,CAAC;QACb,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,119 @@
1
+ // Copyright 2026 XAGI Labs Private Limited
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { createServer } from "node:http";
4
+ import { afterAll, beforeAll, describe, expect, it } from "vitest";
5
+ import { HttpOperationSchema } from "@melra/protocol";
6
+ import { HttpRuntime } from "./index.js";
7
+ let server;
8
+ let origin;
9
+ /** Last request the fixture saw, so header and body handling is assertable. */
10
+ let seen;
11
+ beforeAll(async () => {
12
+ server = createServer((req, res) => {
13
+ const chunks = [];
14
+ req.on("data", (chunk) => chunks.push(chunk));
15
+ req.on("end", () => {
16
+ seen = {
17
+ method: req.method ?? "",
18
+ url: req.url ?? "",
19
+ headers: req.headers,
20
+ body: Buffer.concat(chunks).toString("utf8"),
21
+ };
22
+ if (req.url === "/teapot") {
23
+ res.writeHead(418).end("no coffee");
24
+ return;
25
+ }
26
+ if (req.url === "/big") {
27
+ res.writeHead(200).end("x".repeat(50_000));
28
+ return;
29
+ }
30
+ // Accepts the request and never answers, which is the case MELRA must not
31
+ // report as "the effect did not happen".
32
+ if (req.url === "/silent")
33
+ return;
34
+ res.writeHead(201, { "content-type": "application/json" });
35
+ res.end(JSON.stringify({ created: true }));
36
+ });
37
+ });
38
+ await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve));
39
+ origin = `http://127.0.0.1:${server.address().port}`;
40
+ });
41
+ afterAll(async () => {
42
+ await new Promise((resolve) => server.close(() => resolve()));
43
+ });
44
+ const runtime = () => new HttpRuntime({ allowedDomains: ["*"], allowLocalhost: true });
45
+ const operation = (fields) => HttpOperationSchema.parse({ kind: "http", action: "request", ...fields });
46
+ describe("http runtime", () => {
47
+ it("posts a body and reports the response status", async () => {
48
+ const result = await runtime().execute(operation({
49
+ method: "POST",
50
+ url: `${origin}/orders`,
51
+ content: JSON.stringify({ item: "widget" }),
52
+ headers: { "content-type": "application/json" },
53
+ idempotencyKey: "order-42",
54
+ }));
55
+ expect(seen.method).toBe("POST");
56
+ expect(seen.body).toBe('{"item":"widget"}');
57
+ expect(seen.headers["idempotency-key"]).toBe("order-42");
58
+ expect(result.status).toBe(201);
59
+ expect(result.success).toBe(true);
60
+ expect(result.content).toBe('{"created":true}');
61
+ });
62
+ it("reports a failing status as an unsuccessful effect", async () => {
63
+ const result = await runtime().execute(operation({ url: `${origin}/teapot` }));
64
+ expect(result.status).toBe(418);
65
+ // The adapter never asserts its own success: a 418 is a completed call and
66
+ // a failed effect, and verification is what turns that into `partial`.
67
+ expect(result.success).toBe(false);
68
+ });
69
+ it("stops reading a body past the cap instead of buffering it", async () => {
70
+ const result = await runtime().execute(operation({ url: `${origin}/big`, maxResponseBytes: 1_000 }));
71
+ expect(result.truncated).toBe(true);
72
+ expect(String(result.content).length).toBeLessThan(50_000);
73
+ });
74
+ it("refuses a private destination before any socket opens", async () => {
75
+ const guarded = new HttpRuntime({
76
+ allowedDomains: ["*"],
77
+ allowLocalhost: false,
78
+ });
79
+ await expect(guarded.execute(operation({ url: "http://169.254.169.254/latest/meta-data/" }))).rejects.toThrow("destination_private_blocked");
80
+ });
81
+ it("refuses a host outside the allowlist", async () => {
82
+ const guarded = new HttpRuntime({
83
+ allowedDomains: ["example.com"],
84
+ allowLocalhost: false,
85
+ });
86
+ await expect(guarded.execute(operation({ url: "http://attacker.test/" }))).rejects.toThrow("destination_domain_not_allowed");
87
+ });
88
+ it("rejects an unknown field", () => {
89
+ expect(() => operation({ url: `${origin}/`, followRedirects: true })).toThrow();
90
+ });
91
+ it("cancels in flight when the task signal aborts", async () => {
92
+ const controller = new AbortController();
93
+ const pending = runtime().execute(operation({ url: `${origin}/orders` }), controller.signal);
94
+ controller.abort();
95
+ await expect(pending).rejects.toThrow("task_cancelled");
96
+ });
97
+ it("marks the outcome unknown when a sent request goes unanswered", async () => {
98
+ // The far end has the request and may already have acted on it. Claiming
99
+ // failure here would be the kernel asserting something it cannot know.
100
+ await expect(runtime().execute(operation({
101
+ method: "POST",
102
+ url: `${origin}/silent`,
103
+ content: "charge",
104
+ timeoutMs: 300,
105
+ }))).rejects.toThrow("effect_outcome_unknown:http_timeout");
106
+ });
107
+ it("reports a plain failure when the request never left the machine", async () => {
108
+ const closed = createServer();
109
+ await new Promise((resolve) => closed.listen(0, "127.0.0.1", resolve));
110
+ const port = closed.address().port;
111
+ await new Promise((resolve) => closed.close(() => resolve()));
112
+ const attempt = runtime().execute(operation({ method: "POST", url: `http://127.0.0.1:${port}/charges` }));
113
+ // Nothing reached a server, so this one really did not happen — and must
114
+ // not be parked for reconciliation.
115
+ await expect(attempt).rejects.toThrow(/ECONNREFUSED/);
116
+ await expect(attempt).rejects.not.toThrow(/effect_outcome_unknown/);
117
+ });
118
+ });
119
+ //# sourceMappingURL=index.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.js","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,sCAAsC;AAEtC,OAAO,EAAE,YAAY,EAAe,MAAM,WAAW,CAAC;AAEtD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,IAAI,MAAc,CAAC;AACnB,IAAI,MAAc,CAAC;AACnB,+EAA+E;AAC/E,IAAI,IAAqF,CAAC;AAE1F,SAAS,CAAC,KAAK,IAAI,EAAE;IACnB,MAAM,GAAG,YAAY,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QACjC,MAAM,MAAM,GAAa,EAAE,CAAC;QAC5B,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QACtD,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;YACjB,IAAI,GAAG;gBACL,MAAM,EAAE,GAAG,CAAC,MAAM,IAAI,EAAE;gBACxB,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI,EAAE;gBAClB,OAAO,EAAE,GAAG,CAAC,OAAkC;gBAC/C,IAAI,EAAE,MAAM,CAAC,MAAM,C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AC/E,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;QAC9B,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE,CAClC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,CACvC,CAAC;QACF,MAAM,IAAI,GAAI,MAAM,CAAC,OAAO,EAAkB,CAAC,IAAI,CAAC;QACpD,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAEpE,MAAM,OAAO,GAAG,OAAO,EAAE,CAAC,OAAO,CAC/B,SAAS,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,oBAAoB,IAAI,UAAU,EAAE,CAAC,CACvE,CAAC;QAEF,yEAAyE;QACzE,oCAAoC;QACpC,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QACtD,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@melra/http-runtime",
3
+ "version": "0.3.0-alpha.11",
4
+ "description": "HTTP/API reference effect adapter for the MELRA kernel.",
5
+ "license": "Apache-2.0",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/XAGI-Lab/melra.git",
9
+ "directory": "packages/http-runtime"
10
+ },
11
+ "homepage": "https://github.com/XAGI-Lab/melra#readme",
12
+ "bugs": "https://github.com/XAGI-Lab/melra/issues",
13
+ "type": "module",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "default": "./dist/index.js"
18
+ }
19
+ },
20
+ "files": [
21
+ "dist"
22
+ ],
23
+ "dependencies": {
24
+ "@melra/policy-core": "0.3.0-alpha.11",
25
+ "@melra/protocol": "0.3.0-alpha.11"
26
+ },
27
+ "scripts": {
28
+ "build": "tsc -p tsconfig.json",
29
+ "clean": "rm -rf dist",
30
+ "test": "vitest run",
31
+ "typecheck": "tsc -p tsconfig.json --noEmit"
32
+ }
33
+ }