#!/usr/bin/env node

import * as Effect from "effect/Effect";
import * as Context from "effect/Context";
import * as NodeOS from "node:os";
import * as Schema from "effect/Schema";
//#region ../../packages/shared/src/hostProcess.ts
const HostProcessPlatform = Context.Reference("@p4code/shared/hostProcess/HostProcessPlatform", { defaultValue: () => process.platform });
const HostProcessArchitecture = Context.Reference("@p4code/shared/hostProcess/HostProcessArchitecture", { defaultValue: () => process.arch });
const HostProcessHostname = Context.Reference("@p4code/shared/hostProcess/HostProcessHostname", { defaultValue: () => NodeOS.hostname() });
const HostProcessEnvironment = Context.Reference("@p4code/shared/hostProcess/HostProcessEnvironment", { defaultValue: () => process.env });
Context.Reference("@p4code/shared/hostProcess/HostProcessWorkingDirectory", { defaultValue: () => process.cwd() });
const HostProcessExecutablePath = Context.Reference("@p4code/shared/hostProcess/HostProcessExecutablePath", { defaultValue: () => process.execPath });
const HostProcessArguments = Context.Reference("@p4code/shared/hostProcess/HostProcessArguments", { defaultValue: () => process.argv });
/**
* Numeric uid of the calling user. `launchctl` addresses per-user domains as
* `gui/<uid>`, so the macOS boot service cannot be managed without it.
* `process.getuid` is undefined on Windows, where -1 stands in for "no uid".
*/
const HostProcessUserId = Context.Reference("@p4code/shared/hostProcess/HostProcessUserId", { defaultValue: () => process.getuid?.() ?? -1 });
Effect.map(HostProcessPlatform, (platform) => platform === "win32");
//#endregion
//#region src/terminal/PtyAdapter.ts
/**
* PtyAdapter - Terminal PTY adapter service contract.
*
* Defines the process primitives required by terminal session management
* without binding to a specific PTY implementation.
*
* @module PtyAdapter
*/
/**
* PtySpawnError - Error type for PTY spawn failures.
*/
var PtySpawnError = class extends Schema.TaggedErrorClass()("PtySpawnError", {
	adapter: Schema.String,
	shell: Schema.optional(Schema.String),
	attemptedShells: Schema.optional(Schema.Array(Schema.String)),
	cause: Schema.optional(Schema.Defect())
}) {
	get message() {
		const shell = this.shell === void 0 ? "" : ` '${this.shell}'`;
		const attemptedShells = this.attemptedShells === void 0 || this.attemptedShells.length === 0 ? "" : ` Tried shells: ${this.attemptedShells.join(", ")}.`;
		return `Failed to spawn PTY process${shell} with ${this.adapter}.${attemptedShells}`;
	}
};
/**
* PtyAdapter - Service tag for PTY process integration.
*/
var PtyAdapter = class extends Context.Service()("@p4code/cli/terminal/PtyAdapter") {};
//#endregion
export { HostProcessEnvironment as a, HostProcessPlatform as c, HostProcessArguments as i, HostProcessUserId as l, PtySpawnError as n, HostProcessExecutablePath as o, HostProcessArchitecture as r, HostProcessHostname as s, PtyAdapter as t };

//# sourceMappingURL=PtyAdapter-DLKyoorI.mjs.map