devsess 0.4.0 → 0.5.0

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 (51) hide show
  1. package/dist/async/index.js +2 -2
  2. package/dist/{chunk-SX5HBQHG.js → chunk-KG24ZAKO.js} +20 -80
  3. package/dist/chunk-KG24ZAKO.js.map +1 -0
  4. package/dist/{chunk-GX4J6JR3.js → chunk-MBPIOYW3.js} +157 -9
  5. package/dist/chunk-MBPIOYW3.js.map +1 -0
  6. package/dist/chunk-OODLZZCC.js +287 -0
  7. package/dist/chunk-OODLZZCC.js.map +1 -0
  8. package/dist/{chunk-CBRTTFXG.js → chunk-UOIMVHGX.js} +2 -2
  9. package/dist/current-session.d.ts +1 -0
  10. package/dist/current-session.d.ts.map +1 -1
  11. package/dist/dev/daemon-client.d.ts +21 -0
  12. package/dist/dev/daemon-client.d.ts.map +1 -0
  13. package/dist/dev/daemon-readiness.d.ts.map +1 -1
  14. package/dist/dev/daemon-services.d.ts +3 -0
  15. package/dist/dev/daemon-services.d.ts.map +1 -0
  16. package/dist/dev/sticky-port.d.ts +4 -1
  17. package/dist/dev/sticky-port.d.ts.map +1 -1
  18. package/dist/dev-sessions.d.ts +2 -0
  19. package/dist/dev-sessions.d.ts.map +1 -1
  20. package/dist/index.js +3 -3
  21. package/dist/lock.d.ts +3 -0
  22. package/dist/lock.d.ts.map +1 -0
  23. package/dist/services/container.d.ts.map +1 -1
  24. package/dist/services/core.d.ts +12 -0
  25. package/dist/services/core.d.ts.map +1 -1
  26. package/dist/services/index.d.ts +9 -4
  27. package/dist/services/index.d.ts.map +1 -1
  28. package/dist/services/index.js +119 -52
  29. package/dist/services/index.js.map +1 -1
  30. package/dist/services/local.d.ts +11 -0
  31. package/dist/services/local.d.ts.map +1 -0
  32. package/dist/services/shared/callsite.d.ts +4 -0
  33. package/dist/services/shared/callsite.d.ts.map +1 -0
  34. package/dist/services/shared/entry.d.ts +2 -0
  35. package/dist/services/shared/entry.d.ts.map +1 -0
  36. package/dist/services/shared/entry.js +137 -0
  37. package/dist/services/shared/entry.js.map +1 -0
  38. package/dist/services/shared/host.d.ts +5 -0
  39. package/dist/services/shared/host.d.ts.map +1 -0
  40. package/dist/services/shared/index.d.ts +11 -0
  41. package/dist/services/shared/index.d.ts.map +1 -0
  42. package/dist/services/shared/protocol.d.ts +39 -0
  43. package/dist/services/shared/protocol.d.ts.map +1 -0
  44. package/dist/services/shared/root.d.ts +5 -0
  45. package/dist/services/shared/root.d.ts.map +1 -0
  46. package/dist/socket-line.d.ts +3 -0
  47. package/dist/socket-line.d.ts.map +1 -0
  48. package/package.json +4 -2
  49. package/dist/chunk-GX4J6JR3.js.map +0 -1
  50. package/dist/chunk-SX5HBQHG.js.map +0 -1
  51. /package/dist/{chunk-CBRTTFXG.js.map → chunk-UOIMVHGX.js.map} +0 -0
@@ -0,0 +1,287 @@
1
+ import {
2
+ acquireFileLock,
3
+ getStickyPort,
4
+ readDaemonIdentity,
5
+ readSocketLine,
6
+ sendDaemonRequest
7
+ } from "./chunk-MBPIOYW3.js";
8
+
9
+ // src/services/core.ts
10
+ import { Data, Effect } from "effect";
11
+ var serviceBrand = /* @__PURE__ */ Symbol.for("devsess/ServiceDefinition");
12
+ var isServiceDefinition = (value) => typeof value === "object" && value !== null && serviceBrand in value && value[serviceBrand] === true;
13
+ var withServiceError = (message) => Effect.mapError(
14
+ (cause) => cause instanceof ServiceError ? cause : new ServiceError({ message, cause })
15
+ );
16
+ var runningService = (result) => ({
17
+ ...typeof result.value === "object" && result.value !== null ? result.value : {},
18
+ ports: result.ports
19
+ });
20
+ var ServiceError = class extends Data.TaggedError("ServiceError") {
21
+ };
22
+ var validName = (name) => /^[a-zA-Z0-9][a-zA-Z0-9_.-]*$/.test(name);
23
+
24
+ // src/services/local.ts
25
+ import { Effect as Effect3 } from "effect";
26
+ import { FileSystem } from "effect/FileSystem";
27
+ import { Path } from "effect/Path";
28
+
29
+ // src/dev/daemon-services.ts
30
+ import { Effect as Effect2 } from "effect";
31
+ var reportDaemonService = (name, ports) => Effect2.gen(function* () {
32
+ const identity = yield* readDaemonIdentity;
33
+ if (identity === void 0) return;
34
+ const params = {
35
+ runId: identity.runId,
36
+ service: identity.service,
37
+ name,
38
+ ...identity.instanceId === void 0 ? {} : { instanceId: identity.instanceId }
39
+ };
40
+ const send = (method, values) => sendDaemonRequest(
41
+ identity,
42
+ { version: 1, requestId: crypto.randomUUID(), method, params: values },
43
+ 250
44
+ ).pipe(Effect2.catch(() => Effect2.void));
45
+ yield* Effect2.acquireRelease(
46
+ send("reportService", {
47
+ ...params,
48
+ ...Object.keys(ports).length === 0 ? {} : { ports }
49
+ }),
50
+ () => send("retractService", params)
51
+ );
52
+ }).pipe(Effect2.catch(() => Effect2.void));
53
+
54
+ // src/services/local.ts
55
+ var prepareLocal = (session, def) => Effect3.gen(function* () {
56
+ if (!validName(def.name) || !validName(session.name)) {
57
+ return yield* new ServiceError({
58
+ message: "Service and session names must contain only letters, numbers, dots, underscores, or hyphens"
59
+ });
60
+ }
61
+ const fs = yield* FileSystem;
62
+ const path = yield* Path;
63
+ const dataDir = path.join(yield* session.path(""), "services", def.name);
64
+ const ports = {};
65
+ for (const port of def.ports)
66
+ ports[port] = yield* getStickyPort(session, {
67
+ name: `${def.name}:${port}`
68
+ });
69
+ yield* fs.makeDirectory(dataDir, { recursive: true });
70
+ return { ports, dataDir };
71
+ }).pipe(withServiceError(`Failed to prepare service ${def.name}`));
72
+ var runLocal = (session, def) => Effect3.gen(function* () {
73
+ const prepared = yield* prepareLocal(session, def);
74
+ const value = yield* def.start({
75
+ session,
76
+ ports: prepared.ports,
77
+ dataDir: prepared.dataDir
78
+ });
79
+ yield* reportDaemonService(def.name, prepared.ports);
80
+ return { value, ports: prepared.ports };
81
+ }).pipe(Effect3.annotateLogs({ service: def.name }));
82
+
83
+ // src/services/shared/protocol.ts
84
+ import { spawn } from "child_process";
85
+ import { createHash } from "crypto";
86
+ import { mkdir, open, readlink, rm, symlink } from "fs/promises";
87
+ import { connect } from "net";
88
+ import { tmpdir } from "os";
89
+ import { basename, join } from "path";
90
+ import { fileURLToPath } from "url";
91
+ import { Effect as Effect4, Schedule, Schema } from "effect";
92
+ var sharedGraceMs = 5e3;
93
+ var hostPaths = (sessionDir, name) => {
94
+ const dir = join(sessionDir, "hosts", name);
95
+ return {
96
+ dir,
97
+ socket: join(dir, "host.sock"),
98
+ lock: join(dir, "startup.lock"),
99
+ log: join(dir, "service.log")
100
+ };
101
+ };
102
+ var hostArguments = Schema.fromJsonString(
103
+ Schema.Struct({
104
+ module: Schema.String,
105
+ name: Schema.String,
106
+ root: Schema.String,
107
+ session: Schema.String
108
+ })
109
+ );
110
+ var readyMessage = (output) => Schema.fromJsonString(
111
+ Schema.Struct({
112
+ output,
113
+ ports: Schema.Record(Schema.String, Schema.Number)
114
+ })
115
+ );
116
+ var io = (message, operation) => Effect4.tryPromise({
117
+ try: () => operation(),
118
+ catch: (cause) => new ServiceError({ message, cause })
119
+ });
120
+ var isErrno = (cause, code) => typeof cause === "object" && cause !== null && "code" in cause && cause.code === code;
121
+ var startupLock = (paths) => acquireFileLock(paths.dir, paths.lock).pipe(
122
+ withServiceError("Failed to acquire shared host lock")
123
+ );
124
+ var failWhenHostExits = (lease, name) => Effect4.callback((resume) => {
125
+ const closed = () => resume(
126
+ new ServiceError({
127
+ message: `Shared host ${name} exited while this consumer was active`
128
+ })
129
+ );
130
+ lease.socket.once("close", closed);
131
+ return Effect4.sync(() => lease.socket.removeListener("close", closed));
132
+ });
133
+ var socketPath = async (paths) => {
134
+ if (Buffer.byteLength(paths.socket) < 100) return paths.socket;
135
+ const alias = join(
136
+ tmpdir(),
137
+ `dvs-${createHash("sha256").update(paths.dir).digest("hex").slice(0, 16)}`
138
+ );
139
+ await symlink(paths.dir, alias).catch(async (cause) => {
140
+ if (!isErrno(cause, "EEXIST")) throw cause;
141
+ if (await readlink(alias) !== paths.dir)
142
+ throw new Error(`Unexpected shared socket alias: ${alias}`);
143
+ });
144
+ return join(alias, basename(paths.socket));
145
+ };
146
+ var HostUnavailable = class extends Error {
147
+ };
148
+ var connectHost = async (paths, child) => {
149
+ const socket = connect(await socketPath(paths));
150
+ const exited = () => socket.destroy(new Error("Host exited before readiness"));
151
+ child?.once("exit", exited);
152
+ try {
153
+ if (child !== void 0 && (child.exitCode !== null || child.signalCode !== null))
154
+ exited();
155
+ const line = await readSocketLine(socket);
156
+ socket.on("error", () => socket.destroy());
157
+ return { socket, line };
158
+ } catch (cause) {
159
+ socket.destroy();
160
+ throw new HostUnavailable("Host did not send readiness", { cause });
161
+ } finally {
162
+ child?.removeListener("exit", exited);
163
+ }
164
+ };
165
+ var unavailable = (cause) => cause instanceof HostUnavailable;
166
+ var logTail = async (paths) => {
167
+ const file = await open(paths.log, "r");
168
+ try {
169
+ const size = (await file.stat()).size;
170
+ const buffer = Buffer.alloc(Math.min(size, 8192));
171
+ const read = await file.read(
172
+ buffer,
173
+ 0,
174
+ buffer.length,
175
+ Math.max(0, size - buffer.length)
176
+ );
177
+ return buffer.subarray(0, read.bytesRead).toString("utf8");
178
+ } finally {
179
+ await file.close();
180
+ }
181
+ };
182
+ var startHost = (paths, launch) => Effect4.gen(function* () {
183
+ yield* io(
184
+ "Failed to remove stale host socket",
185
+ () => rm(paths.socket, { force: true })
186
+ );
187
+ const child = yield* io("Failed to launch shared host", launch);
188
+ return yield* Effect4.suspend(() => {
189
+ if (child.exitCode !== null || child.signalCode !== null)
190
+ return io("Failed to read shared host log", () => logTail(paths)).pipe(
191
+ Effect4.flatMap(
192
+ (log) => new ServiceError({
193
+ message: `Shared host failed to start: ${log}`
194
+ })
195
+ )
196
+ );
197
+ return io(
198
+ "Failed to read shared host readiness",
199
+ () => connectHost(paths, child)
200
+ );
201
+ }).pipe(
202
+ Effect4.retry({
203
+ while: (error) => unavailable(error.cause),
204
+ schedule: Schedule.spaced("50 millis")
205
+ })
206
+ );
207
+ });
208
+ var acquireHostUnderLock = (paths, launch) => Effect4.gen(function* () {
209
+ yield* Effect4.acquireRelease(
210
+ startupLock(paths),
211
+ (release) => io("Failed to release shared host lock", release).pipe(Effect4.orDie)
212
+ );
213
+ return yield* io(
214
+ "Failed to connect to shared host",
215
+ () => connectHost(paths)
216
+ ).pipe(
217
+ Effect4.catch(
218
+ (error) => unavailable(error.cause) ? startHost(paths, launch) : error
219
+ )
220
+ );
221
+ }).pipe(Effect4.scoped);
222
+ var acquireHost = (paths, launch) => Effect4.gen(function* () {
223
+ yield* io(
224
+ "Failed to create shared host directory",
225
+ () => mkdir(paths.dir, { recursive: true })
226
+ );
227
+ return yield* io(
228
+ "Failed to connect to shared host",
229
+ () => connectHost(paths)
230
+ ).pipe(
231
+ Effect4.catch(
232
+ (error) => unavailable(error.cause) ? acquireHostUnderLock(paths, launch) : error
233
+ )
234
+ );
235
+ });
236
+ var launchHost = async (paths, args) => {
237
+ const log = await open(paths.log, "a");
238
+ try {
239
+ const entry = new URL(
240
+ import.meta.url.endsWith(".ts") ? "../../../dist/services/shared/entry.js" : "./services/shared/entry.js",
241
+ import.meta.url
242
+ );
243
+ const child = spawn(
244
+ process.execPath,
245
+ [...process.execArgv, fileURLToPath(entry), JSON.stringify(args)],
246
+ {
247
+ detached: true,
248
+ env: Object.fromEntries(
249
+ Object.entries(process.env).filter(
250
+ (entry2) => !entry2[0].startsWith("DEVSESS_")
251
+ )
252
+ ),
253
+ stdio: ["ignore", log.fd, log.fd]
254
+ }
255
+ );
256
+ await new Promise((resolve, reject) => {
257
+ child.once("spawn", resolve);
258
+ child.once("error", reject);
259
+ });
260
+ child.unref();
261
+ return child;
262
+ } finally {
263
+ await log.close();
264
+ }
265
+ };
266
+
267
+ export {
268
+ serviceBrand,
269
+ isServiceDefinition,
270
+ withServiceError,
271
+ runningService,
272
+ ServiceError,
273
+ validName,
274
+ reportDaemonService,
275
+ runLocal,
276
+ sharedGraceMs,
277
+ hostPaths,
278
+ hostArguments,
279
+ readyMessage,
280
+ io,
281
+ startupLock,
282
+ failWhenHostExits,
283
+ socketPath,
284
+ acquireHost,
285
+ launchHost
286
+ };
287
+ //# sourceMappingURL=chunk-OODLZZCC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/services/core.ts","../src/services/local.ts","../src/dev/daemon-services.ts","../src/services/shared/protocol.ts"],"sourcesContent":["import { Data, Effect } from 'effect';\nimport type { FileSystem } from 'effect/FileSystem';\nimport type { Path } from 'effect/Path';\nimport type { Scope } from 'effect/Scope';\nimport type { DevSession } from '../dev-sessions';\nimport type { RunningService, ServiceDefinition } from './index';\n\nexport const serviceBrand = Symbol.for('devsess/ServiceDefinition');\n\nexport const isServiceDefinition = (\n\tvalue: unknown,\n): value is ServiceDefinition<\n\tstring,\n\tstring,\n\tunknown,\n\tunknown,\n\tScope | FileSystem | Path\n> =>\n\ttypeof value === 'object' &&\n\tvalue !== null &&\n\tserviceBrand in value &&\n\tvalue[serviceBrand] === true;\n\nexport const withServiceError = (message: string) =>\n\tEffect.mapError((cause: unknown) =>\n\t\tcause instanceof ServiceError\n\t\t\t? cause\n\t\t\t: new ServiceError({ message, cause }),\n\t);\n\nexport const runningService = <Port extends string, A>(result: {\n\tvalue: A;\n\tports: Readonly<Record<Port, number>>;\n}) =>\n\t({\n\t\t...(typeof result.value === 'object' && result.value !== null\n\t\t\t? result.value\n\t\t\t: {}),\n\t\tports: result.ports,\n\t}) as RunningService<Port, A>;\n\nexport class ServiceError extends Data.TaggedError('ServiceError')<{\n\tmessage: string;\n\tcause?: unknown;\n}> {}\n\nexport type ServiceContext<Port extends string> = {\n\treadonly session: DevSession;\n\treadonly ports: Readonly<Record<Port, number>>;\n\t/** `<session>/services/<service>`, created before `start` runs and kept after it stops. */\n\treadonly dataDir: string;\n};\n\nexport const validName = (name: string) =>\n\t/^[a-zA-Z0-9][a-zA-Z0-9_.-]*$/.test(name);\n","import { Effect } from 'effect';\nimport { FileSystem } from 'effect/FileSystem';\nimport { Path } from 'effect/Path';\nimport { reportDaemonService } from '../dev/daemon-services';\nimport { getStickyPort } from '../dev/sticky-port';\nimport type { DevSession } from '../dev-sessions';\nimport { ServiceError, validName, withServiceError } from './core';\nimport type { ServiceDefinition } from './index';\n\nconst prepareLocal = <Name extends string, Port extends string>(\n\tsession: DevSession,\n\tdef: { readonly name: Name; readonly ports: ReadonlyArray<Port> },\n) =>\n\tEffect.gen(function* () {\n\t\tif (!validName(def.name) || !validName(session.name)) {\n\t\t\treturn yield* new ServiceError({\n\t\t\t\tmessage:\n\t\t\t\t\t'Service and session names must contain only letters, numbers, dots, underscores, or hyphens',\n\t\t\t});\n\t\t}\n\t\tconst fs = yield* FileSystem;\n\t\tconst path = yield* Path;\n\t\tconst dataDir = path.join(yield* session.path(''), 'services', def.name);\n\t\tconst ports = {} as Record<Port, number>;\n\t\tfor (const port of def.ports)\n\t\t\tports[port] = yield* getStickyPort(session, {\n\t\t\t\tname: `${def.name}:${port}`,\n\t\t\t});\n\t\tyield* fs.makeDirectory(dataDir, { recursive: true });\n\t\treturn { ports, dataDir };\n\t}).pipe(withServiceError(`Failed to prepare service ${def.name}`));\n\nexport const runLocal = <Name extends string, Port extends string, A, E, R>(\n\tsession: DevSession,\n\tdef: Pick<ServiceDefinition<Name, Port, A, E, R>, 'name' | 'ports' | 'start'>,\n) =>\n\tEffect.gen(function* () {\n\t\tconst prepared = yield* prepareLocal(session, def);\n\t\tconst value = yield* def.start({\n\t\t\tsession,\n\t\t\tports: prepared.ports,\n\t\t\tdataDir: prepared.dataDir,\n\t\t});\n\t\tyield* reportDaemonService(def.name, prepared.ports);\n\t\treturn { value, ports: prepared.ports };\n\t}).pipe(Effect.annotateLogs({ service: def.name }));\n","import { Effect } from 'effect';\nimport { readDaemonIdentity, sendDaemonRequest } from './daemon-client';\n\nexport const reportDaemonService = (\n\tname: string,\n\tports: Readonly<Record<string, number>>,\n) =>\n\tEffect.gen(function* () {\n\t\tconst identity = yield* readDaemonIdentity;\n\t\tif (identity === undefined) return;\n\t\tconst params = {\n\t\t\trunId: identity.runId,\n\t\t\tservice: identity.service,\n\t\t\tname,\n\t\t\t...(identity.instanceId === undefined\n\t\t\t\t? {}\n\t\t\t\t: { instanceId: identity.instanceId }),\n\t\t};\n\t\tconst send = (method: string, values: Readonly<Record<string, unknown>>) =>\n\t\t\tsendDaemonRequest(\n\t\t\t\tidentity,\n\t\t\t\t{ version: 1, requestId: crypto.randomUUID(), method, params: values },\n\t\t\t\t250,\n\t\t\t).pipe(Effect.catch(() => Effect.void));\n\t\tyield* Effect.acquireRelease(\n\t\t\tsend('reportService', {\n\t\t\t\t...params,\n\t\t\t\t...(Object.keys(ports).length === 0 ? {} : { ports }),\n\t\t\t}),\n\t\t\t() => send('retractService', params),\n\t\t);\n\t}).pipe(Effect.catch(() => Effect.void));\n","import { type ChildProcess, spawn } from 'node:child_process';\nimport { createHash } from 'node:crypto';\nimport { mkdir, open, readlink, rm, symlink } from 'node:fs/promises';\nimport { connect, type Socket } from 'node:net';\nimport { tmpdir } from 'node:os';\nimport { basename, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { Effect, Schedule, Schema } from 'effect';\nimport { acquireFileLock } from '../../lock';\nimport { readSocketLine } from '../../socket-line';\nimport { ServiceError, withServiceError } from '../core';\n\nexport const sharedGraceMs = 5_000;\nexport const hostPaths = (sessionDir: string, name: string) => {\n\tconst dir = join(sessionDir, 'hosts', name);\n\treturn {\n\t\tdir,\n\t\tsocket: join(dir, 'host.sock'),\n\t\tlock: join(dir, 'startup.lock'),\n\t\tlog: join(dir, 'service.log'),\n\t};\n};\nexport type HostPaths = ReturnType<typeof hostPaths>;\nexport const hostArguments = Schema.fromJsonString(\n\tSchema.Struct({\n\t\tmodule: Schema.String,\n\t\tname: Schema.String,\n\t\troot: Schema.String,\n\t\tsession: Schema.String,\n\t}),\n);\ntype HostArguments = typeof hostArguments.Type;\nexport const readyMessage = <A>(output: Schema.Codec<A, unknown>) =>\n\tSchema.fromJsonString(\n\t\tSchema.Struct({\n\t\t\toutput,\n\t\t\tports: Schema.Record(Schema.String, Schema.Number),\n\t\t}),\n\t);\n\nexport const io = <A>(message: string, operation: () => Promise<A>) =>\n\tEffect.tryPromise({\n\t\ttry: () => operation(),\n\t\tcatch: (cause) => new ServiceError({ message, cause }),\n\t});\nexport const isErrno = (cause: unknown, code: string) =>\n\ttypeof cause === 'object' &&\n\tcause !== null &&\n\t'code' in cause &&\n\tcause.code === code;\nexport const startupLock = (paths: HostPaths) =>\n\tacquireFileLock(paths.dir, paths.lock).pipe(\n\t\twithServiceError('Failed to acquire shared host lock'),\n\t);\nexport type Lease = { socket: Socket; line: string };\n\nexport const failWhenHostExits = (lease: Lease, name: string) =>\n\tEffect.callback<never, ServiceError>((resume) => {\n\t\tconst closed = () =>\n\t\t\tresume(\n\t\t\t\tnew ServiceError({\n\t\t\t\t\tmessage: `Shared host ${name} exited while this consumer was active`,\n\t\t\t\t}),\n\t\t\t);\n\t\tlease.socket.once('close', closed);\n\t\treturn Effect.sync(() => lease.socket.removeListener('close', closed));\n\t});\n\n/** Unix sockets have tiny pathname limits; a short alias keeps the socket in the host directory. */\nexport const socketPath = async (paths: HostPaths) => {\n\tif (Buffer.byteLength(paths.socket) < 100) return paths.socket;\n\tconst alias = join(\n\t\ttmpdir(),\n\t\t`dvs-${createHash('sha256').update(paths.dir).digest('hex').slice(0, 16)}`,\n\t);\n\tawait symlink(paths.dir, alias).catch(async (cause: unknown) => {\n\t\tif (!isErrno(cause, 'EEXIST')) throw cause;\n\t\tif ((await readlink(alias)) !== paths.dir)\n\t\t\tthrow new Error(`Unexpected shared socket alias: ${alias}`);\n\t});\n\treturn join(alias, basename(paths.socket));\n};\nclass HostUnavailable extends Error {}\nexport const connectHost = async (\n\tpaths: HostPaths,\n\tchild?: ChildProcess,\n): Promise<Lease> => {\n\tconst socket = connect(await socketPath(paths));\n\tconst exited = () =>\n\t\tsocket.destroy(new Error('Host exited before readiness'));\n\tchild?.once('exit', exited);\n\ttry {\n\t\tif (\n\t\t\tchild !== undefined &&\n\t\t\t(child.exitCode !== null || child.signalCode !== null)\n\t\t)\n\t\t\texited();\n\t\tconst line = await readSocketLine(socket);\n\t\tsocket.on('error', () => socket.destroy());\n\t\treturn { socket, line };\n\t} catch (cause) {\n\t\tsocket.destroy();\n\t\tthrow new HostUnavailable('Host did not send readiness', { cause });\n\t} finally {\n\t\tchild?.removeListener('exit', exited);\n\t}\n};\nconst unavailable = (cause: unknown) => cause instanceof HostUnavailable;\nconst logTail = async (paths: HostPaths) => {\n\tconst file = await open(paths.log, 'r');\n\ttry {\n\t\tconst size = (await file.stat()).size;\n\t\tconst buffer = Buffer.alloc(Math.min(size, 8_192));\n\t\tconst read = await file.read(\n\t\t\tbuffer,\n\t\t\t0,\n\t\t\tbuffer.length,\n\t\t\tMath.max(0, size - buffer.length),\n\t\t);\n\t\treturn buffer.subarray(0, read.bytesRead).toString('utf8');\n\t} finally {\n\t\tawait file.close();\n\t}\n};\ntype Launch = () => Promise<ChildProcess>;\nconst startHost = (paths: HostPaths, launch: Launch) =>\n\tEffect.gen(function* () {\n\t\tyield* io('Failed to remove stale host socket', () =>\n\t\t\trm(paths.socket, { force: true }),\n\t\t);\n\t\tconst child = yield* io('Failed to launch shared host', launch);\n\t\treturn yield* Effect.suspend(() => {\n\t\t\tif (child.exitCode !== null || child.signalCode !== null)\n\t\t\t\treturn io('Failed to read shared host log', () => logTail(paths)).pipe(\n\t\t\t\t\tEffect.flatMap(\n\t\t\t\t\t\t(log) =>\n\t\t\t\t\t\t\tnew ServiceError({\n\t\t\t\t\t\t\t\tmessage: `Shared host failed to start: ${log}`,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\treturn io('Failed to read shared host readiness', () =>\n\t\t\t\tconnectHost(paths, child),\n\t\t\t);\n\t\t}).pipe(\n\t\t\tEffect.retry({\n\t\t\t\twhile: (error) => unavailable(error.cause),\n\t\t\t\tschedule: Schedule.spaced('50 millis'),\n\t\t\t}),\n\t\t);\n\t});\nconst acquireHostUnderLock = (paths: HostPaths, launch: Launch) =>\n\tEffect.gen(function* () {\n\t\tyield* Effect.acquireRelease(startupLock(paths), (release) =>\n\t\t\tio('Failed to release shared host lock', release).pipe(Effect.orDie),\n\t\t);\n\t\treturn yield* io('Failed to connect to shared host', () =>\n\t\t\tconnectHost(paths),\n\t\t).pipe(\n\t\t\tEffect.catch((error) =>\n\t\t\t\tunavailable(error.cause) ? startHost(paths, launch) : error,\n\t\t\t),\n\t\t);\n\t}).pipe(Effect.scoped);\nexport const acquireHost = (paths: HostPaths, launch: Launch) =>\n\tEffect.gen(function* () {\n\t\tyield* io('Failed to create shared host directory', () =>\n\t\t\tmkdir(paths.dir, { recursive: true }),\n\t\t);\n\t\treturn yield* io('Failed to connect to shared host', () =>\n\t\t\tconnectHost(paths),\n\t\t).pipe(\n\t\t\tEffect.catch((error) =>\n\t\t\t\tunavailable(error.cause) ? acquireHostUnderLock(paths, launch) : error,\n\t\t\t),\n\t\t);\n\t});\nexport const launchHost = async (paths: HostPaths, args: HostArguments) => {\n\tconst log = await open(paths.log, 'a');\n\ttry {\n\t\tconst entry = new URL(\n\t\t\timport.meta.url.endsWith('.ts')\n\t\t\t\t? '../../../dist/services/shared/entry.js'\n\t\t\t\t: './services/shared/entry.js',\n\t\t\timport.meta.url,\n\t\t);\n\t\tconst child = spawn(\n\t\t\tprocess.execPath,\n\t\t\t[...process.execArgv, fileURLToPath(entry), JSON.stringify(args)],\n\t\t\t{\n\t\t\t\tdetached: true,\n\t\t\t\tenv: Object.fromEntries(\n\t\t\t\t\tObject.entries(process.env).filter(\n\t\t\t\t\t\t(entry) => !entry[0].startsWith('DEVSESS_'),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t\tstdio: ['ignore', log.fd, log.fd],\n\t\t\t},\n\t\t);\n\t\tawait new Promise<void>((resolve, reject) => {\n\t\t\tchild.once('spawn', resolve);\n\t\t\tchild.once('error', reject);\n\t\t});\n\t\tchild.unref();\n\t\treturn child;\n\t} finally {\n\t\tawait log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IAAI,IAAI,IAAI,EAAE;AAAA,MACjC;AAAA,IACD;AACA,UAAM,IAAI,QAAc,CAAC,SAAS,WAAW;AAC5C,YAAM,KAAK,SAAS,OAAO;AAC3B,YAAM,KAAK,SAAS,MAAM;AAAA,IAC3B,CAAC;AACD,UAAM,MAAM;AACZ,WAAO;AAAA,EACR,UAAE;AACD,UAAM,IAAI,MAAM;AAAA,EACjB;AACD;","names":["Effect","Effect","Effect","Effect","Effect","Effect","entry"]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DevSessions
3
- } from "./chunk-GX4J6JR3.js";
3
+ } from "./chunk-MBPIOYW3.js";
4
4
 
5
5
  // src/current-session.ts
6
6
  import { Context, Effect, Layer } from "effect";
@@ -26,4 +26,4 @@ var CurrentSession = class _CurrentSession extends Context.Service()("devsess/Cu
26
26
  export {
27
27
  CurrentSession
28
28
  };
29
- //# sourceMappingURL=chunk-CBRTTFXG.js.map
29
+ //# sourceMappingURL=chunk-UOIMVHGX.js.map
@@ -2,6 +2,7 @@ import { Context, Effect, Layer } from 'effect';
2
2
  import type { PlatformError } from 'effect/PlatformError';
3
3
  import { type DevSession, DevSessions } from './dev-sessions';
4
4
  declare const CurrentSession_base: Context.ServiceClass<CurrentSession, "devsess/CurrentSession", {
5
+ rootDir: string;
5
6
  name: string;
6
7
  lastModifiedAt: Date | null;
7
8
  path: (relativePath: string) => Effect.Effect<string, never, never>;
@@ -1 +1 @@
1
- {"version":3,"file":"current-session.d.ts","sourceRoot":"","sources":["../src/current-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,KAAK,UAAU,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;;;;;;;AAE9D;;;;;GAKG;AACH,qBAAa,cAAe,SAAQ,mBAGP;IAC5B;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CACjC,cAAc,EACd,aAAa,EACb,WAAW,CACX,CAMC;IAEF,uFAAuF;IACvF,MAAM,CAAC,QAAQ,CAAC,OAAO,YAAa,UAAU,+CACN;CACxC"}
1
+ {"version":3,"file":"current-session.d.ts","sourceRoot":"","sources":["../src/current-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,KAAK,UAAU,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;;;;;;;;AAE9D;;;;;GAKG;AACH,qBAAa,cAAe,SAAQ,mBAGP;IAC5B;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CACjC,cAAc,EACd,aAAa,EACb,WAAW,CACX,CAMC;IAEF,uFAAuF;IACvF,MAAM,CAAC,QAAQ,CAAC,OAAO,YAAa,UAAU,+CACN;CACxC"}
@@ -0,0 +1,21 @@
1
+ import { Config, Effect, Schema } from 'effect';
2
+ type ServiceIdentity = {
3
+ readonly socketPath: string;
4
+ readonly runId: string;
5
+ readonly service: string;
6
+ readonly instanceId?: string;
7
+ };
8
+ export declare const readDaemonIdentity: Effect.Effect<{
9
+ socketPath: string;
10
+ runId: string;
11
+ service: string;
12
+ instanceId?: string | undefined;
13
+ } | undefined, Config.ConfigError, never>;
14
+ export declare const sendDaemonRequest: (identity: ServiceIdentity, request: {
15
+ readonly version: 1;
16
+ readonly requestId: string;
17
+ readonly method: string;
18
+ readonly params: Readonly<Record<string, unknown>>;
19
+ }, timeoutMs?: number) => Effect.Effect<void, Error | Schema.SchemaError, never>;
20
+ export {};
21
+ //# sourceMappingURL=daemon-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daemon-client.d.ts","sourceRoot":"","sources":["../../src/dev/daemon-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAkB,MAAM,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;AAkBxE,KAAK,eAAe,GAAG;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;yCAmB7B,CAAC;AAEH,eAAO,MAAM,iBAAiB,aACnB,eAAe,WAChB;IACR,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACpB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACnD,+EAmCA,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"daemon-readiness.d.ts","sourceRoot":"","sources":["../../src/dev/daemon-readiness.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAgB,MAAM,QAAQ,CAAC;AAyF9C,eAAO,MAAM,sBAAsB,UAAW,OAAO,6DAkClD,CAAC"}
1
+ {"version":3,"file":"daemon-readiness.d.ts","sourceRoot":"","sources":["../../src/dev/daemon-readiness.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAgB,MAAM,QAAQ,CAAC;AAG9C,eAAO,MAAM,sBAAsB,UAAW,OAAO,6DAiCZ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Effect } from 'effect';
2
+ export declare const reportDaemonService: (name: string, ports: Readonly<Record<string, number>>) => Effect.Effect<void, never, import("effect/Scope").Scope>;
3
+ //# sourceMappingURL=daemon-services.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daemon-services.d.ts","sourceRoot":"","sources":["../../src/dev/daemon-services.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,eAAO,MAAM,mBAAmB,SACzB,MAAM,SACL,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,6DA0BC,CAAC"}
@@ -1,6 +1,9 @@
1
1
  import { Effect } from 'effect';
2
+ import { FileSystem } from 'effect/FileSystem';
3
+ import { Path } from 'effect/Path';
2
4
  import type { DevSession } from '../dev-sessions';
5
+ import { SessionStateError } from './session-state';
3
6
  export declare const getStickyPort: (session: DevSession, options?: {
4
7
  name?: string;
5
- }) => Effect.Effect<number, import("effect/PlatformError").PlatformError | import("./session-state").SessionStateError, import("effect/FileSystem").FileSystem | import("effect/Path").Path>;
8
+ }) => Effect.Effect<number, import("effect/PlatformError").PlatformError | SessionStateError, FileSystem | Path>;
6
9
  //# sourceMappingURL=sticky-port.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sticky-port.d.ts","sourceRoot":"","sources":["../../src/dev/sticky-port.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAkBlD,eAAO,MAAM,aAAa,YAChB,UAAU,YACT;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,2LAyBzB,CAAC"}
1
+ {"version":3,"file":"sticky-port.d.ts","sourceRoot":"","sources":["../../src/dev/sticky-port.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAGnC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAgB,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAiBlE,eAAO,MAAM,aAAa,YAChB,UAAU,YACT;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,+GAyCL,CAAC"}
@@ -10,6 +10,7 @@ declare namespace DevSession {
10
10
  pathJoin: (relativePath: string) => string;
11
11
  };
12
12
  export function make(input: DevSessionInput): {
13
+ rootDir: string;
13
14
  name: string;
14
15
  lastModifiedAt: Date | null;
15
16
  path: (relativePath: string) => Effect.Effect<string, never, never>;
@@ -24,6 +25,7 @@ declare const DevSessions_base: Context.ServiceClass<DevSessions, "devsess/DevSe
24
25
  readonly getSessions: Effect.Effect<Array<DevSession>, PlatformError>;
25
26
  readonly createSession: Effect.Effect<DevSession, PlatformError>;
26
27
  readonly getLatestOrCreate: Effect.Effect<DevSession, PlatformError>;
28
+ readonly getOrCreate: (name: string) => Effect.Effect<DevSession, PlatformError>;
27
29
  }>;
28
30
  export declare class DevSessions extends DevSessions_base {
29
31
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"dev-sessions.d.ts","sourceRoot":"","sources":["../src/dev-sessions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,OAAO,EAAQ,MAAM,EAAE,KAAK,EAAU,MAAM,QAAQ,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG1D,kBAAU,UAAU,CAAC;IACpB,KAAK,eAAe,GAAG;QACtB,IAAI,EAAE,MAAM,CAAC;QACb,cAAc,EAAE,IAAI,GAAG,IAAI,CAAC;QAC5B,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,MAAM,CAAC;KAC3C,CAAC;IAEF,MAAM,UAAU,IAAI,CAAC,KAAK,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OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,MAAM,CAAC;KAC3C,CAAC;IAEF,MAAM,UAAU,IAAI,CAAC,KAAK,EAAE,eAAe;QAEzC,OAAO;QACP,IAAI;QACJ,cAAc;QACd,IAAI,iBAAiB,MAAM;QAE3B,QAAQ;MAET;;CACD;AAED,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC;;kBAK5C,MAAM;mBACL,CAAC,YAAY,EAAE,MAAM,KAAK,MAAM;0BACzB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,aAAa,CAAC;4BAC7C,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC;gCACpC,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC;0BAC9C,CACrB,IAAI,EAAE,MAAM,KACR,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC;;AAV/C,qBAAa,WAAY,SAAQ,gBAYP;IACzB;;;;;;;;;;OAUG;IACH,MAAM,CAAC,QAAQ,CAAC,OAAO,YAAa,MAAM,wDAAoC;IAE9E;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CACjC,WAAW,EACX,aAAa,GAAG,wBAAwB,EACxC,UAAU,GAAG,IAAI,CACjB,CAIC;CACF;;;;AAED;;;;GAIG;AACH,qBAAa,wBAAyB,SAAQ,8BAE5C;IACD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC9B,CAAC;CAAG"}
package/dist/index.js CHANGED
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  CurrentSession
3
- } from "./chunk-CBRTTFXG.js";
3
+ } from "./chunk-UOIMVHGX.js";
4
4
  import {
5
5
  awaitRunning,
6
6
  publishRunning,
7
7
  runManagedSubprocess
8
- } from "./chunk-SX5HBQHG.js";
8
+ } from "./chunk-KG24ZAKO.js";
9
9
  import {
10
10
  DevSessions,
11
11
  ProjectRootNotFoundError,
12
12
  SessionState,
13
13
  SessionStateError,
14
14
  getStickyPort
15
- } from "./chunk-GX4J6JR3.js";
15
+ } from "./chunk-MBPIOYW3.js";
16
16
  export {
17
17
  CurrentSession,
18
18
  DevSessions,
package/dist/lock.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import { Effect } from 'effect';
2
+ export declare const acquireFileLock: (file: string, lockPath?: string) => Effect.Effect<() => Promise<void>, Error, never>;
3
+ //# sourceMappingURL=lock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lock.d.ts","sourceRoot":"","sources":["../src/lock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAY,MAAM,QAAQ,CAAC;AAG1C,eAAO,MAAM,eAAe,SAAU,MAAM,wEAmB1C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/services/container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,KAAK,cAAc,EAAE,YAAY,EAAa,MAAM,QAAQ,CAAC;AACtE,OAAO,EAAgB,KAAK,WAAW,EAAiB,MAAM,eAAe,CAAC;AAE9E,MAAM,MAAM,aAAa,CAAC,IAAI,SAAS,MAAM,IAAI;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,WAAW,CAAC,EAAE,WAAW,CAAC;CAC1B,CAAC;AA2FF,eAAO,MAAM,cAAc,GACzB,IAAI,SAAS,MAAM,QAAQ,MAAM,QAAQ,aAAa,CAAC,IAAI,CAAC,WACvD,cAAc,CAAC,IAAI,CAAC;;mJAoGxB,CAAC"}
1
+ {"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/services/container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EACN,KAAK,cAAc,EACnB,YAAY,EAGZ,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAgB,KAAK,WAAW,EAAiB,MAAM,eAAe,CAAC;AAE9E,MAAM,MAAM,aAAa,CAAC,IAAI,SAAS,MAAM,IAAI;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,WAAW,CAAC,EAAE,WAAW,CAAC;CAC1B,CAAC;AA2FF,eAAO,MAAM,cAAc,GACzB,IAAI,SAAS,MAAM,QAAQ,MAAM,QAAQ,aAAa,CAAC,IAAI,CAAC,WACvD,cAAc,CAAC,IAAI,CAAC;;mJA2FiD,CAAC"}
@@ -1,4 +1,16 @@
1
+ import { Effect } from 'effect';
2
+ import type { FileSystem } from 'effect/FileSystem';
3
+ import type { Path } from 'effect/Path';
4
+ import type { Scope } from 'effect/Scope';
1
5
  import type { DevSession } from '../dev-sessions';
6
+ import type { RunningService, ServiceDefinition } from './index';
7
+ export declare const serviceBrand: unique symbol;
8
+ export declare const isServiceDefinition: (value: unknown) => value is ServiceDefinition<string, string, unknown, unknown, Scope | FileSystem | Path>;
9
+ export declare const withServiceError: (message: string) => <A, R>(self: Effect.Effect<A, unknown, R>) => Effect.Effect<A, ServiceError, R>;
10
+ export declare const runningService: <Port extends string, A>(result: {
11
+ value: A;
12
+ ports: Readonly<Record<Port, number>>;
13
+ }) => RunningService<Port, A>;
2
14
  declare const ServiceError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
3
15
  readonly _tag: "ServiceError";
4
16
  } & Readonly<A>;
@@ -1 +1 @@
1
- {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/services/core.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;;;;AAElD,qBAAa,YAAa,SAAQ,kBAAiC;IAClE,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;CAAG;AAEL,MAAM,MAAM,cAAc,CAAC,IAAI,SAAS,MAAM,IAAI;IACjD,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IAC/C,2FAA2F;IAC3F,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,SAAS,SAAU,MAAM,YACI,CAAC"}
1
+ {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/services/core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,MAAM,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,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path } from 'effect/Path';
2
+ import type { FileSystem } from 'effect/FileSystem';
3
+ import type { Path } from 'effect/Path';
4
4
  import type { Scope } from 'effect/Scope';
5
5
  import { CurrentSession } from '../current-session';
6
6
  import type { DevSession } from '../dev-sessions';
7
7
  import { type ContainerSpec } from './container';
8
- import { type ServiceContext, ServiceError } from './core';
8
+ import { type ServiceContext, ServiceError, serviceBrand } from './core';
9
+ import { type SharedOptions } from './shared/index';
9
10
  export type { Healthcheck } from './docker-args';
10
11
  export { type ServiceContext, ServiceError };
11
12
  export type RunningService<Port extends string, A> = (A extends object ? Omit<A, 'ports'> : unknown) & {
@@ -15,8 +16,11 @@ type ServiceIdentifier<Name extends string> = {
15
16
  readonly devsessService: Name;
16
17
  };
17
18
  export type ServiceDefinition<Name extends string, Port extends string, A, E, R> = {
19
+ readonly [serviceBrand]: true;
18
20
  readonly name: Name;
19
21
  readonly ports: ReadonlyArray<Port>;
22
+ readonly shared?: SharedOptions<A>;
23
+ readonly definitionStack?: string;
20
24
  /** Resolves once the service is ready; its scope closing stops it. */
21
25
  readonly start: (ctx: ServiceContext<Port>) => Effect.Effect<A, E, R>;
22
26
  /** Yield inside another service's `start` (or any effect) to depend on this one. */
@@ -24,10 +28,11 @@ export type ServiceDefinition<Name extends string, Port extends string, A, E, R>
24
28
  /** Starts the service once per layer build and shares it with every consumer. */
25
29
  readonly layer: Layer.Layer<ServiceIdentifier<Name>, E | ServiceError, Exclude<R, Scope> | CurrentSession | FileSystem | Path>;
26
30
  };
27
- declare const run: <Name extends string, Port extends string, A, E, R>(session: DevSession, def: Pick<ServiceDefinition<Name, Port, A, E, R>, 'name' | 'ports' | 'start'>) => Effect.Effect<RunningService<Port, A>, E | ServiceError, R | FileSystem | Path>;
31
+ declare const run: <Name extends string, Port extends string, A, E, R>(session: DevSession, def: Pick<ServiceDefinition<Name, Port, A, E, R>, 'name' | 'ports' | 'start' | 'shared' | 'definitionStack'>) => Effect.Effect<RunningService<Port, A>, E | ServiceError, R | FileSystem | Path | Scope>;
28
32
  declare const make: <const Name extends string, A, E, R, const Port extends string = never>(def: {
29
33
  name: Name;
30
34
  ports?: ReadonlyArray<Port>;
35
+ shared?: SharedOptions<A>;
31
36
  start: (ctx: ServiceContext<Port>) => Effect.Effect<A, E, R>;
32
37
  }) => ServiceDefinition<Name, Port, A, E, R>;
33
38
  export declare const Service: {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,KAAK,aAAa,EAAkB,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,KAAK,cAAc,EAAE,YAAY,EAAa,MAAM,QAAQ,CAAC;AAEtE,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,KAAK,cAAc,EAAE,YAAY,EAAE,CAAC;AAE7C,MAAM,MAAM,cAAc,CAAC,IAAI,SAAS,MAAM,EAAE,CAAC,IAAI,CAAC,CAAC,SAAS,MAAM,GACnE,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,GAChB,OAAO,CAAC,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAA;CAAE,CAAC;AAEjE,KAAK,iBAAiB,CAAC,IAAI,SAAS,MAAM,IAAI;IAC7C,QAAQ,CAAC,cAAc,EAAE,IAAI,CAAC;CAC9B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