Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
154 commits
Select commit Hold shift + click to select a range
95db7ba
docs(stack): align runtime architecture documentation
jgoux Aug 5, 2026
b2943a0
fix(process-compose): make unhealthy lifecycle terminal
jgoux Aug 5, 2026
7d19e70
refactor(stack): establish explicit domain model
jgoux Aug 5, 2026
c4aabe0
chore(stack): integrate lifecycle prerequisites
jgoux Aug 5, 2026
442698f
refactor(process-compose): isolate supervisor policies
jgoux Aug 5, 2026
3e56622
refactor(stack): consolidate local lifecycle ownership
jgoux Aug 5, 2026
a650edd
Merge branch 'agent/process-compose-supervisor-cleanup' into agent/st…
jgoux Aug 5, 2026
6c577a4
refactor(stack): restore service factory locality
jgoux Aug 5, 2026
b7a45d1
refactor(stack): make functions configuration explicit
jgoux Aug 5, 2026
e845aee
refactor(stack): narrow package entrypoints
jgoux Aug 5, 2026
854f874
Merge remote-tracking branch 'origin/develop' into agent/stack-domain…
jgoux Aug 5, 2026
47d1387
Merge branch 'agent/stack-domain-model' into agent/stack-runtime-impl…
jgoux Aug 5, 2026
1fa1c33
Merge branch 'agent/stack-runtime-implementation' into agent/stack-fa…
jgoux Aug 5, 2026
d6dd4dd
chore(process-compose): merge current develop
jgoux Aug 5, 2026
83a0f4a
Merge branch 'agent/stack-factory-resource-locality' into agent/funct…
jgoux Aug 5, 2026
bf21955
Merge branch 'agent/functions-bundle-runtime-reload' into agent/stack…
jgoux Aug 5, 2026
5ca2c1b
chore(process-compose): reconcile updated lifecycle imports
jgoux Aug 5, 2026
4a6a049
Merge branch 'agent/stack-factory-resource-locality' into agent/funct…
jgoux Aug 5, 2026
e711ef2
Merge branch 'agent/functions-bundle-runtime-reload' into agent/stack…
jgoux Aug 5, 2026
a596636
chore(process-compose): update supervisor branch base
jgoux Aug 5, 2026
55f8013
test(stack): make partial startup cleanup deterministic
jgoux Aug 5, 2026
8b2e172
Merge branch 'agent/stack-factory-resource-locality' into agent/funct…
jgoux Aug 5, 2026
a2ef611
Merge branch 'agent/functions-bundle-runtime-reload' into agent/stack…
jgoux Aug 5, 2026
d188f8b
Merge remote-tracking branch 'origin/develop' into agent/stack-domain…
jgoux Aug 5, 2026
fa591c0
Merge branch 'agent/stack-domain-model' into agent/stack-runtime-impl…
jgoux Aug 5, 2026
f601375
Merge branch 'agent/stack-runtime-implementation' into agent/stack-fa…
jgoux Aug 5, 2026
c7256a1
Merge branch 'agent/stack-factory-resource-locality' into agent/funct…
jgoux Aug 5, 2026
2771127
Merge branch 'agent/functions-bundle-runtime-reload' into agent/stack…
jgoux Aug 5, 2026
8e2ed76
fix(process-compose): handle terminal health failures
jgoux Aug 5, 2026
21b5638
Merge branch 'agent/process-compose-lifecycle-correctness' into agent…
jgoux Aug 5, 2026
57979d5
fix(process-compose): bound supervisor cleanup commands
jgoux Aug 5, 2026
daeffc2
Merge branch 'agent/process-compose-lifecycle-correctness' into agent…
jgoux Aug 5, 2026
3817fcd
fix(stack): scope readiness deadlines to health waits
jgoux Aug 5, 2026
d552e46
Merge branch 'agent/stack-runtime-implementation' into agent/stack-fa…
jgoux Aug 5, 2026
e4ba7c3
Merge branch 'agent/process-compose-supervisor-cleanup' into agent/st…
jgoux Aug 5, 2026
77782df
test(stack): await lazy Docker service readiness
jgoux Aug 5, 2026
f6703e4
Merge branch 'agent/stack-runtime-implementation' into agent/stack-fa…
jgoux Aug 5, 2026
042464b
Merge branch 'agent/stack-factory-resource-locality' into agent/funct…
jgoux Aug 5, 2026
a570b9e
chore(stack): format merged readiness test
jgoux Aug 5, 2026
0733e98
Merge branch 'agent/functions-bundle-runtime-reload' into agent/stack…
jgoux Aug 5, 2026
b7e84b6
fix(stack): terminate daemon after lazy timeout
jgoux Aug 5, 2026
f757348
Merge branch 'agent/stack-runtime-implementation' into agent/stack-fa…
jgoux Aug 5, 2026
ffe68d5
Merge branch 'agent/stack-factory-resource-locality' into agent/funct…
jgoux Aug 5, 2026
a2dfe0e
Merge branch 'agent/functions-bundle-runtime-reload' into agent/stack…
jgoux Aug 5, 2026
d24cdb9
fix(process-compose): surface recovery hook failures
jgoux Aug 5, 2026
384e0ee
Merge branch 'agent/process-compose-lifecycle-correctness' into agent…
jgoux Aug 5, 2026
4c9bb66
Merge branch 'agent/process-compose-supervisor-cleanup' into agent/st…
jgoux Aug 5, 2026
734b815
Merge branch 'agent/stack-runtime-implementation' into agent/stack-fa…
jgoux Aug 5, 2026
92cd8cf
Merge branch 'agent/stack-factory-resource-locality' into agent/funct…
jgoux Aug 5, 2026
0f1ffff
Merge branch 'agent/functions-bundle-runtime-reload' into agent/stack…
jgoux Aug 5, 2026
6017cc3
test(process-compose): cover recovery hook transition
jgoux Aug 5, 2026
7aec419
Merge branch 'agent/process-compose-supervisor-cleanup' into agent/st…
jgoux Aug 5, 2026
5fd81e2
Merge branch 'agent/stack-runtime-implementation' into agent/stack-fa…
jgoux Aug 5, 2026
903c87a
Merge branch 'agent/stack-factory-resource-locality' into agent/funct…
jgoux Aug 5, 2026
3ffcb5a
Merge branch 'agent/functions-bundle-runtime-reload' into agent/stack…
jgoux Aug 5, 2026
f1ade49
fix(process-compose): fail blocked healthy dependents
jgoux Aug 5, 2026
851479d
Merge branch 'agent/process-compose-lifecycle-correctness' into agent…
jgoux Aug 5, 2026
ccdc785
Merge branch 'agent/process-compose-supervisor-cleanup' into agent/st…
jgoux Aug 5, 2026
37bc585
Merge branch 'agent/stack-runtime-implementation' into agent/stack-fa…
jgoux Aug 5, 2026
4fcb5b2
Merge branch 'agent/stack-factory-resource-locality' into agent/funct…
jgoux Aug 5, 2026
d2cafef
Merge branch 'agent/functions-bundle-runtime-reload' into agent/stack…
jgoux Aug 5, 2026
27e8561
fix(process-compose): hard-kill timed-out cleanup
jgoux Aug 5, 2026
7fe14af
Merge branch 'agent/process-compose-supervisor-cleanup' of github.com…
jgoux Aug 5, 2026
a1f7a11
fix(stack): make readiness teardown terminal
jgoux Aug 5, 2026
1cb73c9
Merge branch 'agent/stack-runtime-implementation' of github.com:supab…
jgoux Aug 5, 2026
58214a1
Merge branch 'agent/stack-factory-resource-locality' of github.com:su…
jgoux Aug 5, 2026
2860d13
Merge branch 'agent/functions-bundle-runtime-reload' of github.com:su…
jgoux Aug 5, 2026
42c775c
fix(process-compose): await restartable dependencies
jgoux Aug 5, 2026
39cc38d
Merge branch 'agent/process-compose-lifecycle-correctness' of github.…
jgoux Aug 5, 2026
c9de7d0
Merge branch 'agent/process-compose-supervisor-cleanup' of github.com…
jgoux Aug 5, 2026
8c44089
Merge branch 'agent/stack-runtime-implementation' of github.com:supab…
jgoux Aug 5, 2026
23ccdfe
Merge branch 'agent/stack-factory-resource-locality' of github.com:su…
jgoux Aug 5, 2026
a07a441
Merge branch 'agent/functions-bundle-runtime-reload' of github.com:su…
jgoux Aug 5, 2026
48a6057
fix(stack): synchronize status after readiness
jgoux Aug 5, 2026
62f861a
Merge branch 'agent/process-compose-lifecycle-correctness' of github.…
jgoux Aug 5, 2026
0985e68
Merge branch 'agent/process-compose-supervisor-cleanup' of github.com…
jgoux Aug 5, 2026
62a5a0a
Merge branch 'agent/stack-runtime-implementation' of github.com:supab…
jgoux Aug 5, 2026
861ec01
Merge branch 'agent/stack-factory-resource-locality' of github.com:su…
jgoux Aug 5, 2026
3abbea4
Merge branch 'agent/functions-bundle-runtime-reload' of github.com:su…
jgoux Aug 5, 2026
c9de546
fix(stack): derive startup coordination timeouts
jgoux Aug 5, 2026
759dd1f
Merge branch 'agent/process-compose-lifecycle-correctness' of github.…
jgoux Aug 5, 2026
6f815fb
Merge branch 'agent/process-compose-supervisor-cleanup' of github.com…
jgoux Aug 5, 2026
5867864
Merge remote-tracking branch 'origin/agent/stack-runtime-implementati…
jgoux Aug 5, 2026
66c64bb
Merge remote-tracking branch 'origin/agent/stack-factory-resource-loc…
jgoux Aug 5, 2026
ca0e335
Merge remote-tracking branch 'origin/agent/functions-bundle-runtime-r…
jgoux Aug 5, 2026
a14d408
fix(stack): align startup budget deadlines
jgoux Aug 6, 2026
db7d015
fix(process-compose): await restarting completed dependencies
jgoux Aug 6, 2026
2c825a0
chore(process-compose): integrate lifecycle hardening
jgoux Aug 6, 2026
6a1cdfe
chore(stack): integrate lifecycle hardening
jgoux Aug 6, 2026
3c03ea6
chore(stack): integrate runtime hardening
jgoux Aug 6, 2026
5c0cd57
chore(stack): integrate runtime hardening
jgoux Aug 6, 2026
b1f683b
chore(stack): integrate runtime hardening
jgoux Aug 6, 2026
af6c027
fix(stack): align dependent startup deadlines
jgoux Aug 6, 2026
908ed4d
chore(stack): document dependency startup path
jgoux Aug 6, 2026
7c40a83
chore(stack): integrate dependency path documentation
jgoux Aug 6, 2026
28a6113
chore(stack): integrate dependency path documentation
jgoux Aug 6, 2026
df91369
chore(stack): integrate dependency path documentation
jgoux Aug 6, 2026
5a298f1
test(stack): align Docker setup timeout
jgoux Aug 6, 2026
1184ec5
fix(process-compose): terminate timed-out cleanup trees
jgoux Aug 6, 2026
1abd493
fix(stack): keep pre-start failures retryable
jgoux Aug 6, 2026
e01aaf7
fix(stack): align activation lifecycle ownership
jgoux Aug 6, 2026
d5ae582
fix(stack): harden functions bundle reloads
jgoux Aug 6, 2026
5bd8454
Merge remote-tracking branch 'origin/agent/process-compose-supervisor…
jgoux Aug 6, 2026
bc3c975
Merge remote-tracking branch 'origin/agent/stack-runtime-implementati…
jgoux Aug 6, 2026
ce37d40
Merge remote-tracking branch 'origin/agent/stack-factory-resource-loc…
jgoux Aug 6, 2026
f28f73b
Merge remote-tracking branch 'origin/agent/functions-bundle-runtime-r…
jgoux Aug 6, 2026
65feb43
Merge remote-tracking branch 'origin/agent/process-compose-lifecycle-…
jgoux Aug 6, 2026
e403043
Merge remote-tracking branch 'origin/agent/process-compose-supervisor…
jgoux Aug 6, 2026
1a6b5ad
Merge remote-tracking branch 'origin/agent/stack-runtime-implementati…
jgoux Aug 6, 2026
c3e1bf6
Merge remote-tracking branch 'origin/agent/stack-factory-resource-loc…
jgoux Aug 6, 2026
39c139d
Merge remote-tracking branch 'origin/agent/functions-bundle-runtime-r…
jgoux Aug 6, 2026
7505537
fix(stack): close foreground runtime on readiness timeout
jgoux Aug 6, 2026
c859ed2
Merge remote-tracking branch 'origin/agent/stack-runtime-implementati…
jgoux Aug 6, 2026
a0dcac5
Merge remote-tracking branch 'origin/agent/stack-factory-resource-loc…
jgoux Aug 6, 2026
f6b72c0
Merge remote-tracking branch 'origin/agent/functions-bundle-runtime-r…
jgoux Aug 6, 2026
e089d7d
fix(process-compose): preserve active restart policy
jgoux Aug 6, 2026
f275859
fix(stack): serialize projected state snapshots
jgoux Aug 6, 2026
6a737c2
Merge remote-tracking branch 'origin/agent/process-compose-lifecycle-…
jgoux Aug 6, 2026
eb18b78
Merge remote-tracking branch 'origin/agent/process-compose-supervisor…
jgoux Aug 6, 2026
70914be
Merge remote-tracking branch 'origin/agent/stack-runtime-implementati…
jgoux Aug 6, 2026
e74eb8c
Merge remote-tracking branch 'origin/agent/stack-factory-resource-loc…
jgoux Aug 6, 2026
6d8c90f
Merge remote-tracking branch 'origin/agent/functions-bundle-runtime-r…
jgoux Aug 6, 2026
665f8cc
fix(stack): propagate terminal local disposal
jgoux Aug 6, 2026
e302ffe
Merge remote-tracking branch 'origin/agent/stack-factory-resource-loc…
jgoux Aug 6, 2026
a9d9aa8
Merge remote-tracking branch 'origin/agent/functions-bundle-runtime-r…
jgoux Aug 6, 2026
ed31de0
fix(process-compose): use active policy for readiness
jgoux Aug 6, 2026
267de27
fix(stack): budget native database initialization
jgoux Aug 6, 2026
58c889b
Merge branch 'agent/process-compose-lifecycle-correctness' into agent…
jgoux Aug 6, 2026
bd2aa0a
Merge branch 'agent/process-compose-supervisor-cleanup' into agent/st…
jgoux Aug 6, 2026
5822afd
Merge branch 'agent/stack-runtime-implementation' into agent/stack-fa…
jgoux Aug 6, 2026
096f0c8
Merge branch 'agent/stack-factory-resource-locality' into agent/funct…
jgoux Aug 6, 2026
df15293
Merge branch 'agent/functions-bundle-runtime-reload' into agent/stack…
jgoux Aug 6, 2026
858e882
fix(stack): stop daemon after terminal disposal
jgoux Aug 6, 2026
c860c9a
fix(stack): strip functions from daemon startup
jgoux Aug 6, 2026
f5955c6
Merge branch 'agent/stack-factory-resource-locality' into agent/funct…
jgoux Aug 6, 2026
b3d4a7d
Merge branch 'agent/functions-bundle-runtime-reload' into agent/stack…
jgoux Aug 6, 2026
eeac2a0
fix(process-compose): handle stopped dependencies
jgoux Aug 6, 2026
1131ac6
Merge branch 'agent/process-compose-lifecycle-correctness' into agent…
jgoux Aug 6, 2026
24a9dca
Merge branch 'agent/process-compose-supervisor-cleanup' into agent/st…
jgoux Aug 6, 2026
4cce96f
Merge branch 'agent/stack-runtime-implementation' into agent/stack-fa…
jgoux Aug 6, 2026
31fde24
Merge branch 'agent/stack-factory-resource-locality' into agent/funct…
jgoux Aug 6, 2026
9cadaa2
Merge branch 'agent/functions-bundle-runtime-reload' into agent/stack…
jgoux Aug 6, 2026
32bc3b6
fix(stack): flush terminal daemon responses
jgoux Aug 6, 2026
54e6404
Merge branch 'agent/stack-factory-resource-locality' into agent/funct…
jgoux Aug 6, 2026
74909a2
Merge branch 'agent/functions-bundle-runtime-reload' into agent/stack…
jgoux Aug 6, 2026
0369f52
fix(stack): reject function path symlink escapes
jgoux Aug 6, 2026
4127f14
Merge branch 'agent/functions-bundle-runtime-reload' into agent/stack…
jgoux Aug 6, 2026
6b27914
Merge remote-tracking branch 'origin/develop' into agent/stack-domain…
jgoux Aug 6, 2026
4358f44
Merge remote-tracking branch 'origin/agent/stack-domain-model' into a…
jgoux Aug 6, 2026
3ced584
Merge remote-tracking branch 'origin/agent/process-compose-supervisor…
jgoux Aug 6, 2026
60786d5
Merge remote-tracking branch 'origin/agent/stack-runtime-implementati…
jgoux Aug 6, 2026
4727261
Merge remote-tracking branch 'origin/agent/stack-factory-resource-loc…
jgoux Aug 6, 2026
42124d7
Merge remote-tracking branch 'origin/agent/functions-bundle-runtime-r…
jgoux Aug 6, 2026
a77ac27
Merge remote-tracking branch 'origin/develop' into agent/stack-packag…
jgoux Aug 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions apps/cli/src/next/commands/branches/switch/switch.handler.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { StateManager, daemonLayer, resolveManagedStack, stopDaemon } from "@supabase/stack/effect";
import { daemonEntryPoint } from "@supabase/stack";
import { Effect, Option } from "effect";
import { PlatformApi } from "../../../auth/platform-api.service.ts";
import { CliConfig } from "../../../config/cli-config.service.ts";
Expand Down Expand Up @@ -154,17 +153,14 @@ export const switchBranch = Effect.fn("branches.switch")(function* (opts: {
},
});

const stackLayer = yield* daemonLayer(
{
cacheRoot: cliConfig.supabaseHome,
cwd: runtimeInfo.cwd,
projectDir: projectHome.projectRoot,
projectStateRoot: projectHome.projectHomeDir,
name: stackState.name,
...launchConfig,
},
daemonEntryPoint,
);
const stackLayer = yield* daemonLayer({
cacheRoot: cliConfig.supabaseHome,
cwd: runtimeInfo.cwd,
projectDir: projectHome.projectRoot,
projectStateRoot: projectHome.projectHomeDir,
name: stackState.name,
...launchConfig,
});

yield* Effect.scoped(
Effect.gen(function* () {
Expand Down
3 changes: 1 addition & 2 deletions apps/cli/src/next/commands/functions/dev/dev.command.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { unixHttpClientLayer } from "@supabase/stack";
import { DEFAULT_MANAGED_STACK_NAME } from "@supabase/stack/effect";
import { DEFAULT_MANAGED_STACK_NAME, unixHttpClientLayer } from "@supabase/stack/effect";
import { Layer } from "effect";
import { Command, Flag } from "effect/unstable/cli";
import type * as CliCommand from "effect/unstable/cli/Command";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { daemonEntryPoint } from "@supabase/stack";
import {
connectLayer,
daemonLayer,
Expand Down Expand Up @@ -68,18 +67,15 @@ const startFullStack = Effect.fnUntraced(function* (opts: FunctionsDevStackOptio
yield* ensureProjectStateIgnored(projectHome.projectRoot);

const serviceVersionContext = yield* resolveServiceVersionContext([], undefined);
const stackLayer = yield* daemonLayer(
{
cacheRoot: cliConfig.supabaseHome,
cwd: runtimeInfo.cwd,
projectDir: projectHome.projectRoot,
projectStateRoot: projectHome.projectHomeDir,
name: opts.stack,
edgeRuntime: opts.edgeRuntime,
...versionsFromContext(serviceVersionContext),
},
daemonEntryPoint,
);
const stackLayer = yield* daemonLayer({
cacheRoot: cliConfig.supabaseHome,
cwd: runtimeInfo.cwd,
projectDir: projectHome.projectRoot,
projectStateRoot: projectHome.projectHomeDir,
name: opts.stack,
edgeRuntime: opts.edgeRuntime,
...versionsFromContext(serviceVersionContext),
});
const state = yield* stateManager.read(opts.stack);

yield* stateManager.writeMetadata(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, expect, it } from "@effect/vitest";
import { FunctionResponse } from "@supabase/api/effect";
import { BunServices } from "@effect/platform-bun";
import { unixHttpClientLayer } from "@supabase/stack";
import { unixHttpClientLayer } from "@supabase/stack/effect";
import { mkdtempSync } from "node:fs";
import { mkdir, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, expect, it } from "@effect/vitest";
import { BunServices } from "@effect/platform-bun";
import { unixHttpClientLayer } from "@supabase/stack";
import { unixHttpClientLayer } from "@supabase/stack/effect";
import { existsSync, mkdtempSync } from "node:fs";
import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
Expand Down
2 changes: 1 addition & 1 deletion apps/cli/src/next/commands/logs/logs.integration.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, expect, it } from "@effect/vitest";
import { BunServices } from "@effect/platform-bun";
import { unixHttpClientLayer } from "@supabase/stack";
import { unixHttpClientLayer } from "@supabase/stack/effect";
import { Effect, Exit, Fiber, Layer } from "effect";
import { mkdtempSync } from "node:fs";
import { tmpdir } from "node:os";
Expand Down
20 changes: 8 additions & 12 deletions apps/cli/src/next/commands/start/start.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
stackMetadata,
type StackMetadata,
} from "@supabase/stack/effect";
import { daemonEntryPoint } from "@supabase/stack";
import { Command, Flag } from "effect/unstable/cli";
import type * as CliCommand from "effect/unstable/cli/Command";
import { projectLocalServiceVersionsLayer } from "../../config/project-local-service-versions.layer.ts";
Expand Down Expand Up @@ -197,17 +196,14 @@ export const startCommand = Command.make("start", flags).pipe(
yield* output.intro("Start local Supabase stack");
yield* ensureProjectStateIgnored(projectHome.projectRoot);

const stackLayer = yield* daemonLayer(
{
cacheRoot: cliConfig.supabaseHome,
cwd: runtimeInfo.cwd,
projectDir: projectHome.projectRoot,
projectStateRoot: projectHome.projectHomeDir,
name: flags.stack,
...stackConfig,
},
daemonEntryPoint,
);
const stackLayer = yield* daemonLayer({
cacheRoot: cliConfig.supabaseHome,
cwd: runtimeInfo.cwd,
projectDir: projectHome.projectRoot,
projectStateRoot: projectHome.projectHomeDir,
name: flags.stack,
...stackConfig,
});
const daemonState = yield* stateManager.read(flags.stack);

const metadata = stackMetadata({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, expect, it } from "@effect/vitest";
import { BunServices } from "@effect/platform-bun";
import { unixHttpClientLayer } from "@supabase/stack";
import { unixHttpClientLayer } from "@supabase/stack/effect";
import { StackServiceState } from "@supabase/stack/effect";
import { Effect, Layer } from "effect";
import { status } from "./status.handler.ts";
Expand Down
2 changes: 1 addition & 1 deletion apps/cli/src/next/commands/stop/stop.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { tmpdir } from "node:os";
import { join } from "node:path";
import { Effect, Exit, Layer } from "effect";
import { BunServices } from "@effect/platform-bun";
import { unixHttpClientLayer } from "@supabase/stack";
import { unixHttpClientLayer } from "@supabase/stack/effect";
import { stop } from "./stop.handler.ts";
import { mockOutput, withEnv } from "../../../../tests/helpers/mocks.ts";
import {
Expand Down
2 changes: 1 addition & 1 deletion apps/cli/src/shared/cli/run.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BunServices } from "@effect/platform-bun";
import { ProjectConfigStore } from "@supabase/config";
import { unixHttpClientLayer } from "@supabase/stack";
import { unixHttpClientLayer } from "@supabase/stack/effect";
import { Cause, Console, Effect, Exit, Fiber, Layer, Runtime, Stdio } from "effect";
import { CliError, CliOutput, Command } from "effect/unstable/cli";
import { CLI_VERSION } from "./version.ts";
Expand Down
2 changes: 1 addition & 1 deletion apps/cli/tests/helpers/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
type StackMetadata,
type StackState,
} from "@supabase/stack/effect";
import { UnixHttpClient } from "@supabase/stack";
import { UnixHttpClient } from "@supabase/stack/testing";
import { Api } from "../../src/next/auth/api.service.ts";
import type { LoginSessionResponse, ProfileResponse } from "../../src/next/auth/api.service.ts";
import { Credentials } from "../../src/next/auth/credentials.service.ts";
Expand Down
4 changes: 2 additions & 2 deletions apps/cli/tests/helpers/running-stack.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { BunServices } from "@effect/platform-bun";
import * as BunHttpServer from "@effect/platform-bun/BunHttpServer";
import { unixHttpClientLayer } from "@supabase/stack";
import {
DaemonServer,
DEFAULT_VERSIONS,
fullVersionManifest,
type PartialVersionManifest,
Expand All @@ -14,7 +12,9 @@ import {
type StackInfo,
type StackMetadata,
type StackState,
unixHttpClientLayer,
} from "@supabase/stack/effect";
import { DaemonServer } from "@supabase/stack/testing";
import { Effect, Layer, ManagedRuntime, Option, Stream } from "effect";
import { spawn, type ChildProcess } from "node:child_process";
import { mkdirSync, mkdtempSync, rmSync } from "node:fs";
Expand Down
23 changes: 14 additions & 9 deletions packages/stack/docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ The package exposes two levels of Interface:

- `@supabase/stack` selects `bun.ts` or `node.ts` through export conditions and exposes the
Promise-oriented `createStack()` / `StackHandle` Interface plus prefetch helpers.
- `@supabase/stack/effect` exposes Effect Interfaces and layer factories used by the CLI and
advanced callers.
- `@supabase/stack/effect` selects a runtime Adapter through the same export conditions and exposes
Effect Interfaces plus platform-bound layer factories used by the CLI and advanced callers.
- `@supabase/stack/testing` exposes only the service tags needed to replace daemon transport in
consumer tests. Runtime implementation tags do not leak through the root or Effect barrels.

The root runtime Adapters provide Effect filesystem, path, child-process, HTTP-server, and Unix
socket HTTP implementations. `createStack.ts` remains platform-agnostic and receives a
`PlatformFactory`.
Internal runtime Adapters provide Effect filesystem, path, child-process, HTTP-server, and Unix
socket HTTP implementations. `createStack.ts` and the layer factories remain platform-agnostic;
the conditional root and Effect entries bind them to their selected runtime.

```mermaid
flowchart LR
Expand Down Expand Up @@ -293,12 +295,15 @@ Callers may explicitly supply `projectStateRoot`, in which case durable stacks l
## Runtime entrypoints and exports

- `bun.ts` and `node.ts` are root export-condition targets.
- `effect-bun.ts` and `effect-node.ts` are Effect export-condition targets. They bind foreground,
daemon, and Unix-socket layers without exposing raw platform factories or bootstrap paths.
- `daemon-bun.ts` is exported as `@supabase/stack/daemon-bun` so the compiled CLI can dispatch to
it in-process.
- `daemon-node.ts` is intentionally not a package export. `node.ts` resolves it by file URL and
passes that filesystem path to `daemonLayer`; the package `knip.entry` list preserves this live
file-URL-only entrypoint.
- `effect.ts` is the low-level Effect export used by the CLI. There is no `internals.ts` entrypoint.
- `daemon-node.ts` is intentionally not a package export. The internal Node platform Adapter
resolves it by file URL and passes that filesystem path to `daemonLayer`; the package
`knip.entry` list preserves this live file-URL-only entrypoint.
- `effect.ts` is the platform-agnostic consumer contract re-exported by the conditional Effect
entries. There is no general-purpose `internals.ts` entrypoint.

## Testing

Expand Down
29 changes: 15 additions & 14 deletions packages/stack/docs/detach-mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,20 +163,21 @@ crash-recovery metadata is deliberately separate from user-facing `/status` conn

## Package entrypoints

| File | Reachability and role |
| --------------------- | ------------------------------------------------------------------------------------------------------------- |
| `src/daemon.ts` | Shared daemon protocol and lifecycle; receives runtime-specific HTTP-server factories. |
| `src/daemon-bun.ts` | Bun daemon Adapter. Exported as `@supabase/stack/daemon-bun` for compiled CLI dispatch. |
| `src/daemon-node.ts` | Node daemon Adapter. Intentionally file-URL-only: `node.ts` resolves its path and passes it to `daemonLayer`. |
| `src/DaemonServer.ts` | Unix-socket HTTP/SSE Adapter over `Stack`. |
| `src/RemoteStack.ts` | Remote Effect `Stack` Adapter over that transport. |
| `src/layers.ts` | Foreground, foreground-daemon, forked-daemon, and connect layer composition. |
| `src/StateManager.ts` | Durable metadata, live-state claims, scanning, stale-state removal, and deletion. |
| `src/effect.ts` | Effect-facing exports consumed by the CLI and advanced callers. |

There is no `internals.ts`. `daemon-node.ts` is not a package export because Node root consumers
reach it by the file URL returned from `node.ts`; it is listed under `knip.entry` in `package.json`
so static unused-code analysis preserves that live entrypoint.
| File | Reachability and role |
| --------------------- | ------------------------------------------------------------------------------------------------------- |
| `src/daemon.ts` | Shared daemon protocol and lifecycle; receives runtime-specific HTTP-server factories. |
| `src/daemon-bun.ts` | Bun daemon Adapter. Exported as `@supabase/stack/daemon-bun` for compiled CLI dispatch. |
| `src/daemon-node.ts` | Node daemon Adapter. Intentionally file-URL-only: the internal Node platform Adapter resolves its path. |
| `src/DaemonServer.ts` | Unix-socket HTTP/SSE Adapter over `Stack`. |
| `src/RemoteStack.ts` | Remote Effect `Stack` Adapter over that transport. |
| `src/layers.ts` | Foreground, foreground-daemon, forked-daemon, and connect layer composition. |
| `src/StateManager.ts` | Durable metadata, live-state claims, scanning, stale-state removal, and deletion. |
| `src/effect-*.ts` | Conditional Effect entries that bind consumer layers to Bun or Node. |
| `src/effect.ts` | Platform-agnostic Effect contracts re-exported by the conditional entries. |

There is no `internals.ts`. `daemon-node.ts` is not a package export because the Node Effect
Adapter reaches it through the file URL returned by the internal platform module; it is listed
under `knip.entry` in `package.json` so static unused-code analysis preserves that live entrypoint.

## Compiled executable re-entry

Expand Down
6 changes: 5 additions & 1 deletion packages/stack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
"bun": "./src/bun.ts",
"default": "./src/node.ts"
},
"./effect": "./src/effect.ts",
"./effect": {
"bun": "./src/effect-bun.ts",
"default": "./src/effect-node.ts"
},
"./testing": "./src/testing.ts",
"./daemon-bun": "./src/daemon-bun.ts"
},
"scripts": {
Expand Down
17 changes: 1 addition & 16 deletions packages/stack/src/JwtGenerator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { createHmac } from "node:crypto";
import { Effect, Layer, Context } from "effect";

// Hardcoded opaque key defaults matching Go CLI (pkg/config/apikeys.go:19-20).
// These are client-facing keys for local dev — SDKs use these, not JWTs directly.
Expand All @@ -10,8 +9,7 @@ export const defaultSecretKey = "sb_secret_N7UND0UgjKTVK-Uodkm0Hg_xSvEMPvz";
export const defaultJwtSecret = "super-secret-jwt-token-with-at-least-32-characters-long";

/**
* Pure synchronous JWT generation. Used both by the JwtGenerator service
* and directly in createStack() where JWTs are needed before layers run.
* Pure synchronous JWT generation used while resolving stack configuration.
*/
export function generateJwt(secret: string, role: string): string {
const header = Buffer.from(JSON.stringify({ alg: "HS256", typ: "JWT" })).toString("base64url");
Expand All @@ -38,16 +36,3 @@ export function generateJwks(secret: string): string {
],
});
}

export class JwtGenerator extends Context.Service<
JwtGenerator,
{
readonly generate: (secret: string, role: string) => Effect.Effect<string>;
readonly generateJwks: (secret: string) => Effect.Effect<string>;
}
>()("local/JwtGenerator") {
static layer: Layer.Layer<JwtGenerator> = Layer.succeed(this, {
generate: (secret: string, role: string) => Effect.sync(() => generateJwt(secret, role)),
generateJwks: (secret: string) => Effect.sync(() => generateJwks(secret)),
});
}
2 changes: 1 addition & 1 deletion packages/stack/src/UnixSocketSse.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { DaemonServer } from "./DaemonServer.ts";
import { RemoteStack } from "./RemoteStack.ts";
import { Stack, type StackInfo } from "./Stack.ts";
import { StackServiceState } from "./StackServiceState.ts";
import { unixHttpClientLayer } from "./bun.ts";
import { unixHttpClientLayer } from "./platform-bun.ts";

const REFERENCE_IDLE_TIMEOUT_SECONDS = 1;
// Keep the idle gap just past a short reference timeout so the suite stays fast.
Expand Down
46 changes: 2 additions & 44 deletions packages/stack/src/bun.ts
Original file line number Diff line number Diff line change
@@ -1,59 +1,17 @@
import { BunServices } from "@effect/platform-bun";
import * as BunHttpServer from "@effect/platform-bun/BunHttpServer";
import { fileURLToPath } from "node:url";
import { Effect, Layer } from "effect";
import { FetchHttpClient } from "effect/unstable/http";
import { BinaryResolver } from "./BinaryResolver.ts";
import {
createStack as createStackCore,
type PlatformFactory,
type StackHandle,
} from "./createStack.ts";
import { createStack as createStackCore, type StackHandle } from "./createStack.ts";
import {
prefetch as prefetchEffect,
type PrefetchOptions,
type PrefetchResult,
} from "./prefetch.ts";
import { defaultCacheRoot } from "./paths.ts";
import { platformFactory } from "./platform-bun.ts";
import { StackPreparation } from "./StackPreparation.ts";
import type { StackConfig } from "./StackConfig.ts";
import { UnixHttpClient, UnixHttpClientError } from "./UnixHttpClient.ts";

interface BunUnixRequestInit extends RequestInit {
readonly unix: string;
}

export const unixHttpClientLayer = Layer.succeed(UnixHttpClient, {
request: (socketPath, path, init) =>
Effect.tryPromise({
try: () => {
const requestInit: BunUnixRequestInit = {
...init,
unix: socketPath,
};
return fetch(`http://localhost${path}`, requestInit);
},
catch: (cause) => new UnixHttpClientError({ socketPath, path, cause }),
}),
});

// ---------------------------------------------------------------------------
// Platform values — for use with Effect layer factories
// ---------------------------------------------------------------------------

/** Bun platform factory for use with foregroundLayer / daemonLayer. */
export const platformFactory: PlatformFactory = ({ apiPort, releaseApiPort }) =>
Layer.mergeAll(
BunServices.layer,
Layer.unwrap(releaseApiPort.pipe(Effect.as(BunHttpServer.layer({ port: apiPort })))),
);

/** Path to the Bun daemon entry point for use with daemonLayer. */
export const daemonEntryPoint: string = fileURLToPath(new URL("./daemon-bun.ts", import.meta.url));

// ---------------------------------------------------------------------------
// Promise API — convenience wrappers for non-Effect consumers
// ---------------------------------------------------------------------------

export async function createStack(config?: StackConfig): Promise<StackHandle> {
return createStackCore(config, platformFactory);
Expand Down
Loading
Loading