Skip to content

Commit a8da70b

Browse files
BunsDevCopilotCopilot
authored
Resolve PR #395 conflicts and integrate pr-365-merge fixes (#424)
* Add OpenClaw gateway auth and device token persistence - Add gateway client handshake with signed device identity - Persist encrypted gateway config, device keys, and tokens - Thread OpenClaw auth state through server and UI * Wire in Openclaw gateway config and drop Solar Witch theme - Add `OpenclawGatewayConfigLive` to the server runtime layer - Remove the Solar Witch theme definitions from the web styles * Apply reviewer feedback: fix connect handshake, config error handling, Solar Witch theme, and legacy import banner gating Agent-Logs-Url: https://github.com/OpenKnots/okcode/sessions/9615af9c-7cb2-409b-93c1-541b906a4a67 Co-authored-by: BunsDev <68980965+BunsDev@users.noreply.github.com> * Add nonce validation in test handshake for clearer error reporting Agent-Logs-Url: https://github.com/OpenKnots/okcode/sessions/9615af9c-7cb2-409b-93c1-541b906a4a67 Co-authored-by: BunsDev <68980965+BunsDev@users.noreply.github.com> * Update DESIGN.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update apps/web/src/themes.css Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Route Claude chats through provider runtime - Remove Anthropic env-based chat handling - Validate Claude against provider health and new provider options - Update migrations and theme docs --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 88efc86 commit a8da70b

30 files changed

Lines changed: 2110 additions & 234 deletions

apps/server/src/index.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,45 @@ import { version } from "../package.json" with { type: "json" };
1010
import { ServerLive } from "./wsServer";
1111
import { NetService } from "@okcode/shared/Net";
1212
import { FetchHttpClient } from "effect/unstable/http";
13+
import { OpenclawGatewayConfig } from "./persistence/Services/OpenclawGatewayConfig";
1314

1415
const RuntimeLayer = Layer.empty.pipe(
1516
Layer.provideMerge(CliConfig.layer),
1617
Layer.provideMerge(ServerLive),
1718
Layer.provideMerge(OpenLive),
19+
Layer.provideMerge(
20+
Layer.succeed(OpenclawGatewayConfig, {
21+
getSummary: () =>
22+
Effect.succeed({
23+
gatewayUrl: null,
24+
hasSharedSecret: false,
25+
deviceId: null,
26+
devicePublicKey: null,
27+
deviceFingerprint: null,
28+
hasDeviceToken: false,
29+
deviceTokenRole: null,
30+
deviceTokenScopes: [],
31+
updatedAt: null,
32+
}),
33+
getStored: () => Effect.succeed(null),
34+
save: () => Effect.die("unexpected openclaw save"),
35+
resolveForConnect: () => Effect.succeed(null),
36+
saveDeviceToken: () => Effect.void,
37+
clearDeviceToken: () => Effect.void,
38+
resetDeviceState: () =>
39+
Effect.succeed({
40+
gatewayUrl: null,
41+
hasSharedSecret: false,
42+
deviceId: null,
43+
devicePublicKey: null,
44+
deviceFingerprint: null,
45+
hasDeviceToken: false,
46+
deviceTokenRole: null,
47+
deviceTokenScopes: [],
48+
updatedAt: null,
49+
}),
50+
}),
51+
),
1852
Layer.provideMerge(NetService.layer),
1953
Layer.provideMerge(NodeServices.layer),
2054
Layer.provideMerge(FetchHttpClient.layer),

apps/server/src/main.test.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { NetService } from "@okcode/shared/Net";
1515
import { CliConfig, okcodeCli, type CliConfigShape } from "./main";
1616
import { ServerConfig, type ServerConfigShape } from "./config";
1717
import { Open, type OpenShape } from "./open";
18+
import { OpenclawGatewayConfig } from "./persistence/Services/OpenclawGatewayConfig";
1819
import { Server, type ServerShape } from "./wsServer";
1920

2021
const start = vi.fn(() => undefined);
@@ -54,6 +55,37 @@ const testLayer = Layer.mergeAll(
5455
start: serverStart,
5556
stopSignal: Effect.void,
5657
} satisfies ServerShape),
58+
Layer.succeed(OpenclawGatewayConfig, {
59+
getSummary: () =>
60+
Effect.succeed({
61+
gatewayUrl: null,
62+
hasSharedSecret: false,
63+
deviceId: null,
64+
devicePublicKey: null,
65+
deviceFingerprint: null,
66+
hasDeviceToken: false,
67+
deviceTokenRole: null,
68+
deviceTokenScopes: [],
69+
updatedAt: null,
70+
}),
71+
getStored: () => Effect.succeed(null),
72+
save: () => Effect.die("unexpected openclaw save"),
73+
resolveForConnect: () => Effect.succeed(null),
74+
saveDeviceToken: () => Effect.void,
75+
clearDeviceToken: () => Effect.void,
76+
resetDeviceState: () =>
77+
Effect.succeed({
78+
gatewayUrl: null,
79+
hasSharedSecret: false,
80+
deviceId: null,
81+
devicePublicKey: null,
82+
deviceFingerprint: null,
83+
hasDeviceToken: false,
84+
deviceTokenRole: null,
85+
deviceTokenScopes: [],
86+
updatedAt: null,
87+
}),
88+
}),
5789
Layer.succeed(Open, {
5890
openBrowser: (_target: string) => Effect.void,
5991
openInEditor: () => Effect.void,

apps/server/src/main.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
import { fixPath, resolveBaseDir } from "./os-jank";
2121
import { Open } from "./open";
2222
import * as SqlitePersistence from "./persistence/Layers/Sqlite";
23+
import { OpenclawGatewayConfigLive } from "./persistence/Layers/OpenclawGatewayConfig";
2324
import { makeServerProviderLayer, makeServerRuntimeServicesLayer } from "./serverLayers";
2425
import { ProviderHealthLive } from "./provider/Layers/ProviderHealth";
2526
import { Server } from "./wsServer";
@@ -194,6 +195,7 @@ const LayerLive = (input: CliInput) =>
194195
Layer.empty.pipe(
195196
Layer.provideMerge(makeServerRuntimeServicesLayer()),
196197
Layer.provideMerge(makeServerProviderLayer()),
198+
Layer.provideMerge(OpenclawGatewayConfigLive),
197199
Layer.provideMerge(ProviderHealthLive),
198200
Layer.provideMerge(SqlitePersistence.layerConfig),
199201
Layer.provideMerge(ServerLoggerLive),

0 commit comments

Comments
 (0)