@smthrs/kernel 1.0.0-rc.5 → 1.0.0-rc.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/README.md +4 -4
  2. package/dist/cjs/ChildProcessSpawner.d.ts +4 -4
  3. package/dist/cjs/ChildProcessSpawner.d.ts.map +1 -1
  4. package/dist/cjs/ChildProcessSpawner.js +4 -4
  5. package/dist/cjs/ChildProcessSpawner.js.map +1 -1
  6. package/dist/cjs/CommandLine.d.ts +2 -2
  7. package/dist/cjs/CommandLine.d.ts.map +1 -1
  8. package/dist/cjs/CommandLine.js.map +1 -1
  9. package/dist/cjs/ContainedSpawner.d.ts +2 -2
  10. package/dist/cjs/ContainedSpawner.d.ts.map +1 -1
  11. package/dist/cjs/ContainedSpawner.js +2 -2
  12. package/dist/cjs/ContainedSpawner.js.map +2 -2
  13. package/dist/cjs/FileSystem.d.ts.map +1 -1
  14. package/dist/cjs/FileSystem.js +4 -3
  15. package/dist/cjs/FileSystem.js.map +2 -2
  16. package/dist/cjs/HostServices.d.ts +3 -3
  17. package/dist/cjs/HostServices.d.ts.map +1 -1
  18. package/dist/cjs/HostServices.js +2 -2
  19. package/dist/cjs/HostServices.js.map +1 -1
  20. package/dist/cjs/HttpClient.d.ts +5 -5
  21. package/dist/cjs/HttpClient.d.ts.map +1 -1
  22. package/dist/cjs/HttpClient.js +9 -9
  23. package/dist/cjs/HttpClient.js.map +1 -1
  24. package/dist/cjs/ProcessConfinement.d.ts +1 -1
  25. package/dist/cjs/ProcessConfinement.d.ts.map +1 -1
  26. package/dist/cjs/ProcessConfinement.js.map +1 -1
  27. package/dist/cjs/Rooted.d.ts +2 -2
  28. package/dist/cjs/Rooted.d.ts.map +1 -1
  29. package/dist/cjs/Rooted.js +2 -2
  30. package/dist/cjs/Rooted.js.map +1 -1
  31. package/dist/cjs/internal/Containment.d.ts +1 -1
  32. package/dist/cjs/internal/Containment.d.ts.map +1 -1
  33. package/dist/cjs/internal/Containment.js.map +1 -1
  34. package/dist/cjs/internal/Pipeline.d.ts +2 -2
  35. package/dist/cjs/internal/Pipeline.d.ts.map +1 -1
  36. package/dist/cjs/internal/Pipeline.js +2 -2
  37. package/dist/cjs/internal/Pipeline.js.map +2 -2
  38. package/dist/cjs/test/HostContract.d.ts +5 -5
  39. package/dist/cjs/test/HostContract.d.ts.map +1 -1
  40. package/dist/cjs/test/HostContract.js +4 -4
  41. package/dist/cjs/test/HostContract.js.map +1 -1
  42. package/dist/esm/ChildProcessSpawner.d.ts +4 -4
  43. package/dist/esm/ChildProcessSpawner.d.ts.map +1 -1
  44. package/dist/esm/ChildProcessSpawner.js +5 -5
  45. package/dist/esm/ChildProcessSpawner.js.map +1 -1
  46. package/dist/esm/CommandLine.d.ts +2 -2
  47. package/dist/esm/CommandLine.d.ts.map +1 -1
  48. package/dist/esm/CommandLine.js +1 -1
  49. package/dist/esm/CommandLine.js.map +1 -1
  50. package/dist/esm/ContainedSpawner.d.ts +2 -2
  51. package/dist/esm/ContainedSpawner.d.ts.map +1 -1
  52. package/dist/esm/ContainedSpawner.js +2 -2
  53. package/dist/esm/ContainedSpawner.js.map +1 -1
  54. package/dist/esm/FileSystem.d.ts.map +1 -1
  55. package/dist/esm/FileSystem.js +5 -4
  56. package/dist/esm/FileSystem.js.map +1 -1
  57. package/dist/esm/HostServices.d.ts +3 -3
  58. package/dist/esm/HostServices.d.ts.map +1 -1
  59. package/dist/esm/HostServices.js +2 -2
  60. package/dist/esm/HostServices.js.map +1 -1
  61. package/dist/esm/HttpClient.d.ts +5 -5
  62. package/dist/esm/HttpClient.d.ts.map +1 -1
  63. package/dist/esm/HttpClient.js +9 -9
  64. package/dist/esm/HttpClient.js.map +1 -1
  65. package/dist/esm/ProcessConfinement.d.ts +1 -1
  66. package/dist/esm/ProcessConfinement.d.ts.map +1 -1
  67. package/dist/esm/ProcessConfinement.js.map +1 -1
  68. package/dist/esm/Rooted.d.ts +2 -2
  69. package/dist/esm/Rooted.d.ts.map +1 -1
  70. package/dist/esm/Rooted.js +2 -2
  71. package/dist/esm/Rooted.js.map +1 -1
  72. package/dist/esm/internal/Containment.d.ts +1 -1
  73. package/dist/esm/internal/Containment.d.ts.map +1 -1
  74. package/dist/esm/internal/Containment.js.map +1 -1
  75. package/dist/esm/internal/Pipeline.d.ts +2 -2
  76. package/dist/esm/internal/Pipeline.d.ts.map +1 -1
  77. package/dist/esm/internal/Pipeline.js +2 -2
  78. package/dist/esm/internal/Pipeline.js.map +1 -1
  79. package/dist/esm/test/HostContract.d.ts +5 -5
  80. package/dist/esm/test/HostContract.d.ts.map +1 -1
  81. package/dist/esm/test/HostContract.js +4 -4
  82. package/dist/esm/test/HostContract.js.map +1 -1
  83. package/docs/api.md +2 -2
  84. package/docs/guides/adapt-a-new-host-platform.md +3 -3
  85. package/docs/installation.md +3 -3
  86. package/docs/quickstart.md +1 -1
  87. package/docs/testing.md +1 -1
  88. package/package.json +10 -11
  89. package/src/ChildProcessSpawner.ts +5 -5
  90. package/src/CommandLine.ts +2 -2
  91. package/src/ContainedSpawner.ts +2 -6
  92. package/src/FileSystem.ts +4 -4
  93. package/src/HostServices.ts +3 -3
  94. package/src/HttpClient.ts +9 -9
  95. package/src/ProcessConfinement.ts +1 -1
  96. package/src/Rooted.ts +2 -2
  97. package/src/internal/Containment.ts +1 -1
  98. package/src/internal/Pipeline.ts +2 -2
  99. package/src/test/HostContract.ts +5 -5
package/README.md CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  Release candidate scope, host requirements and compatibility review are defined in the [library support policy](https://github.com/smithersai/smithers/blob/main/RELEASE_SUPPORT.md).
4
4
 
5
- This package declares `effect` as an exact
6
- `4.0.0-rc.115` peer dependency. Keep the application on that version so
7
- all Smithers packages share one Effect runtime.
5
+ This package declares `effect` as a `^4.0.4` peer dependency. Install one
6
+ `effect` release in that range so all Smithers packages share one Effect
7
+ runtime.
8
8
 
9
9
  **Documentation:** https://kernel.smithers.sh
10
10
 
@@ -29,7 +29,7 @@ without ever mentioning permission.
29
29
  [installation page](https://kernel.smithers.sh/installation/) covers how to
30
30
  depend on it from a checkout, the import forms, and the two test helpers.
31
31
 
32
- It needs Node.js 26.4.0 or later and `effect` 4.0.0-rc.115. It carries no
32
+ It needs Node.js 26.4.0 or later and `effect` `^4.0.4`. It carries no
33
33
  platform implementations of its own, so a composition that reaches a real
34
34
  machine also adds a bundle such as
35
35
  [`@smthrs/platform-node`](https://platform-node.smithers.sh).
@@ -2,7 +2,7 @@
2
2
  * Permission-aware process spawning.
3
3
  *
4
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
5
+ * `effect/process`. The only thing the kernel adds is the
6
6
  * `proc:spawn` capability check and the host confinement wrapper, applied to
7
7
  * the one primitive every other helper is derived from.
8
8
  *
@@ -22,7 +22,7 @@
22
22
  * @since 1.0.0-rc.0
23
23
  */
24
24
  import { Layer, Path } from "effect";
25
- import { ChildProcessSpawner } from "effect/unstable/process/ChildProcessSpawner";
25
+ import { ChildProcessSpawner } from "effect/process/ChildProcessSpawner";
26
26
  import { GrantStore } from "./GrantStore.ts";
27
27
  import { Workspace } from "./Workspace.ts";
28
28
  /**
@@ -32,7 +32,7 @@ import { Workspace } from "./Workspace.ts";
32
32
  * @category services
33
33
  * @since 1.0.0-rc.0
34
34
  */
35
- export { ChildProcessSpawner } from "effect/unstable/process/ChildProcessSpawner";
35
+ export { ChildProcessSpawner } from "effect/process/ChildProcessSpawner";
36
36
  /**
37
37
  * Derives the full six-method surface from one `spawn`, so `exitCode`,
38
38
  * `string`, `lines`, and both `stream*` helpers can never bypass whatever
@@ -41,7 +41,7 @@ export { ChildProcessSpawner } from "effect/unstable/process/ChildProcessSpawner
41
41
  * @category constructors
42
42
  * @since 1.0.0-rc.0
43
43
  */
44
- export { make } from "effect/unstable/process/ChildProcessSpawner";
44
+ export { make } from "effect/process/ChildProcessSpawner";
45
45
  /**
46
46
  * Constructs an unavailable spawner stub.
47
47
  *
@@ -1 +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"}
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,oCAAoC,CAAA;AAE7F,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAK5C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAgK1C;;;;;;GAMG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAA;AAExE;;;;;;;GAOG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAA;AAEzD;;;;;;;;;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"}
@@ -38,8 +38,8 @@ module.exports = __toCommonJS(ChildProcessSpawner_exports);
38
38
  var import_Permission = require("@smthrs/capability/Permission");
39
39
  var import_effect = require("effect");
40
40
  var import_PlatformError = require("effect/PlatformError");
41
- var ChildProcess = __toESM(require("effect/unstable/process/ChildProcess"), 1);
42
- var import_ChildProcessSpawner = require("effect/unstable/process/ChildProcessSpawner");
41
+ var ChildProcess = __toESM(require("effect/process/ChildProcess"), 1);
42
+ var import_ChildProcessSpawner = require("effect/process/ChildProcessSpawner");
43
43
  var CommandLine = __toESM(require("./CommandLine.js"), 1);
44
44
  var import_GrantStore = require("./GrantStore.js");
45
45
  var Containment = __toESM(require("./internal/Containment.js"), 1);
@@ -47,8 +47,8 @@ var import_makeCapability = require("./internal/makeCapability.js");
47
47
  var ProcessConfinement = __toESM(require("./ProcessConfinement.js"), 1);
48
48
  var Rooted = __toESM(require("./Rooted.js"), 1);
49
49
  var import_Workspace = require("./Workspace.js");
50
- var import_ChildProcessSpawner2 = require("effect/unstable/process/ChildProcessSpawner");
51
- var import_ChildProcessSpawner3 = require("effect/unstable/process/ChildProcessSpawner");
50
+ var import_ChildProcessSpawner2 = require("effect/process/ChildProcessSpawner");
51
+ var import_ChildProcessSpawner3 = require("effect/process/ChildProcessSpawner");
52
52
  const data = (value, name) => {
53
53
  const descriptor = Object.getOwnPropertyDescriptor(value, name);
54
54
  if (descriptor === void 0 || !("value" in descriptor)) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/ChildProcessSpawner.ts"],
4
- "sourcesContent": ["/**\n * Permission-aware process spawning.\n *\n * Smithers has no shell service of its own \u2014 process execution is Effect's\n * `effect/unstable/process`. The only thing the kernel adds is the\n * `proc:spawn` capability check and the host confinement wrapper, applied to\n * the one primitive every other helper is derived from.\n *\n * There is no kernel spawner interface and no kernel spawner tag. Effect owns\n * both, and its tag fixes the error channel to `PlatformError`, so this module\n * is only the middleware: a `Layer` over Effect's own tag. A denied command is\n * projected into `PlatformError` by `Permission.toPlatformError`, which keeps\n * the structured kernel failure on the error's `cause`. Because the channel\n * stays `PlatformError`, the full six-method surface is derived from the one\n * guarded `spawn` through Effect's own `ChildProcessSpawner.make` without a\n * cast.\n *\n * Governing design:\n * `docs/specs/Concepts/Permission Kernel.md` and\n * `docs/specs/Concepts/Host Adapters.md`.\n *\n * @since 1.0.0-rc.0\n */\n\nimport { toPlatformError } from \"@smthrs/capability/Permission\"\nimport { Effect, FileSystem, Layer, Option, Path, type Scope } from \"effect\"\nimport { type PlatformError, systemError } from \"effect/PlatformError\"\nimport * as ChildProcess from \"effect/unstable/process/ChildProcess\"\nimport { ChildProcessSpawner, make as makeSpawner } from \"effect/unstable/process/ChildProcessSpawner\"\nimport * as CommandLine from \"./CommandLine.ts\"\nimport { GrantStore } from \"./GrantStore.ts\"\nimport * as Containment from \"./internal/Containment.ts\"\nimport { makeCapability } from \"./internal/makeCapability.ts\"\nimport * as ProcessConfinement from \"./ProcessConfinement.ts\"\nimport * as Rooted from \"./Rooted.ts\"\nimport { Workspace } from \"./Workspace.ts\"\n\nconst data = (value: object, name: PropertyKey): unknown => {\n const descriptor = Object.getOwnPropertyDescriptor(value, name)\n if (descriptor === undefined || !(\"value\" in descriptor)) {\n throw new TypeError(`command ${String(name)} must be a data property`)\n }\n return descriptor.value\n}\n\nconst optionalData = (value: object, name: PropertyKey): unknown => {\n const descriptor = Object.getOwnPropertyDescriptor(value, name)\n if (descriptor === undefined) return undefined\n if (!(\"value\" in descriptor)) throw new TypeError(`command ${String(name)} must be a data property`)\n return descriptor.value\n}\n\nconst snapshotRecord = (\n value: Readonly<Record<string, string | undefined>> | undefined\n): Record<string, string | undefined> | undefined => {\n if (value === undefined) return undefined\n const snapshot: Record<string, string | undefined> = Object.create(null)\n for (const [name, descriptor] of Object.entries(Object.getOwnPropertyDescriptors(value))) {\n if (!descriptor.enumerable) continue\n if (!(\"value\" in descriptor) || (descriptor.value !== undefined && typeof descriptor.value !== \"string\")) {\n throw new TypeError(\"command environment must contain string data properties\")\n }\n snapshot[name] = descriptor.value\n }\n return Object.freeze(snapshot)\n}\n\nconst snapshotStreamConfig = <A>(value: A): A => {\n if (typeof value !== \"object\" || value === null) return value\n const descriptors = Object.getOwnPropertyDescriptors(value)\n if (descriptors.stream === undefined) return value\n if (!(\"value\" in descriptors.stream)) throw new TypeError(\"command stream must be a data property\")\n const snapshot: Record<string, unknown> = { stream: descriptors.stream.value }\n for (const name of [\"endOnDone\", \"encoding\"] as const) {\n const descriptor = descriptors[name]\n if (descriptor !== undefined) {\n if (!(\"value\" in descriptor)) throw new TypeError(`command ${name} must be a data property`)\n snapshot[name] = descriptor.value\n }\n }\n return Object.freeze(snapshot) as A\n}\n\nconst snapshotAdditionalFds = (\n value: ChildProcess.CommandOptions[\"additionalFds\"]\n): ChildProcess.CommandOptions[\"additionalFds\"] => {\n if (value === undefined) return undefined\n const snapshot: Record<`fd${number}`, ChildProcess.AdditionalFdConfig> = {}\n for (const [name, descriptor] of Object.entries(Object.getOwnPropertyDescriptors(value))) {\n if (!descriptor.enumerable) continue\n if (!(\"value\" in descriptor) || typeof descriptor.value !== \"object\" || descriptor.value === null) {\n throw new TypeError(\"additional file descriptors must be data records\")\n }\n const config = descriptor.value as ChildProcess.AdditionalFdConfig\n const type = data(config, \"type\")\n if (type === \"input\") {\n const stream = Object.getOwnPropertyDescriptor(config, \"stream\")\n snapshot[name as `fd${number}`] = Object.freeze({\n type,\n ...(stream === undefined ? {} : \"value\" in stream ? { stream: stream.value } : (() => {\n throw new TypeError(\"additional fd stream must be a data property\")\n })())\n })\n } else if (type === \"output\") {\n const sink = Object.getOwnPropertyDescriptor(config, \"sink\")\n snapshot[name as `fd${number}`] = Object.freeze({\n type,\n ...(sink === undefined ? {} : \"value\" in sink ? { sink: sink.value } : (() => {\n throw new TypeError(\"additional fd sink must be a data property\")\n })())\n })\n } else {\n throw new TypeError(\"additional file descriptor type is invalid\")\n }\n }\n return Object.freeze(snapshot)\n}\n\nconst snapshotOptions = (options: ChildProcess.CommandOptions): ChildProcess.CommandOptions =>\n Object.freeze({\n killSignal: options.killSignal,\n forceKillAfter: options.forceKillAfter,\n cwd: options.cwd,\n env: snapshotRecord(options.env),\n extendEnv: options.extendEnv,\n shell: options.shell,\n detached: options.detached,\n windowsHide: options.windowsHide,\n stdin: snapshotStreamConfig(options.stdin),\n stdout: snapshotStreamConfig(options.stdout),\n stderr: snapshotStreamConfig(options.stderr),\n additionalFds: snapshotAdditionalFds(options.additionalFds)\n })\n\nconst snapshotCommand = (command: ChildProcess.Command): ChildProcess.Command => {\n const tag = data(command, \"_tag\")\n if (tag === \"StandardCommand\") {\n const executable = data(command, \"command\")\n const args = data(command, \"args\")\n const options = data(command, \"options\")\n if (typeof executable !== \"string\" || !Array.isArray(args) || !args.every((arg) => typeof arg === \"string\")) {\n throw new TypeError(\"standard command executable and arguments are invalid\")\n }\n if (typeof options !== \"object\" || options === null) throw new TypeError(\"command options are invalid\")\n return ChildProcess.make(\n executable,\n Object.freeze([...args]),\n snapshotOptions(options)\n )\n }\n if (tag === \"PipedCommand\") {\n const left = data(command, \"left\")\n const right = data(command, \"right\")\n const options = data(command, \"options\")\n if (typeof left !== \"object\" || left === null || typeof right !== \"object\" || right === null) {\n throw new TypeError(\"pipeline commands are invalid\")\n }\n if (typeof options !== \"object\" || options === null) throw new TypeError(\"pipeline options are invalid\")\n const from = optionalData(options, \"from\")\n const to = optionalData(options, \"to\")\n return ChildProcess.pipeTo(\n snapshotCommand(right as ChildProcess.Command),\n Object.freeze({\n ...(from === undefined ? {} : { from: from as ChildProcess.PipeFromOption }),\n ...(to === undefined ? {} : { to: to as ChildProcess.PipeToOption })\n })\n )(snapshotCommand(left as ChildProcess.Command))\n }\n throw new TypeError(\"unsupported command shape\")\n}\n\nconst maximumEnvironmentNames = 64\n\n/**\n * The environment this process holds, which a child built with\n * `ChildProcessEnvironment.make` inherits its bootstrap names from. Empty on a\n * host with no process environment, so every declared bootstrap name counts\n * as an override there.\n */\nconst ambientEnvironment = (): Readonly<Record<string, string | undefined>> =>\n (globalThis as { readonly process?: { readonly env?: Record<string, string | undefined> } }).process?.env ?? {}\n\nconst environmentNames = (command: ChildProcess.StandardCommand): ReadonlyArray<string> | undefined => {\n const environment = command.options.env\n if (environment === undefined) return undefined\n const names = Object.entries(environment)\n .filter(([, value]) => value !== undefined)\n .map(([name]) => name)\n .sort()\n if (names.length === 0) return undefined\n return names.length <= maximumEnvironmentNames\n ? names\n : [...names.slice(0, maximumEnvironmentNames), `+${names.length - maximumEnvironmentNames} more`]\n}\n\n/**\n * Effect's own process spawner tag, unchanged. Re-exported so the kernel\n * namespace stays one-stop; it is the *same* tag, never a second one.\n *\n * @category services\n * @since 1.0.0-rc.0\n */\nexport { ChildProcessSpawner } from \"effect/unstable/process/ChildProcessSpawner\"\n\n/**\n * Derives the full six-method surface from one `spawn`, so `exitCode`,\n * `string`, `lines`, and both `stream*` helpers can never bypass whatever\n * `spawn` was given.\n *\n * @category constructors\n * @since 1.0.0-rc.0\n */\nexport { make } from \"effect/unstable/process/ChildProcessSpawner\"\n\n/**\n * Constructs an unavailable spawner stub.\n *\n * Every derived helper reports the missing host as a `NotFound`\n * `PlatformError` naming the command line, so an unconfigured capability\n * answers rather than vanishing.\n *\n * @category constructors\n * @since 1.0.0-rc.0\n */\nexport const makeNoop = (\n overrides: Partial<ChildProcessSpawner[\"Service\"]> = {}\n): ChildProcessSpawner[\"Service\"] => ({\n ...makeSpawner((command) =>\n Effect.fail(\n systemError({\n _tag: \"NotFound\",\n module: \"ChildProcessSpawner\",\n method: \"spawn\",\n description: `no process host for \\`${CommandLine.render(command)}\\``\n })\n )\n ),\n ...overrides\n})\n\n/**\n * Provides an unavailable spawner stub.\n *\n * @category layers\n * @since 1.0.0-rc.0\n */\nexport const layerNoop = (\n overrides: Partial<ChildProcessSpawner[\"Service\"]> = {}\n): Layer.Layer<ChildProcessSpawner> => Layer.succeed(ChildProcessSpawner)(makeNoop(overrides))\n\n/**\n * Decorates the process spawner in place with a `proc:spawn` capability check.\n *\n * The check is suspended into the spawn itself, so building a `Command` or a\n * stream neither requests permission nor starts a process; only running one\n * does. Every pipeline stage is checked as its own capability, left to right,\n * and no stage starts until all pass. A stage's resource is\n * `CommandLine.resource`: the command line `CommandLine.render` produces, with\n * a `shell: true` line that holds shell control syntax marked as\n * `sh -c '<line>'`, any environment variable the child would not inherit from\n * this process named in an `env <NAME>\u2026 -- ` prefix, and a working directory\n * outside `Workspace.root` named in a `cwd <path> -- ` prefix. Custom shell\n * paths are included explicitly in the resource; browser and remote adapters\n * reject them rather than silently substituting a different shell.\n *\n * Every approved stage requires `ProcessConfinement` in the host context.\n * A missing service refuses spawning; its `layerNoop` is the explicit choice\n * for an unconfined host.\n *\n * Pipeline `from`/`to` routing remains outside the grant. The working\n * directory and overridden environment names also reach attended surfaces as\n * display metadata; environment values never leave the command.\n *\n * The layer provides the tag it also requires: compose it over a host spawner\n * layer with `Layer.provide` and a `ChildProcess.Command` run as a plain\n * `Effect` is checked too.\n *\n * A command with no `cwd`, or a relative one, runs in `Workspace.root`, never\n * the process's own directory; the check sees that resolved directory. When\n * the host filesystem is in the layer's context, the working directory and\n * `Workspace.root` are compared by real path, so a symlink inside the\n * workspace that leads out of it is named, as its target, in the `cwd` prefix.\n *\n * @category layers\n * @since 1.0.0-rc.0\n */\nexport const layer: Layer.Layer<\n ChildProcessSpawner,\n never,\n ChildProcessSpawner | GrantStore | Path.Path | Workspace\n> = Layer.effect(\n ChildProcessSpawner,\n Effect.gen(function*() {\n const spawner = yield* ChildProcessSpawner\n const grants = yield* GrantStore\n const confinement = yield* Effect.serviceOption(ProcessConfinement.ProcessConfinement)\n const path = yield* Path.Path\n const rooted = Rooted.path(path, path.resolve((yield* Workspace).root))\n const root = rooted.resolve(\".\")\n // The raw host filesystem this layer is composed over, when there is one.\n // A symlink inside the workspace can lead out of it, so containment is\n // judged on real paths; a directory that cannot be resolved (it does not\n // exist, or the host has no filesystem) is judged lexically.\n const fileSystem = yield* Effect.serviceOption(FileSystem.FileSystem)\n const real = (directory: string) =>\n Option.match(fileSystem, {\n onNone: () => Effect.succeed(directory),\n onSome: (fs) => fs.realPath(directory).pipe(Effect.orElseSucceed(() => directory))\n })\n const within = (base: string) => (directory: string) => {\n const relative = path.relative(base, directory)\n return relative.split(path.sep)[0] !== \"..\" && !path.isAbsolute(relative)\n }\n const checkStage = (stage: ChildProcess.StandardCommand) =>\n Effect.gen(function*() {\n // Rooted.command gives every stage an absolute cwd.\n const cwd = stage.options.cwd!\n const realRoot = yield* real(root)\n const resolvedCwd = yield* real(cwd)\n const contains = resolvedCwd === cwd\n ? (directory: string) => within(root)(directory) || within(realRoot)(directory)\n : within(realRoot)\n return yield* checkResolved(\n stage,\n CommandLine.resource(stage, {\n ambient: ambientEnvironment(),\n contains,\n resolvedCwd\n })\n )\n })\n const checkResolved = (stage: ChildProcess.StandardCommand, rendered: string) => {\n const environment = environmentNames(stage)\n return makeCapability(\"proc:spawn\", rendered).pipe(\n Effect.flatMap((capability) =>\n grants.check(capability, {\n cwd: stage.options.cwd,\n ...(environment === undefined ? {} : { env: environment })\n })\n ),\n Effect.mapError((error) =>\n toPlatformError({\n module: \"ChildProcessSpawner\",\n method: \"spawn\",\n pathOrDescriptor: rendered,\n error\n })\n )\n )\n }\n const check = (command: ChildProcess.Command) =>\n Effect.forEach(CommandLine.stages(command), checkStage, { discard: true })\n const confine = (\n command: ChildProcess.Command\n ): Effect.Effect<\n ChildProcess.Command,\n PlatformError,\n Scope.Scope\n > =>\n Option.match(confinement, {\n onNone: () =>\n Effect.fail(systemError({\n _tag: \"NotFound\",\n module: \"ProcessConfinement\",\n method: \"confine\",\n description:\n \"process confinement is required; use ProcessConfinement.layerNoop to explicitly run unconfined\"\n })),\n onSome: (service) =>\n Effect.gen(function*() {\n const profile = yield* ProcessConfinement.profile(grants, root, path).pipe(\n Effect.mapError((error) => toPlatformError({ module: \"ChildProcessSpawner\", method: \"spawn\", error }))\n )\n const wrap = (\n command: ChildProcess.Command\n ): Effect.Effect<\n ChildProcess.Command,\n PlatformError,\n Scope.Scope\n > =>\n command._tag === \"StandardCommand\"\n ? service.confine(command, profile)\n : Effect.gen(function*() {\n const left = yield* wrap(command.left)\n const right = yield* wrap(command.right)\n return ChildProcess.pipeTo(right, command.options)(left)\n })\n return yield* wrap(command)\n })\n })\n return Containment.inherit(\n spawner,\n makeSpawner(\n Effect.fn(\"ChildProcessSpawner.spawn\")((command: ChildProcess.Command) =>\n Effect.try({\n try: () => snapshotCommand(command),\n catch: () =>\n systemError({\n _tag: \"InvalidData\",\n module: \"ChildProcessSpawner\",\n method: \"spawn\",\n description: \"command must be an immutable supported process description\"\n })\n }).pipe(\n Effect.map((snapshot) => Rooted.command(snapshot, rooted)),\n Effect.flatMap((rooted) =>\n check(rooted).pipe(Effect.andThen(confine(rooted)), Effect.flatMap(spawner.spawn))\n )\n )\n )\n )\n )\n })\n)\n"],
4
+ "sourcesContent": ["/**\n * Permission-aware process spawning.\n *\n * Smithers has no shell service of its own \u2014 process execution is Effect's\n * `effect/process`. The only thing the kernel adds is the\n * `proc:spawn` capability check and the host confinement wrapper, applied to\n * the one primitive every other helper is derived from.\n *\n * There is no kernel spawner interface and no kernel spawner tag. Effect owns\n * both, and its tag fixes the error channel to `PlatformError`, so this module\n * is only the middleware: a `Layer` over Effect's own tag. A denied command is\n * projected into `PlatformError` by `Permission.toPlatformError`, which keeps\n * the structured kernel failure on the error's `cause`. Because the channel\n * stays `PlatformError`, the full six-method surface is derived from the one\n * guarded `spawn` through Effect's own `ChildProcessSpawner.make` without a\n * cast.\n *\n * Governing design:\n * `docs/specs/Concepts/Permission Kernel.md` and\n * `docs/specs/Concepts/Host Adapters.md`.\n *\n * @since 1.0.0-rc.0\n */\n\nimport { toPlatformError } from \"@smthrs/capability/Permission\"\nimport { Effect, FileSystem, Layer, Option, Path, type Scope } from \"effect\"\nimport { type PlatformError, systemError } from \"effect/PlatformError\"\nimport * as ChildProcess from \"effect/process/ChildProcess\"\nimport { ChildProcessSpawner, make as makeSpawner } from \"effect/process/ChildProcessSpawner\"\nimport * as CommandLine from \"./CommandLine.ts\"\nimport { GrantStore } from \"./GrantStore.ts\"\nimport * as Containment from \"./internal/Containment.ts\"\nimport { makeCapability } from \"./internal/makeCapability.ts\"\nimport * as ProcessConfinement from \"./ProcessConfinement.ts\"\nimport * as Rooted from \"./Rooted.ts\"\nimport { Workspace } from \"./Workspace.ts\"\n\nconst data = (value: object, name: PropertyKey): unknown => {\n const descriptor = Object.getOwnPropertyDescriptor(value, name)\n if (descriptor === undefined || !(\"value\" in descriptor)) {\n throw new TypeError(`command ${String(name)} must be a data property`)\n }\n return descriptor.value\n}\n\nconst optionalData = (value: object, name: PropertyKey): unknown => {\n const descriptor = Object.getOwnPropertyDescriptor(value, name)\n if (descriptor === undefined) return undefined\n if (!(\"value\" in descriptor)) throw new TypeError(`command ${String(name)} must be a data property`)\n return descriptor.value\n}\n\nconst snapshotRecord = (\n value: Readonly<Record<string, string | undefined>> | undefined\n): Record<string, string | undefined> | undefined => {\n if (value === undefined) return undefined\n const snapshot: Record<string, string | undefined> = Object.create(null)\n for (const [name, descriptor] of Object.entries(Object.getOwnPropertyDescriptors(value))) {\n if (!descriptor.enumerable) continue\n if (!(\"value\" in descriptor) || (descriptor.value !== undefined && typeof descriptor.value !== \"string\")) {\n throw new TypeError(\"command environment must contain string data properties\")\n }\n snapshot[name] = descriptor.value\n }\n return Object.freeze(snapshot)\n}\n\nconst snapshotStreamConfig = <A>(value: A): A => {\n if (typeof value !== \"object\" || value === null) return value\n const descriptors = Object.getOwnPropertyDescriptors(value)\n if (descriptors.stream === undefined) return value\n if (!(\"value\" in descriptors.stream)) throw new TypeError(\"command stream must be a data property\")\n const snapshot: Record<string, unknown> = { stream: descriptors.stream.value }\n for (const name of [\"endOnDone\", \"encoding\"] as const) {\n const descriptor = descriptors[name]\n if (descriptor !== undefined) {\n if (!(\"value\" in descriptor)) throw new TypeError(`command ${name} must be a data property`)\n snapshot[name] = descriptor.value\n }\n }\n return Object.freeze(snapshot) as A\n}\n\nconst snapshotAdditionalFds = (\n value: ChildProcess.CommandOptions[\"additionalFds\"]\n): ChildProcess.CommandOptions[\"additionalFds\"] => {\n if (value === undefined) return undefined\n const snapshot: Record<`fd${number}`, ChildProcess.AdditionalFdConfig> = {}\n for (const [name, descriptor] of Object.entries(Object.getOwnPropertyDescriptors(value))) {\n if (!descriptor.enumerable) continue\n if (!(\"value\" in descriptor) || typeof descriptor.value !== \"object\" || descriptor.value === null) {\n throw new TypeError(\"additional file descriptors must be data records\")\n }\n const config = descriptor.value as ChildProcess.AdditionalFdConfig\n const type = data(config, \"type\")\n if (type === \"input\") {\n const stream = Object.getOwnPropertyDescriptor(config, \"stream\")\n snapshot[name as `fd${number}`] = Object.freeze({\n type,\n ...(stream === undefined ? {} : \"value\" in stream ? { stream: stream.value } : (() => {\n throw new TypeError(\"additional fd stream must be a data property\")\n })())\n })\n } else if (type === \"output\") {\n const sink = Object.getOwnPropertyDescriptor(config, \"sink\")\n snapshot[name as `fd${number}`] = Object.freeze({\n type,\n ...(sink === undefined ? {} : \"value\" in sink ? { sink: sink.value } : (() => {\n throw new TypeError(\"additional fd sink must be a data property\")\n })())\n })\n } else {\n throw new TypeError(\"additional file descriptor type is invalid\")\n }\n }\n return Object.freeze(snapshot)\n}\n\nconst snapshotOptions = (options: ChildProcess.CommandOptions): ChildProcess.CommandOptions =>\n Object.freeze({\n killSignal: options.killSignal,\n forceKillAfter: options.forceKillAfter,\n cwd: options.cwd,\n env: snapshotRecord(options.env),\n extendEnv: options.extendEnv,\n shell: options.shell,\n detached: options.detached,\n windowsHide: options.windowsHide,\n stdin: snapshotStreamConfig(options.stdin),\n stdout: snapshotStreamConfig(options.stdout),\n stderr: snapshotStreamConfig(options.stderr),\n additionalFds: snapshotAdditionalFds(options.additionalFds)\n })\n\nconst snapshotCommand = (command: ChildProcess.Command): ChildProcess.Command => {\n const tag = data(command, \"_tag\")\n if (tag === \"StandardCommand\") {\n const executable = data(command, \"command\")\n const args = data(command, \"args\")\n const options = data(command, \"options\")\n if (typeof executable !== \"string\" || !Array.isArray(args) || !args.every((arg) => typeof arg === \"string\")) {\n throw new TypeError(\"standard command executable and arguments are invalid\")\n }\n if (typeof options !== \"object\" || options === null) throw new TypeError(\"command options are invalid\")\n return ChildProcess.make(\n executable,\n Object.freeze([...args]),\n snapshotOptions(options)\n )\n }\n if (tag === \"PipedCommand\") {\n const left = data(command, \"left\")\n const right = data(command, \"right\")\n const options = data(command, \"options\")\n if (typeof left !== \"object\" || left === null || typeof right !== \"object\" || right === null) {\n throw new TypeError(\"pipeline commands are invalid\")\n }\n if (typeof options !== \"object\" || options === null) throw new TypeError(\"pipeline options are invalid\")\n const from = optionalData(options, \"from\")\n const to = optionalData(options, \"to\")\n return ChildProcess.pipeTo(\n snapshotCommand(right as ChildProcess.Command),\n Object.freeze({\n ...(from === undefined ? {} : { from: from as ChildProcess.PipeFromOption }),\n ...(to === undefined ? {} : { to: to as ChildProcess.PipeToOption })\n })\n )(snapshotCommand(left as ChildProcess.Command))\n }\n throw new TypeError(\"unsupported command shape\")\n}\n\nconst maximumEnvironmentNames = 64\n\n/**\n * The environment this process holds, which a child built with\n * `ChildProcessEnvironment.make` inherits its bootstrap names from. Empty on a\n * host with no process environment, so every declared bootstrap name counts\n * as an override there.\n */\nconst ambientEnvironment = (): Readonly<Record<string, string | undefined>> =>\n (globalThis as { readonly process?: { readonly env?: Record<string, string | undefined> } }).process?.env ?? {}\n\nconst environmentNames = (command: ChildProcess.StandardCommand): ReadonlyArray<string> | undefined => {\n const environment = command.options.env\n if (environment === undefined) return undefined\n const names = Object.entries(environment)\n .filter(([, value]) => value !== undefined)\n .map(([name]) => name)\n .sort()\n if (names.length === 0) return undefined\n return names.length <= maximumEnvironmentNames\n ? names\n : [...names.slice(0, maximumEnvironmentNames), `+${names.length - maximumEnvironmentNames} more`]\n}\n\n/**\n * Effect's own process spawner tag, unchanged. Re-exported so the kernel\n * namespace stays one-stop; it is the *same* tag, never a second one.\n *\n * @category services\n * @since 1.0.0-rc.0\n */\nexport { ChildProcessSpawner } from \"effect/process/ChildProcessSpawner\"\n\n/**\n * Derives the full six-method surface from one `spawn`, so `exitCode`,\n * `string`, `lines`, and both `stream*` helpers can never bypass whatever\n * `spawn` was given.\n *\n * @category constructors\n * @since 1.0.0-rc.0\n */\nexport { make } from \"effect/process/ChildProcessSpawner\"\n\n/**\n * Constructs an unavailable spawner stub.\n *\n * Every derived helper reports the missing host as a `NotFound`\n * `PlatformError` naming the command line, so an unconfigured capability\n * answers rather than vanishing.\n *\n * @category constructors\n * @since 1.0.0-rc.0\n */\nexport const makeNoop = (\n overrides: Partial<ChildProcessSpawner[\"Service\"]> = {}\n): ChildProcessSpawner[\"Service\"] => ({\n ...makeSpawner((command) =>\n Effect.fail(\n systemError({\n _tag: \"NotFound\",\n module: \"ChildProcessSpawner\",\n method: \"spawn\",\n description: `no process host for \\`${CommandLine.render(command)}\\``\n })\n )\n ),\n ...overrides\n})\n\n/**\n * Provides an unavailable spawner stub.\n *\n * @category layers\n * @since 1.0.0-rc.0\n */\nexport const layerNoop = (\n overrides: Partial<ChildProcessSpawner[\"Service\"]> = {}\n): Layer.Layer<ChildProcessSpawner> => Layer.succeed(ChildProcessSpawner)(makeNoop(overrides))\n\n/**\n * Decorates the process spawner in place with a `proc:spawn` capability check.\n *\n * The check is suspended into the spawn itself, so building a `Command` or a\n * stream neither requests permission nor starts a process; only running one\n * does. Every pipeline stage is checked as its own capability, left to right,\n * and no stage starts until all pass. A stage's resource is\n * `CommandLine.resource`: the command line `CommandLine.render` produces, with\n * a `shell: true` line that holds shell control syntax marked as\n * `sh -c '<line>'`, any environment variable the child would not inherit from\n * this process named in an `env <NAME>\u2026 -- ` prefix, and a working directory\n * outside `Workspace.root` named in a `cwd <path> -- ` prefix. Custom shell\n * paths are included explicitly in the resource; browser and remote adapters\n * reject them rather than silently substituting a different shell.\n *\n * Every approved stage requires `ProcessConfinement` in the host context.\n * A missing service refuses spawning; its `layerNoop` is the explicit choice\n * for an unconfined host.\n *\n * Pipeline `from`/`to` routing remains outside the grant. The working\n * directory and overridden environment names also reach attended surfaces as\n * display metadata; environment values never leave the command.\n *\n * The layer provides the tag it also requires: compose it over a host spawner\n * layer with `Layer.provide` and a `ChildProcess.Command` run as a plain\n * `Effect` is checked too.\n *\n * A command with no `cwd`, or a relative one, runs in `Workspace.root`, never\n * the process's own directory; the check sees that resolved directory. When\n * the host filesystem is in the layer's context, the working directory and\n * `Workspace.root` are compared by real path, so a symlink inside the\n * workspace that leads out of it is named, as its target, in the `cwd` prefix.\n *\n * @category layers\n * @since 1.0.0-rc.0\n */\nexport const layer: Layer.Layer<\n ChildProcessSpawner,\n never,\n ChildProcessSpawner | GrantStore | Path.Path | Workspace\n> = Layer.effect(\n ChildProcessSpawner,\n Effect.gen(function*() {\n const spawner = yield* ChildProcessSpawner\n const grants = yield* GrantStore\n const confinement = yield* Effect.serviceOption(ProcessConfinement.ProcessConfinement)\n const path = yield* Path.Path\n const rooted = Rooted.path(path, path.resolve((yield* Workspace).root))\n const root = rooted.resolve(\".\")\n // The raw host filesystem this layer is composed over, when there is one.\n // A symlink inside the workspace can lead out of it, so containment is\n // judged on real paths; a directory that cannot be resolved (it does not\n // exist, or the host has no filesystem) is judged lexically.\n const fileSystem = yield* Effect.serviceOption(FileSystem.FileSystem)\n const real = (directory: string) =>\n Option.match(fileSystem, {\n onNone: () => Effect.succeed(directory),\n onSome: (fs) => fs.realPath(directory).pipe(Effect.orElseSucceed(() => directory))\n })\n const within = (base: string) => (directory: string) => {\n const relative = path.relative(base, directory)\n return relative.split(path.sep)[0] !== \"..\" && !path.isAbsolute(relative)\n }\n const checkStage = (stage: ChildProcess.StandardCommand) =>\n Effect.gen(function*() {\n // Rooted.command gives every stage an absolute cwd.\n const cwd = stage.options.cwd!\n const realRoot = yield* real(root)\n const resolvedCwd = yield* real(cwd)\n const contains = resolvedCwd === cwd\n ? (directory: string) => within(root)(directory) || within(realRoot)(directory)\n : within(realRoot)\n return yield* checkResolved(\n stage,\n CommandLine.resource(stage, {\n ambient: ambientEnvironment(),\n contains,\n resolvedCwd\n })\n )\n })\n const checkResolved = (stage: ChildProcess.StandardCommand, rendered: string) => {\n const environment = environmentNames(stage)\n return makeCapability(\"proc:spawn\", rendered).pipe(\n Effect.flatMap((capability) =>\n grants.check(capability, {\n cwd: stage.options.cwd,\n ...(environment === undefined ? {} : { env: environment })\n })\n ),\n Effect.mapError((error) =>\n toPlatformError({\n module: \"ChildProcessSpawner\",\n method: \"spawn\",\n pathOrDescriptor: rendered,\n error\n })\n )\n )\n }\n const check = (command: ChildProcess.Command) =>\n Effect.forEach(CommandLine.stages(command), checkStage, { discard: true })\n const confine = (\n command: ChildProcess.Command\n ): Effect.Effect<\n ChildProcess.Command,\n PlatformError,\n Scope.Scope\n > =>\n Option.match(confinement, {\n onNone: () =>\n Effect.fail(systemError({\n _tag: \"NotFound\",\n module: \"ProcessConfinement\",\n method: \"confine\",\n description:\n \"process confinement is required; use ProcessConfinement.layerNoop to explicitly run unconfined\"\n })),\n onSome: (service) =>\n Effect.gen(function*() {\n const profile = yield* ProcessConfinement.profile(grants, root, path).pipe(\n Effect.mapError((error) => toPlatformError({ module: \"ChildProcessSpawner\", method: \"spawn\", error }))\n )\n const wrap = (\n command: ChildProcess.Command\n ): Effect.Effect<\n ChildProcess.Command,\n PlatformError,\n Scope.Scope\n > =>\n command._tag === \"StandardCommand\"\n ? service.confine(command, profile)\n : Effect.gen(function*() {\n const left = yield* wrap(command.left)\n const right = yield* wrap(command.right)\n return ChildProcess.pipeTo(right, command.options)(left)\n })\n return yield* wrap(command)\n })\n })\n return Containment.inherit(\n spawner,\n makeSpawner(\n Effect.fn(\"ChildProcessSpawner.spawn\")((command: ChildProcess.Command) =>\n Effect.try({\n try: () => snapshotCommand(command),\n catch: () =>\n systemError({\n _tag: \"InvalidData\",\n module: \"ChildProcessSpawner\",\n method: \"spawn\",\n description: \"command must be an immutable supported process description\"\n })\n }).pipe(\n Effect.map((snapshot) => Rooted.command(snapshot, rooted)),\n Effect.flatMap((rooted) =>\n check(rooted).pipe(Effect.andThen(confine(rooted)), Effect.flatMap(spawner.spawn))\n )\n )\n )\n )\n )\n })\n)\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBA,wBAAgC;AAChC,oBAAoE;AACpE,2BAAgD;AAChD,mBAA8B;AAC9B,iCAAyD;AACzD,kBAA6B;AAC7B,wBAA2B;AAC3B,kBAA6B;AAC7B,4BAA+B;AAC/B,yBAAoC;AACpC,aAAwB;AACxB,uBAA0B;AAuK1B,IAAA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OAAO,OAAOA,SAAQ,OAAO,EAAE,IAAI;AAAA,QACzD,CAAC;AACL,eAAO,OAAO,KAAK,OAAO;AAAA,MAC5B,CAAC;AAAA,IACL,CAAC;AACH,WAAO,YAAY;AAAA,MACjB;AAAA,UACA,2BAAAD;AAAA,QACE,qBAAO,GAAG,2BAA2B;AAAA,UAAE,CAAC,YACtC,qBAAO,IAAI;AAAA,YACT,KAAK,MAAM,gBAAgB,OAAO;AAAA,YAClC,OAAO,UACL,kCAAY;AAAA,cACV,MAAM;AAAA,cACN,QAAQ;AAAA,cACR,QAAQ;AAAA,cACR,aAAa;AAAA,YACf,CAAC;AAAA,UACL,CAAC,EAAE;AAAA,YACD,qBAAO,IAAI,CAAC,aAAa,OAAO,QAAQ,UAAU,MAAM,CAAC;AAAA,YACzD,qBAAO;AAAA,cAAQ,CAACE,YACd,MAAMA,OAAM,EAAE,KAAK,qBAAO,QAAQ,QAAQA,OAAM,CAAC,GAAG,qBAAO,QAAQ,QAAQ,KAAK,CAAC;AAAA,YACnF;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF,CAAC;AACH;",
6
6
  "names": ["import_ChildProcessSpawner", "makeSpawner", "command", "rooted"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @since 1.0.0-rc.0
3
3
  *
4
- * Rendering an `effect/unstable/process` `Command` back to a shell command
4
+ * Rendering an `effect/process` `Command` back to a shell command
5
5
  * line.
6
6
  *
7
7
  * Two callers need the same string and must agree on it exactly:
@@ -18,7 +18,7 @@
18
18
  * The module is pure string handling — no host access — so it stays on the
19
19
  * browser-safe side of the package.
20
20
  */
21
- import type * as ChildProcess from "effect/unstable/process/ChildProcess";
21
+ import type * as ChildProcess from "effect/process/ChildProcess";
22
22
  /**
23
23
  * Quotes one token for a POSIX shell, leaving obviously safe tokens alone.
24
24
  *
@@ -1 +1 @@
1
- {"version":3,"file":"CommandLine.d.ts","sourceRoot":"","sources":["../../src/CommandLine.ts"],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GAAI,SAAS,YAAY,CAAC,OAAO,KAAG,MAAM,GAAG,SACiB,CAAA;AAE9E;;;;;;GAMG;AACH,eAAO,MAAM,GAAG,GACd,SAAS,YAAY,CAAC,OAAO,KAC5B,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,SACsC,CAAA"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/CommandLine.ts"],
4
- "sourcesContent": ["/**\n * @since 1.0.0-rc.0\n *\n * Rendering an `effect/unstable/process` `Command` back to a shell command\n * line.\n *\n * Two callers need the same string and must agree on it exactly:\n *\n * 1. `@smthrs/kernel/ChildProcessSpawner` uses it as the `proc:spawn`\n * capability resource, so a grant reads the way an operator wrote it; and\n * 2. `@smthrs/platform-browser/BrowserChildProcessSpawner` uses it as the line\n * it hands to the in-browser bash interpreter, which has no `argv` to spawn\n * with.\n *\n * A single renderer keeps a granted capability and the command a browser\n * actually runs from drifting apart.\n *\n * The module is pure string handling \u2014 no host access \u2014 so it stays on the\n * browser-safe side of the package.\n */\n\nimport type * as ChildProcess from \"effect/unstable/process/ChildProcess\"\nimport { isInheritedName } from \"./ChildProcessEnvironment.ts\"\n\n/** Tokens made only of these characters need no quoting in a POSIX shell. */\nconst SAFE = /^[A-Za-z0-9_@%+=:,./-]+$/\n\n/**\n * Quotes one token for a POSIX shell, leaving obviously safe tokens alone.\n *\n * @category rendering\n * @since 1.0.0-rc.0\n */\nexport const quote = (token: string): string =>\n token !== \"\" && SAFE.test(token) ? token : `'${token.replaceAll(\"'\", `'\\\\''`)}'`\n\n/**\n * Renders a `Command` as a single shell command line.\n *\n * A standard command with `shell: true` renders its tokens verbatim, matching\n * the line Node and the browser interpreter hand to the default shell. A\n * custom shell renders as an explicit `<shell> -c <line>` invocation so the\n * selected executable is part of the permission resource. Without `shell`,\n * every token is POSIX-quoted to preserve literal argv semantics. These\n * distinctions are security-sensitive: the rendered value is also the\n * `proc:spawn` capability resource, so it must describe what will execute.\n * The rendering is POSIX-only by contract: on Windows, Node invokes the shell\n * with `/d /s /c` rather than `-c`, so the rendered line describes the POSIX\n * invocation, not a cmd.exe one.\n *\n * The `proc:spawn` capability resource is {@link resource}, which starts from\n * this line and adds what the line alone cannot show.\n *\n * A `PipedCommand` renders with `|` between its sides. That is a faithful\n * rendering of what the pipeline does, and it is the only form an interpreter\n * that takes a command line rather than an `argv` can be given. `from`/`to`\n * pipe options are *not* expressible this way; rendering ignores them, so a\n * pipeline that redirects `stderr` renders like one that pipes `stdout`.\n * Capability checks therefore see the commands, never the plumbing.\n *\n * @category rendering\n * @since 1.0.0-rc.0\n */\nexport const render = (command: ChildProcess.Command): string =>\n command._tag === \"StandardCommand\"\n ? command.options.shell === undefined || command.options.shell === false\n ? [command.command, ...command.args].map(quote).join(\" \")\n : command.options.shell === true\n ? [command.command, ...command.args].join(\" \")\n : `${quote(command.options.shell)} -c ${quote([command.command, ...command.args].join(\" \"))}`\n : `${render(command.left)} | ${render(command.right)}`\n\n/**\n * Shell syntax that chains, substitutes, groups, or redirects: everything that\n * lets one shell line run or write more than a single simple command.\n */\nconst shellControl = /[;&|`$<>()\\n\\r]/\n\n/**\n * Redirections that neither run nor write anything a grant should see: an fd\n * duplication such as `2>&1` and a discard to `/dev/null`. They are removed\n * before {@link shellControl} is tested, so `git status 2>&1` keeps its\n * verbatim resource. Only a space or tab may sit between `>` and `/dev/null`:\n * `>` followed by a line break is not a discard, so it stays control syntax.\n */\nconst harmlessRedirect = /(^|\\s)(?:\\d*>&\\d+|\\d*>[ \\t]*\\/dev\\/null)(?=\\s|$)/g\n\n/**\n * What {@link resource} compares a stage against, supplied by the spawner that\n * checks it.\n *\n * @category models\n * @since 1.0.0-rc.1\n */\nexport interface ResourceContext {\n /**\n * The environment the spawning process itself holds. A bootstrap name\n * (`PATH`, `HOME`, ...) whose declared value equals the ambient value is the\n * inherited default and stays out of the resource; one set to anything else\n * is named. Omitted, every declared bootstrap name is named.\n */\n readonly ambient?: Readonly<Record<string, string | undefined>> | undefined\n /**\n * Whether a stage's working directory is inside the directory the flow\n * already governs. A `cwd` it rejects is named in the resource. Omitted,\n * every `cwd` a stage sets is named.\n */\n readonly contains?: ((directory: string) => boolean) | undefined\n /**\n * The stage `cwd` with every symlink resolved, when the host could resolve\n * it. It replaces the lexical `cwd` both for `contains` and in the\n * `cwd <path> -- ` prefix, so a symlink inside the governed directory that\n * leads out of it is judged, and shown, by where the command really runs.\n */\n readonly resolvedCwd?: string | undefined\n}\n\n/**\n * Names of the environment variables a stage sets that the child would not\n * otherwise inherit: every name outside the bootstrap set, and a bootstrap\n * name whose value differs from the ambient one.\n */\nconst overriddenNames = (\n command: ChildProcess.StandardCommand,\n ambient: Readonly<Record<string, string | undefined>>\n): ReadonlyArray<string> =>\n Object.entries(command.options.env ?? {})\n .filter(([name, value]) => value !== undefined && (!isInheritedName(name) || ambient[name] !== value))\n .map(([name]) => name)\n .sort()\n\n/**\n * The stages of a command in execution order: the command itself, or every\n * `StandardCommand` of a pipeline from left to right. The spawner checks each\n * stage as its own `proc:spawn` capability.\n *\n * @category rendering\n * @since 1.0.0-rc.1\n */\nexport const stages = (command: ChildProcess.Command): ReadonlyArray<ChildProcess.StandardCommand> =>\n command._tag === \"StandardCommand\" ? [command] : [...stages(command.left), ...stages(command.right)]\n\n/**\n * The `proc:spawn` capability resource for one stage: {@link render}, with\n * three additions that keep a prefix grant from authorizing code the stage\n * never named.\n *\n * - A `shell: true` stage whose line holds shell control syntax (`;`, `&`,\n * `|`, `` ` ``, `$`, `<`, `>`, `(`, `)`, or a line break) is marked as the\n * explicit `sh -c '<line>'` it is. A grant such as `git status *` then\n * cannot match `git status; curl x | sh`, while a simple shell line such as\n * `git status --short` keeps its verbatim resource. An fd duplication such\n * as `2>&1` and a discard to `/dev/null` do not count as control syntax.\n * - A stage that sets an environment variable the child would not otherwise\n * inherit is prefixed with `env <NAME>\u2026 -- `, sorted names only. That is\n * every name outside the bootstrap set `ChildProcessEnvironment` inherits\n * (`PATH`, `HOME`, `USER`, `LANG`, `TERM`, `TMPDIR`, `SHELL`, `LC_*`), and a\n * bootstrap name whose value differs from `context.ambient`. A grant for\n * `git status` covers neither `env GIT_SSH_COMMAND -- git status` nor\n * `env PATH -- git status`. Values never enter the resource because they\n * often carry credentials.\n * - A stage whose `cwd` `context.contains` rejects is prefixed with\n * `cwd <path> -- `, so a grant does not follow the command into a\n * directory whose configuration the flow does not govern. When\n * `context.resolvedCwd` is given, that real path is judged and named\n * instead of the lexical `cwd`.\n *\n * A pipeline has no single resource: the spawner checks every one of its\n * {@link stages}, so `git status | sh` needs a grant for `sh` too.\n *\n * The `env` and `cwd` prefixes share their spelling with a literal command:\n * `make(\"env\", [\"PATH\", \"--\", \"git\", \"status\"])` renders as\n * `env PATH -- git status`, the resource of `git status` with `PATH`\n * overridden. The alias grants nothing extra. The literal command runs a\n * program named `PATH` (or `cwd`) from the ambient `PATH`, not `git`. A grant\n * with `*` inside the prefix, such as `env * -- git status`, also matches\n * `env -C /x -- git status`, but it already admits any variable name,\n * including `GIT_SSH_COMMAND` and `LD_PRELOAD`, which run arbitrary code.\n * Grant a prefixed resource exactly as the request shows it.\n *\n * @category rendering\n * @since 1.0.0-rc.1\n */\nexport const resource = (command: ChildProcess.StandardCommand, context: ResourceContext = {}): string => {\n const line = render(command)\n const shown = command.options.shell === true && shellControl.test(line.replace(harmlessRedirect, \"$1\"))\n ? `sh -c ${quote(line)}`\n : line\n const names = overriddenNames(command, context.ambient ?? {})\n const withEnv = names.length === 0 ? shown : `env ${names.map(quote).join(\" \")} -- ${shown}`\n const directory = command.options.cwd === undefined ? undefined : context.resolvedCwd ?? command.options.cwd\n return directory === undefined || context.contains?.(directory) === true\n ? withEnv\n : `cwd ${quote(directory)} -- ${withEnv}`\n}\n\n/** The leading token of a shell line, which is the program the line runs. */\nconst program = (line: string): string => {\n const trimmed = line.trimStart()\n const end = trimmed.search(/\\s/)\n return end === -1 ? trimmed : trimmed.slice(0, end)\n}\n\n/**\n * The executable a command runs, without its arguments.\n *\n * A durable record of a spawned process names its program with this rather\n * than with {@link render}: arguments carry credentials (`curl -u user:pass`,\n * `mysql -phunter2`), and a journal that keeps them keeps them permanently.\n * Nothing that reads such a record needs more than the program name; a reaper\n * matches processes by pid and process group.\n *\n * Without `shell`, `command` is the executable itself, spaces and all. With a\n * shell, the line is what runs, so the program is its first token: both\n * `make(\"mysql -phunter2\", [], { shell: true })` and\n * `make(\"mysql\", [\"-phunter2\"])` yield `mysql`. A pipeline names one\n * executable per stage, joined the way {@link render} joins the stages.\n *\n * @category rendering\n * @since 1.0.0-rc.0\n */\nexport const executable = (command: ChildProcess.Command): string =>\n command._tag === \"StandardCommand\"\n ? command.options.shell === undefined || command.options.shell === false\n ? command.command\n : program(command.command)\n : `${executable(command.left)} | ${executable(command.right)}`\n\n/**\n * The working directory a command runs in, taking the leftmost stage of a\n * pipeline, which is the stage `setCwd` and the spawners agree to treat as the\n * pipeline's own directory.\n *\n * @category rendering\n * @since 1.0.0-rc.0\n */\nexport const cwd = (command: ChildProcess.Command): string | undefined =>\n command._tag === \"StandardCommand\" ? command.options.cwd : cwd(command.left)\n\n/**\n * The environment overrides a command runs with, taking the leftmost stage of\n * a pipeline for the same reason {@link cwd} does.\n *\n * @category rendering\n * @since 1.0.0-rc.0\n */\nexport const env = (\n command: ChildProcess.Command\n): Record<string, string | undefined> | undefined =>\n command._tag === \"StandardCommand\" ? command.options.env : env(command.left)\n"],
4
+ "sourcesContent": ["/**\n * @since 1.0.0-rc.0\n *\n * Rendering an `effect/process` `Command` back to a shell command\n * line.\n *\n * Two callers need the same string and must agree on it exactly:\n *\n * 1. `@smthrs/kernel/ChildProcessSpawner` uses it as the `proc:spawn`\n * capability resource, so a grant reads the way an operator wrote it; and\n * 2. `@smthrs/platform-browser/BrowserChildProcessSpawner` uses it as the line\n * it hands to the in-browser bash interpreter, which has no `argv` to spawn\n * with.\n *\n * A single renderer keeps a granted capability and the command a browser\n * actually runs from drifting apart.\n *\n * The module is pure string handling \u2014 no host access \u2014 so it stays on the\n * browser-safe side of the package.\n */\n\nimport type * as ChildProcess from \"effect/process/ChildProcess\"\nimport { isInheritedName } from \"./ChildProcessEnvironment.ts\"\n\n/** Tokens made only of these characters need no quoting in a POSIX shell. */\nconst SAFE = /^[A-Za-z0-9_@%+=:,./-]+$/\n\n/**\n * Quotes one token for a POSIX shell, leaving obviously safe tokens alone.\n *\n * @category rendering\n * @since 1.0.0-rc.0\n */\nexport const quote = (token: string): string =>\n token !== \"\" && SAFE.test(token) ? token : `'${token.replaceAll(\"'\", `'\\\\''`)}'`\n\n/**\n * Renders a `Command` as a single shell command line.\n *\n * A standard command with `shell: true` renders its tokens verbatim, matching\n * the line Node and the browser interpreter hand to the default shell. A\n * custom shell renders as an explicit `<shell> -c <line>` invocation so the\n * selected executable is part of the permission resource. Without `shell`,\n * every token is POSIX-quoted to preserve literal argv semantics. These\n * distinctions are security-sensitive: the rendered value is also the\n * `proc:spawn` capability resource, so it must describe what will execute.\n * The rendering is POSIX-only by contract: on Windows, Node invokes the shell\n * with `/d /s /c` rather than `-c`, so the rendered line describes the POSIX\n * invocation, not a cmd.exe one.\n *\n * The `proc:spawn` capability resource is {@link resource}, which starts from\n * this line and adds what the line alone cannot show.\n *\n * A `PipedCommand` renders with `|` between its sides. That is a faithful\n * rendering of what the pipeline does, and it is the only form an interpreter\n * that takes a command line rather than an `argv` can be given. `from`/`to`\n * pipe options are *not* expressible this way; rendering ignores them, so a\n * pipeline that redirects `stderr` renders like one that pipes `stdout`.\n * Capability checks therefore see the commands, never the plumbing.\n *\n * @category rendering\n * @since 1.0.0-rc.0\n */\nexport const render = (command: ChildProcess.Command): string =>\n command._tag === \"StandardCommand\"\n ? command.options.shell === undefined || command.options.shell === false\n ? [command.command, ...command.args].map(quote).join(\" \")\n : command.options.shell === true\n ? [command.command, ...command.args].join(\" \")\n : `${quote(command.options.shell)} -c ${quote([command.command, ...command.args].join(\" \"))}`\n : `${render(command.left)} | ${render(command.right)}`\n\n/**\n * Shell syntax that chains, substitutes, groups, or redirects: everything that\n * lets one shell line run or write more than a single simple command.\n */\nconst shellControl = /[;&|`$<>()\\n\\r]/\n\n/**\n * Redirections that neither run nor write anything a grant should see: an fd\n * duplication such as `2>&1` and a discard to `/dev/null`. They are removed\n * before {@link shellControl} is tested, so `git status 2>&1` keeps its\n * verbatim resource. Only a space or tab may sit between `>` and `/dev/null`:\n * `>` followed by a line break is not a discard, so it stays control syntax.\n */\nconst harmlessRedirect = /(^|\\s)(?:\\d*>&\\d+|\\d*>[ \\t]*\\/dev\\/null)(?=\\s|$)/g\n\n/**\n * What {@link resource} compares a stage against, supplied by the spawner that\n * checks it.\n *\n * @category models\n * @since 1.0.0-rc.1\n */\nexport interface ResourceContext {\n /**\n * The environment the spawning process itself holds. A bootstrap name\n * (`PATH`, `HOME`, ...) whose declared value equals the ambient value is the\n * inherited default and stays out of the resource; one set to anything else\n * is named. Omitted, every declared bootstrap name is named.\n */\n readonly ambient?: Readonly<Record<string, string | undefined>> | undefined\n /**\n * Whether a stage's working directory is inside the directory the flow\n * already governs. A `cwd` it rejects is named in the resource. Omitted,\n * every `cwd` a stage sets is named.\n */\n readonly contains?: ((directory: string) => boolean) | undefined\n /**\n * The stage `cwd` with every symlink resolved, when the host could resolve\n * it. It replaces the lexical `cwd` both for `contains` and in the\n * `cwd <path> -- ` prefix, so a symlink inside the governed directory that\n * leads out of it is judged, and shown, by where the command really runs.\n */\n readonly resolvedCwd?: string | undefined\n}\n\n/**\n * Names of the environment variables a stage sets that the child would not\n * otherwise inherit: every name outside the bootstrap set, and a bootstrap\n * name whose value differs from the ambient one.\n */\nconst overriddenNames = (\n command: ChildProcess.StandardCommand,\n ambient: Readonly<Record<string, string | undefined>>\n): ReadonlyArray<string> =>\n Object.entries(command.options.env ?? {})\n .filter(([name, value]) => value !== undefined && (!isInheritedName(name) || ambient[name] !== value))\n .map(([name]) => name)\n .sort()\n\n/**\n * The stages of a command in execution order: the command itself, or every\n * `StandardCommand` of a pipeline from left to right. The spawner checks each\n * stage as its own `proc:spawn` capability.\n *\n * @category rendering\n * @since 1.0.0-rc.1\n */\nexport const stages = (command: ChildProcess.Command): ReadonlyArray<ChildProcess.StandardCommand> =>\n command._tag === \"StandardCommand\" ? [command] : [...stages(command.left), ...stages(command.right)]\n\n/**\n * The `proc:spawn` capability resource for one stage: {@link render}, with\n * three additions that keep a prefix grant from authorizing code the stage\n * never named.\n *\n * - A `shell: true` stage whose line holds shell control syntax (`;`, `&`,\n * `|`, `` ` ``, `$`, `<`, `>`, `(`, `)`, or a line break) is marked as the\n * explicit `sh -c '<line>'` it is. A grant such as `git status *` then\n * cannot match `git status; curl x | sh`, while a simple shell line such as\n * `git status --short` keeps its verbatim resource. An fd duplication such\n * as `2>&1` and a discard to `/dev/null` do not count as control syntax.\n * - A stage that sets an environment variable the child would not otherwise\n * inherit is prefixed with `env <NAME>\u2026 -- `, sorted names only. That is\n * every name outside the bootstrap set `ChildProcessEnvironment` inherits\n * (`PATH`, `HOME`, `USER`, `LANG`, `TERM`, `TMPDIR`, `SHELL`, `LC_*`), and a\n * bootstrap name whose value differs from `context.ambient`. A grant for\n * `git status` covers neither `env GIT_SSH_COMMAND -- git status` nor\n * `env PATH -- git status`. Values never enter the resource because they\n * often carry credentials.\n * - A stage whose `cwd` `context.contains` rejects is prefixed with\n * `cwd <path> -- `, so a grant does not follow the command into a\n * directory whose configuration the flow does not govern. When\n * `context.resolvedCwd` is given, that real path is judged and named\n * instead of the lexical `cwd`.\n *\n * A pipeline has no single resource: the spawner checks every one of its\n * {@link stages}, so `git status | sh` needs a grant for `sh` too.\n *\n * The `env` and `cwd` prefixes share their spelling with a literal command:\n * `make(\"env\", [\"PATH\", \"--\", \"git\", \"status\"])` renders as\n * `env PATH -- git status`, the resource of `git status` with `PATH`\n * overridden. The alias grants nothing extra. The literal command runs a\n * program named `PATH` (or `cwd`) from the ambient `PATH`, not `git`. A grant\n * with `*` inside the prefix, such as `env * -- git status`, also matches\n * `env -C /x -- git status`, but it already admits any variable name,\n * including `GIT_SSH_COMMAND` and `LD_PRELOAD`, which run arbitrary code.\n * Grant a prefixed resource exactly as the request shows it.\n *\n * @category rendering\n * @since 1.0.0-rc.1\n */\nexport const resource = (command: ChildProcess.StandardCommand, context: ResourceContext = {}): string => {\n const line = render(command)\n const shown = command.options.shell === true && shellControl.test(line.replace(harmlessRedirect, \"$1\"))\n ? `sh -c ${quote(line)}`\n : line\n const names = overriddenNames(command, context.ambient ?? {})\n const withEnv = names.length === 0 ? shown : `env ${names.map(quote).join(\" \")} -- ${shown}`\n const directory = command.options.cwd === undefined ? undefined : context.resolvedCwd ?? command.options.cwd\n return directory === undefined || context.contains?.(directory) === true\n ? withEnv\n : `cwd ${quote(directory)} -- ${withEnv}`\n}\n\n/** The leading token of a shell line, which is the program the line runs. */\nconst program = (line: string): string => {\n const trimmed = line.trimStart()\n const end = trimmed.search(/\\s/)\n return end === -1 ? trimmed : trimmed.slice(0, end)\n}\n\n/**\n * The executable a command runs, without its arguments.\n *\n * A durable record of a spawned process names its program with this rather\n * than with {@link render}: arguments carry credentials (`curl -u user:pass`,\n * `mysql -phunter2`), and a journal that keeps them keeps them permanently.\n * Nothing that reads such a record needs more than the program name; a reaper\n * matches processes by pid and process group.\n *\n * Without `shell`, `command` is the executable itself, spaces and all. With a\n * shell, the line is what runs, so the program is its first token: both\n * `make(\"mysql -phunter2\", [], { shell: true })` and\n * `make(\"mysql\", [\"-phunter2\"])` yield `mysql`. A pipeline names one\n * executable per stage, joined the way {@link render} joins the stages.\n *\n * @category rendering\n * @since 1.0.0-rc.0\n */\nexport const executable = (command: ChildProcess.Command): string =>\n command._tag === \"StandardCommand\"\n ? command.options.shell === undefined || command.options.shell === false\n ? command.command\n : program(command.command)\n : `${executable(command.left)} | ${executable(command.right)}`\n\n/**\n * The working directory a command runs in, taking the leftmost stage of a\n * pipeline, which is the stage `setCwd` and the spawners agree to treat as the\n * pipeline's own directory.\n *\n * @category rendering\n * @since 1.0.0-rc.0\n */\nexport const cwd = (command: ChildProcess.Command): string | undefined =>\n command._tag === \"StandardCommand\" ? command.options.cwd : cwd(command.left)\n\n/**\n * The environment overrides a command runs with, taking the leftmost stage of\n * a pipeline for the same reason {@link cwd} does.\n *\n * @category rendering\n * @since 1.0.0-rc.0\n */\nexport const env = (\n command: ChildProcess.Command\n): Record<string, string | undefined> | undefined =>\n command._tag === \"StandardCommand\" ? command.options.env : env(command.left)\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsBA,qCAAgC;AAGhC,MAAM,OAAO;AAQN,MAAM,QAAQ,CAAC,UACpB,UAAU,MAAM,KAAK,KAAK,KAAK,IAAI,QAAQ,IAAI,MAAM,WAAW,KAAK,OAAO,CAAC;AA6BxE,MAAM,SAAS,CAAC,YACrB,QAAQ,SAAS,oBACb,QAAQ,QAAQ,UAAU,UAAa,QAAQ,QAAQ,UAAU,QAC/D,CAAC,QAAQ,SAAS,GAAG,QAAQ,IAAI,EAAE,IAAI,KAAK,EAAE,KAAK,GAAG,IACtD,QAAQ,QAAQ,UAAU,OAC1B,CAAC,QAAQ,SAAS,GAAG,QAAQ,IAAI,EAAE,KAAK,GAAG,IAC3C,GAAG,MAAM,QAAQ,QAAQ,KAAK,CAAC,OAAO,MAAM,CAAC,QAAQ,SAAS,GAAG,QAAQ,IAAI,EAAE,KAAK,GAAG,CAAC,CAAC,KAC3F,GAAG,OAAO,QAAQ,IAAI,CAAC,MAAM,OAAO,QAAQ,KAAK,CAAC;AAMxD,MAAM,eAAe;AASrB,MAAM,mBAAmB;AAqCzB,MAAM,kBAAkB,CACtB,SACA,YAEA,OAAO,QAAQ,QAAQ,QAAQ,OAAO,CAAC,CAAC,EACrC,OAAO,CAAC,CAAC,MAAM,KAAK,MAAM,UAAU,WAAc,KAAC,gDAAgB,IAAI,KAAK,QAAQ,IAAI,MAAM,MAAM,EACp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jB,YAEA,QAAQ,SAAS,oBAAoB,QAAQ,QAAQ,MAAM,IAAI,QAAQ,IAAI;",
6
6
  "names": []
7
7
  }
@@ -26,9 +26,9 @@
26
26
  import * as Effect from "effect/Effect";
27
27
  import * as Layer from "effect/Layer";
28
28
  import * as PlatformError from "effect/PlatformError";
29
+ import * as ChildProcess from "effect/process/ChildProcess";
30
+ import { type ChildProcessHandle, ChildProcessSpawner } from "effect/process/ChildProcessSpawner";
29
31
  import * as Scope from "effect/Scope";
30
- import * as ChildProcess from "effect/unstable/process/ChildProcess";
31
- import { type ChildProcessHandle, ChildProcessSpawner } from "effect/unstable/process/ChildProcessSpawner";
32
32
  import * as ProcessLedger from "./ProcessLedger.ts";
33
33
  /**
34
34
  * How long a contained child may take to honour `SIGTERM`.
@@ -1 +1 @@
1
- {"version":3,"file":"ContainedSpawner.d.ts","sourceRoot":"","sources":["../../src/ContainedSpawner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,aAAa,MAAM,sBAAsB,CAAA;AAErD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,YAAY,MAAM,sCAAsC,CAAA;AACpE,OAAO,EACL,KAAK,kBAAkB,EACvB,mBAAmB,EAEpB,MAAM,6CAA6C,CAAA;AAIpD,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAA;AAEnD;;;;;GAKG;AACH,eAAO,MAAM,cAAc,OAAO,CAAA;AAElC;;;;;GAKG;AACH,MAAM,WAAW,OAAO;IACtB;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACrC;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CACvC;AAED;;;;;;;;;;;;;;;;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AAI,SAAS,mBAAmB,CAAC,SAAS,CAAC,KAAG,OAA2C,CAAA;AAEjH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,GAC1B,SAAS,YAAY,CAAC,OAAO,EAC7B,UAAU,OAAO,KAChB,YAAY,CAAC,OAcf,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,OAAO,GAAI,SAAS,YAAY,CAAC,OAAO,EAAE,KAAK,MAAM,EAAE,WAAW,MAAM,KAAG,MAAM,GAAG,IAIhG,CAAA;AAKD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,KAAK,GAChB,UAAU,OAAO,EACjB,YAAY,SAAS,KACpB,KAAK,CAAC,KAAK,CAAC,mBAAmB,EAAE,KAAK,EAAE,mBAAmB,GAAG,aAAa,CAAC,aAAa,CAmEzF,CAAA"}
@@ -39,10 +39,10 @@ var Effect = __toESM(require("effect/Effect"), 1);
39
39
  var Exit = __toESM(require("effect/Exit"), 1);
40
40
  var Layer = __toESM(require("effect/Layer"), 1);
41
41
  var PlatformError = __toESM(require("effect/PlatformError"), 1);
42
+ var ChildProcess = __toESM(require("effect/process/ChildProcess"), 1);
43
+ var import_ChildProcessSpawner = require("effect/process/ChildProcessSpawner");
42
44
  var Schedule = __toESM(require("effect/Schedule"), 1);
43
45
  var Scope = __toESM(require("effect/Scope"), 1);
44
- var ChildProcess = __toESM(require("effect/unstable/process/ChildProcess"), 1);
45
- var import_ChildProcessSpawner = require("effect/unstable/process/ChildProcessSpawner");
46
46
  var CommandLine = __toESM(require("./CommandLine.js"), 1);
47
47
  var Containment = __toESM(require("./internal/Containment.js"), 1);
48
48
  var Pipeline = __toESM(require("./internal/Pipeline.js"), 1);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/ContainedSpawner.ts"],
4
- "sourcesContent": ["/**\n * Process containment: prepared ownership, bounded cleanup and durable records.\n *\n * A host supplies a {@link Lifecycle} that owns launch and cleanup independently\n * of the command's exit status. The lifecycle first prepares a process identity;\n * this decorator commits that identity to {@link ProcessLedger.ProcessLedger}\n * before activating the caller's command. Failed or interrupted startup closes\n * its child scope immediately, including any earlier legs of a partial pipeline.\n *\n * Each command receives default termination and escalation options. The host\n * lifecycle validates that policy and verifies cleanup before the decorator\n * retires its record. Unverifiable cleanup retains the record for recovery;\n * a host that dies also leaves its committed records discoverable by the next\n * incarnation's reaper (`ProcessReaper` in `@smthrs/platform-node`).\n *\n * Every pipeline leg is prepared and recorded separately, including legs whose\n * pid the aggregate handle does not expose. The module remains platform-neutral.\n * A layer without a lifecycle provides only deadline defaults and bookkeeping;\n * it does not declare the verified-cleanup contract read by {@link isContained}.\n *\n * Governing design:\n * `docs/specs/Concepts/Host Adapters.md`.\n *\n * @since 1.0.0-rc.0\n */\n\nimport * as Effect from \"effect/Effect\"\nimport * as Exit from \"effect/Exit\"\nimport * as Layer from \"effect/Layer\"\nimport * as PlatformError from \"effect/PlatformError\"\nimport * as Schedule from \"effect/Schedule\"\nimport * as Scope from \"effect/Scope\"\nimport * as ChildProcess from \"effect/unstable/process/ChildProcess\"\nimport {\n type ChildProcessHandle,\n ChildProcessSpawner,\n make as makeSpawner\n} from \"effect/unstable/process/ChildProcessSpawner\"\nimport * as CommandLine from \"./CommandLine.ts\"\nimport * as Containment from \"./internal/Containment.ts\"\nimport * as Pipeline from \"./internal/Pipeline.ts\"\nimport * as ProcessLedger from \"./ProcessLedger.ts\"\n\n/**\n * How long a contained child may take to honour `SIGTERM`.\n *\n * @category models\n * @since 1.0.0-rc.0\n */\nexport const defaultGraceMs = 2000\n\n/**\n * Containment configuration.\n *\n * @category models\n * @since 1.0.0-rc.0\n */\nexport interface Options {\n /**\n * Milliseconds between the `SIGTERM` that asks a child to stop and the\n * `SIGKILL` that makes it. Default {@link defaultGraceMs}.\n */\n readonly graceMs?: number | undefined\n /**\n * The platform the host spawner runs on, as `process.platform` spells it.\n * Windows records no POSIX process group, including for detached children.\n * On POSIX, detachment determines whether the child leads its own group.\n * Default `\"linux\"`; host bundles pass their actual platform.\n */\n readonly platform?: string | undefined\n}\n\n/**\n * A platform's preparation, activation, and cleanup of a contained process.\n *\n * Preparation receives the underlying spawner and must own cleanup before it\n * can fail or be interrupted. It returns the process identity to record and an\n * idempotent `activate` effect. The decorator runs activation only after that\n * identity commits to the ledger. A platform can therefore prepare an owner\n * without executing the caller's command before it is durably discoverable.\n *\n * Failed startup closes its own scope immediately. A successful startup keeps\n * that scope attached to the caller's scope. `settled` must stay false on failed\n * or unverifiable cleanup; only verified cleanup permits ledger retirement.\n * The wrapped handle applies the same policy to an explicit `kill`.\n *\n * @category models\n * @since 1.0.0\n */\nexport type Lifecycle = (\n command: ChildProcess.StandardCommand,\n spawn: (\n command: ChildProcess.StandardCommand\n ) => Effect.Effect<ChildProcessHandle, PlatformError.PlatformError, Scope.Scope>\n) => Effect.Effect<\n {\n readonly handle: ChildProcessHandle\n readonly activate: Effect.Effect<void, PlatformError.PlatformError, Scope.Scope>\n readonly settled: Effect.Effect<boolean>\n },\n PlatformError.PlatformError,\n Scope.Scope\n>\n\n/**\n * Whether a spawner declares the platform lifecycle required for containment.\n *\n * Only a layer with a {@link Lifecycle} declares this contract. A kill deadline\n * alone does not verify cleanup. The permission decorator preserves the\n * declaration when it wraps a contained service. The marker interoperates\n * across the package's ESM and CommonJS projections.\n *\n * This is a trusted composition check: a caller-supplied lifecycle remains\n * responsible for implementing its contract.\n *\n * @category predicates\n * @since 1.0.0\n */\nexport const isContained = (spawner: ChildProcessSpawner[\"Service\"]): boolean => Containment.isContained(spawner)\n\n/**\n * Supplies a command's default termination signal and escalation deadline.\n *\n * Both legs of a pipeline get the same policy \u2014 a pipeline is one action's\n * process tree and a surviving leg is as much of a leak as a surviving\n * child. Explicit `killSignal` and `forceKillAfter` values are preserved for\n * the host lifecycle to validate.\n *\n * @category constructors\n * @since 1.0.0-rc.0\n */\nexport const withContainment = (\n command: ChildProcess.Command,\n options?: Options\n): ChildProcess.Command => {\n const graceMs = options?.graceMs ?? defaultGraceMs\n if (command._tag === \"PipedCommand\") {\n return ChildProcess.pipeTo(\n withContainment(command.left, options),\n withContainment(command.right, options),\n command.options\n )\n }\n return ChildProcess.make(command.command, [...command.args], {\n ...command.options,\n killSignal: command.options.killSignal ?? \"SIGTERM\",\n forceKillAfter: command.options.forceKillAfter ?? graceMs\n })\n}\n\n/**\n * The process group a started child leads, or `null` when it shares the\n * host's or the platform has no POSIX process groups.\n *\n * A detached POSIX child leads a group whose id is its own pid. A child in\n * the host's group must not record that group as its own cleanup target.\n * Windows detachment creates an independent console, not a POSIX group;\n * Windows records therefore always carry `null`.\n *\n * @category constructors\n * @since 1.0.0-rc.0\n */\nexport const groupOf = (command: ChildProcess.Command, pid: number, platform?: string): number | null => {\n if (platform === \"win32\") return null\n const options = command._tag === \"PipedCommand\" ? rightmost(command).options : command.options\n return (options.detached ?? true) ? pid : null\n}\n\nconst rightmost = (command: ChildProcess.Command): ChildProcess.StandardCommand =>\n command._tag === \"StandardCommand\" ? command : rightmost(command.right)\n\n/**\n * Decorates the process spawner in place with containment and bookkeeping.\n *\n * Compose it over a host spawner layer with `Layer.provide`. It provides the\n * tag it also requires. Compose the permission decorator over this layer to\n * authorize the caller's whole pipeline before its per-process expansion. A\n * lifecycle may use different commands during preparation; a decorator below\n * containment sees those platform commands instead of the caller's command.\n *\n * @category layers\n * @since 1.0.0-rc.0\n */\nexport const layer = (\n options?: Options,\n lifecycle?: Lifecycle\n): Layer.Layer<ChildProcessSpawner, never, ChildProcessSpawner | ProcessLedger.ProcessLedger> =>\n Layer.effect(\n ChildProcessSpawner,\n Effect.gen(function*() {\n const spawner = yield* ChildProcessSpawner\n const ledger = yield* ProcessLedger.ProcessLedger\n const service = makeSpawner(\n (command) =>\n Effect.uninterruptibleMask((restore) =>\n Effect.gen(function*() {\n // A failed startup must clean up even when its caller catches the\n // error and keeps the outer scope open. One child scope contains\n // the entire pipeline, so failure of a later leg also closes all\n // earlier legs. Successful spawns retain it until their caller closes.\n const processScope = yield* Scope.fork(yield* Scope.Scope)\n return yield* restore(\n Pipeline.spawn(\n command,\n Effect.fn(\"ContainedSpawner.spawn\")(function*(command) {\n // The release finalizer is registered BEFORE the spawn, so scope\n // closure runs it AFTER the spawn's own kill finalizer: finalizers\n // run last-registered-first, and a ledger that announced an exit\n // while the process was still being signalled would be telling the\n // next incarnation to stop looking for something still alive. The\n // slot is empty until the record exists, which is also what makes a\n // spawn that never got recorded a no-op to release.\n const slot: { current?: ProcessLedger.ProcessRecord; settled: Effect.Effect<boolean> } = {\n settled: Effect.succeed(true)\n }\n yield* Effect.addFinalizer(() =>\n Effect.gen(function*() {\n if (slot.current === undefined) return\n if (yield* slot.settled) return yield* releaseQuietly(ledger, slot.current)\n yield* Effect.logWarning(\n `process cleanup could not verify ${slot.current.pid}; retaining its ledger record`\n )\n })\n )\n const contained = withContainment(command, options) as ChildProcess.StandardCommand\n const watched = lifecycle === undefined ? undefined : yield* lifecycle(contained, spawner.spawn)\n const handle = watched?.handle ?? (yield* spawner.spawn(contained))\n slot.settled = watched?.settled ?? slot.settled\n const pid = handle.pid as number\n slot.current = yield* ledger.record({\n pid,\n pgid: groupOf(command, pid, options?.platform),\n commandDigest: CommandLine.executable(command)\n }).pipe(\n // A spawn whose record did not commit is precisely the child this\n // module exists to make discoverable, so it is not started: the\n // process is signalled and the caller is told, rather than left\n // running with nothing durable naming it.\n Effect.tapCause(() => Effect.ignore(handle.kill())),\n Effect.mapError(unrecorded)\n )\n if (watched !== undefined) yield* watched.activate\n return handle\n })\n ).pipe(Scope.provide(processScope))\n ).pipe(\n Effect.onError((cause) => Scope.close(processScope, Exit.failCause(cause)))\n )\n })\n )\n )\n return lifecycle === undefined ? service : Containment.mark(service)\n })\n )\n\n/** The spawn failure a caller sees when the ledger could not record a child. */\nconst unrecorded = (cause: unknown): PlatformError.PlatformError =>\n PlatformError.systemError({\n _tag: \"Unknown\",\n module: \"ChildProcess\",\n method: \"spawn\",\n description: \"the process ledger could not record this spawn durably\",\n cause\n })\n\n/**\n * Retires a record on scope close, retrying the durable write.\n *\n * A finalizer has nowhere to report a failure, so the retry is the report: an\n * exit that never commits leaves the record inherited, and the next\n * incarnation's reaper finds a pid that is already gone and retires it then.\n * That is the safe direction, and the reason this is the ONE place a ledger\n * failure is logged rather than propagated.\n */\nconst releaseQuietly = (\n ledger: ProcessLedger.Service,\n record: ProcessLedger.ProcessRecord\n): Effect.Effect<void> =>\n ledger.release(record).pipe(\n Effect.retry(Schedule.recurs(2)),\n Effect.catch((error) =>\n Effect.logWarning(`process ledger could not retire ${record.pid}; leaving it for the reaper`, error)\n )\n )\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0BA,aAAwB;AACxB,WAAsB;AACtB,YAAuB;AACvB,oBAA+B;AAC/B,eAA0B;AAC1B,YAAuB;AACvB,mBAA8B;AAC9B,iCAIO;AACP,kBAA6B;AAC7B,kBAA6B;AAC7B,eAA0B;AAC1B,oBAA+B;AAQxB,MAAM,iBAAiB;AAqEvB,MAAM,cAAc,CAAC,YAAqD,YAAY,YAAY,OAAO;AAazG,MAAM,kBAAkB,CAC7B,SACA,YACyB;AACzB,QAAM,UAAU,SAAS,WAAW;AACpC,MAAI,QAAQ,SAAS,gBAAgB;AACnC,WAAO,aAAa;AAAA,MAClB,gBAAgB,QAAQ,MAAM,OAAO;AAAA,MACrC,gBAAgB,QAAQ,OAAO,OAAO;AAAA,MACtC,QAAQ;AAAA,IACV;AAAA,EACF;AACA,SAAO,aAAa,KAAK,QAAQ,SAAS,CAAC,GAAG,QAAQ,IAAI,GAAG;AAAA,IAC3D,GAAG,QAAQ;AAAA,IACX,YAAY,QAAQ,QAAQ,cAAc;AAAA,IAC1C,gBAAgB,QAAQ,QAAQ,kBAAkB;AAAA,EACpD,CAAC;AACH;AAcO,MAAM,UAAU,CAAC,SAA+B,KAAa,aAAqC;AACvG,MAAI,aAAa,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AAQA,UAAS,KAAK,SAAS,QAAQ;AAAA,kBAC7C,eAAe,YAAY,WAAWA,QAAO;AAAA,gBAC/C,CAAC,EAAE;AAAA;AAAA;AAAA;AAAA;AAAA,kBAKD,OAAO,SAAS,MAAM,OAAO,OAAO,OAAO,KAAK,CAAC,CAAC;AAAA,kBAClD,OAAO,SAAS,UAAU;AAAA,gBAC5B;AACA,oBAAI,YAAY,OAAW,QAAO,QAAQ;AAC1C,uBAAO;AAAA,cACT,CAAC;AAAA,YACH,EAAE,KAAK,MAAM,QAAQ,YAAY,CAAC;AAAA,UACpC,EAAE;AAAA,YACA,OAAO,QAAQ,CAAC,UAAU,MAAM,MAAM,cAAc,KAAK,UAAU,KAAK,CAAC,CAAC;AAAA,UAC5E;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACJ;AACA,WAAO,cAAc,SAAY,UAAU,YAAY,KAAK,OAAO;AAAA,EACrE,CAAC;AACH;AAGF,MAAM,aAAa,CAAC,UAClB,cAAc,YAAY;AAAA,EACxB,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,aAAa;AAAA,EACb;AACF,CAAC;AAWH,MAAM,iBAAiB,CACrB,QACA,WAEA,OAAO,QAAQ,MAAM,EAAE;AAAA,EACrB,OAAO,MAAM,SAAS,OAAO,CAAC,CAAC;AAAA,EAC/B,OAAO;AAAA,IAAM,CAAC,UACZ,OAAO,WAAW,mCAAmC,OAAO,GAAG,+BAA+B,KAAK;AAAA,EACrG;AACF;",
4
+ "sourcesContent": ["/**\n * Process containment: prepared ownership, bounded cleanup and durable records.\n *\n * A host supplies a {@link Lifecycle} that owns launch and cleanup independently\n * of the command's exit status. The lifecycle first prepares a process identity;\n * this decorator commits that identity to {@link ProcessLedger.ProcessLedger}\n * before activating the caller's command. Failed or interrupted startup closes\n * its child scope immediately, including any earlier legs of a partial pipeline.\n *\n * Each command receives default termination and escalation options. The host\n * lifecycle validates that policy and verifies cleanup before the decorator\n * retires its record. Unverifiable cleanup retains the record for recovery;\n * a host that dies also leaves its committed records discoverable by the next\n * incarnation's reaper (`ProcessReaper` in `@smthrs/platform-node`).\n *\n * Every pipeline leg is prepared and recorded separately, including legs whose\n * pid the aggregate handle does not expose. The module remains platform-neutral.\n * A layer without a lifecycle provides only deadline defaults and bookkeeping;\n * it does not declare the verified-cleanup contract read by {@link isContained}.\n *\n * Governing design:\n * `docs/specs/Concepts/Host Adapters.md`.\n *\n * @since 1.0.0-rc.0\n */\n\nimport * as Effect from \"effect/Effect\"\nimport * as Exit from \"effect/Exit\"\nimport * as Layer from \"effect/Layer\"\nimport * as PlatformError from \"effect/PlatformError\"\nimport * as ChildProcess from \"effect/process/ChildProcess\"\nimport { type ChildProcessHandle, ChildProcessSpawner, make as makeSpawner } from \"effect/process/ChildProcessSpawner\"\nimport * as Schedule from \"effect/Schedule\"\nimport * as Scope from \"effect/Scope\"\nimport * as CommandLine from \"./CommandLine.ts\"\nimport * as Containment from \"./internal/Containment.ts\"\nimport * as Pipeline from \"./internal/Pipeline.ts\"\nimport * as ProcessLedger from \"./ProcessLedger.ts\"\n\n/**\n * How long a contained child may take to honour `SIGTERM`.\n *\n * @category models\n * @since 1.0.0-rc.0\n */\nexport const defaultGraceMs = 2000\n\n/**\n * Containment configuration.\n *\n * @category models\n * @since 1.0.0-rc.0\n */\nexport interface Options {\n /**\n * Milliseconds between the `SIGTERM` that asks a child to stop and the\n * `SIGKILL` that makes it. Default {@link defaultGraceMs}.\n */\n readonly graceMs?: number | undefined\n /**\n * The platform the host spawner runs on, as `process.platform` spells it.\n * Windows records no POSIX process group, including for detached children.\n * On POSIX, detachment determines whether the child leads its own group.\n * Default `\"linux\"`; host bundles pass their actual platform.\n */\n readonly platform?: string | undefined\n}\n\n/**\n * A platform's preparation, activation, and cleanup of a contained process.\n *\n * Preparation receives the underlying spawner and must own cleanup before it\n * can fail or be interrupted. It returns the process identity to record and an\n * idempotent `activate` effect. The decorator runs activation only after that\n * identity commits to the ledger. A platform can therefore prepare an owner\n * without executing the caller's command before it is durably discoverable.\n *\n * Failed startup closes its own scope immediately. A successful startup keeps\n * that scope attached to the caller's scope. `settled` must stay false on failed\n * or unverifiable cleanup; only verified cleanup permits ledger retirement.\n * The wrapped handle applies the same policy to an explicit `kill`.\n *\n * @category models\n * @since 1.0.0\n */\nexport type Lifecycle = (\n command: ChildProcess.StandardCommand,\n spawn: (\n command: ChildProcess.StandardCommand\n ) => Effect.Effect<ChildProcessHandle, PlatformError.PlatformError, Scope.Scope>\n) => Effect.Effect<\n {\n readonly handle: ChildProcessHandle\n readonly activate: Effect.Effect<void, PlatformError.PlatformError, Scope.Scope>\n readonly settled: Effect.Effect<boolean>\n },\n PlatformError.PlatformError,\n Scope.Scope\n>\n\n/**\n * Whether a spawner declares the platform lifecycle required for containment.\n *\n * Only a layer with a {@link Lifecycle} declares this contract. A kill deadline\n * alone does not verify cleanup. The permission decorator preserves the\n * declaration when it wraps a contained service. The marker interoperates\n * across the package's ESM and CommonJS projections.\n *\n * This is a trusted composition check: a caller-supplied lifecycle remains\n * responsible for implementing its contract.\n *\n * @category predicates\n * @since 1.0.0\n */\nexport const isContained = (spawner: ChildProcessSpawner[\"Service\"]): boolean => Containment.isContained(spawner)\n\n/**\n * Supplies a command's default termination signal and escalation deadline.\n *\n * Both legs of a pipeline get the same policy \u2014 a pipeline is one action's\n * process tree and a surviving leg is as much of a leak as a surviving\n * child. Explicit `killSignal` and `forceKillAfter` values are preserved for\n * the host lifecycle to validate.\n *\n * @category constructors\n * @since 1.0.0-rc.0\n */\nexport const withContainment = (\n command: ChildProcess.Command,\n options?: Options\n): ChildProcess.Command => {\n const graceMs = options?.graceMs ?? defaultGraceMs\n if (command._tag === \"PipedCommand\") {\n return ChildProcess.pipeTo(\n withContainment(command.left, options),\n withContainment(command.right, options),\n command.options\n )\n }\n return ChildProcess.make(command.command, [...command.args], {\n ...command.options,\n killSignal: command.options.killSignal ?? \"SIGTERM\",\n forceKillAfter: command.options.forceKillAfter ?? graceMs\n })\n}\n\n/**\n * The process group a started child leads, or `null` when it shares the\n * host's or the platform has no POSIX process groups.\n *\n * A detached POSIX child leads a group whose id is its own pid. A child in\n * the host's group must not record that group as its own cleanup target.\n * Windows detachment creates an independent console, not a POSIX group;\n * Windows records therefore always carry `null`.\n *\n * @category constructors\n * @since 1.0.0-rc.0\n */\nexport const groupOf = (command: ChildProcess.Command, pid: number, platform?: string): number | null => {\n if (platform === \"win32\") return null\n const options = command._tag === \"PipedCommand\" ? rightmost(command).options : command.options\n return (options.detached ?? true) ? pid : null\n}\n\nconst rightmost = (command: ChildProcess.Command): ChildProcess.StandardCommand =>\n command._tag === \"StandardCommand\" ? command : rightmost(command.right)\n\n/**\n * Decorates the process spawner in place with containment and bookkeeping.\n *\n * Compose it over a host spawner layer with `Layer.provide`. It provides the\n * tag it also requires. Compose the permission decorator over this layer to\n * authorize the caller's whole pipeline before its per-process expansion. A\n * lifecycle may use different commands during preparation; a decorator below\n * containment sees those platform commands instead of the caller's command.\n *\n * @category layers\n * @since 1.0.0-rc.0\n */\nexport const layer = (\n options?: Options,\n lifecycle?: Lifecycle\n): Layer.Layer<ChildProcessSpawner, never, ChildProcessSpawner | ProcessLedger.ProcessLedger> =>\n Layer.effect(\n ChildProcessSpawner,\n Effect.gen(function*() {\n const spawner = yield* ChildProcessSpawner\n const ledger = yield* ProcessLedger.ProcessLedger\n const service = makeSpawner(\n (command) =>\n Effect.uninterruptibleMask((restore) =>\n Effect.gen(function*() {\n // A failed startup must clean up even when its caller catches the\n // error and keeps the outer scope open. One child scope contains\n // the entire pipeline, so failure of a later leg also closes all\n // earlier legs. Successful spawns retain it until their caller closes.\n const processScope = yield* Scope.fork(yield* Scope.Scope)\n return yield* restore(\n Pipeline.spawn(\n command,\n Effect.fn(\"ContainedSpawner.spawn\")(function*(command) {\n // The release finalizer is registered BEFORE the spawn, so scope\n // closure runs it AFTER the spawn's own kill finalizer: finalizers\n // run last-registered-first, and a ledger that announced an exit\n // while the process was still being signalled would be telling the\n // next incarnation to stop looking for something still alive. The\n // slot is empty until the record exists, which is also what makes a\n // spawn that never got recorded a no-op to release.\n const slot: { current?: ProcessLedger.ProcessRecord; settled: Effect.Effect<boolean> } = {\n settled: Effect.succeed(true)\n }\n yield* Effect.addFinalizer(() =>\n Effect.gen(function*() {\n if (slot.current === undefined) return\n if (yield* slot.settled) return yield* releaseQuietly(ledger, slot.current)\n yield* Effect.logWarning(\n `process cleanup could not verify ${slot.current.pid}; retaining its ledger record`\n )\n })\n )\n const contained = withContainment(command, options) as ChildProcess.StandardCommand\n const watched = lifecycle === undefined ? undefined : yield* lifecycle(contained, spawner.spawn)\n const handle = watched?.handle ?? (yield* spawner.spawn(contained))\n slot.settled = watched?.settled ?? slot.settled\n const pid = handle.pid as number\n slot.current = yield* ledger.record({\n pid,\n pgid: groupOf(command, pid, options?.platform),\n commandDigest: CommandLine.executable(command)\n }).pipe(\n // A spawn whose record did not commit is precisely the child this\n // module exists to make discoverable, so it is not started: the\n // process is signalled and the caller is told, rather than left\n // running with nothing durable naming it.\n Effect.tapCause(() => Effect.ignore(handle.kill())),\n Effect.mapError(unrecorded)\n )\n if (watched !== undefined) yield* watched.activate\n return handle\n })\n ).pipe(Scope.provide(processScope))\n ).pipe(\n Effect.onError((cause) => Scope.close(processScope, Exit.failCause(cause)))\n )\n })\n )\n )\n return lifecycle === undefined ? service : Containment.mark(service)\n })\n )\n\n/** The spawn failure a caller sees when the ledger could not record a child. */\nconst unrecorded = (cause: unknown): PlatformError.PlatformError =>\n PlatformError.systemError({\n _tag: \"Unknown\",\n module: \"ChildProcess\",\n method: \"spawn\",\n description: \"the process ledger could not record this spawn durably\",\n cause\n })\n\n/**\n * Retires a record on scope close, retrying the durable write.\n *\n * A finalizer has nowhere to report a failure, so the retry is the report: an\n * exit that never commits leaves the record inherited, and the next\n * incarnation's reaper finds a pid that is already gone and retires it then.\n * That is the safe direction, and the reason this is the ONE place a ledger\n * failure is logged rather than propagated.\n */\nconst releaseQuietly = (\n ledger: ProcessLedger.Service,\n record: ProcessLedger.ProcessRecord\n): Effect.Effect<void> =>\n ledger.release(record).pipe(\n Effect.retry(Schedule.recurs(2)),\n Effect.catch((error) =>\n Effect.logWarning(`process ledger could not retire ${record.pid}; leaving it for the reaper`, error)\n )\n )\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0BA,aAAwB;AACxB,WAAsB;AACtB,YAAuB;AACvB,oBAA+B;AAC/B,mBAA8B;AAC9B,iCAAkF;AAClF,eAA0B;AAC1B,YAAuB;AACvB,kBAA6B;AAC7B,kBAA6B;AAC7B,eAA0B;AAC1B,oBAA+B;AAQxB,MAAM,iBAAiB;AAqEvB,MAAM,cAAc,CAAC,YAAqD,YAAY,YAAY,OAAO;AAazG,MAAM,kBAAkB,CAC7B,SACA,YACyB;AACzB,QAAM,UAAU,SAAS,WAAW;AACpC,MAAI,QAAQ,SAAS,gBAAgB;AACnC,WAAO,aAAa;AAAA,MAClB,gBAAgB,QAAQ,MAAM,OAAO;AAAA,MACrC,gBAAgB,QAAQ,OAAO,OAAO;AAAA,MACtC,QAAQ;AAAA,IACV;AAAA,EACF;AACA,SAAO,aAAa,KAAK,QAAQ,SAAS,CAAC,GAAG,QAAQ,IAAI,GAAG;AAAA,IAC3D,GAAG,QAAQ;AAAA,IACX,YAAY,QAAQ,QAAQ,cAAc;AAAA,IAC1C,gBAAgB,QAAQ,QAAQ,kBAAkB;AAAA,EACpD,CAAC;AACH;AAcO,MAAM,UAAU,CAAC,SAA+B,KAAa,aAAqC;AACvG,MAAI,aAAa,QAAS,QAAO;AACjC,QAAM,UAAU,QAAQ,SAAS,iBAAiB,UAAU,OAAO,EAAE,UAAU,QAAQ;AACvF,SAAQ,QAAQ,YAAY,OAAQ,MAAM;AAC5C;AAEA,MAAM,YAAY,CAAC,YACjB,QAAQ,SAAS,oBAAoB,UAAU,UAAU,QAAQ,KAAK;AAc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OAAO,MAAM,KACZ,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,aAAa,CA6CnD,CAAA;AAoID;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,KAAK,CAC7B,gBAAgB,CAAC,UAAU,EAC3B,aAAa,CAAC,aAAa,EAC3B,gBAAgB,CAAC,UAAU,GAAG,UAAU,CAAC,IAAI,GAAG,SAAS,GAAG,UAAU,CAkvBvE,CAAA"}
@@ -45,6 +45,7 @@ __export(FileSystem_exports, {
45
45
  module.exports = __toCommonJS(FileSystem_exports);
46
46
  var import_Permission = require("@smthrs/capability/Permission");
47
47
  var import_effect = require("effect");
48
+ var import_encoding = require("effect/encoding");
48
49
  var Batch = __toESM(require("./FileSystemBatch.js"), 1);
49
50
  var import_GrantStore = require("./GrantStore.js");
50
51
  var import_makeCapability = require("./internal/makeCapability.js");
@@ -90,7 +91,7 @@ const withIsolatedFileSystem = (fileSystem) => {
90
91
  remove: (request) => fileSystem.remove(request.path, request.options),
91
92
  rename: (request) => fileSystem.rename(request.from, request.to),
92
93
  stat: (request) => fileSystem.stat(request.path),
93
- writeFile: (request) => import_effect.Encoding.decodeBase64(request.data).pipe(
94
+ writeFile: (request) => import_encoding.Base64.decode(request.data).pipe(
94
95
  import_effect.Effect.fromResult,
95
96
  import_effect.Effect.orDie,
96
97
  import_effect.Effect.flatMap((data) => fileSystem.writeFile(request.path, data, request.options))
@@ -200,7 +201,7 @@ const confined = (fileSystem, root) => import_effect.Effect.gen(function* () {
200
201
  return run({
201
202
  operation: "writeFile",
202
203
  path: normalize(value),
203
- data: import_effect.Encoding.encodeBase64(data),
204
+ data: import_encoding.Base64.encode(data),
204
205
  options
205
206
  });
206
207
  }
@@ -732,7 +733,7 @@ const layer = import_effect.Layer.effect(
732
733
  return atomicOne("fs:write", value, "writeFile", {
733
734
  operation: "writeFile",
734
735
  path: normalize(value),
735
- data: import_effect.Encoding.encodeBase64(bytes),
736
+ data: import_encoding.Base64.encode(bytes),
736
737
  options: captured
737
738
  });
738
739
  })