@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,65 @@
|
|
|
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 key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var TestGrantStore_exports = {};
|
|
20
|
+
__export(TestGrantStore_exports, {
|
|
21
|
+
layerAllow: () => layerAllow,
|
|
22
|
+
layerDeny: () => layerDeny,
|
|
23
|
+
layerScripted: () => layerScripted
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(TestGrantStore_exports);
|
|
26
|
+
var import_Permission = require("@smthrs/capability/Permission");
|
|
27
|
+
var import_effect = require("effect");
|
|
28
|
+
var import_GrantStore = require("../GrantStore.js");
|
|
29
|
+
var import_GrantStore2 = require("../GrantStore.js");
|
|
30
|
+
const layerAllow = import_GrantStore2.layerNoop;
|
|
31
|
+
const layerDeny = (reason = "denied by test") => {
|
|
32
|
+
const service = import_GrantStore2.GrantStore.of({
|
|
33
|
+
policy: import_GrantStore.emptyPolicy,
|
|
34
|
+
check: import_effect.Effect.fn("GrantStore.check")((capability) => import_effect.Effect.fail((0, import_Permission.permissionDenied)(capability, reason))),
|
|
35
|
+
reply: import_effect.Effect.fn("GrantStore.reply")(() => import_effect.Effect.fail(new import_Permission.GrantStoreError({ code: "request_not_found" }))),
|
|
36
|
+
list: import_effect.Effect.fn("GrantStore.list")(() => import_effect.Effect.succeed([]))(),
|
|
37
|
+
grantEnvelope: import_effect.Effect.fn("GrantStore.grantEnvelope")(() => import_effect.Effect.void)
|
|
38
|
+
});
|
|
39
|
+
return import_effect.Layer.succeed(import_GrantStore2.GrantStore)(service);
|
|
40
|
+
};
|
|
41
|
+
const layerScripted = (replies) => import_effect.Layer.effect(
|
|
42
|
+
import_GrantStore2.GrantStore,
|
|
43
|
+
import_effect.Effect.sync(() => {
|
|
44
|
+
let index = 0;
|
|
45
|
+
const service = import_GrantStore2.GrantStore.of({
|
|
46
|
+
policy: import_GrantStore.emptyPolicy,
|
|
47
|
+
check: import_effect.Effect.fn("GrantStore.check")(
|
|
48
|
+
(capability) => import_effect.Effect.suspend(() => {
|
|
49
|
+
const reply = replies[index++];
|
|
50
|
+
return reply !== void 0 && reply !== "deny" ? import_effect.Effect.void : import_effect.Effect.fail(
|
|
51
|
+
(0, import_Permission.permissionDenied)(
|
|
52
|
+
capability,
|
|
53
|
+
reply === void 0 ? "permission reply script exhausted" : "permission request denied"
|
|
54
|
+
)
|
|
55
|
+
);
|
|
56
|
+
})
|
|
57
|
+
),
|
|
58
|
+
reply: import_effect.Effect.fn("GrantStore.reply")(() => import_effect.Effect.fail(new import_Permission.GrantStoreError({ code: "request_not_found" }))),
|
|
59
|
+
list: import_effect.Effect.fn("GrantStore.list")(() => import_effect.Effect.succeed([]))(),
|
|
60
|
+
grantEnvelope: import_effect.Effect.fn("GrantStore.grantEnvelope")(() => import_effect.Effect.void)
|
|
61
|
+
});
|
|
62
|
+
return service;
|
|
63
|
+
})
|
|
64
|
+
);
|
|
65
|
+
//# sourceMappingURL=TestGrantStore.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/test/TestGrantStore.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Deterministic grant-store layers for tests.\n *\n * @since 1.0.0-rc.0\n */\n\nimport { GrantStoreError, permissionDenied } from \"@smthrs/capability/Permission\"\nimport { Effect, Layer } from \"effect\"\nimport { emptyPolicy as closedPolicy } from \"../GrantStore.ts\"\nimport { GrantStore, layerNoop, type Resolution, type Service } from \"../GrantStore.ts\"\n\n/**\n * An allow-all grant store.\n *\n * @category layers\n * @since 1.0.0-rc.0\n */\nexport const layerAllow: Layer.Layer<GrantStore> = layerNoop\n\n/**\n * Provides a grant store that denies every capability.\n *\n * @category layers\n * @since 1.0.0-rc.0\n */\nexport const layerDeny = (reason = \"denied by test\"): Layer.Layer<GrantStore> => {\n const service = GrantStore.of({\n policy: closedPolicy,\n check: Effect.fn(\"GrantStore.check\")((capability) => Effect.fail(permissionDenied(capability, reason))),\n reply: Effect.fn(\"GrantStore.reply\")(() => Effect.fail(new GrantStoreError({ code: \"request_not_found\" }))),\n list: Effect.fn(\"GrantStore.list\")(() => Effect.succeed([]))(),\n grantEnvelope: Effect.fn(\"GrantStore.grantEnvelope\")(() => Effect.void)\n })\n return Layer.succeed(GrantStore)(service)\n}\n\n/**\n * Provides a grant store whose checks consume a deterministic sequence of\n * attended-style replies. `once`, `run`, and `remembered` allow the check;\n * `deny` rejects it. Exhausting the script rejects further checks.\n *\n * @category layers\n * @since 1.0.0-rc.0\n */\nexport const layerScripted = (\n replies: ReadonlyArray<Resolution>\n): Layer.Layer<GrantStore> =>\n Layer.effect(\n GrantStore,\n Effect.sync(() => {\n let index = 0\n const service: Service = GrantStore.of({\n policy: closedPolicy,\n check: Effect.fn(\"GrantStore.check\")((capability) =>\n Effect.suspend(() => {\n const reply = replies[index++]\n return reply !== undefined && reply !== \"deny\"\n ? Effect.void\n : Effect.fail(\n permissionDenied(\n capability,\n reply === undefined ? \"permission reply script exhausted\" : \"permission request denied\"\n )\n )\n })\n ),\n reply: Effect.fn(\"GrantStore.reply\")(() => Effect.fail(new GrantStoreError({ code: \"request_not_found\" }))),\n list: Effect.fn(\"GrantStore.list\")(() => Effect.succeed([]))(),\n grantEnvelope: Effect.fn(\"GrantStore.grantEnvelope\")(() => Effect.void)\n })\n return service\n })\n )\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,wBAAkD;AAClD,oBAA8B;AAC9B,wBAA4C;AAC5C,IAAAA,qBAAqE;AAQ9D,MAAM,aAAsC;AAQ5C,MAAM,YAAY,CAAC,SAAS,qBAA8C;AAC/E,QAAM,UAAU,8BAAW,GAAG;AAAA,IAC5B,QAAQ,kBAAAC;AAAA,IACR,OAAO,qBAAO,GAAG,kBAAkB,EAAE,CAAC,eAAe,qBAAO,SAAK,oCAAiB,YAAY,MAAM,CAAC,CAAC;AAAA,IACtG,OAAO,qBAAO,GAAG,kBAAkB,EAAE,MAAM,qBAAO,KAAK,IAAI,kCAAgB,EAAE,MAAM,oBAAoB,CAAC,CAAC,CAAC;AAAA,IAC1G,MAAM,qBAAO,GAAG,iBAAiB,EAAE,MAAM,qBAAO,QAAQ,CAAC,CAAC,CAAC,EAAE;AAAA,IAC7D,eAAe,qBAAO,GAAG,0BAA0B,EAAE,MAAM,qBAAO,IAAI;AAAA,EACxE,CAAC;AACD,SAAO,oBAAM,QAAQ,6BAAU,EAAE,OAAO;AAC1C;AAUO,MAAM,gBAAgB,CAC3B,YAEA,oBAAM;AAAA,EACJ;AAAA,EACA,qBAAO,KAAK,MAAM;AAChB,QAAI,QAAQ;AACZ,UAAM,UAAmB,8BAAW,GAAG;AAAA,MACrC,QAAQ,kBAAAA;AAAA,MACR,OAAO,qBAAO,GAAG,kBAAkB;AAAA,QAAE,CAAC,eACpC,qBAAO,QAAQ,MAAM;AACnB,gBAAM,QAAQ,QAAQ,OAAO;AAC7B,iBAAO,UAAU,UAAa,UAAU,SACpC,qBAAO,OACP,qBAAO;AAAA,gBACP;AAAA,cACE;AAAA,cACA,UAAU,SAAY,sCAAsC;AAAA,YAC9D;AAAA,UACF;AAAA,QACJ,CAAC;AAAA,MACH;AAAA,MACA,OAAO,qBAAO,GAAG,kBAAkB,EAAE,MAAM,qBAAO,KAAK,IAAI,kCAAgB,EAAE,MAAM,oBAAoB,CAAC,CAAC,CAAC;AAAA,MAC1G,MAAM,qBAAO,GAAG,iBAAiB,EAAE,MAAM,qBAAO,QAAQ,CAAC,CAAC,CAAC,EAAE;AAAA,MAC7D,eAAe,qBAAO,GAAG,0BAA0B,EAAE,MAAM,qBAAO,IAAI;AAAA,IACxE,CAAC;AACD,WAAO;AAAA,EACT,CAAC;AACH;",
|
|
6
|
+
"names": ["import_GrantStore", "closedPolicy"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CapabilitySet.d.ts","sourceRoot":"","sources":["../../src/CapabilitySet.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,kCAAkC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CapabilitySet.js","sourceRoot":"","sources":["../../src/CapabilitySet.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,kCAAkC,CAAA","sourcesContent":["/**\n * The shared monotone authority implementation used by declarations and guards.\n * @since 1.0.0\n */\n\nexport * from \"@smthrs/capability/CapabilitySet\"\n"]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Least-authority environment construction for child processes.
|
|
3
|
+
*
|
|
4
|
+
* @since 1.0.0-rc.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Credential-bearing field names shared with the model request boundary.
|
|
8
|
+
*
|
|
9
|
+
* `token`, `key` (optionally followed by a separated `id`), and `pat` are
|
|
10
|
+
* anchored to complete or separator-delimited suffixes so names such as
|
|
11
|
+
* `TOKEN_COUNT` and `KEYBOARD` remain ordinary diagnostics. Keeping this rule
|
|
12
|
+
* below the model and process layers gives request validation and child
|
|
13
|
+
* spawning one definition of a sensitive name.
|
|
14
|
+
*
|
|
15
|
+
* @category constants
|
|
16
|
+
* @since 1.0.0-rc.0
|
|
17
|
+
*/
|
|
18
|
+
export declare const credentialNamePattern: RegExp;
|
|
19
|
+
/**
|
|
20
|
+
* Reports whether a field name conventionally carries credentials.
|
|
21
|
+
*
|
|
22
|
+
* @category predicates
|
|
23
|
+
* @since 1.0.0-rc.0
|
|
24
|
+
*/
|
|
25
|
+
export declare const isCredentialName: (name: string) => boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Ambient variables a child may inherit for executable lookup, identity,
|
|
28
|
+
* locale, terminal behavior, temporary files, and its shell.
|
|
29
|
+
*
|
|
30
|
+
* Locale category variables are admitted separately by their `LC_` prefix.
|
|
31
|
+
*
|
|
32
|
+
* @category constants
|
|
33
|
+
* @since 1.0.0-rc.0
|
|
34
|
+
*/
|
|
35
|
+
export declare const inheritedNames: ReadonlyArray<string>;
|
|
36
|
+
/**
|
|
37
|
+
* Reports whether a variable belongs to the bootstrap set {@link make}
|
|
38
|
+
* inherits: one of {@link inheritedNames} or a locale `LC_` category,
|
|
39
|
+
* compared case-insensitively.
|
|
40
|
+
*
|
|
41
|
+
* @category predicates
|
|
42
|
+
* @since 1.0.0-rc.1
|
|
43
|
+
*/
|
|
44
|
+
export declare const isInheritedName: (name: string) => boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Selects the bootstrap allowlist from an ambient environment and overlays
|
|
47
|
+
* caller-declared names.
|
|
48
|
+
*
|
|
49
|
+
* Sensitive-looking ambient names are withheld even if a future bootstrap
|
|
50
|
+
* list grows to include one. A caller declaration is applied last because it
|
|
51
|
+
* is the explicit authority for that child; an `undefined` declaration
|
|
52
|
+
* removes an inherited name. The returned null-prototype record is always
|
|
53
|
+
* suitable as a replacement environment and never asks the spawner to merge
|
|
54
|
+
* the rest of the host process environment.
|
|
55
|
+
*
|
|
56
|
+
* @category constructors
|
|
57
|
+
* @since 1.0.0-rc.0
|
|
58
|
+
*/
|
|
59
|
+
export declare const make: (ambient: Readonly<Record<string, string | undefined>>, declared?: Readonly<Record<string, string | undefined>>) => Record<string, string>;
|
|
60
|
+
//# sourceMappingURL=ChildProcessEnvironment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChildProcessEnvironment.d.ts","sourceRoot":"","sources":["../../src/ChildProcessEnvironment.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,qBAAqB,QACoR,CAAA;AAEtT;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,KAAG,OAA2C,CAAA;AAE3F;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,EAAE,aAAa,CAAC,MAAM,CAQ/C,CAAA;AAIF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,KAAG,OAG9C,CAAA;AASD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,IAAI,GACf,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,EACrD,WAAU,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAM,KAC1D,MAAM,CAAC,MAAM,EAAE,MAAM,CAUvB,CAAA"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Least-authority environment construction for child processes.
|
|
3
|
+
*
|
|
4
|
+
* @since 1.0.0-rc.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Credential-bearing field names shared with the model request boundary.
|
|
8
|
+
*
|
|
9
|
+
* `token`, `key` (optionally followed by a separated `id`), and `pat` are
|
|
10
|
+
* anchored to complete or separator-delimited suffixes so names such as
|
|
11
|
+
* `TOKEN_COUNT` and `KEYBOARD` remain ordinary diagnostics. Keeping this rule
|
|
12
|
+
* below the model and process layers gives request validation and child
|
|
13
|
+
* spawning one definition of a sensitive name.
|
|
14
|
+
*
|
|
15
|
+
* @category constants
|
|
16
|
+
* @since 1.0.0-rc.0
|
|
17
|
+
*/
|
|
18
|
+
export const credentialNamePattern = /authorization|api[-_]?key|access[-_]?token|refresh[-_]?token|id[-_]?token|auth[-_]?token|api[-_]?token|session[-_]?token|bearer|(?:^|[-_])token$|(?:^|[-_])key(?:[-_]id)?$|(?:^|[-_])pat$|secret|credential|password|passphrase|passwd|signature|x-amz-signature|cookie|set[-_]?cookie|chatgpt[-_]?account[-_]?id/i;
|
|
19
|
+
/**
|
|
20
|
+
* Reports whether a field name conventionally carries credentials.
|
|
21
|
+
*
|
|
22
|
+
* @category predicates
|
|
23
|
+
* @since 1.0.0-rc.0
|
|
24
|
+
*/
|
|
25
|
+
export const isCredentialName = (name) => credentialNamePattern.test(name);
|
|
26
|
+
/**
|
|
27
|
+
* Ambient variables a child may inherit for executable lookup, identity,
|
|
28
|
+
* locale, terminal behavior, temporary files, and its shell.
|
|
29
|
+
*
|
|
30
|
+
* Locale category variables are admitted separately by their `LC_` prefix.
|
|
31
|
+
*
|
|
32
|
+
* @category constants
|
|
33
|
+
* @since 1.0.0-rc.0
|
|
34
|
+
*/
|
|
35
|
+
export const inheritedNames = Object.freeze([
|
|
36
|
+
"PATH",
|
|
37
|
+
"HOME",
|
|
38
|
+
"USER",
|
|
39
|
+
"LANG",
|
|
40
|
+
"TERM",
|
|
41
|
+
"TMPDIR",
|
|
42
|
+
"SHELL"
|
|
43
|
+
]);
|
|
44
|
+
const inherited = new Set(inheritedNames);
|
|
45
|
+
/**
|
|
46
|
+
* Reports whether a variable belongs to the bootstrap set {@link make}
|
|
47
|
+
* inherits: one of {@link inheritedNames} or a locale `LC_` category,
|
|
48
|
+
* compared case-insensitively.
|
|
49
|
+
*
|
|
50
|
+
* @category predicates
|
|
51
|
+
* @since 1.0.0-rc.1
|
|
52
|
+
*/
|
|
53
|
+
export const isInheritedName = (name) => {
|
|
54
|
+
const canonical = name.toUpperCase();
|
|
55
|
+
return inherited.has(canonical) || canonical.startsWith("LC_");
|
|
56
|
+
};
|
|
57
|
+
const remove = (environment, name) => {
|
|
58
|
+
const canonical = name.toUpperCase();
|
|
59
|
+
for (const present of Object.keys(environment)) {
|
|
60
|
+
if (present.toUpperCase() === canonical)
|
|
61
|
+
delete environment[present];
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Selects the bootstrap allowlist from an ambient environment and overlays
|
|
66
|
+
* caller-declared names.
|
|
67
|
+
*
|
|
68
|
+
* Sensitive-looking ambient names are withheld even if a future bootstrap
|
|
69
|
+
* list grows to include one. A caller declaration is applied last because it
|
|
70
|
+
* is the explicit authority for that child; an `undefined` declaration
|
|
71
|
+
* removes an inherited name. The returned null-prototype record is always
|
|
72
|
+
* suitable as a replacement environment and never asks the spawner to merge
|
|
73
|
+
* the rest of the host process environment.
|
|
74
|
+
*
|
|
75
|
+
* @category constructors
|
|
76
|
+
* @since 1.0.0-rc.0
|
|
77
|
+
*/
|
|
78
|
+
export const make = (ambient, declared = {}) => {
|
|
79
|
+
const environment = Object.create(null);
|
|
80
|
+
for (const [name, value] of Object.entries(ambient)) {
|
|
81
|
+
if (value !== undefined && isInheritedName(name) && !isCredentialName(name))
|
|
82
|
+
environment[name] = value;
|
|
83
|
+
}
|
|
84
|
+
for (const [name, value] of Object.entries(declared)) {
|
|
85
|
+
remove(environment, name);
|
|
86
|
+
if (value !== undefined)
|
|
87
|
+
environment[name] = value;
|
|
88
|
+
}
|
|
89
|
+
return environment;
|
|
90
|
+
};
|
|
91
|
+
//# sourceMappingURL=ChildProcessEnvironment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChildProcessEnvironment.js","sourceRoot":"","sources":["../../src/ChildProcessEnvironment.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAChC,oTAAoT,CAAA;AAEtT;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAY,EAAW,EAAE,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAE3F;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,cAAc,GAA0B,MAAM,CAAC,MAAM,CAAC;IACjE,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,QAAQ;IACR,OAAO;CACR,CAAC,CAAA;AAEF,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,cAAc,CAAC,CAAA;AAEzC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAAY,EAAW,EAAE;IACvD,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,EAAE,CAAA;IACpC,OAAO,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;AAChE,CAAC,CAAA;AAED,MAAM,MAAM,GAAG,CAAC,WAAmC,EAAE,IAAY,EAAQ,EAAE;IACzE,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,EAAE,CAAA;IACpC,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;QAC/C,IAAI,OAAO,CAAC,WAAW,EAAE,KAAK,SAAS;YAAE,OAAO,WAAW,CAAC,OAAO,CAAC,CAAA;IACtE,CAAC;AACH,CAAC,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAClB,OAAqD,EACrD,WAAyD,EAAE,EACnC,EAAE;IAC1B,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAA2B,CAAA;IACjE,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACpD,IAAI,KAAK,KAAK,SAAS,IAAI,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC;YAAE,WAAW,CAAC,IAAI,CAAC,GAAG,KAAK,CAAA;IACxG,CAAC;IACD,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACrD,MAAM,CAAC,WAAW,EAAE,IAAI,CAAC,CAAA;QACzB,IAAI,KAAK,KAAK,SAAS;YAAE,WAAW,CAAC,IAAI,CAAC,GAAG,KAAK,CAAA;IACpD,CAAC;IACD,OAAO,WAAW,CAAA;AACpB,CAAC,CAAA","sourcesContent":["/**\n * Least-authority environment construction for child processes.\n *\n * @since 1.0.0-rc.0\n */\n\n/**\n * Credential-bearing field names shared with the model request boundary.\n *\n * `token`, `key` (optionally followed by a separated `id`), and `pat` are\n * anchored to complete or separator-delimited suffixes so names such as\n * `TOKEN_COUNT` and `KEYBOARD` remain ordinary diagnostics. Keeping this rule\n * below the model and process layers gives request validation and child\n * spawning one definition of a sensitive name.\n *\n * @category constants\n * @since 1.0.0-rc.0\n */\nexport const credentialNamePattern =\n /authorization|api[-_]?key|access[-_]?token|refresh[-_]?token|id[-_]?token|auth[-_]?token|api[-_]?token|session[-_]?token|bearer|(?:^|[-_])token$|(?:^|[-_])key(?:[-_]id)?$|(?:^|[-_])pat$|secret|credential|password|passphrase|passwd|signature|x-amz-signature|cookie|set[-_]?cookie|chatgpt[-_]?account[-_]?id/i\n\n/**\n * Reports whether a field name conventionally carries credentials.\n *\n * @category predicates\n * @since 1.0.0-rc.0\n */\nexport const isCredentialName = (name: string): boolean => credentialNamePattern.test(name)\n\n/**\n * Ambient variables a child may inherit for executable lookup, identity,\n * locale, terminal behavior, temporary files, and its shell.\n *\n * Locale category variables are admitted separately by their `LC_` prefix.\n *\n * @category constants\n * @since 1.0.0-rc.0\n */\nexport const inheritedNames: ReadonlyArray<string> = Object.freeze([\n \"PATH\",\n \"HOME\",\n \"USER\",\n \"LANG\",\n \"TERM\",\n \"TMPDIR\",\n \"SHELL\"\n])\n\nconst inherited = new Set(inheritedNames)\n\n/**\n * Reports whether a variable belongs to the bootstrap set {@link make}\n * inherits: one of {@link inheritedNames} or a locale `LC_` category,\n * compared case-insensitively.\n *\n * @category predicates\n * @since 1.0.0-rc.1\n */\nexport const isInheritedName = (name: string): boolean => {\n const canonical = name.toUpperCase()\n return inherited.has(canonical) || canonical.startsWith(\"LC_\")\n}\n\nconst remove = (environment: Record<string, string>, name: string): void => {\n const canonical = name.toUpperCase()\n for (const present of Object.keys(environment)) {\n if (present.toUpperCase() === canonical) delete environment[present]\n }\n}\n\n/**\n * Selects the bootstrap allowlist from an ambient environment and overlays\n * caller-declared names.\n *\n * Sensitive-looking ambient names are withheld even if a future bootstrap\n * list grows to include one. A caller declaration is applied last because it\n * is the explicit authority for that child; an `undefined` declaration\n * removes an inherited name. The returned null-prototype record is always\n * suitable as a replacement environment and never asks the spawner to merge\n * the rest of the host process environment.\n *\n * @category constructors\n * @since 1.0.0-rc.0\n */\nexport const make = (\n ambient: Readonly<Record<string, string | undefined>>,\n declared: Readonly<Record<string, string | undefined>> = {}\n): Record<string, string> => {\n const environment = Object.create(null) as Record<string, string>\n for (const [name, value] of Object.entries(ambient)) {\n if (value !== undefined && isInheritedName(name) && !isCredentialName(name)) environment[name] = value\n }\n for (const [name, value] of Object.entries(declared)) {\n remove(environment, name)\n if (value !== undefined) environment[name] = value\n }\n return environment\n}\n"]}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Permission-aware process spawning.
|
|
3
|
+
*
|
|
4
|
+
* Smithers has no shell service of its own — process execution is Effect's
|
|
5
|
+
* `effect/unstable/process`. The only thing the kernel adds is the
|
|
6
|
+
* `proc:spawn` capability check and the host confinement wrapper, applied to
|
|
7
|
+
* the one primitive every other helper is derived from.
|
|
8
|
+
*
|
|
9
|
+
* There is no kernel spawner interface and no kernel spawner tag. Effect owns
|
|
10
|
+
* both, and its tag fixes the error channel to `PlatformError`, so this module
|
|
11
|
+
* is only the middleware: a `Layer` over Effect's own tag. A denied command is
|
|
12
|
+
* projected into `PlatformError` by `Permission.toPlatformError`, which keeps
|
|
13
|
+
* the structured kernel failure on the error's `cause`. Because the channel
|
|
14
|
+
* stays `PlatformError`, the full six-method surface is derived from the one
|
|
15
|
+
* guarded `spawn` through Effect's own `ChildProcessSpawner.make` without a
|
|
16
|
+
* cast.
|
|
17
|
+
*
|
|
18
|
+
* Governing design:
|
|
19
|
+
* `docs/specs/Concepts/Permission Kernel.md` and
|
|
20
|
+
* `docs/specs/Concepts/Host Adapters.md`.
|
|
21
|
+
*
|
|
22
|
+
* @since 1.0.0-rc.0
|
|
23
|
+
*/
|
|
24
|
+
import { Layer, Path } from "effect";
|
|
25
|
+
import { ChildProcessSpawner } from "effect/unstable/process/ChildProcessSpawner";
|
|
26
|
+
import { GrantStore } from "./GrantStore.ts";
|
|
27
|
+
import { Workspace } from "./Workspace.ts";
|
|
28
|
+
/**
|
|
29
|
+
* Effect's own process spawner tag, unchanged. Re-exported so the kernel
|
|
30
|
+
* namespace stays one-stop; it is the *same* tag, never a second one.
|
|
31
|
+
*
|
|
32
|
+
* @category services
|
|
33
|
+
* @since 1.0.0-rc.0
|
|
34
|
+
*/
|
|
35
|
+
export { ChildProcessSpawner } from "effect/unstable/process/ChildProcessSpawner";
|
|
36
|
+
/**
|
|
37
|
+
* Derives the full six-method surface from one `spawn`, so `exitCode`,
|
|
38
|
+
* `string`, `lines`, and both `stream*` helpers can never bypass whatever
|
|
39
|
+
* `spawn` was given.
|
|
40
|
+
*
|
|
41
|
+
* @category constructors
|
|
42
|
+
* @since 1.0.0-rc.0
|
|
43
|
+
*/
|
|
44
|
+
export { make } from "effect/unstable/process/ChildProcessSpawner";
|
|
45
|
+
/**
|
|
46
|
+
* Constructs an unavailable spawner stub.
|
|
47
|
+
*
|
|
48
|
+
* Every derived helper reports the missing host as a `NotFound`
|
|
49
|
+
* `PlatformError` naming the command line, so an unconfigured capability
|
|
50
|
+
* answers rather than vanishing.
|
|
51
|
+
*
|
|
52
|
+
* @category constructors
|
|
53
|
+
* @since 1.0.0-rc.0
|
|
54
|
+
*/
|
|
55
|
+
export declare const makeNoop: (overrides?: Partial<ChildProcessSpawner["Service"]>) => ChildProcessSpawner["Service"];
|
|
56
|
+
/**
|
|
57
|
+
* Provides an unavailable spawner stub.
|
|
58
|
+
*
|
|
59
|
+
* @category layers
|
|
60
|
+
* @since 1.0.0-rc.0
|
|
61
|
+
*/
|
|
62
|
+
export declare const layerNoop: (overrides?: Partial<ChildProcessSpawner["Service"]>) => Layer.Layer<ChildProcessSpawner>;
|
|
63
|
+
/**
|
|
64
|
+
* Decorates the process spawner in place with a `proc:spawn` capability check.
|
|
65
|
+
*
|
|
66
|
+
* The check is suspended into the spawn itself, so building a `Command` or a
|
|
67
|
+
* stream neither requests permission nor starts a process; only running one
|
|
68
|
+
* does. Every pipeline stage is checked as its own capability, left to right,
|
|
69
|
+
* and no stage starts until all pass. A stage's resource is
|
|
70
|
+
* `CommandLine.resource`: the command line `CommandLine.render` produces, with
|
|
71
|
+
* a `shell: true` line that holds shell control syntax marked as
|
|
72
|
+
* `sh -c '<line>'`, any environment variable the child would not inherit from
|
|
73
|
+
* this process named in an `env <NAME>… -- ` prefix, and a working directory
|
|
74
|
+
* outside `Workspace.root` named in a `cwd <path> -- ` prefix. Custom shell
|
|
75
|
+
* paths are included explicitly in the resource; browser and remote adapters
|
|
76
|
+
* reject them rather than silently substituting a different shell.
|
|
77
|
+
*
|
|
78
|
+
* Every approved stage requires `ProcessConfinement` in the host context.
|
|
79
|
+
* A missing service refuses spawning; its `layerNoop` is the explicit choice
|
|
80
|
+
* for an unconfined host.
|
|
81
|
+
*
|
|
82
|
+
* Pipeline `from`/`to` routing remains outside the grant. The working
|
|
83
|
+
* directory and overridden environment names also reach attended surfaces as
|
|
84
|
+
* display metadata; environment values never leave the command.
|
|
85
|
+
*
|
|
86
|
+
* The layer provides the tag it also requires: compose it over a host spawner
|
|
87
|
+
* layer with `Layer.provide` and a `ChildProcess.Command` run as a plain
|
|
88
|
+
* `Effect` is checked too.
|
|
89
|
+
*
|
|
90
|
+
* A command with no `cwd`, or a relative one, runs in `Workspace.root`, never
|
|
91
|
+
* the process's own directory; the check sees that resolved directory. When
|
|
92
|
+
* the host filesystem is in the layer's context, the working directory and
|
|
93
|
+
* `Workspace.root` are compared by real path, so a symlink inside the
|
|
94
|
+
* workspace that leads out of it is named, as its target, in the `cwd` prefix.
|
|
95
|
+
*
|
|
96
|
+
* @category layers
|
|
97
|
+
* @since 1.0.0-rc.0
|
|
98
|
+
*/
|
|
99
|
+
export declare const layer: Layer.Layer<ChildProcessSpawner, never, ChildProcessSpawner | GrantStore | Path.Path | Workspace>;
|
|
100
|
+
//# sourceMappingURL=ChildProcessSpawner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChildProcessSpawner.d.ts","sourceRoot":"","sources":["../../src/ChildProcessSpawner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,EAAsB,KAAK,EAAU,IAAI,EAAc,MAAM,QAAQ,CAAA;AAG5E,OAAO,EAAE,mBAAmB,EAAuB,MAAM,6CAA6C,CAAA;AAEtG,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAK5C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAgK1C;;;;;;GAMG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAA;AAEjF;;;;;;;GAOG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,6CAA6C,CAAA;AAElE;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ,GACnB,YAAW,OAAO,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAM,KACtD,mBAAmB,CAAC,SAAS,CAY9B,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,SAAS,GACpB,YAAW,OAAO,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAM,KACtD,KAAK,CAAC,KAAK,CAAC,mBAAmB,CAA4D,CAAA;AAE9F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,KAAK,CAC7B,mBAAmB,EACnB,KAAK,EACL,mBAAmB,GAAG,UAAU,GAAG,IAAI,CAAC,IAAI,GAAG,SAAS,CA4HzD,CAAA"}
|