@smthrs/kernel 0.0.0-stage → 1.0.0-rc.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 +206 -0
- package/LICENSE +21 -0
- package/README.md +154 -2
- package/dist/cjs/CapabilitySet.d.ts +6 -0
- package/dist/cjs/CapabilitySet.d.ts.map +1 -0
- package/dist/cjs/CapabilitySet.js +19 -0
- package/dist/cjs/CapabilitySet.js.map +7 -0
- package/dist/cjs/ChildProcessEnvironment.d.ts +60 -0
- package/dist/cjs/ChildProcessEnvironment.d.ts.map +1 -0
- package/dist/cjs/ChildProcessEnvironment.js +61 -0
- package/dist/cjs/ChildProcessEnvironment.js.map +7 -0
- package/dist/cjs/ChildProcessSpawner.d.ts +100 -0
- package/dist/cjs/ChildProcessSpawner.d.ts.map +1 -0
- package/dist/cjs/ChildProcessSpawner.js +291 -0
- package/dist/cjs/ChildProcessSpawner.js.map +7 -0
- package/dist/cjs/CommandLine.d.ts +173 -0
- package/dist/cjs/CommandLine.d.ts.map +1 -0
- package/dist/cjs/CommandLine.js +54 -0
- package/dist/cjs/CommandLine.js.map +7 -0
- package/dist/cjs/ContainedSpawner.d.ts +135 -0
- package/dist/cjs/ContainedSpawner.d.ts.map +1 -0
- package/dist/cjs/ContainedSpawner.js +141 -0
- package/dist/cjs/ContainedSpawner.js.map +7 -0
- package/dist/cjs/FileSystem.d.ts +452 -0
- package/dist/cjs/FileSystem.d.ts.map +1 -0
- package/dist/cjs/FileSystem.js +890 -0
- package/dist/cjs/FileSystem.js.map +7 -0
- package/dist/cjs/FileSystemBatch.d.ts +94 -0
- package/dist/cjs/FileSystemBatch.d.ts.map +1 -0
- package/dist/cjs/FileSystemBatch.js +31 -0
- package/dist/cjs/FileSystemBatch.js.map +7 -0
- package/dist/cjs/GrantEvent.d.ts +240 -0
- package/dist/cjs/GrantEvent.d.ts.map +1 -0
- package/dist/cjs/GrantEvent.js +115 -0
- package/dist/cjs/GrantEvent.js.map +7 -0
- package/dist/cjs/GrantStore.d.ts +270 -0
- package/dist/cjs/GrantStore.d.ts.map +1 -0
- package/dist/cjs/GrantStore.js +857 -0
- package/dist/cjs/GrantStore.js.map +7 -0
- package/dist/cjs/HostError.d.ts +36 -0
- package/dist/cjs/HostError.d.ts.map +1 -0
- package/dist/cjs/HostError.js +17 -0
- package/dist/cjs/HostError.js.map +7 -0
- package/dist/cjs/HostServices.d.ts +101 -0
- package/dist/cjs/HostServices.d.ts.map +1 -0
- package/dist/cjs/HostServices.js +66 -0
- package/dist/cjs/HostServices.js.map +7 -0
- package/dist/cjs/HttpClient.d.ts +177 -0
- package/dist/cjs/HttpClient.d.ts.map +1 -0
- package/dist/cjs/HttpClient.js +217 -0
- package/dist/cjs/HttpClient.js.map +7 -0
- package/dist/cjs/Jj.d.ts +67 -0
- package/dist/cjs/Jj.d.ts.map +1 -0
- package/dist/cjs/Jj.js +118 -0
- package/dist/cjs/Jj.js.map +7 -0
- package/dist/cjs/JournalGrantStore.d.ts +65 -0
- package/dist/cjs/JournalGrantStore.d.ts.map +1 -0
- package/dist/cjs/JournalGrantStore.js +354 -0
- package/dist/cjs/JournalGrantStore.js.map +7 -0
- package/dist/cjs/Path.d.ts +37 -0
- package/dist/cjs/Path.d.ts.map +1 -0
- package/dist/cjs/Path.js +46 -0
- package/dist/cjs/Path.js.map +7 -0
- package/dist/cjs/ProcessConfinement.d.ts +55 -0
- package/dist/cjs/ProcessConfinement.d.ts.map +1 -0
- package/dist/cjs/ProcessConfinement.js +94 -0
- package/dist/cjs/ProcessConfinement.js.map +7 -0
- package/dist/cjs/ProcessLedger.d.ts +260 -0
- package/dist/cjs/ProcessLedger.d.ts.map +1 -0
- package/dist/cjs/ProcessLedger.js +190 -0
- package/dist/cjs/ProcessLedger.js.map +7 -0
- package/dist/cjs/Rooted.d.ts +53 -0
- package/dist/cjs/Rooted.d.ts.map +1 -0
- package/dist/cjs/Rooted.js +101 -0
- package/dist/cjs/Rooted.js.map +7 -0
- package/dist/cjs/Unreachable.d.ts +27 -0
- package/dist/cjs/Unreachable.d.ts.map +1 -0
- package/dist/cjs/Unreachable.js +43 -0
- package/dist/cjs/Unreachable.js.map +7 -0
- package/dist/cjs/Workspace.d.ts +62 -0
- package/dist/cjs/Workspace.d.ts.map +1 -0
- package/dist/cjs/Workspace.js +35 -0
- package/dist/cjs/Workspace.js.map +7 -0
- package/dist/cjs/index.d.ts +161 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +73 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/internal/Containment.d.ts +24 -0
- package/dist/cjs/internal/Containment.d.ts.map +1 -0
- package/dist/cjs/internal/Containment.js +30 -0
- package/dist/cjs/internal/Containment.js.map +7 -0
- package/dist/cjs/internal/Pipeline.d.ts +18 -0
- package/dist/cjs/internal/Pipeline.d.ts.map +1 -0
- package/dist/cjs/internal/Pipeline.js +90 -0
- package/dist/cjs/internal/Pipeline.js.map +7 -0
- package/dist/cjs/internal/makeCapability.d.ts +16 -0
- package/dist/cjs/internal/makeCapability.d.ts.map +1 -0
- package/dist/cjs/internal/makeCapability.js +44 -0
- package/dist/cjs/internal/makeCapability.js.map +7 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/test/FileSystemBatchContract.d.ts +15 -0
- package/dist/cjs/test/FileSystemBatchContract.d.ts.map +1 -0
- package/dist/cjs/test/FileSystemBatchContract.js +76 -0
- package/dist/cjs/test/FileSystemBatchContract.js.map +7 -0
- package/dist/cjs/test/HostContract.d.ts +225 -0
- package/dist/cjs/test/HostContract.d.ts.map +1 -0
- package/dist/cjs/test/HostContract.js +489 -0
- package/dist/cjs/test/HostContract.js.map +7 -0
- package/dist/cjs/test/TestGrantStore.d.ts +31 -0
- package/dist/cjs/test/TestGrantStore.d.ts.map +1 -0
- package/dist/cjs/test/TestGrantStore.js +65 -0
- package/dist/cjs/test/TestGrantStore.js.map +7 -0
- package/dist/esm/CapabilitySet.d.ts +6 -0
- package/dist/esm/CapabilitySet.d.ts.map +1 -0
- package/dist/esm/CapabilitySet.js +6 -0
- package/dist/esm/CapabilitySet.js.map +1 -0
- package/dist/esm/ChildProcessEnvironment.d.ts +60 -0
- package/dist/esm/ChildProcessEnvironment.d.ts.map +1 -0
- package/dist/esm/ChildProcessEnvironment.js +91 -0
- package/dist/esm/ChildProcessEnvironment.js.map +1 -0
- package/dist/esm/ChildProcessSpawner.d.ts +100 -0
- package/dist/esm/ChildProcessSpawner.d.ts.map +1 -0
- package/dist/esm/ChildProcessSpawner.js +342 -0
- package/dist/esm/ChildProcessSpawner.js.map +1 -0
- package/dist/esm/CommandLine.d.ts +173 -0
- package/dist/esm/CommandLine.d.ts.map +1 -0
- package/dist/esm/CommandLine.js +195 -0
- package/dist/esm/CommandLine.js.map +1 -0
- package/dist/esm/ContainedSpawner.d.ts +135 -0
- package/dist/esm/ContainedSpawner.d.ts.map +1 -0
- package/dist/esm/ContainedSpawner.js +180 -0
- package/dist/esm/ContainedSpawner.js.map +1 -0
- package/dist/esm/FileSystem.d.ts +452 -0
- package/dist/esm/FileSystem.d.ts.map +1 -0
- package/dist/esm/FileSystem.js +989 -0
- package/dist/esm/FileSystem.js.map +1 -0
- package/dist/esm/FileSystemBatch.d.ts +94 -0
- package/dist/esm/FileSystemBatch.d.ts.map +1 -0
- package/dist/esm/FileSystemBatch.js +26 -0
- package/dist/esm/FileSystemBatch.js.map +1 -0
- package/dist/esm/GrantEvent.d.ts +240 -0
- package/dist/esm/GrantEvent.d.ts.map +1 -0
- package/dist/esm/GrantEvent.js +155 -0
- package/dist/esm/GrantEvent.js.map +1 -0
- package/dist/esm/GrantStore.d.ts +270 -0
- package/dist/esm/GrantStore.d.ts.map +1 -0
- package/dist/esm/GrantStore.js +951 -0
- package/dist/esm/GrantStore.js.map +1 -0
- package/dist/esm/HostError.d.ts +36 -0
- package/dist/esm/HostError.d.ts.map +1 -0
- package/dist/esm/HostError.js +20 -0
- package/dist/esm/HostError.js.map +1 -0
- package/dist/esm/HostServices.d.ts +101 -0
- package/dist/esm/HostServices.d.ts.map +1 -0
- package/dist/esm/HostServices.js +76 -0
- package/dist/esm/HostServices.js.map +1 -0
- package/dist/esm/HttpClient.d.ts +177 -0
- package/dist/esm/HttpClient.d.ts.map +1 -0
- package/dist/esm/HttpClient.js +299 -0
- package/dist/esm/HttpClient.js.map +1 -0
- package/dist/esm/Jj.d.ts +67 -0
- package/dist/esm/Jj.d.ts.map +1 -0
- package/dist/esm/Jj.js +111 -0
- package/dist/esm/Jj.js.map +1 -0
- package/dist/esm/JournalGrantStore.d.ts +65 -0
- package/dist/esm/JournalGrantStore.d.ts.map +1 -0
- package/dist/esm/JournalGrantStore.js +350 -0
- package/dist/esm/JournalGrantStore.js.map +1 -0
- package/dist/esm/Path.d.ts +37 -0
- package/dist/esm/Path.d.ts.map +1 -0
- package/dist/esm/Path.js +34 -0
- package/dist/esm/Path.js.map +1 -0
- package/dist/esm/ProcessConfinement.d.ts +55 -0
- package/dist/esm/ProcessConfinement.d.ts.map +1 -0
- package/dist/esm/ProcessConfinement.js +106 -0
- package/dist/esm/ProcessConfinement.js.map +1 -0
- package/dist/esm/ProcessLedger.d.ts +260 -0
- package/dist/esm/ProcessLedger.d.ts.map +1 -0
- package/dist/esm/ProcessLedger.js +283 -0
- package/dist/esm/ProcessLedger.js.map +1 -0
- package/dist/esm/Rooted.d.ts +53 -0
- package/dist/esm/Rooted.d.ts.map +1 -0
- package/dist/esm/Rooted.js +104 -0
- package/dist/esm/Rooted.js.map +1 -0
- package/dist/esm/Unreachable.d.ts +27 -0
- package/dist/esm/Unreachable.d.ts.map +1 -0
- package/dist/esm/Unreachable.js +26 -0
- package/dist/esm/Unreachable.js.map +1 -0
- package/dist/esm/Workspace.d.ts +62 -0
- package/dist/esm/Workspace.d.ts.map +1 -0
- package/dist/esm/Workspace.js +51 -0
- package/dist/esm/Workspace.js.map +1 -0
- package/dist/esm/index.d.ts +161 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +151 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/internal/Containment.d.ts +24 -0
- package/dist/esm/internal/Containment.d.ts.map +1 -0
- package/dist/esm/internal/Containment.js +27 -0
- package/dist/esm/internal/Containment.js.map +1 -0
- package/dist/esm/internal/Pipeline.d.ts +18 -0
- package/dist/esm/internal/Pipeline.d.ts.map +1 -0
- package/dist/esm/internal/Pipeline.js +68 -0
- package/dist/esm/internal/Pipeline.js.map +1 -0
- package/dist/esm/internal/makeCapability.d.ts +16 -0
- package/dist/esm/internal/makeCapability.d.ts.map +1 -0
- package/dist/esm/internal/makeCapability.js +22 -0
- package/dist/esm/internal/makeCapability.js.map +1 -0
- package/dist/esm/test/FileSystemBatchContract.d.ts +15 -0
- package/dist/esm/test/FileSystemBatchContract.d.ts.map +1 -0
- package/dist/esm/test/FileSystemBatchContract.js +57 -0
- package/dist/esm/test/FileSystemBatchContract.js.map +1 -0
- package/dist/esm/test/HostContract.d.ts +225 -0
- package/dist/esm/test/HostContract.d.ts.map +1 -0
- package/dist/esm/test/HostContract.js +460 -0
- package/dist/esm/test/HostContract.js.map +1 -0
- package/dist/esm/test/TestGrantStore.d.ts +31 -0
- package/dist/esm/test/TestGrantStore.d.ts.map +1 -0
- package/dist/esm/test/TestGrantStore.js +57 -0
- package/dist/esm/test/TestGrantStore.js.map +1 -0
- package/docs/README.md +162 -0
- package/docs/api.md +1532 -0
- package/docs/concepts/decoration-in-place.md +117 -0
- package/docs/concepts/filesystem-batches.md +58 -0
- package/docs/concepts/filesystem-confinement.md +168 -0
- package/docs/concepts/grant-decisions.md +181 -0
- package/docs/concepts/process-containment.md +155 -0
- package/docs/contract.md +14 -0
- package/docs/guides/adapt-a-new-host-platform.md +148 -0
- package/docs/guides/answer-permission-requests.md +151 -0
- package/docs/guides/authorize-network-and-model-calls.md +118 -0
- package/docs/guides/contain-spawned-processes.md +118 -0
- package/docs/guides/guard-a-host-bundle.md +109 -0
- package/docs/guides/persist-grants-across-restarts.md +135 -0
- package/docs/guides/write-a-capability-policy.md +159 -0
- package/docs/installation.md +115 -0
- package/docs/quickstart.md +182 -0
- package/docs/testing.md +108 -0
- package/docs/troubleshooting.md +281 -0
- package/package.json +344 -3
- package/src/CapabilitySet.ts +6 -0
- package/src/ChildProcessEnvironment.ts +98 -0
- package/src/ChildProcessSpawner.ts +414 -0
- package/src/CommandLine.ts +250 -0
- package/src/ContainedSpawner.ts +284 -0
- package/src/FileSystem.ts +1655 -0
- package/src/FileSystemBatch.ts +90 -0
- package/src/GrantEvent.ts +174 -0
- package/src/GrantStore.ts +1345 -0
- package/src/HostError.ts +37 -0
- package/src/HostServices.ts +133 -0
- package/src/HttpClient.ts +406 -0
- package/src/Jj.ts +159 -0
- package/src/JournalGrantStore.ts +461 -0
- package/src/Path.ts +47 -0
- package/src/ProcessConfinement.ts +156 -0
- package/src/ProcessLedger.ts +423 -0
- package/src/Rooted.ts +128 -0
- package/src/Unreachable.ts +30 -0
- package/src/Workspace.ts +65 -0
- package/src/index.ts +181 -0
- package/src/internal/Containment.ts +37 -0
- package/src/internal/Pipeline.ts +85 -0
- package/src/internal/makeCapability.ts +26 -0
- package/src/test/FileSystemBatchContract.ts +59 -0
- package/src/test/HostContract.ts +785 -0
- package/src/test/TestGrantStore.ts +73 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trusted composition metadata shared by contained and permission-aware spawners.
|
|
3
|
+
* @since 1.0.0
|
|
4
|
+
*/
|
|
5
|
+
import type { ChildProcessSpawner } from "effect/unstable/process/ChildProcessSpawner";
|
|
6
|
+
/**
|
|
7
|
+
* Reads only an own data property, without invoking an accessor.
|
|
8
|
+
* @private
|
|
9
|
+
* @since 1.0.0
|
|
10
|
+
*/
|
|
11
|
+
export declare const isContained: (spawner: ChildProcessSpawner["Service"]) => boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Marks a newly constructed service without copying through object spreads.
|
|
14
|
+
* @private
|
|
15
|
+
* @since 1.0.0
|
|
16
|
+
*/
|
|
17
|
+
export declare const mark: (spawner: ChildProcessSpawner["Service"]) => ChildProcessSpawner["Service"];
|
|
18
|
+
/**
|
|
19
|
+
* Preserves the declaration on a wrapper that delegates its process lifetime.
|
|
20
|
+
* @private
|
|
21
|
+
* @since 1.0.0
|
|
22
|
+
*/
|
|
23
|
+
export declare const inherit: (source: ChildProcessSpawner["Service"], wrapper: ChildProcessSpawner["Service"]) => ChildProcessSpawner["Service"];
|
|
24
|
+
//# sourceMappingURL=Containment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Containment.d.ts","sourceRoot":"","sources":["../../../src/internal/Containment.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAA;AAOtF;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,SAAS,mBAAmB,CAAC,SAAS,CAAC,KAAG,OACP,CAAA;AAE/D;;;;GAIG;AACH,eAAO,MAAM,IAAI,GAAI,SAAS,mBAAmB,CAAC,SAAS,CAAC,KAAG,mBAAmB,CAAC,SAAS,CACmB,CAAA;AAE/G;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAClB,QAAQ,mBAAmB,CAAC,SAAS,CAAC,EACtC,SAAS,mBAAmB,CAAC,SAAS,CAAC,KACtC,mBAAmB,CAAC,SAAS,CAAkD,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key2 of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key2) && key2 !== except)
|
|
14
|
+
__defProp(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var Containment_exports = {};
|
|
20
|
+
__export(Containment_exports, {
|
|
21
|
+
inherit: () => inherit,
|
|
22
|
+
isContained: () => isContained,
|
|
23
|
+
mark: () => mark
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(Containment_exports);
|
|
26
|
+
const key = /* @__PURE__ */ Symbol.for("@smthrs/kernel/ContainedSpawner/Lifecycle/v1");
|
|
27
|
+
const isContained = (spawner) => Object.getOwnPropertyDescriptor(spawner, key)?.value === true;
|
|
28
|
+
const mark = (spawner) => Object.defineProperty(spawner, key, { value: true, enumerable: false, writable: false, configurable: false });
|
|
29
|
+
const inherit = (source, wrapper) => isContained(source) ? mark(wrapper) : wrapper;
|
|
30
|
+
//# sourceMappingURL=Containment.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/internal/Containment.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Trusted composition metadata shared by contained and permission-aware spawners.\n * @since 1.0.0\n */\n\nimport type { ChildProcessSpawner } from \"effect/unstable/process/ChildProcessSpawner\"\n\n// The registry key also works when a service crosses the ESM/CJS projections.\n// This declares a trusted lifecycle contract; it cannot prove a supplied\n// lifecycle is honest or turn process containment into a security sandbox.\nconst key = Symbol.for(\"@smthrs/kernel/ContainedSpawner/Lifecycle/v1\")\n\n/**\n * Reads only an own data property, without invoking an accessor.\n * @private\n * @since 1.0.0\n */\nexport const isContained = (spawner: ChildProcessSpawner[\"Service\"]): boolean =>\n Object.getOwnPropertyDescriptor(spawner, key)?.value === true\n\n/**\n * Marks a newly constructed service without copying through object spreads.\n * @private\n * @since 1.0.0\n */\nexport const mark = (spawner: ChildProcessSpawner[\"Service\"]): ChildProcessSpawner[\"Service\"] =>\n Object.defineProperty(spawner, key, { value: true, enumerable: false, writable: false, configurable: false })\n\n/**\n * Preserves the declaration on a wrapper that delegates its process lifetime.\n * @private\n * @since 1.0.0\n */\nexport const inherit = (\n source: ChildProcessSpawner[\"Service\"],\n wrapper: ChildProcessSpawner[\"Service\"]\n): ChildProcessSpawner[\"Service\"] => isContained(source) ? mark(wrapper) : wrapper\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,MAAM,MAAM,uBAAO,IAAI,8CAA8C;AAO9D,MAAM,cAAc,CAAC,YAC1B,OAAO,yBAAyB,SAAS,GAAG,GAAG,UAAU;AAOpD,MAAM,OAAO,CAAC,YACnB,OAAO,eAAe,SAAS,KAAK,EAAE,OAAO,MAAM,YAAY,OAAO,UAAU,OAAO,cAAc,MAAM,CAAC;AAOvG,MAAM,UAAU,CACrB,QACA,YACmC,YAAY,MAAM,IAAI,KAAK,OAAO,IAAI;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pipeline wiring around a per-process spawner, so every leg has its own lifecycle.
|
|
3
|
+
* @since 1.0.0
|
|
4
|
+
*/
|
|
5
|
+
import * as Effect from "effect/Effect";
|
|
6
|
+
import type * as PlatformError from "effect/PlatformError";
|
|
7
|
+
import type * as Scope from "effect/Scope";
|
|
8
|
+
import * as ChildProcess from "effect/unstable/process/ChildProcess";
|
|
9
|
+
import { type ChildProcessHandle } from "effect/unstable/process/ChildProcessSpawner";
|
|
10
|
+
type Spawn = (command: ChildProcess.StandardCommand) => Effect.Effect<ChildProcessHandle, PlatformError.PlatformError, Scope.Scope>;
|
|
11
|
+
/**
|
|
12
|
+
* Preserve Effect's rightmost output/status and reverse-order kill/reref semantics.
|
|
13
|
+
* @private
|
|
14
|
+
* @since 1.0.0
|
|
15
|
+
*/
|
|
16
|
+
export declare const spawn: (command: ChildProcess.Command, standard: Spawn) => Effect.Effect<ChildProcessHandle, PlatformError.PlatformError, Scope.Scope>;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=Pipeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Pipeline.d.ts","sourceRoot":"","sources":["../../../src/internal/Pipeline.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,KAAK,aAAa,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAA;AAE1C,OAAO,KAAK,YAAY,MAAM,sCAAsC,CAAA;AACpE,OAAO,EAAE,KAAK,kBAAkB,EAAc,MAAM,6CAA6C,CAAA;AAEjG,KAAK,KAAK,GAAG,CACX,OAAO,EAAE,YAAY,CAAC,eAAe,KAClC,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE,aAAa,CAAC,aAAa,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA;AAsChF;;;;GAIG;AACH,eAAO,MAAM,KAAK,GAChB,SAAS,YAAY,CAAC,OAAO,EAC7B,UAAU,KAAK,KACd,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE,aAAa,CAAC,aAAa,EAAE,KAAK,CAAC,KAAK,CAuBzE,CAAA"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var Pipeline_exports = {};
|
|
30
|
+
__export(Pipeline_exports, {
|
|
31
|
+
spawn: () => spawn
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(Pipeline_exports);
|
|
34
|
+
var Effect = __toESM(require("effect/Effect"), 1);
|
|
35
|
+
var Exit = __toESM(require("effect/Exit"), 1);
|
|
36
|
+
var Stream = __toESM(require("effect/Stream"), 1);
|
|
37
|
+
var ChildProcess = __toESM(require("effect/unstable/process/ChildProcess"), 1);
|
|
38
|
+
var import_ChildProcessSpawner = require("effect/unstable/process/ChildProcessSpawner");
|
|
39
|
+
const source = (handle, from) => {
|
|
40
|
+
if (from === "stderr") return handle.stderr;
|
|
41
|
+
if (from === "all") return handle.all;
|
|
42
|
+
const fd = from === void 0 ? void 0 : ChildProcess.parseFdName(from);
|
|
43
|
+
return fd === void 0 ? handle.stdout : handle.getOutputFd(fd);
|
|
44
|
+
};
|
|
45
|
+
const withInput = (command, stream, to) => {
|
|
46
|
+
if (command._tag === "PipedCommand") {
|
|
47
|
+
return ChildProcess.pipeTo(withInput(command.left, stream, to), command.right, command.options);
|
|
48
|
+
}
|
|
49
|
+
const fd = to === void 0 ? void 0 : ChildProcess.parseFdName(to);
|
|
50
|
+
if (fd !== void 0) {
|
|
51
|
+
return ChildProcess.make(command.command, command.args, {
|
|
52
|
+
...command.options,
|
|
53
|
+
additionalFds: {
|
|
54
|
+
...command.options.additionalFds,
|
|
55
|
+
[ChildProcess.fdName(fd)]: { type: "input", stream }
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
const stdin = command.options.stdin;
|
|
60
|
+
return ChildProcess.make(command.command, command.args, {
|
|
61
|
+
...command.options,
|
|
62
|
+
stdin: {
|
|
63
|
+
...typeof stdin === "object" && !Stream.isStream(stdin) ? stdin : {},
|
|
64
|
+
stream
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
const spawn = (command, standard) => Effect.gen(function* () {
|
|
69
|
+
if (command._tag === "StandardCommand") return yield* standard(command);
|
|
70
|
+
const left = yield* spawn(command.left, standard);
|
|
71
|
+
const right = yield* spawn(
|
|
72
|
+
withInput(command.right, source(left, command.options.from), command.options.to),
|
|
73
|
+
standard
|
|
74
|
+
);
|
|
75
|
+
return (0, import_ChildProcessSpawner.makeHandle)({
|
|
76
|
+
...right,
|
|
77
|
+
kill: (options) => Effect.gen(function* () {
|
|
78
|
+
const rightExit = yield* Effect.exit(right.kill(options));
|
|
79
|
+
const leftExit = yield* Effect.exit(left.kill(options));
|
|
80
|
+
if (Exit.isFailure(rightExit)) return yield* Effect.failCause(rightExit.cause);
|
|
81
|
+
return yield* leftExit;
|
|
82
|
+
}),
|
|
83
|
+
unref: Effect.gen(function* () {
|
|
84
|
+
const leftReref = yield* left.unref;
|
|
85
|
+
const rightReref = yield* right.unref;
|
|
86
|
+
return Effect.andThen(rightReref, leftReref);
|
|
87
|
+
})
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
//# sourceMappingURL=Pipeline.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/internal/Pipeline.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Pipeline wiring around a per-process spawner, so every leg has its own lifecycle.\n * @since 1.0.0\n */\n\nimport * as Effect from \"effect/Effect\"\nimport * as Exit from \"effect/Exit\"\nimport type * as PlatformError from \"effect/PlatformError\"\nimport type * as Scope from \"effect/Scope\"\nimport * as Stream from \"effect/Stream\"\nimport * as ChildProcess from \"effect/unstable/process/ChildProcess\"\nimport { type ChildProcessHandle, makeHandle } from \"effect/unstable/process/ChildProcessSpawner\"\n\ntype Spawn = (\n command: ChildProcess.StandardCommand\n) => Effect.Effect<ChildProcessHandle, PlatformError.PlatformError, Scope.Scope>\n\nconst source = (handle: ChildProcessHandle, from: ChildProcess.PipeFromOption | undefined) => {\n if (from === \"stderr\") return handle.stderr\n if (from === \"all\") return handle.all\n const fd = from === undefined ? undefined : ChildProcess.parseFdName(from)\n return fd === undefined ? handle.stdout : handle.getOutputFd(fd)\n}\n\n/** An edge feeds the first process of its destination, including a nested pipeline. */\nconst withInput = (\n command: ChildProcess.Command,\n stream: Stream.Stream<Uint8Array, PlatformError.PlatformError>,\n to: ChildProcess.PipeToOption | undefined\n): ChildProcess.Command => {\n if (command._tag === \"PipedCommand\") {\n return ChildProcess.pipeTo(withInput(command.left, stream, to), command.right, command.options)\n }\n const fd = to === undefined ? undefined : ChildProcess.parseFdName(to)\n if (fd !== undefined) {\n return ChildProcess.make(command.command, command.args, {\n ...command.options,\n additionalFds: {\n ...command.options.additionalFds,\n [ChildProcess.fdName(fd)]: { type: \"input\", stream }\n }\n })\n }\n const stdin = command.options.stdin\n return ChildProcess.make(command.command, command.args, {\n ...command.options,\n stdin: {\n ...(typeof stdin === \"object\" && !Stream.isStream(stdin) ? stdin : {}),\n stream\n }\n })\n}\n\n/**\n * Preserve Effect's rightmost output/status and reverse-order kill/reref semantics.\n * @private\n * @since 1.0.0\n */\nexport const spawn = (\n command: ChildProcess.Command,\n standard: Spawn\n): Effect.Effect<ChildProcessHandle, PlatformError.PlatformError, Scope.Scope> =>\n Effect.gen(function*() {\n if (command._tag === \"StandardCommand\") return yield* standard(command)\n const left = yield* spawn(command.left, standard)\n const right = yield* spawn(\n withInput(command.right, source(left, command.options.from), command.options.to),\n standard\n )\n return makeHandle({\n ...right,\n kill: (options) =>\n Effect.gen(function*() {\n const rightExit = yield* Effect.exit(right.kill(options))\n const leftExit = yield* Effect.exit(left.kill(options))\n if (Exit.isFailure(rightExit)) return yield* Effect.failCause(rightExit.cause)\n return yield* leftExit\n }),\n unref: Effect.gen(function*() {\n const leftReref = yield* left.unref\n const rightReref = yield* right.unref\n return Effect.andThen(rightReref, leftReref)\n })\n })\n })\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,aAAwB;AACxB,WAAsB;AAGtB,aAAwB;AACxB,mBAA8B;AAC9B,iCAAoD;AAMpD,MAAM,SAAS,CAAC,QAA4B,SAAkD;AAC5F,MAAI,SAAS,SAAU,QAAO,OAAO;AACrC,MAAI,SAAS,MAAO,QAAO,OAAO;AAClC,QAAM,KAAK,SAAS,SAAY,SAAY,aAAa,YAAY,IAAI;AACzE,SAAO,OAAO,SAAY,OAAO,SAAS,OAAO,YAAY,EAAE;AACjE;AAGA,MAAM,YAAY,CAChB,SACA,QACA,OACyB;AACzB,MAAI,QA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O,OAAO,UAAU,UAAU,KAAK;AAC7E,aAAO,OAAO;AAAA,IAChB,CAAC;AAAA,IACH,OAAO,OAAO,IAAI,aAAY;AAC5B,YAAM,YAAY,OAAO,KAAK;AAC9B,YAAM,aAAa,OAAO,MAAM;AAChC,aAAO,OAAO,QAAQ,YAAY,SAAS;AAAA,IAC7C,CAAC;AAAA,EACH,CAAC;AACH,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed capability construction for host decorators.
|
|
3
|
+
*
|
|
4
|
+
* @since 1.0.0-rc.0
|
|
5
|
+
*/
|
|
6
|
+
import * as Capability from "@smthrs/capability/Capability";
|
|
7
|
+
import { GrantStoreError } from "@smthrs/capability/Permission";
|
|
8
|
+
import { Effect } from "effect";
|
|
9
|
+
/**
|
|
10
|
+
* Constructs decorator requests without leaking schema failures as defects.
|
|
11
|
+
*
|
|
12
|
+
* @category constructors
|
|
13
|
+
* @since 1.0.0-rc.0
|
|
14
|
+
*/
|
|
15
|
+
export declare const makeCapability: (action: Capability.Action, resource: string) => Effect.Effect<Capability.Capability, GrantStoreError, never>;
|
|
16
|
+
//# sourceMappingURL=makeCapability.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"makeCapability.d.ts","sourceRoot":"","sources":["../../../src/internal/makeCapability.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAA;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,QAAQ,UAAU,CAAC,MAAM,EAAE,UAAU,MAAM,iEAStE,CAAA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var makeCapability_exports = {};
|
|
30
|
+
__export(makeCapability_exports, {
|
|
31
|
+
makeCapability: () => makeCapability
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(makeCapability_exports);
|
|
34
|
+
var Capability = __toESM(require("@smthrs/capability/Capability"), 1);
|
|
35
|
+
var import_Permission = require("@smthrs/capability/Permission");
|
|
36
|
+
var import_effect = require("effect");
|
|
37
|
+
const makeCapability = (action, resource) => import_effect.Effect.try({
|
|
38
|
+
try: () => Capability.make(action, resource),
|
|
39
|
+
catch: () => new import_Permission.GrantStoreError({
|
|
40
|
+
code: "invalid_resolution",
|
|
41
|
+
message: `capability requires a valid action and a resource within maximumCapabilityResourceLength (${Capability.maxResourceLength} UTF-16 code units)`
|
|
42
|
+
})
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=makeCapability.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/internal/makeCapability.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Typed capability construction for host decorators.\n *\n * @since 1.0.0-rc.0\n */\n\nimport * as Capability from \"@smthrs/capability/Capability\"\nimport { GrantStoreError } from \"@smthrs/capability/Permission\"\nimport { Effect } from \"effect\"\n\n/**\n * Constructs decorator requests without leaking schema failures as defects.\n *\n * @category constructors\n * @since 1.0.0-rc.0\n */\nexport const makeCapability = (action: Capability.Action, resource: string) =>\n Effect.try({\n try: () => Capability.make(action, resource),\n catch: () =>\n new GrantStoreError({\n code: \"invalid_resolution\",\n message:\n `capability requires a valid action and a resource within maximumCapabilityResourceLength (${Capability.maxResourceLength} UTF-16 code units)`\n })\n })\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,iBAA4B;AAC5B,wBAAgC;AAChC,oBAAuB;AAQhB,MAAM,iBAAiB,CAAC,QAA2B,aACxD,qBAAO,IAAI;AAAA,EACT,KAAK,MAAM,WAAW,KAAK,QAAQ,QAAQ;AAAA,EAC3C,OAAO,MACL,IAAI,kCAAgB;AAAA,IAClB,MAAM;AAAA,IACN,SACE,6FAA6F,WAAW,iBAAiB;AAAA,EAC7H,CAAC;AACL,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The optional atomic batch portion of the shared host contract.
|
|
3
|
+
*
|
|
4
|
+
* @since 1.0.0
|
|
5
|
+
*/
|
|
6
|
+
import { Effect, type FileSystem, Path } from "effect";
|
|
7
|
+
/**
|
|
8
|
+
* Exercises every advertised batch implementation over the host contract's
|
|
9
|
+
* fresh `source.txt` fixture. Isolated volumes may omit this optimization.
|
|
10
|
+
*
|
|
11
|
+
* @since 1.0.0
|
|
12
|
+
* @category testing
|
|
13
|
+
*/
|
|
14
|
+
export declare const check: (fs: FileSystem.FileSystem, root: string) => Effect.Effect<void, import("effect/PlatformError").PlatformError, Path.Path>;
|
|
15
|
+
//# sourceMappingURL=FileSystemBatchContract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileSystemBatchContract.d.ts","sourceRoot":"","sources":["../../../src/test/FileSystemBatchContract.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,MAAM,EAAE,KAAK,UAAU,EAAU,IAAI,EAAU,MAAM,QAAQ,CAAA;AAGtE;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,GAAI,IAAI,UAAU,CAAC,UAAU,EAAE,MAAM,MAAM,iFAyCzD,CAAA"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var FileSystemBatchContract_exports = {};
|
|
30
|
+
__export(FileSystemBatchContract_exports, {
|
|
31
|
+
check: () => check
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(FileSystemBatchContract_exports);
|
|
34
|
+
var import_vitest = require("@effect/vitest");
|
|
35
|
+
var import_effect = require("effect");
|
|
36
|
+
var KernelFileSystem = __toESM(require("../FileSystem.js"), 1);
|
|
37
|
+
const check = (fs, root) => import_effect.Effect.gen(function* () {
|
|
38
|
+
const atomic = fs[KernelFileSystem.AtomicFileSystemTypeId];
|
|
39
|
+
if (atomic?.batchLimits === void 0) {
|
|
40
|
+
(0, import_vitest.expect)(KernelFileSystem.batch(fs)).toBeUndefined();
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const path = yield* import_effect.Path.Path;
|
|
44
|
+
const boundaryRoot = yield* fs.realPath(root);
|
|
45
|
+
const rootIdentity = atomic.identifyRoot === void 0 ? yield* import_effect.Effect.map(fs.stat(root), (info) => `${info.dev}:${import_effect.Option.getOrThrow(info.ino)}`) : yield* atomic.identifyRoot(boundaryRoot);
|
|
46
|
+
const response = yield* atomic.execute({
|
|
47
|
+
operation: "batch",
|
|
48
|
+
boundaryRoot,
|
|
49
|
+
logicalRoot: root,
|
|
50
|
+
rootIdentity,
|
|
51
|
+
requests: [
|
|
52
|
+
{ operation: "digest", path: path.join(root, "source.txt"), content: true },
|
|
53
|
+
{ operation: "stat", path: path.join(root, "source.txt") },
|
|
54
|
+
{ operation: "readDirectory", path: root },
|
|
55
|
+
{ operation: "glob", path: path.join(root, "*.txt"), root },
|
|
56
|
+
{ operation: "digest", path: path.join(root, "absent") }
|
|
57
|
+
]
|
|
58
|
+
});
|
|
59
|
+
(0, import_vitest.expect)(response.rootIdentity).toBe(rootIdentity);
|
|
60
|
+
(0, import_vitest.expect)(response.entries.map((entry) => entry.index)).toEqual([2, 3, 4, 0, 1]);
|
|
61
|
+
const entries = [...response.entries].sort((a, b) => a.index - b.index);
|
|
62
|
+
(0, import_vitest.expect)(import_effect.Result.getOrThrow(entries[0].result)).toEqual({
|
|
63
|
+
operation: "digest",
|
|
64
|
+
digest: "0e1c618211c39c03726d50ee05e7e520ca6d8a2a3619b17983adc574e3ca34bf",
|
|
65
|
+
sizeBytes: 13,
|
|
66
|
+
bytes: new TextEncoder().encode("host-contract")
|
|
67
|
+
});
|
|
68
|
+
(0, import_vitest.expect)(import_effect.Result.getOrThrow(entries[1].result)).toMatchObject({
|
|
69
|
+
operation: "stat",
|
|
70
|
+
info: { type: "File", size: 13n }
|
|
71
|
+
});
|
|
72
|
+
(0, import_vitest.expect)(import_effect.Result.getOrThrow(entries[2].result)).toEqual({ operation: "readDirectory", paths: ["source.txt"] });
|
|
73
|
+
(0, import_vitest.expect)(import_effect.Result.getOrThrow(entries[3].result)).toEqual({ operation: "glob", paths: [path.join(root, "source.txt")] });
|
|
74
|
+
(0, import_vitest.expect)(entries[4].result).toMatchObject({ _tag: "Failure", failure: { reason: { _tag: "NotFound" } } });
|
|
75
|
+
});
|
|
76
|
+
//# sourceMappingURL=FileSystemBatchContract.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/test/FileSystemBatchContract.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * The optional atomic batch portion of the shared host contract.\n *\n * @since 1.0.0\n */\n\nimport { expect } from \"@effect/vitest\"\nimport { Effect, type FileSystem, Option, Path, Result } from \"effect\"\nimport * as KernelFileSystem from \"../FileSystem.ts\"\n\n/**\n * Exercises every advertised batch implementation over the host contract's\n * fresh `source.txt` fixture. Isolated volumes may omit this optimization.\n *\n * @since 1.0.0\n * @category testing\n */\nexport const check = (fs: FileSystem.FileSystem, root: string) =>\n Effect.gen(function*() {\n const atomic = (fs as Partial<KernelFileSystem.AtomicHostFileSystem>)[KernelFileSystem.AtomicFileSystemTypeId]\n if (atomic?.batchLimits === undefined) {\n expect(KernelFileSystem.batch(fs)).toBeUndefined()\n return\n }\n const path = yield* Path.Path\n const boundaryRoot = yield* fs.realPath(root)\n const rootIdentity = atomic.identifyRoot === undefined\n ? yield* Effect.map(fs.stat(root), (info) => `${info.dev}:${Option.getOrThrow(info.ino)}`)\n : yield* atomic.identifyRoot(boundaryRoot)\n const response = yield* atomic.execute({\n operation: \"batch\",\n boundaryRoot,\n logicalRoot: root,\n rootIdentity,\n requests: [\n { operation: \"digest\", path: path.join(root, \"source.txt\"), content: true },\n { operation: \"stat\", path: path.join(root, \"source.txt\") },\n { operation: \"readDirectory\", path: root },\n { operation: \"glob\", path: path.join(root, \"*.txt\"), root },\n { operation: \"digest\", path: path.join(root, \"absent\") }\n ]\n })\n expect(response.rootIdentity).toBe(rootIdentity)\n expect(response.entries.map((entry) => entry.index)).toEqual([2, 3, 4, 0, 1])\n const entries = [...response.entries].sort((a, b) => a.index - b.index)\n expect(Result.getOrThrow(entries[0]!.result)).toEqual({\n operation: \"digest\",\n digest: \"0e1c618211c39c03726d50ee05e7e520ca6d8a2a3619b17983adc574e3ca34bf\",\n sizeBytes: 13,\n bytes: new TextEncoder().encode(\"host-contract\")\n })\n expect(Result.getOrThrow(entries[1]!.result)).toMatchObject({\n operation: \"stat\",\n info: { type: \"File\", size: 13n }\n })\n expect(Result.getOrThrow(entries[2]!.result)).toEqual({ operation: \"readDirectory\", paths: [\"source.txt\"] })\n expect(Result.getOrThrow(entries[3]!.result)).toEqual({ operation: \"glob\", paths: [path.join(root, \"source.txt\")] })\n expect(entries[4]!.result).toMatchObject({ _tag: \"Failure\", failure: { reason: { _tag: \"NotFound\" } } })\n })\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,oBAAuB;AACvB,oBAA8D;AAC9D,uBAAkC;AAS3B,MAAM,QAAQ,CAAC,IAA2B,SAC/C,qBAAO,IAAI,aAAY;AACrB,QAAM,SAAU,GAAsD,iBAAiB,sBAAsB;AAC7G,MAAI,QAAQ,gBAAgB,QAAW;AACrC,8BAAO,iBAAiB,MAAM,EAAE,CAAC,EAAE,cAAc;AACjD;AAAA,EACF;AACA,QAAM,OAAO,OAAO,mBAAK;AACzB,QAAM,eAAe,OAAO,GAAG,SAAS,IAAI;AAC5C,QAAM,eAAe,OAAO,iBAAiB,SACzC,OAAO,qBAAO,IAAI,GAAG,KAAK,IAAI,GAAG,CAAC,SAAS,GAAG,KAAK,GAAG,IAAI,qBAAO,WAAW,KAAK,GAAG,CAAC,EAAE,IACvF,OAAO,OAAO,aAAa,YAAY;AAC3C,QAAM,WAAW,OAAO,OAAO,QAAQ;AAAA,IACrC,WAAW;AAAA,IACX;AAAA,IACA,aAAa;AAAA,IACb;AAAA,IACA,UAAU;AAAA,MACR,EAAE,WAAW,UAAU,MAAM,KAAK,KAAK,MAAM,YAAY,GAAG,SAAS,KAAK;AAAA,MAC1E,EAAE,WAAW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W,EAAE,EAAE,CAAC;AACzG,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared contract suite for complete Host bundles.
|
|
3
|
+
*
|
|
4
|
+
* This module is emitted as ESM, CJS, and declarations and exported from
|
|
5
|
+
* `@smthrs/kernel/test/contract`. It intentionally has a Vitest peer because
|
|
6
|
+
* it registers a reusable behavioral contract for third-party Host bundles.
|
|
7
|
+
*
|
|
8
|
+
* @since 1.0.0-rc.0
|
|
9
|
+
*/
|
|
10
|
+
import type { Jj, JjErrorCode } from "@smthrs/jj";
|
|
11
|
+
import { Effect, FileSystem, type Layer, Path } from "effect";
|
|
12
|
+
import { HttpClient } from "effect/unstable/http/HttpClient";
|
|
13
|
+
import * as HttpClientRequest from "effect/unstable/http/HttpClientRequest";
|
|
14
|
+
import type * as HttpClientResponse from "effect/unstable/http/HttpClientResponse";
|
|
15
|
+
import * as ChildProcess from "effect/unstable/process/ChildProcess";
|
|
16
|
+
import { ChildProcessSpawner } from "effect/unstable/process/ChildProcessSpawner";
|
|
17
|
+
export { check as checkFileSystemBatch } from "./FileSystemBatchContract.ts";
|
|
18
|
+
/**
|
|
19
|
+
* A capability that must fail with a stable typed code.
|
|
20
|
+
*
|
|
21
|
+
* @category models
|
|
22
|
+
* @since 1.0.0-rc.0
|
|
23
|
+
*/
|
|
24
|
+
export interface FailureCapability<Code extends string> {
|
|
25
|
+
readonly expected: "failure";
|
|
26
|
+
readonly code: Code;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Successful filesystem contract options.
|
|
30
|
+
*
|
|
31
|
+
* `scratchPath` is required only for hosts whose filesystem does not accept an
|
|
32
|
+
* OS temp path — an in-memory double, say. Omitting it takes
|
|
33
|
+
* {@link defaultScratchPath}, which is process-scoped and outside the working
|
|
34
|
+
* tree.
|
|
35
|
+
*
|
|
36
|
+
* @category models
|
|
37
|
+
* @since 1.0.0-rc.0
|
|
38
|
+
*/
|
|
39
|
+
export interface FileSystemSuccess {
|
|
40
|
+
readonly expected: "success";
|
|
41
|
+
readonly scratchPath?: string | undefined;
|
|
42
|
+
/** Operations this otherwise available host deliberately refuses. */
|
|
43
|
+
readonly unsupported?: Partial<Record<FileSystemOperation, string>> | undefined;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Every method on Effect's closed filesystem service.
|
|
47
|
+
* @category constants
|
|
48
|
+
* @since 1.0.0-rc.0
|
|
49
|
+
*/
|
|
50
|
+
export declare const FileSystemOperations: readonly ["access", "copy", "copyFile", "chmod", "chown", "glob", "exists", "link", "makeDirectory", "makeTempDirectory", "makeTempDirectoryScoped", "makeTempFile", "makeTempFileScoped", "open", "readDirectory", "readFile", "readFileString", "readLink", "realPath", "remove", "rename", "sink", "stat", "stream", "symlink", "truncate", "utimes", "watch", "writeFile", "writeFileString"];
|
|
51
|
+
/**
|
|
52
|
+
* One method of Effect's closed filesystem service.
|
|
53
|
+
* @category models
|
|
54
|
+
* @since 1.0.0-rc.0
|
|
55
|
+
*/
|
|
56
|
+
export type FileSystemOperation = typeof FileSystemOperations[number];
|
|
57
|
+
/**
|
|
58
|
+
* Successful Path contract expectation.
|
|
59
|
+
*
|
|
60
|
+
* @category models
|
|
61
|
+
* @since 1.0.0-rc.0
|
|
62
|
+
*/
|
|
63
|
+
export interface PathSuccess {
|
|
64
|
+
readonly expected: "success";
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Successful `ChildProcessSpawner` contract options.
|
|
68
|
+
*
|
|
69
|
+
* Defaults use the current Node or Bun executable. In-process browser
|
|
70
|
+
* doubles can provide their own scripted commands and expected output.
|
|
71
|
+
*
|
|
72
|
+
* There is no timeout case: a wall-clock budget is `Effect.timeout` around any
|
|
73
|
+
* effect, not a per-spawn option, so there is nothing host-specific left to
|
|
74
|
+
* assert.
|
|
75
|
+
*
|
|
76
|
+
* @category models
|
|
77
|
+
* @since 1.0.0-rc.0
|
|
78
|
+
*/
|
|
79
|
+
export interface ChildProcessSuccess {
|
|
80
|
+
readonly expected: "success";
|
|
81
|
+
readonly execCommand?: ChildProcess.Command | undefined;
|
|
82
|
+
readonly expectedStdout?: string | undefined;
|
|
83
|
+
readonly streamCommand?: ChildProcess.Command | undefined;
|
|
84
|
+
readonly expectedStreamText?: string | undefined;
|
|
85
|
+
/** A command carrying `cwd` and `env` options through to the child. */
|
|
86
|
+
readonly optionsCommand?: ChildProcess.Command | undefined;
|
|
87
|
+
readonly expectedOptionsStdout?: string | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* How the host handles a command fed from a `stdin` stream: the expected
|
|
90
|
+
* stdout when it supports one, or the typed code when it does not.
|
|
91
|
+
*/
|
|
92
|
+
readonly stdin?: {
|
|
93
|
+
readonly command: ChildProcess.Command;
|
|
94
|
+
readonly expectedStdout: string;
|
|
95
|
+
} | FailureCapability<string> | undefined;
|
|
96
|
+
/** A two-leg pipeline, or the exact typed refusal for hosts without one. */
|
|
97
|
+
readonly pipeline?: {
|
|
98
|
+
readonly command: ChildProcess.Command;
|
|
99
|
+
readonly expectedStdout: string;
|
|
100
|
+
} | FailureCapability<string> | undefined;
|
|
101
|
+
readonly interruptCommand?: ChildProcess.Command | undefined;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Successful Jj contract expectation.
|
|
105
|
+
*
|
|
106
|
+
* @category models
|
|
107
|
+
* @since 1.0.0-rc.0
|
|
108
|
+
*/
|
|
109
|
+
export interface JjSuccess {
|
|
110
|
+
readonly expected: "success";
|
|
111
|
+
/** Makes the first and second snapshots observably different. */
|
|
112
|
+
readonly prepareChange?: ((phase: "first" | "second") => Effect.Effect<void, unknown>) | undefined;
|
|
113
|
+
/** Nonexistent path at which the contract may add one temporary workspace. */
|
|
114
|
+
readonly workspacePath?: string | undefined;
|
|
115
|
+
/** Path whose repository root the host must resolve. */
|
|
116
|
+
readonly rootFrom?: string | undefined;
|
|
117
|
+
/** Optional methods this otherwise available backend explicitly refuses. */
|
|
118
|
+
readonly unsupported?: Partial<Record<"root" | "revert", JjErrorCode>> | undefined;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Every method on the closed Jj host service.
|
|
122
|
+
* @category constants
|
|
123
|
+
* @since 1.0.0-rc.0
|
|
124
|
+
*/
|
|
125
|
+
export declare const JjOperations: readonly ["snapshot", "restore", "diff", "workspaceAdd", "workspaceForget", "status", "root", "revert"];
|
|
126
|
+
/**
|
|
127
|
+
* One method of the closed Jj host service.
|
|
128
|
+
* @category models
|
|
129
|
+
* @since 1.0.0-rc.0
|
|
130
|
+
*/
|
|
131
|
+
export type JjOperation = typeof JjOperations[number];
|
|
132
|
+
/**
|
|
133
|
+
* Successful HTTP contract probe.
|
|
134
|
+
*
|
|
135
|
+
* A request is explicit so the shared suite never invents a live network call.
|
|
136
|
+
*
|
|
137
|
+
* @category models
|
|
138
|
+
* @since 1.0.0-rc.0
|
|
139
|
+
*/
|
|
140
|
+
export interface HttpClientProbe {
|
|
141
|
+
/** Exact request the host must execute. */
|
|
142
|
+
readonly request: HttpClientRequest.HttpClientRequest;
|
|
143
|
+
/** Adapter-specific response proof. */
|
|
144
|
+
readonly assertResponse: (response: HttpClientResponse.HttpClientResponse) => void;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Successful read/write/redirect HTTP contract probes.
|
|
148
|
+
* @category models
|
|
149
|
+
* @since 1.0.0-rc.0
|
|
150
|
+
*/
|
|
151
|
+
export interface HttpClientSuccess {
|
|
152
|
+
readonly expected: "success";
|
|
153
|
+
/** Safe read method. */
|
|
154
|
+
readonly read: HttpClientProbe;
|
|
155
|
+
/** Body-carrying write method. */
|
|
156
|
+
readonly write: HttpClientProbe;
|
|
157
|
+
/** Manual redirect response; the host must not follow it below the guard. */
|
|
158
|
+
readonly redirect: HttpClientProbe;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Complete capability expectations for the closed five-tag Host surface.
|
|
162
|
+
* Unsupported capabilities are asserted with their code and are never skipped.
|
|
163
|
+
*
|
|
164
|
+
* @category models
|
|
165
|
+
* @since 1.0.0-rc.0
|
|
166
|
+
*/
|
|
167
|
+
export interface HostContractCapabilities {
|
|
168
|
+
readonly fileSystem: FileSystemSuccess | FailureCapability<string>;
|
|
169
|
+
readonly path: PathSuccess | FailureCapability<string>;
|
|
170
|
+
readonly childProcess: ChildProcessSuccess | FailureCapability<string>;
|
|
171
|
+
readonly jj: JjSuccess | FailureCapability<JjErrorCode>;
|
|
172
|
+
readonly httpClient: HttpClientSuccess | FailureCapability<string>;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* The full layer output required by the contract.
|
|
176
|
+
*
|
|
177
|
+
* @category models
|
|
178
|
+
* @since 1.0.0-rc.0
|
|
179
|
+
*/
|
|
180
|
+
export type HostContractLayer = Layer.Layer<FileSystem.FileSystem | Path.Path | ChildProcessSpawner | Jj | HttpClient, unknown>;
|
|
181
|
+
/**
|
|
182
|
+
* Normalizes the code a Host failure is identified by, across the three shapes
|
|
183
|
+
* the closed surface produces: a `code` field (`JjError`), a nested
|
|
184
|
+
* `reason._tag` (`PlatformError`, `HttpClientError`), and a bare `_tag`.
|
|
185
|
+
* Anything else is uncoded.
|
|
186
|
+
*
|
|
187
|
+
* @category testing
|
|
188
|
+
* @since 1.0.0-rc.0
|
|
189
|
+
*/
|
|
190
|
+
export declare const errorCode: (error: unknown) => string | undefined;
|
|
191
|
+
/**
|
|
192
|
+
* Asserts that `effect` fails with `code`. Succeeding is itself a contract
|
|
193
|
+
* violation: a capability declared unsupported must never quietly work.
|
|
194
|
+
*
|
|
195
|
+
* @category testing
|
|
196
|
+
* @since 1.0.0-rc.0
|
|
197
|
+
*/
|
|
198
|
+
export declare const assertFailure: <A, E, R>(effect: Effect.Effect<A, E, R>, code: string) => Effect.Effect<void, never, R>;
|
|
199
|
+
/**
|
|
200
|
+
* Allocates the scratch file path a contract bundle writes through when the
|
|
201
|
+
* caller declares no `scratchPath` of its own.
|
|
202
|
+
*
|
|
203
|
+
* The path is absolute under the OS temp directory and scoped by both process
|
|
204
|
+
* id and an allocation counter. A repo-relative default would put the file in
|
|
205
|
+
* the working tree, where it is neither ignored by git nor private to one test
|
|
206
|
+
* process: concurrent `vitest run` invocations would then race the same path,
|
|
207
|
+
* and the suite's `ensuring` remove could truncate a sibling's file between its
|
|
208
|
+
* write and its read.
|
|
209
|
+
*
|
|
210
|
+
* @category testing
|
|
211
|
+
* @since 1.0.0-rc.0
|
|
212
|
+
*/
|
|
213
|
+
export declare const defaultScratchPath: (suite: string) => string;
|
|
214
|
+
/**
|
|
215
|
+
* Registers the shared Host contract with Vitest.
|
|
216
|
+
*
|
|
217
|
+
* Every invocation creates ten cases: complete service presence,
|
|
218
|
+
* FileSystem, Path, five child-process lifecycle cases, Jj, and
|
|
219
|
+
* HttpClient.
|
|
220
|
+
*
|
|
221
|
+
* @category testing
|
|
222
|
+
* @since 1.0.0-rc.0
|
|
223
|
+
*/
|
|
224
|
+
export declare const runHostContract: (name: string, layer: HostContractLayer, caps: HostContractCapabilities) => void;
|
|
225
|
+
//# sourceMappingURL=HostContract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HostContract.d.ts","sourceRoot":"","sources":["../../../src/test/HostContract.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH,OAAO,KAAK,EAAE,EAAE,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,EAAY,MAAM,EAAS,UAAU,EAAE,KAAK,KAAK,EAAU,IAAI,EAAU,MAAM,QAAQ,CAAA;AAC9F,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;AAC5D,OAAO,KAAK,iBAAiB,MAAM,wCAAwC,CAAA;AAC3E,OAAO,KAAK,KAAK,kBAAkB,MAAM,yCAAyC,CAAA;AAClF,OAAO,KAAK,YAAY,MAAM,sCAAsC,CAAA;AACpE,OAAO,EAA2B,mBAAmB,EAAE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