Skip to content

Commit 4c59bcd

Browse files
authored
update effect (#267)
1 parent f17f0a3 commit 4c59bcd

24 files changed

+1534
-1454
lines changed

flake.lock

Lines changed: 32 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
{
22
inputs = {
33
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
4+
nixpkgs-stable.url = "github:nixos/nixpkgs/25.05";
45
flake-parts.url = "github:hercules-ci/flake-parts";
56
systems.url = "github:nix-systems/default";
67
process-compose-flake.url = "github:Platonic-Systems/process-compose-flake";
78
services-flake.url = "github:juspay/services-flake";
89
};
9-
outputs = inputs @ {flake-parts, ...}:
10+
outputs = inputs @ {
11+
flake-parts,
12+
nixpkgs-stable,
13+
...
14+
}:
1015
flake-parts.lib.mkFlake {inherit inputs;} {
1116
systems = import inputs.systems;
1217
imports = [
@@ -17,7 +22,11 @@
1722
pkgs,
1823
system,
1924
...
20-
}: {
25+
}: let
26+
pkgs-stable = import inputs.nixpkgs-stable {
27+
inherit system;
28+
};
29+
in {
2130
process-compose."default" = {config, ...}: {
2231
imports = [
2332
inputs.services-flake.processComposeModules.default
@@ -36,6 +45,7 @@
3645
signal = 2;
3746
};
3847
readiness_probe = {
48+
initial_delay_seconds = 15;
3949
http_get = {
4050
host = "localhost";
4151
port = 4000;
@@ -45,29 +55,21 @@
4555
};
4656
};
4757

48-
settings.processes.shard-manager = {
49-
command = "tsx --watch packages/shard-manager/src/main.ts";
50-
};
51-
settings.processes.shard-manager.depends_on = {
52-
pg.condition = "process_healthy";
53-
};
54-
5558
settings.processes.runner = {
5659
command = "tsx --watch packages/runner/src/main.ts";
5760
};
58-
settings.processes.runner.depends_on.shard-manager.condition = "process_started";
5961

6062
settings.processes.discord-bot = {
6163
command = "tsx --watch packages/discord-bot/src/main.ts";
6264
};
63-
settings.processes.discord-bot.depends_on.shard-manager.condition = "process_started";
65+
settings.processes.discord-bot.depends_on.runner.condition = "process_started";
6466
};
6567

6668
devShells.default = pkgs.mkShell {
6769
nativeBuildInputs = with pkgs; [
6870
corepack
6971
nodejs
70-
flyctl
72+
pkgs-stable.flyctl
7173
postgresql
7274
];
7375

fly.shard-manager.toml

Lines changed: 0 additions & 15 deletions
This file was deleted.

package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,33 +16,33 @@
1616
},
1717
"devDependencies": {
1818
"@babel/cli": "^7.28.3",
19-
"@babel/core": "^7.28.4",
19+
"@babel/core": "^7.28.5",
2020
"@babel/plugin-transform-export-namespace-from": "^7.27.1",
2121
"@babel/plugin-transform-modules-commonjs": "^7.27.1",
2222
"@effect/build-utils": "^0.8.9",
2323
"@effect/eslint-plugin": "^0.3.2",
24-
"@effect/language-service": "^0.41.1",
25-
"@eslint/js": "^9.36.0",
26-
"@types/node": "^24.6.0",
27-
"@vitest/coverage-v8": "^3.2.4",
28-
"@vitest/expect": "^3.2.4",
24+
"@effect/language-service": "^0.55.5",
25+
"@eslint/js": "^9.39.1",
26+
"@types/node": "^24.10.1",
27+
"@vitest/coverage-v8": "^4.0.8",
28+
"@vitest/expect": "^4.0.8",
2929
"ast-types": "^0.14.2",
3030
"babel-plugin-annotate-pure-calls": "^0.5.0",
31-
"eslint": "^9.36.0",
31+
"eslint": "^9.39.1",
3232
"eslint-import-resolver-typescript": "^4.4.4",
3333
"eslint-plugin-import-x": "^4.16.1",
3434
"eslint-plugin-local-rules": "^3.0.2",
3535
"eslint-plugin-simple-import-sort": "^12.1.1",
3636
"eslint-plugin-sort-destructure-keys": "^2.0.0",
3737
"glob": "^11.0.3",
3838
"prettier": "^3.6.2",
39-
"rimraf": "^6.0.1",
40-
"tsup": "^8.5.0",
39+
"rimraf": "^6.1.0",
40+
"tsup": "^8.5.1",
4141
"tsx": "^4.20.6",
4242
"typescript": "^5.9.3",
43-
"typescript-eslint": "^8.45.0",
44-
"vite": "^7.1.7",
45-
"vitest": "^3.2.4"
43+
"typescript-eslint": "^8.46.4",
44+
"vite": "^7.2.2",
45+
"vitest": "^4.0.8"
4646
},
4747
"pnpm": {
4848
"patchedDependencies": {

packages/discord-bot/package.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,24 @@
1010
"@chat/discord": "workspace:*",
1111
"@chat/domain": "workspace:*",
1212
"@chat/shared": "workspace:*",
13-
"@effect/ai": "^0.29.1",
14-
"@effect/ai-openai": "^0.32.0",
15-
"@effect/cluster": "^0.50.2",
16-
"@effect/experimental": "^0.56.0",
17-
"@effect/language-service": "^0.41.1",
18-
"@effect/opentelemetry": "^0.58.0",
19-
"@effect/platform": "^0.92.1",
20-
"@effect/platform-node": "^0.98.2",
21-
"@octokit/plugin-rest-endpoint-methods": "^16.1.0",
22-
"@octokit/types": "^15.0.0",
23-
"@types/node": "^24.6.0",
24-
"dfx": "^0.126.0",
25-
"effect": "^3.18.1",
13+
"@effect/ai": "^0.32.1",
14+
"@effect/ai-openai": "^0.35.0",
15+
"@effect/cluster": "^0.52.9",
16+
"@effect/experimental": "^0.57.1",
17+
"@effect/language-service": "^0.55.5",
18+
"@effect/opentelemetry": "^0.59.1",
19+
"@effect/platform": "^0.93.2",
20+
"@effect/platform-node": "^0.100.0",
21+
"@octokit/plugin-rest-endpoint-methods": "^17.0.0",
22+
"@octokit/types": "^16.0.0",
23+
"@types/node": "^24.10.1",
24+
"dfx": "^0.127.0",
25+
"effect": "^3.19.3",
2626
"fuzzysort": "^3.1.0",
2727
"html-entities": "^2.6.0",
28-
"octokit": "^5.0.3"
28+
"octokit": "^5.0.5"
2929
},
3030
"dependencies": {
31-
"@effect/workflow": "^0.11.2"
31+
"@effect/workflow": "^0.12.5"
3232
}
3333
}

packages/discord-bot/src/Cluster.ts

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,11 @@
11
import { SqlClientLayer } from "@chat/shared/Sql"
22
import type { Runners, Sharding } from "@effect/cluster"
3-
import { ClusterWorkflowEngine, RunnerAddress } from "@effect/cluster"
4-
import { NodeClusterRunnerSocket } from "@effect/platform-node"
3+
import { ClusterWorkflowEngine } from "@effect/cluster"
4+
import { NodeClusterSocket } from "@effect/platform-node"
55
import type { WorkflowEngine } from "@effect/workflow"
6-
import { Config, Effect, Layer } from "effect"
6+
import { Layer } from "effect"
77

8-
const ShardingLayer = Layer.unwrapEffect(
9-
Effect.gen(function*() {
10-
const shardManagerHost = yield* Config.string("SHARD_MANAGER_HOST").pipe(
11-
Config.withDefault("localhost")
12-
)
13-
14-
return NodeClusterRunnerSocket.layer({
15-
clientOnly: true,
16-
storage: "sql",
17-
shardingConfig: {
18-
shardManagerAddress: RunnerAddress.make(shardManagerHost, 8080)
19-
}
20-
})
21-
})
22-
).pipe(
8+
const ShardingLayer = NodeClusterSocket.layer({ clientOnly: true }).pipe(
239
Layer.provide(SqlClientLayer),
2410
Layer.orDie
2511
)

packages/discord/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
"./*": "./src/*.ts"
1010
},
1111
"dependencies": {
12-
"@effect/platform": "^0.92.1",
13-
"@effect/platform-node": "^0.98.2",
14-
"dfx": "^0.126.0",
15-
"effect": "^3.18.1"
12+
"@effect/platform": "^0.93.2",
13+
"@effect/platform-node": "^0.100.0",
14+
"dfx": "^0.127.0",
15+
"effect": "^3.19.3"
1616
}
1717
}

packages/domain/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
"./*": "./src/*.ts"
1010
},
1111
"dependencies": {
12-
"@effect/ai": "^0.29.1",
13-
"@effect/cluster": "^0.50.2",
14-
"@effect/rpc": "^0.71.0",
15-
"@effect/sql": "^0.46.0",
16-
"@effect/workflow": "^0.11.2",
17-
"effect": "^3.18.1"
12+
"@effect/ai": "^0.32.1",
13+
"@effect/cluster": "^0.52.9",
14+
"@effect/rpc": "^0.72.1",
15+
"@effect/sql": "^0.48.0",
16+
"@effect/workflow": "^0.12.5",
17+
"effect": "^3.19.3"
1818
}
1919
}

packages/runner/package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@
1010
"@chat/discord": "workspace:*",
1111
"@chat/domain": "workspace:*",
1212
"@chat/shared": "workspace:*",
13-
"@effect/ai": "^0.29.1",
14-
"@effect/ai-openai": "^0.32.0",
15-
"@effect/cluster": "^0.50.2",
16-
"@effect/platform": "^0.92.1",
17-
"@effect/platform-node": "^0.98.2",
18-
"@effect/rpc": "^0.71.0",
19-
"@effect/sql": "^0.46.0",
20-
"@effect/sql-pg": "^0.47.0",
21-
"dfx": "^0.126.0",
22-
"effect": "^3.18.1"
13+
"@effect/ai": "^0.32.1",
14+
"@effect/ai-openai": "^0.35.0",
15+
"@effect/cluster": "^0.52.9",
16+
"@effect/platform": "^0.93.2",
17+
"@effect/platform-node": "^0.100.0",
18+
"@effect/rpc": "^0.72.1",
19+
"@effect/sql": "^0.48.0",
20+
"@effect/sql-pg": "^0.49.5",
21+
"dfx": "^0.127.0",
22+
"effect": "^3.19.3"
2323
},
2424
"dependencies": {
25-
"@effect/workflow": "^0.11.2"
25+
"@effect/workflow": "^0.12.5"
2626
}
2727
}

packages/runner/src/main.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { TracerLayer } from "@chat/shared/Otel"
22
import { SqlClientLayer } from "@chat/shared/Sql"
33
import { ClusterWorkflowEngine, RunnerAddress } from "@effect/cluster"
4-
import { NodeClusterRunnerSocket, NodeRuntime } from "@effect/platform-node"
4+
import { NodeClusterSocket, NodeRuntime } from "@effect/platform-node"
55
import { Config, Effect, Layer, Option } from "effect"
66
import { ConversationEntity } from "./Conversation.ts"
77
import { MessageLoggerEntity } from "./MessageLogger.ts"
@@ -11,18 +11,13 @@ const RunnerLayer = Layer.unwrapEffect(Effect.gen(function*() {
1111
const runnerIp = yield* Config.string("FLY_PRIVATE_IP").pipe(
1212
Config.withDefault("localhost")
1313
)
14-
const shardManagerHost = runnerIp === "localhost"
15-
? "localhost"
16-
: "shard-manager.internal"
1714
const listenHost = runnerIp === "localhost"
1815
? "localhost"
1916
: "fly-local-6pn"
20-
return NodeClusterRunnerSocket.layer({
21-
storage: "sql",
17+
return NodeClusterSocket.layer({
2218
shardingConfig: {
2319
runnerAddress: Option.some(RunnerAddress.make(runnerIp, 34431)),
24-
runnerListenAddress: Option.some(RunnerAddress.make(listenHost, 34431)),
25-
shardManagerAddress: RunnerAddress.make(shardManagerHost, 8080)
20+
runnerListenAddress: Option.some(RunnerAddress.make(listenHost, 34431))
2621
}
2722
})
2823
}))

0 commit comments

Comments
 (0)